]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/inet_pton.3
white space clean-ups.
[thirdparty/man-pages.git] / man3 / inet_pton.3
CommitLineData
fea681da
MK
1.\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
23.\" References: RFC 2553
69962544 24.TH INET_PTON 3 2000-12-18 "Linux" "Linux Programmer's Manual"
fea681da
MK
25.SH NAME
26inet_pton \- Create a network address structure
27.SH SYNOPSIS
28.nf
29.B #include <sys/types.h>
30.B #include <sys/socket.h>
31.B #include <arpa/inet.h>
32.sp
33.BI "int inet_pton(int " "af" ", const char *" "src" ", void *" "dst" );
34.SH DESCRIPTION
35This function converts the character string
36.I src
37into a network address structure in the
38.I af
39address family, then
40copies
41the network address structure to
42.IR dst .
43.PP
2777b1ca 44.BR inet_pton ()
fea681da
MK
45extends the
46.BR inet_addr (3)
47function to support multiple address families,
48.BR inet_addr (3)
49is now considered to be deprecated in favor of
2777b1ca 50.BR inet_pton ().
fea681da
MK
51The following address families are currently supported:
52.TP
53.B AF_INET
54.I src
55points to a character string containing an IPv4 network address in
56the dotted-quad format, "\fIddd.ddd.ddd.ddd\fP".
57The address is converted
58to a
59.I struct in_addr
60and copied to
a5e0a0e4 61.IR dst ,
fea681da
MK
62which must be
63.I sizeof(struct in_addr)
64bytes long.
65.TP
66.B AF_INET6
67.I src
68points to a character string containing an IPv6 network address in
69any allowed IPv6 address format.
70The address is converted
71to a
72.I struct in6_addr
73and copied to
a5e0a0e4 74.IR dst ,
fea681da
MK
75which must be
76.I sizeof(struct in6_addr)
77bytes long.
78.PP
79Certain legacy hex and octal formats of
80.B AF_INET
81addresses are not supported by
31e9a9ec 82.BR inet_pton (),
fea681da
MK
83which rejects them.
84.SH "RETURN VALUE"
e511ffb6 85.BR inet_pton ()
fea681da
MK
86returns a negative value and sets
87.I errno
88to
89.B EAFNOSUPPORT
90if
91.I af
92does not contain a valid address family.
930 is returned if
94.I src
95does not contain a character string representing a valid network
96address in the specified address family.
97A positive value is returned if the network address was successfully
98converted.
68e1685c
MK
99.SH "CONFORMING TO"
100POSIX.1-2001.
fea681da
MK
101.SH BUGS
102.B AF_INET6
103does not recognize IPv4 addresses.
104An explicit IPv6-mapped IPv4 address must be supplied in
105.I src
106instead.
e37e3282
MK
107.SH "SEE ALSO"
108.BR inet_ntop (3)