![]() |
DDNet documentation
|
Classes | |
| struct | NETADDR |
Typedefs | |
| typedef struct NETADDR | NETADDR |
Functions | |
| 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_host_lookup (const char *hostname, NETADDR *addr, int types) |
Variables | |
| const NETADDR | NETADDR_ZEROED |
| constexpr auto | NETADDR_MAXSTRSIZE = 1 + (8 * 4 + 7) + 1 + 1 + 5 + 1 |
| typedef struct NETADDR NETADDR |
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_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. |
|
inlineconstexpr |
|
extern |