jabberd2
2.3.3
|
object like wrapper around struct sockaddr_storage More...
#include "util.h"
Go to the source code of this file.
Functions | |
int | j_inet_pton (const char *src, struct sockaddr_storage *dst) |
set the address of a struct sockaddr_storage (modeled after the stdlib function inet_pton) More... | |
const char * | j_inet_ntop (struct sockaddr_storage *src, char *dst, size_t size) |
get the string representation of an address in struct sockaddr_storage (modeled after the stdlib function inet_ntop) More... | |
int | j_inet_getport (struct sockaddr_storage *sa) |
get the port number out of a struct sockaddr_storage More... | |
int | j_inet_setport (struct sockaddr_storage *sa, in_port_t port) |
set the port number in a struct sockaddr_storage More... | |
socklen_t | j_inet_addrlen (struct sockaddr_storage *sa) |
calculate the size of an address structure (on some unices the stdlibc functions for socket handling want to get the size of the address structure that is contained in the struct sockaddr_storage, not the size of struct sockaddr_storage itself) More... | |
object like wrapper around struct sockaddr_storage
The functions in this file are used as a wrapper around struct sockaddr_storage to access this structure like an object. The structure is seen as an object that contains an IPv4 or an IPv6 address and these functions are the access methods to this object.
Definition in file inaddr.c.
int j_inet_pton | ( | const char * | src, |
struct sockaddr_storage * | dst | ||
) |
set the address of a struct sockaddr_storage (modeled after the stdlib function inet_pton)
src | the address that should be assigned to the struct sockaddr_storage (either a dotted quad for IPv4 or a compressed IPv6 address) |
dst | the struct sockaddr_storage that should get the new address |
Definition at line 46 of file inaddr.c.
References AF_INET6, sockaddr_in6::sin6_addr, and sockaddr_storage::ss_family.
Referenced by _mio_connect(), _mio_listen(), access_allow(), access_check(), and access_deny().
const char* j_inet_ntop | ( | struct sockaddr_storage * | src, |
char * | dst, | ||
size_t | size | ||
) |
get the string representation of an address in struct sockaddr_storage (modeled after the stdlib function inet_ntop)
src | the struct sockaddr_storage where the address should be read |
dst | where to write the result |
size | the size of the result buffer |
Definition at line 97 of file inaddr.c.
References AF_INET6, sockaddr_in6::sin6_addr, and sockaddr_storage::ss_family.
Referenced by _mio_accept().
int j_inet_getport | ( | struct sockaddr_storage * | sa | ) |
get the port number out of a struct sockaddr_storage
sa | the struct sockaddr_storage where we want to read the port |
Definition at line 148 of file inaddr.c.
References AF_INET6, sockaddr_in6::sin6_port, and sockaddr_storage::ss_family.
Referenced by _c2s_client_mio_callback(), _mio_accept(), in_mio_callback(), and router_mio_callback().
int j_inet_setport | ( | struct sockaddr_storage * | sa, |
in_port_t | port | ||
) |
set the port number in a struct sockaddr_storage
sa | the struct sockaddr_storage where the port should be set |
port | the port number that should be set (in host byte order) |
Definition at line 173 of file inaddr.c.
References AF_INET6, sockaddr_in6::sin6_port, and sockaddr_storage::ss_family.
Referenced by _mio_connect(), and _mio_listen().
socklen_t j_inet_addrlen | ( | struct sockaddr_storage * | sa | ) |
calculate the size of an address structure (on some unices the stdlibc functions for socket handling want to get the size of the address structure that is contained in the struct sockaddr_storage, not the size of struct sockaddr_storage itself)
sa | the struct sockaddr_storage for which we want to get the size of the contained address structure |
Definition at line 203 of file inaddr.c.
References AF_INET6, and sockaddr_storage::ss_family.
Referenced by _mio_connect(), and _mio_listen().