Penguin
Blame: inet_pton(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of inet_pton(3) version 5, including all changes. View license author blame.
Rev Author # Line
1 perry 1 !!NAME
2
3
4 inet_pton - Create a network address structure
5 !!SYNOPSIS
6
7
5 JohnMcPherson 8 #include <sys/types.h>
9 #include <sys/socket.h>
10 #include <arpa/inet.h>
1 perry 11
5 JohnMcPherson 12 int inet_pton(int af, const char *src, void *dst);
1 perry 13
5 JohnMcPherson 14 !!DESCRIPTION
1 perry 15
16
5 JohnMcPherson 17 This function converts the character string ''src'' into a network address structure in the ''af'' address family, then copies the network address structure to ''dst''.
1 perry 18
19
5 JohnMcPherson 20 inet_pton(3) extends the inet_addr(3) function to support multiple address families, inet_addr(3) is now considered to be deprecated in favor of inet_pton(3). The following address families are currently supported:
1 perry 21
5 JohnMcPherson 22 ;__AF_INET__: ''src'' points to a character string containing an [IPv4] network address in the dotted-quad format, ''ddd.ddd.ddd.ddd'' ''struct in_addr'' and copied to ''dst,'' which must be ''sizeof(struct in_addr)'' bytes long.
1 perry 23
24
5 JohnMcPherson 25 ;__AF_INET6__: ''src'' points to a character string containing an [IPv6] network address in any allowed IPv6 address format. The address is converted to a ''struct in6_addr'' and copied to ''dst,'' which must be ''sizeof(struct in6_addr)'' bytes long.
1 perry 26
27
5 JohnMcPherson 28 Certain legacy hex and octal formats of __AF_INET__ addresses are not supported by ''inet_pton'', which rejects them.
1 perry 29
30 !!RETURN VALUE
31
5 JohnMcPherson 32 __inet_pton__ returns a negative value and sets ''errno'' to [EAFNOSUPPORT] if ''af'' does not contain a valid address family. 0 is returned if ''src'' does not contain a character string representing a valid network address in the specified address family. A positive value is returned if the network address was successfully converted.
1 perry 33
34 !!SEE ALSO
35
36
4 perry 37 inet_ntop(3)
1 perry 38
5 JohnMcPherson 39 !!BUGS
1 perry 40
5 JohnMcPherson 41 __AF_INET6__ does not recognize IPv4 addresses. An explicit IPv6-mapped IPv4 address must be supplied in ''src'' instead.
1 perry 42 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 6 times)