nmsg 1.1.2
|
Socket utilities. More...
Go to the source code of this file.
Functions | |
nmsg_res | nmsg_sock_parse (int af, const char *addr, unsigned port, struct sockaddr_in *sai, struct sockaddr_in6 *sai6, struct sockaddr **sa, socklen_t *salen) |
Parse an IP address and port number into a sockaddr. | |
nmsg_res | nmsg_sock_parse_sockspec (const char *sockspec, int *af, char **addr, unsigned *port_start, unsigned *port_end) |
Parse a "socket spec" string. | |
Socket utilities.
Definition in file sock.h.
nmsg_res nmsg_sock_parse | ( | int | af, |
const char * | addr, | ||
unsigned | port, | ||
struct sockaddr_in * | sai, | ||
struct sockaddr_in6 * | sai6, | ||
struct sockaddr ** | sa, | ||
socklen_t * | salen | ||
) |
Parse an IP address and port number into a sockaddr.
[in] | af | Address family (AF_INET or AF_INET6). |
[in] | addr | Network address. |
[in] | port | Network port. |
[in] | sai | Caller-allocated sockaddr_in structure. |
[in] | sai6 | Caller-allocated sockaddr_in6 structure. |
[out] | sa | Will be set to point to either sai or sai6. |
[out] | salen | Length of sa. |
nmsg_res nmsg_sock_parse_sockspec | ( | const char * | sockspec, |
int * | af, | ||
char ** | addr, | ||
unsigned * | port_start, | ||
unsigned * | port_end | ||
) |
Parse a "socket spec" string.
[in] | sockspec | The "socket spec" string. |
[out] | af | Address family (AF_INET or AF_INET6). |
[out] | addr | Network address. Dynamically allocated; must be freed with free(). |
[out] | port_start | Start of network port range. |
[out] | port_end | End of network port range. |