![]() |
DDraceNetwork Documentation
|
Classes | |
| struct | NETADDR |
| struct | NETSTATS |
Typedefs | |
| typedef int | UNIXSOCKET |
| typedef struct sockaddr_un | UNIXSOCKETADDR |
| typedef struct NETSOCKET_INTERNAL * | NETSOCKET |
| typedef struct NETADDR | NETADDR |
| typedef struct NETSTATS | NETSTATS |
Functions | |
| void | net_init () |
| int | net_host_lookup (const char *hostname, NETADDR *addr, int types) |
| int | net_addr_comp (const NETADDR *a, const NETADDR *b) |
| int | net_addr_comp_noport (const NETADDR *a, const NETADDR *b) |
| void | net_addr_str (const NETADDR *addr, char *string, int max_length, bool add_port) |
| int | net_addr_from_url (NETADDR *addr, const char *string, char *host_buf, size_t host_buf_size) |
| bool | net_addr_is_local (const NETADDR *addr) |
| int | net_addr_from_str (NETADDR *addr, const char *string) |
| int | net_set_non_blocking (NETSOCKET sock) |
| int | net_errno () |
| std::string | net_error_message () |
| int | net_would_block () |
| int | net_socket_read_wait (NETSOCKET sock, std::chrono::nanoseconds nanoseconds) |
| int | net_socket_type (NETSOCKET sock) |
Variables | |
| const NETADDR | NETADDR_ZEROED |
| typedef struct NETADDR NETADDR |
| typedef struct NETSOCKET_INTERNAL* NETSOCKET |
| typedef struct NETSTATS NETSTATS |
| typedef int UNIXSOCKET |
| typedef struct sockaddr_un UNIXSOCKETADDR |
Compares two network addresses.
| a | Address to compare. |
| b | Address to compare to. |
Compares two network addresses ignoring port.
| a | Address to compare. |
| b | Address to compare to. |
| int net_addr_from_str | ( | NETADDR * | addr, |
| const char * | string ) |
Turns string into a network address.
| addr | Address to fill in. |
| string | String to parse. |
| int net_addr_from_url | ( | NETADDR * | addr, |
| const char * | string, | ||
| char * | host_buf, | ||
| size_t | host_buf_size ) |
Turns url string into a network address struct. The url format is tw-0.6+udp://{ipaddr}[:{port}] ipaddr: can be ipv4 or ipv6 port: is a optional internet protocol port
This format is used for parsing the master server, be careful before changing it.
Examples: tw-0.6+udp://127.0.0.1 tw-0.6+udp://127.0.0.1:8303
| addr | Address to fill in. |
| string | String to parse. |
| host_buf | Pointer to a buffer to write the host to It will include the port if one is included in the url It can also be set to nullptr then it will be ignored. |
| host_buf_size | Size of the host buffer or 0 if no host_buf pointer is given. |
| bool net_addr_is_local | ( | const NETADDR * | addr | ) |
Checks if an address is local.
| addr | Address to check. |
| void net_addr_str | ( | const NETADDR * | addr, |
| char * | string, | ||
| int | max_length, | ||
| bool | add_port ) |
Turns a network address into a representative string.
| addr | Address to turn into a string. |
| string | Buffer to fill with the string. |
| max_length | Maximum size of the string. |
| add_port | Whether to add the port to the string. |
| int net_errno | ( | ) |
If a network operation failed, the error code.
| std::string net_error_message | ( | ) |
If a network operation failed, the platform-specific error code and string.
| int net_host_lookup | ( | const char * | hostname, |
| NETADDR * | addr, | ||
| int | types ) |
Looks up the ip of a hostname.
| hostname | Host name to look up. |
| addr | The output address to write to. |
| types | The type of IP that should be returned. |
| void net_init | ( | ) |
Initiates network functionality.
| int net_set_non_blocking | ( | NETSOCKET | sock | ) |
Make a socket not block on operations
| sock | The socket to set the mode on. |
| int net_socket_read_wait | ( | NETSOCKET | sock, |
| std::chrono::nanoseconds | nanoseconds ) |
Waits for a socket to have data available to receive up the specified timeout duration.
| sock | Socket to wait on. |
| nanoseconds | Timeout duration to wait. |
| int net_socket_type | ( | NETSOCKET | sock | ) |
Determine a socket's type.
| sock | Socket whose type should be determined. |
| int net_would_block | ( | ) |
Determines whether a network operation would block.
|
extern |