jabberd2  2.3.1
Macros | Functions
inaddr.h File Reference
#include "ac-stdint.h"
#include <util/util_compat.h>

Go to the source code of this file.

Macros

#define JABBERD2_API   extern
 

Functions

JABBERD2_API 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...
 
JABBERD2_API 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...
 
JABBERD2_API int j_inet_getport (struct sockaddr_storage *sa)
 get the port number out of a struct sockaddr_storage More...
 
JABBERD2_API int j_inet_setport (struct sockaddr_storage *sa, in_port_t port)
 set the port number in a struct sockaddr_storage More...
 
JABBERD2_API 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...
 

Macro Definition Documentation

#define JABBERD2_API   extern

Definition at line 59 of file inaddr.h.

Function Documentation

JABBERD2_API 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)

Parameters
srcthe address that should be assigned to the struct sockaddr_storage (either a dotted quad for IPv4 or a compressed IPv6 address)
dstthe struct sockaddr_storage that should get the new address
Returns
1 on success, 0 if address is not valid

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().

JABBERD2_API 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)

Parameters
srcthe struct sockaddr_storage where the address should be read
dstwhere to write the result
sizethe size of the result buffer
Returns
NULL if failed, pointer to the result otherwise

Definition at line 97 of file inaddr.c.

References AF_INET6, sockaddr_in6::sin6_addr, and sockaddr_storage::ss_family.

Referenced by _mio_accept().

JABBERD2_API int j_inet_getport ( struct sockaddr_storage sa)

get the port number out of a struct sockaddr_storage

Parameters
sathe struct sockaddr_storage where we want to read the port
Returns
the port number (already converted to host byte order!)

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().

JABBERD2_API int j_inet_setport ( struct sockaddr_storage sa,
in_port_t  port 
)

set the port number in a struct sockaddr_storage

Parameters
sathe struct sockaddr_storage where the port should be set
portthe port number that should be set (in host byte order)
Returns
1 on success, 0 if address family is not supported

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().

JABBERD2_API 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)

Parameters
sathe struct sockaddr_storage for which we want to get the size of the contained address structure
Returns
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().