summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmc <>2012-04-20 07:00:21 +0000
committerjmc <>2012-04-20 07:00:21 +0000
commitcac7bfdacac68dd010c6c082d280538c48791fe2 (patch)
tree6369489aa16e1f30392e6066a881e09a340e3535
parent891102fe0de88602dbd6799f09c9578690841f95 (diff)
downloadopenbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.tar.gz
openbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.tar.bz2
openbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.zip
rearrange DESCRIPTION somewhat to make this page more readable;
from Lawrence Teo
-rw-r--r--src/lib/libc/net/inet.379
1 files changed, 40 insertions, 39 deletions
diff --git a/src/lib/libc/net/inet.3 b/src/lib/libc/net/inet.3
index 3f198ae8e0..ba7a3c8375 100644
--- a/src/lib/libc/net/inet.3
+++ b/src/lib/libc/net/inet.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: inet.3,v 1.22 2008/12/09 19:38:38 otto Exp $ 1.\" $OpenBSD: inet.3,v 1.23 2012/04/20 07:00:21 jmc Exp $
2.\" $NetBSD: inet.3,v 1.7 1997/06/18 02:25:24 lukem Exp $ 2.\" $NetBSD: inet.3,v 1.7 1997/06/18 02:25:24 lukem Exp $
3.\" 3.\"
4.\" Copyright (c) 1983, 1990, 1991, 1993 4.\" Copyright (c) 1983, 1990, 1991, 1993
@@ -30,43 +30,43 @@
30.\" 30.\"
31.\" @(#)inet.3 8.1 (Berkeley) 6/4/93 31.\" @(#)inet.3 8.1 (Berkeley) 6/4/93
32.\" 32.\"
33.Dd $Mdocdate: December 9 2008 $ 33.Dd $Mdocdate: April 20 2012 $
34.Dt INET 3 34.Dt INET 3
35.Os 35.Os
36.Sh NAME 36.Sh NAME
37.Nm inet_addr ,
38.Nm inet_aton , 37.Nm inet_aton ,
39.Nm inet_lnaof , 38.Nm inet_addr ,
40.Nm inet_makeaddr ,
41.Nm inet_netof ,
42.Nm inet_network , 39.Nm inet_network ,
43.Nm inet_ntoa , 40.Nm inet_pton ,
44.Nm inet_ntop , 41.Nm inet_ntop ,
45.Nm inet_pton 42.Nm inet_ntoa ,
43.Nm inet_makeaddr ,
44.Nm inet_netof ,
45.Nm inet_lnaof
46.Nd Internet address manipulation routines 46.Nd Internet address manipulation routines
47.Sh SYNOPSIS 47.Sh SYNOPSIS
48.Fd #include <sys/types.h> 48.Fd #include <sys/types.h>
49.Fd #include <sys/socket.h> 49.Fd #include <sys/socket.h>
50.Fd #include <netinet/in.h> 50.Fd #include <netinet/in.h>
51.Fd #include <arpa/inet.h> 51.Fd #include <arpa/inet.h>
52.Ft in_addr_t
53.Fn inet_addr "const char *cp"
54.Ft int 52.Ft int
55.Fn inet_aton "const char *cp" "struct in_addr *addr" 53.Fn inet_aton "const char *cp" "struct in_addr *addr"
56.Ft in_addr_t 54.Ft in_addr_t
57.Fn inet_lnaof "struct in_addr in" 55.Fn inet_addr "const char *cp"
56.Ft in_addr_t
57.Fn inet_network "const char *cp"
58.Ft int
59.Fn inet_pton "int af" "const char *src" "void *dst"
60.Ft const char *
61.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size"
62.Ft char *
63.Fn inet_ntoa "struct in_addr in"
58.Ft struct in_addr 64.Ft struct in_addr
59.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna" 65.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna"
60.Ft in_addr_t 66.Ft in_addr_t
61.Fn inet_netof "struct in_addr in" 67.Fn inet_netof "struct in_addr in"
62.Ft in_addr_t 68.Ft in_addr_t
63.Fn inet_network "const char *cp" 69.Fn inet_lnaof "struct in_addr in"
64.Ft char *
65.Fn inet_ntoa "struct in_addr in"
66.Ft const char *
67.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size"
68.Ft int
69.Fn inet_pton "int af" "const char *src" "void *dst"
70.Sh DESCRIPTION 70.Sh DESCRIPTION
71The routines 71The routines
72.Fn inet_aton , 72.Fn inet_aton ,
@@ -77,6 +77,25 @@ interpret character strings representing
77numbers expressed in the Internet standard 77numbers expressed in the Internet standard
78.Dq dot 78.Dq dot
79notation. 79notation.
80.Pp
81The
82.Fn inet_aton
83routine interprets the specified character string as an Internet address,
84placing the address into the structure provided.
85It returns 1 if the string was successfully interpreted,
86or 0 if the string was invalid.
87.Pp
88The
89.Fn inet_addr
90and
91.Fn inet_network
92functions return numbers suitable for use
93as Internet addresses and Internet network
94numbers, respectively.
95Both functions return the constant
96.Dv INADDR_NONE
97if the specified character string is malformed.
98.Pp
80The 99The
81.Fn inet_pton 100.Fn inet_pton
82function converts a presentation format address (that is, printable form 101function converts a presentation format address (that is, printable form
@@ -92,19 +111,6 @@ This function is presently valid for
92.Dv AF_INET 111.Dv AF_INET
93and 112and
94.Dv AF_INET6 . 113.Dv AF_INET6 .
95The
96.Fn inet_aton
97routine interprets the specified character string as an Internet address,
98placing the address into the structure provided.
99It returns 1 if the string was successfully interpreted,
100or 0 if the string was invalid.
101The
102.Fn inet_addr
103and
104.Fn inet_network
105functions return numbers suitable for use
106as Internet addresses and Internet network
107numbers, respectively.
108.Pp 114.Pp
109The function 115The function
110.Fn inet_ntop 116.Fn inet_ntop
@@ -118,15 +124,18 @@ if a system
118error occurs (in which case, 124error occurs (in which case,
119.Va errno 125.Va errno
120will have been set), or it returns a pointer to the destination string. 126will have been set), or it returns a pointer to the destination string.
127.Pp
121The routine 128The routine
122.Fn inet_ntoa 129.Fn inet_ntoa
123takes an Internet address and returns an 130takes an Internet address and returns an
124ASCII string representing the address in dot notation. 131ASCII string representing the address in dot notation.
132.Pp
125The routine 133The routine
126.Fn inet_makeaddr 134.Fn inet_makeaddr
127takes an Internet network number and a local 135takes an Internet network number and a local
128network address and constructs an Internet address 136network address and constructs an Internet address
129from it. 137from it.
138.Pp
130The routines 139The routines
131.Fn inet_netof 140.Fn inet_netof
132and 141and
@@ -261,14 +270,6 @@ or in compressed form:
261::FFFF:129.144.52.38 270::FFFF:129.144.52.38
262.Ed 271.Ed
263.El 272.El
264.Sh DIAGNOSTICS
265The constant
266.Dv INADDR_NONE
267is returned by
268.Fn inet_addr
269and
270.Fn inet_network
271for malformed requests.
272.Sh SEE ALSO 273.Sh SEE ALSO
273.Xr byteorder 3 , 274.Xr byteorder 3 ,
274.Xr gethostbyname 3 , 275.Xr gethostbyname 3 ,