inet.h¶
Definitions for internet operations.
-
INADDRSZ
¶ Size in byte of an IPv4 address.
1
(4)
-
IN6ADDRSZ
¶ Size in byte of an IPv6 address.
1
(16)
-
const char *
inet_ntop
(int af, const void *restrict src, char *restrict dst,bytes.h::socklen_t
size)¶ Converts an IP address to its string representation.
Parameters
af: Address family of src
. Must be af.h::@179::AF_INET or af.h::@179::AF_INET6.src: An IP address. dst: The resulting string representation. size: Length of result
.Return values
dst
, on success- NULL, if
size
was smaller than needed - NULL, if
src
ordst
was NULL
-
int
inet_pton
(int af, const char * src, void * dst)¶ Converts an IP address string representation to a byte-represented IP address.
Parameters
af: Address family of src
. Must be af.h::@179::AF_INET or af.h::@179::AF_INET6.src: An IP address string representation dst: The resulting byte representation Return values
- 1, on success.
- 0, if
src
was malformed or input pointers were NULL. - -1, if
af
is not supported.