This header provides functions ported from Unix in arpa/inet.h. More...
Functions | |
int | evil_inet_pton (int af, const char *src, void *dst) |
Convert IPv4 and IPv6 addresses from text to binary form. More... | |
const char * | evil_inet_ntop (int af, const char *src, void *dst, size_t size) |
Convert IPv4 and IPv6 addresses from binary to text form. More... | |
This header provides functions ported from Unix in arpa/inet.h.
int evil_inet_pton | ( | int | af, |
const char * | src, | ||
void * | dst | ||
) |
Convert IPv4 and IPv6 addresses from text to binary form.
af | The address family. |
src | The address to convert. |
dst | The converted address structure. |
This function converts IPv4 and IPv6 addresses from src
to the binary form dst
. The following address families to pass to af
are currently supported:
src
points to a character string containing an IPv4 network address in dotted-decimal format, "ddd.ddd.ddd.ddd", where ddd is a decimal number of up to three digits in the range 0 tosrc
points to a character string containing an IPv6 network address. The address is converted to a struct in6_addr and copied to dst, which must be sizeof(struct in6_addr) (16) bytes (128 bits) long. The allowed formats for IPv6 addresses follow these rules: On success this function returns 1 (network address was successfully converted). 0 is returned if src
does not contain a character string representing a valid network address in the specified address family. If af does not contain a valid address family, -1 is returned and errno is set to EAFNOSUPPORT.
Conformity: POSIX.1-2001.
Supported OS: Windows XP, CE.
const char* evil_inet_ntop | ( | int | af, |
const char * | src, | ||
void * | dst, | ||
size_t | size | ||
) |
Convert IPv4 and IPv6 addresses from binary to text form.
af | The address family. |
src | The address structure to convert. |
dst | A buffer containing the converted string. |
size | The size of the buffer. |
This function converts the network address structure src
in the af
address family into a character string. The resulting string is copied to the buffer pointed to by dst
, which must be a non-NULL pointer. The caller specifies the number of bytes available in this buffer in the argument size
. The following address families to pass to af
are currently supported:
src
points to a struct in_addr (in network byte order) which is converted to an IPv4 network address in the dotted-decimal format, "ddd.ddd.ddd.ddd". The buffer dst
must be at least INET_ADDRSTRLEN bytes long. src
points to a struct in6_addr (in network byte order) which is converted to a representation of this address in the most appropriate IPv6 network address format for this address. The buffer dst
must be at least INET6_ADDRSTRLEN bytes long.On success, this function returns a non-NULL pointer to dst
. NULL is returned if there was an error, with errno set to indicate the error.
Conformity: POSIX.1-2001.
Supported OS: Windows XP, CE.