Several things: a patch from PR#6355, nroff/mandoc cleanup, and

update a reference to RFC 1884 to RFC 2373.
This commit is contained in:
fair 1999-03-17 23:19:43 +00:00
parent 4bd7ef0241
commit 0204f38aae

View File

@ -1,4 +1,4 @@
.\" $NetBSD: inet.3,v 1.10 1998/02/06 05:40:54 perry Exp $
.\" $NetBSD: inet.3,v 1.11 1999/03/17 23:19:43 fair Exp $
.\"
.\" Copyright (c) 1983, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -82,25 +82,32 @@ and
.Fn inet_network
interpret character strings representing
numbers expressed in the Internet standard
.Ql \&.
.Qq dotted quad
notation.
.Pp
The
.Fn inet_pton
function converts a presentation format address (that is, printable form
as held in a character string) to network format (usually a
.Ft struct in_addr
or some other internal binary representation, in network byte order). It
returns 1 if the address was valid for the specified address family, or
or some other internal binary representation, in network byte order).
It returns 1 if the address was valid for the specified address family, or
0 if the address wasn't parseable in the specified address family, or -1
if some system error occurred (in which case
.Va errno
will have been set). This function is presently valid for AF_INET and
AF_INET6. The
will have been set).
This function is presently valid for
.Dv AF_INET
and
.Dv AF_INET6 .
.Pp
The
.Fn inet_aton
routine interprets the specified character string as an Internet address,
placing the address into the structure provided.
It returns 1 if the string was successfully interpreted,
or 0 if the string is invalid.
.Pp
The
.Fn inet_addr
and
@ -114,27 +121,35 @@ The function
converts an address from network format (usually a
.Ft struct in_addr
or some other binary form, in network byte order) to presentation format
(suitable for external display purposes). It returns NULL if a system
error occurs (in which case,
(suitable for external display purposes).
It returns NULL if a system error occurs (in which case,
.Va errno
will have been set), or it returns a pointer to the destination string.
.Pp
The routine
.Fn inet_ntoa
takes an Internet address and returns an
.Tn ASCII
string representing the address in
.Ql \&.
notation. The routine
.Qq dotted quad
notation.
.Pp
The routine
.Fn inet_makeaddr
takes an Internet network number and a local
network address and constructs an Internet address
from it. The routines
takes an Internet network number and a local network address (both in
host order) and constructs an Internet address from it.
Note that to convert only a single value to a
.Ft struct in_addr
form that value shoud be passed as the first parameter and
.Ql 0L
should be given for the second parameter.
.Pp
The routines
.Fn inet_netof
and
.Fn inet_lnaof
break apart Internet host addresses, returning
the network number and local network address part,
respectively.
break apart Internet host addresses, returning the network number and
local network address part, respectively (both in host order).
.Pp
All Internet addresses are returned in network
order (bytes ordered from left to right).
@ -142,7 +157,7 @@ All network numbers and local address parts are
returned as machine format integer values.
.Sh INTERNET ADDRESSES (IP VERSION 4)
Values specified using the
.Ql \&.
.Qq dotted quad
notation take one
of the following forms:
.Bd -literal -offset indent
@ -154,11 +169,11 @@ a
.Pp
When four parts are specified, each is interpreted
as a byte of data and assigned, from left to right,
to the four bytes of an Internet address. Note
that when an Internet address is viewed as a 32-bit
to the four bytes of an Internet address.
Note that when an Internet address is viewed as a 32-bit
integer quantity on a system that uses little-endian
byte order (such as the
.Tn Intel 386, 486
byte order (e.g.
.Tn Intel i386, i486
and
.Tn Pentium
processors) the bytes referred to above appear as
@ -186,14 +201,14 @@ rearrangement.
All numbers supplied as
.Dq parts
in a
.Ql \&.
.Qq dotted quad
notation
may be decimal, octal, or hexadecimal, as specified
in the C language (i.e., a leading 0x or 0X implies
hexadecimal; otherwise, a leading 0 implies octal;
otherwise, the number is interpreted as decimal).
.Sh INTERNET ADDRESSES (IP VERSION 6)
The presentation format of an IPv6 address is given in [RFC1884 2.2]:
The presentation format of an IPv6 address is given in RFC 2373:
.Pp
There are three conventional forms for representing IPv6 addresses as
text strings:
@ -209,16 +224,18 @@ FEDC:BA98:7654:3210:FEDC:BA98:7654:3210
.Pp
Note that it is not necessary to write the leading zeros in an
individual field, but there must be at least one numeral in
every field (except for the case described in 2.).
every field (except for the case described in 2).
.It
Due to the method of allocating certain styles of IPv6
addresses, it will be common for addresses to contain long
strings of zero bits. In order to make writing addresses
strings of zero bits.
In order to make writing addresses
.Pp
containing zero bits easier a special syntax is available to
compress the zeros. The use of ``::'' indicates multiple groups
of 16-bits of zeros. The ``::'' can only appear once in an
address. The ``::'' can also be used to compress the leading
compress the zeros.
The use of ``::'' indicates multiple groups of 16-bits of zeros.
The ``::'' can only appear once in an address.
The ``::'' can also be used to compress the leading
and/or trailing zeros in an address.
.Pp
For example the following addresses:
@ -242,7 +259,8 @@ dealing with a mixed environment of IPv4 and IPv6 nodes is
x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values
of the six high-order 16-bit pieces of the address, and the 'd's
are the decimal values of the four low-order 8-bit pieces of the
address (standard IPv4 representation). Examples:
address (standard IPv4 representation).
Examples:
.Bd -literal -offset indent
0:0:0:0:0:0:13.1.68.3
0:0:0:0:0:FFFF:129.144.52.38
@ -269,18 +287,25 @@ for malformed requests.
.Xr inet_net 3 ,
.Xr hosts 5 ,
.Xr networks 5
.Rs
.%R RFC
.%N 2373
.%D July 1998
.%T "IP Version 6 Addressing Architecture"
.Re
.Sh STANDARDS
The
.Nm inet_ntop
and
.Nm inet_pton
functions conforms to the IETF IPng
functions conforms to the IETF Next Generation IP (a.k.a. IPng and IPv6)
.Bx
API and address formatting
specifications. Note that
API and address formatting specifications.
Note that
.Nm inet_pton
does not accept 1-, 2-, or 3-part dotted addresses; all four parts
must be specified. This is a narrower input set than that accepted by
must be specified.
This is a narrower input set than that accepted by
.Nm inet_aton .
.Sh HISTORY
The