diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/inet_net.3 | 97 |
1 files changed, 65 insertions, 32 deletions
diff --git a/src/lib/libc/net/inet_net.3 b/src/lib/libc/net/inet_net.3 index 5c32aecd86..fcdca84ec2 100644 --- a/src/lib/libc/net/inet_net.3 +++ b/src/lib/libc/net/inet_net.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: inet_net.3,v 1.6 2000/04/21 15:38:17 aaron Exp $ | 1 | .\" $OpenBSD: inet_net.3,v 1.7 2002/10/26 22:01:15 marc Exp $ |
| 2 | .\" $NetBSD: inet_net.3,v 1.1 1997/06/18 02:25:27 lukem Exp $ | 2 | .\" $NetBSD: inet_net.3,v 1.1 1997/06/18 02:25:27 lukem Exp $ |
| 3 | .\" | 3 | .\" |
| 4 | .\" Copyright (c) 1997 The NetBSD Foundation, Inc. | 4 | .\" Copyright (c) 1997 The NetBSD Foundation, Inc. |
| @@ -82,6 +82,14 @@ It will be set to | |||
| 82 | .Er ENOENT | 82 | .Er ENOENT |
| 83 | if the Internet network number was not valid). | 83 | if the Internet network number was not valid). |
| 84 | .Pp | 84 | .Pp |
| 85 | Caution: | ||
| 86 | The | ||
| 87 | .Fa dst | ||
| 88 | field should be zeroed before calling | ||
| 89 | .Fn inet_net_pton | ||
| 90 | as the function will only fill the number of bytes necessary to | ||
| 91 | encode the network number in network byte order. | ||
| 92 | .Pp | ||
| 85 | The only value for | 93 | The only value for |
| 86 | .Fa af | 94 | .Fa af |
| 87 | currently supported is | 95 | currently supported is |
| @@ -90,42 +98,66 @@ currently supported is | |||
| 90 | is the size of the result buffer | 98 | is the size of the result buffer |
| 91 | .Fa dst . | 99 | .Fa dst . |
| 92 | .Sh NETWORK NUMBERS (IP VERSION 4) | 100 | .Sh NETWORK NUMBERS (IP VERSION 4) |
| 93 | Internet network numbers may be specified in one of the following forms: | 101 | The external representation of Internet network numbers may be specified in |
| 102 | one of the following forms: | ||
| 94 | .Bd -literal -offset indent | 103 | .Bd -literal -offset indent |
| 95 | a.b.c.d/bits | ||
| 96 | a.b.c.d | ||
| 97 | a.b.c | ||
| 98 | a.b | ||
| 99 | a | 104 | a |
| 105 | a.b | ||
| 106 | a.b.c | ||
| 107 | a.b.c.d | ||
| 100 | .Ed | 108 | .Ed |
| 101 | .Pp | 109 | .Pp |
| 102 | When four parts are specified, each is interpreted | 110 | Any of the above four forms may have |
| 103 | as a byte of data and assigned, from left to right, | 111 | .Dq Li /bits |
| 104 | to the four bytes of an Internet network number. | 112 | appended where |
| 105 | Note that when an Internet network number is viewed as a 32-bit | 113 | .Dq Li bits |
| 106 | integer quantity on a system that uses little-endian | 114 | is in the range |
| 107 | byte order (such as the Intel 386, 486, and Pentium processors) | 115 | .Li 0-32 |
| 108 | the bytes referred to above appear as | 116 | and is used to explicitly specify the number of bits in the network address. |
| 109 | .Dq Li d.c.b.a . | 117 | When |
| 110 | That is, little-endian bytes are ordered from right to left. | 118 | .Dq Li /bits |
| 119 | is not specified the number of bits in the network address is calculated | ||
| 120 | as the larger of the number of bits in the class to which the address | ||
| 121 | belongs and the number of bits provided rounded up modulo 8. | ||
| 122 | Examples: | ||
| 123 | .Bl -tag -width 10.1.2.3/24 | ||
| 124 | .It Li 10 | ||
| 125 | an 8 bit network number (class A), value | ||
| 126 | .Li 10.0.0.0 . | ||
| 127 | .It Li 192 | ||
| 128 | a 24 bit network number (class C), value | ||
| 129 | .Li 192.0.0.0 . | ||
| 130 | .It Li 10.10 | ||
| 131 | a 16 bit network number, value | ||
| 132 | .Li 10.10.0.0 . | ||
| 133 | .It Li 10.1.2.0 | ||
| 134 | a 24 bit network number, value | ||
| 135 | .Li 10.1.2.0 . | ||
| 136 | .It Li 10.1.2.3 | ||
| 137 | a 32 bit network number, value | ||
| 138 | .Li 10.1.2.3 . | ||
| 139 | .It Li 10.1.2.3/24 | ||
| 140 | a 24 bit network number (explicit), value | ||
| 141 | .Li 10.1.2.3 . | ||
| 142 | .El | ||
| 111 | .Pp | 143 | .Pp |
| 112 | When a three part number is specified, the last | 144 | Note that when the number of bits is especified using |
| 113 | part is interpreted as a 16-bit quantity and placed | 145 | .Dq Li /bits |
| 114 | in the rightmost two bytes of the Internet network number. | 146 | notation the value of the address still includes all bits suplied |
| 115 | This makes the three part number format convenient | 147 | in the external representation, even those bits which are the host |
| 116 | for specifying Class B network numbers as | 148 | part of an internet address. |
| 117 | .Dq Li 128.net.host . | 149 | Also, unlike |
| 118 | .Pp | 150 | .Xr inet_pton 3 |
| 119 | When a two part number is supplied, the last part | 151 | where the external representation is assumed to be an internet address, the |
| 120 | is interpreted as a 24-bit quantity and placed in | 152 | external representation for |
| 121 | the rightmost three bytes of the Internet network number. | 153 | .Fn inet_net_pton |
| 122 | This makes the two part number format convenient | 154 | is assumed to be a network address. |
| 123 | for specifying Class A network numbers as | 155 | Thus |
| 124 | .Dq Li net.host . | 156 | .Dq Li 10.1 |
| 125 | .Pp | 157 | is assumed to be |
| 126 | When only one part is given, the value is stored | 158 | .Dq Li 10.1.0.0 |
| 127 | directly in the Internet network number without any byte | 159 | not |
| 128 | rearrangement. | 160 | .Dq Li 10.0.0.1 |
| 129 | .Pp | 161 | .Pp |
| 130 | All numbers supplied as | 162 | All numbers supplied as |
| 131 | .Dq parts | 163 | .Dq parts |
| @@ -139,6 +171,7 @@ otherwise, the number is interpreted as decimal). | |||
| 139 | .Sh SEE ALSO | 171 | .Sh SEE ALSO |
| 140 | .Xr byteorder 3 , | 172 | .Xr byteorder 3 , |
| 141 | .Xr inet 3 , | 173 | .Xr inet 3 , |
| 174 | .Xr inet_pton 3, | ||
| 142 | .Xr networks 5 | 175 | .Xr networks 5 |
| 143 | .Sh HISTORY | 176 | .Sh HISTORY |
| 144 | The | 177 | The |
