

Go to the source code of this file.
Functions | |
| int | parse_address (const char *raw_address, struct sockaddr_storage *address) |
| BOOL | parse_url (const char *url, char *ip, int ip_size, int *port, char *rest, int rest_size) |
| int | find_interface (struct sockaddr_storage *saddr, const char *interface, const char *address) |
| char * | get_mac_address_from_socket (const SOCKET sock, const struct sockaddr_storage *sa_ip, const char *ip, char *mac_buffer) |
| BOOL | is_address_multicast (const char *address) |
| char * | get_ip_from_sock_address (const struct sockaddr_storage *saddr, char *ip_buffer) |
| BOOL | is_address_ipv6 (const char *ip) |
| BOOL | is_address_ipv6_ex (const char *ip, struct sockaddr_in6 *saddr6) |
| BOOL | is_address_ipv4 (const char *ip) |
| BOOL | is_address_ipv4_ex (const char *ip, struct sockaddr_in *saddr) |
| BOOL | set_ip_and_port_in_sock_address (const char *ip, int port, struct sockaddr_storage *saddr) |
| int | get_port_from_sock_address (const struct sockaddr_storage *saddr) |
Header file for net_utils.c
Definition in file net_utils.h.
| int find_interface | ( | struct sockaddr_storage * | saddr, |
| const char * | interface, | ||
| const char * | address | ||
| ) |
Tries to find an interface with the specified name or IP address
| saddr | A pointer to the buffer of the address that should be updated. |
| interface | The interface name we want to find. |
| address | The address name we want to find. |
Definition at line 192 of file net_utils.c.
| char* get_ip_from_sock_address | ( | const struct sockaddr_storage * | saddr, |
| char * | ip_buffer | ||
| ) |
Retrieve the IP in printable format from a socket address struct.
| saddr | The socket addres struct. |
| ip_buffer | If set, the resulting IP will be stored in it and no new allocation will be made. The returned pointer will equal this one. |
Definition at line 621 of file net_utils.c.
| char* get_mac_address_from_socket | ( | const SOCKET | sock, |
| const struct sockaddr_storage * | sa_ip, | ||
| const char * | ip, | ||
| char * | mac_buffer | ||
| ) |
Get the remote MAC address from a given sock.
| sock | The socket to extract the MAC address from. |
| sa_ip | The socket address to extract for. |
| ip | The IP address to extract for. If sa_ip is set this will be ignored. |
| mac_buffer | A buffer to store the resulting MAC in. If empty a new allocation will be returned as a return value, otherwise the returned value will point to the mac_buffer. |
Definition at line 455 of file net_utils.c.
| int get_port_from_sock_address | ( | const struct sockaddr_storage * | saddr | ) |
Retrieve the port from a socket address.
| saddr | The socket address to get the port from. |
Definition at line 729 of file net_utils.c.
|
inline |
Check whether an IP address is of version 4.
| ip | The IP address to check. |
Definition at line 674 of file net_utils.c.
| BOOL is_address_ipv4_ex | ( | const char * | ip, |
| struct sockaddr_in * | saddr | ||
| ) |
Check whether an IP address is of version 4. This function will also fill the given socket address structure with the network form of the IP address.
| ip | The IP address to check. |
| saddr | The socket address to fill. |
Definition at line 680 of file net_utils.c.
|
inline |
Check whether an IP address is of version 6.
| ip | The IP address to check. |
Definition at line 659 of file net_utils.c.
| BOOL is_address_ipv6_ex | ( | const char * | ip, |
| struct sockaddr_in6 * | saddr6 | ||
| ) |
Check whether an IP address is of version 6. This function will also fill the given socket address structure with the network form of the IP address.
| ip | The IP address to check. |
| saddr6 | The socket address to fill. |
Definition at line 665 of file net_utils.c.
| BOOL is_address_multicast | ( | const char * | address | ) |
Check whether a given IP is a multicast IP (if IPV6 checks for UPnP multicast IP, should be changed to check if multicast at all).
| address | The address to check. |
Definition at line 583 of file net_utils.c.
| int parse_address | ( | const char * | raw_address, |
| struct sockaddr_storage * | address | ||
| ) |
Parse a string containing an IP address.
| raw_address | The string containing the IP address. |
| address | The sockaddr_storage buffer to store the address. |
Definition at line 33 of file net_utils.c.
| BOOL parse_url | ( | const char * | url, |
| char * | ip, | ||
| int | ip_size, | ||
| int * | port, | ||
| char * | rest, | ||
| int | rest_size | ||
| ) |
Parse a URL into an IP, port and rest. This function does not work with domain names, only with IP addresses.
| url | The URL to parse. |
| ip | the IP in the URL. |
| The | size of the ip. |
| port | The port in the URL. |
| rest | The rest of the URL. |
| rest_size | The size of the rest data. |
Definition at line 107 of file net_utils.c.
| BOOL set_ip_and_port_in_sock_address | ( | const char * | ip, |
| int | port, | ||
| struct sockaddr_storage * | saddr | ||
| ) |
Set the network form of the given IP address in the given socket address buffer.
| ip | The IP to set. |
| port | The port to set. |
| saddr | The socket address buffer to set the IP in. |
Definition at line 689 of file net_utils.c.
1.8.8