File: netinet_in.h.0p

package info (click to toggle)
manpages-posix 2013a-2
  • links: PTS
  • area: non-free
  • in suites: buster, stretch
  • size: 9,464 kB
  • ctags: 5
  • sloc: makefile: 45; sh: 34
file content (391 lines) | stat: -rw-r--r-- 8,970 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
'\" et
.TH netinet_in.h "0P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.

.SH NAME
netinet/in.h
\(em Internet address family
.SH SYNOPSIS
.LP
.nf
#include <netinet/in.h>
.fi
.SH DESCRIPTION
The
.IR <netinet/in.h> 
header shall define the following types:
.IP "\fBin_port_t\fP" 10
Equivalent to the type
.BR uint16_t
as described in
.IR <inttypes.h> .
.IP "\fBin_addr_t\fP" 10
Equivalent to the type
.BR uint32_t
as described in
.IR <inttypes.h> .
.P
The
.IR <netinet_in.h> 
header shall define the
.BR sa_family_t
type as described in
.IR <sys/socket.h> .
.P
The
.IR <netinet_in.h> 
header shall define the
.BR uint8_t
and
.BR uint32_t
types as described in
.IR <inttypes.h> .
Inclusion of the
.IR <netinet/in.h> 
header may also make visible all symbols from
.IR <inttypes.h> 
and
.IR <sys/socket.h> .
.P
The
.IR <netinet/in.h> 
header shall define the
.BR in_addr
structure, which shall include at least the following member:
.sp
.RS 4
.nf
\fB
in_addr_t  s_addr
.fi \fR
.P
.RE
.P
The
.IR <netinet/in.h> 
header shall define the
.BR sockaddr_in
structure, which shall include at least the following members:
.sp
.RS 4
.nf
\fB
sa_family_t     sin_family   \fRAF_INET.\fR
in_port_t       sin_port     \fRPort number.\fR
struct in_addr  sin_addr     \fRIP address.\fR
.fi \fR
.P
.RE
.P
The
.IR sin_port
and
.IR sin_addr
members shall be in network byte order.
.P
The
.BR sockaddr_in
structure is used to store addresses for the Internet address family.
Pointers to this type shall be cast by applications to
.BR "struct sockaddr *"
for use with socket functions.
.P
The
.IR <netinet/in.h> 
header shall define the
.BR in6_addr
structure, which shall include at least the following member:
.sp
.RS 4
.nf
\fB
uint8_t s6_addr[16]
.fi \fR
.P
.RE
.P
This array is used to contain a 128-bit IPv6 address, stored in network
byte order.
.P
The
.IR <netinet/in.h> 
header shall define the
.BR sockaddr_in6
structure, which shall include at least the following members:
.sp
.RS 4
.nf
\fB
sa_family_t      sin6_family    \fRAF_INET6.\fR
in_port_t        sin6_port      \fRPort number.\fR
uint32_t         sin6_flowinfo  \fRIPv6 traffic class and flow information.\fR
struct in6_addr  sin6_addr      \fRIPv6 address.\fR
uint32_t         sin6_scope_id  \fRSet of interfaces for a scope.\fR
.fi \fR
.P
.RE
.P
The
.IR sin6_port
and
.IR sin6_addr
members shall be in network byte order.
.P
The
.BR sockaddr_in6
structure shall be set to zero by an application prior to using it,
since implementations are free to have additional,
implementation-defined fields in
.BR sockaddr_in6 .
.P
The
.IR sin6_scope_id
field is a 32-bit integer that identifies a set of interfaces as
appropriate for the scope of the address carried in the
.IR sin6_addr
field. For a link scope
.IR sin6_addr ,
the application shall ensure that
.IR sin6_scope_id
is a link index. For a site scope
.IR sin6_addr ,
the application shall ensure that
.IR sin6_scope_id
is a site index. The mapping of
.IR sin6_scope_id
to an interface or set of interfaces is implementation-defined.
.P
The
.IR <netinet/in.h> 
header shall declare the following external variable:
.sp
.RS 4
.nf
\fB
const struct in6_addr in6addr_any
.fi \fR
.P
.RE
.P
This variable is initialized by the system to contain the wildcard IPv6
address. The
.IR <netinet/in.h> 
header also defines the IN6ADDR_ANY_INIT macro. This macro must be
constant at compile time and can be used to initialize a variable of
type
.BR "struct in6_addr"
to the IPv6 wildcard address.
.P
The
.IR <netinet/in.h> 
header shall declare the following external variable:
.sp
.RS 4
.nf
\fB
const struct in6_addr in6addr_loopback
.fi \fR
.P
.RE
.P
This variable is initialized by the system to contain the loopback IPv6
address. The
.IR <netinet/in.h> 
header also defines the IN6ADDR_LOOPBACK_INIT macro. This macro must be
constant at compile time and can be used to initialize a variable of
type
.BR "struct in6_addr"
to the IPv6 loopback address.
.P
The
.IR <netinet/in.h> 
header shall define the
.BR ipv6_mreq
structure, which shall include at least the following members:
.sp
.RS 4
.nf
\fB
struct in6_addr  ipv6mr_multiaddr  \fRIPv6 multicast address.\fR
unsigned         ipv6mr_interface  \fRInterface index.\fR
.fi \fR
.P
.RE
.P
The
.IR <netinet/in.h> 
header shall define the following symbolic constants for use as
values of the
.IR level
argument of
\fIgetsockopt\fR()
and
\fIsetsockopt\fR():
.IP IPPROTO_IP 16
Internet protocol.
.IP IPPROTO_IPV6 16
Internet Protocol Version 6.
.IP IPPROTO_ICMP 16
Control message protocol.
.IP IPPROTO_RAW 16
Raw IP Packets Protocol.
.IP IPPROTO_TCP 16
Transmission control protocol.
.IP IPPROTO_UDP 16
User datagram protocol.
.P
The
.IR <netinet/in.h> 
header shall define the following symbolic constants for use as
destination addresses for
\fIconnect\fR(),
\fIsendmsg\fR(),
and
\fIsendto\fR():
.IP INADDR_ANY 16
IPv4 local host address.
.IP INADDR_BROADCAST 16
IPv4 broadcast address.
.P
The
.IR <netinet/in.h> 
header shall define the following symbolic constant, with the value
specified, to help applications declare buffers of the proper size
to store IPv4 addresses in string form:
.IP INET_ADDRSTRLEN 16
16. Length of the string form for IP.
.P
The
\fIhtonl\fR(),
\fIhtons\fR(),
\fIntohl\fR(),
and
\fIntohs\fR()
functions shall be available as described in
.IR <arpa/inet.h> .
Inclusion of the
.IR <netinet/in.h> 
header may also make visible all symbols from
.IR <arpa/inet.h> .
.P
The
.IR <netinet/in.h> 
header shall define the following symbolic constant, with the value
specified, to help applications declare buffers of the proper size
to store IPv6 addresses in string form:
.IP INET6_ADDRSTRLEN 16
46. Length of the string form for IPv6.
.br
.P
The
.IR <netinet/in.h> 
header shall define the following symbolic constants, with distinct
integer values, for use in the
.IR option_name
argument in the
\fIgetsockopt\fR()
or
\fIsetsockopt\fR()
functions at protocol level IPPROTO_IPV6:
.IP IPV6_JOIN_GROUP 16
Join a multicast group.
.IP IPV6_LEAVE_GROUP 16
Quit a multicast group.
.IP IPV6_MULTICAST_HOPS 16
.br
Multicast hop limit.
.IP IPV6_MULTICAST_IF 16
Interface to use for outgoing multicast packets.
.IP IPV6_MULTICAST_LOOP 16
.br
Multicast packets are delivered back to the local application.
.IP IPV6_UNICAST_HOPS 16
Unicast hop limit.
.IP IPV6_V6ONLY 16
Restrict AF_INET6 socket to IPv6 communications only.
.P
The
.IR <netinet/in.h> 
header shall define the following macros that test for special IPv6
addresses. Each macro is of type
.BR int
and takes a single argument of type
.BR "const struct in6_addr *" :
.IP IN6_IS_ADDR_UNSPECIFIED 6
.br
Unspecified address.
.IP IN6_IS_ADDR_LOOPBACK 6
.br
Loopback address.
.IP IN6_IS_ADDR_MULTICAST 6
.br
Multicast address.
.IP IN6_IS_ADDR_LINKLOCAL 6
.br
Unicast link-local address.
.IP IN6_IS_ADDR_SITELOCAL 6
.br
Unicast site-local address.
.IP IN6_IS_ADDR_V4MAPPED 6
.br
IPv4 mapped address.
.IP IN6_IS_ADDR_V4COMPAT 6
.br
IPv4-compatible address.
.IP IN6_IS_ADDR_MC_NODELOCAL 6
.br
Multicast node-local address.
.IP IN6_IS_ADDR_MC_LINKLOCAL 6
.br
Multicast link-local address.
.IP IN6_IS_ADDR_MC_SITELOCAL 6
.br
Multicast site-local address.
.IP IN6_IS_ADDR_MC_ORGLOCAL 6
.br
Multicast organization-local address.
.IP IN6_IS_ADDR_MC_GLOBAL 6
.br
Multicast global address.
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
None.
.SH "RATIONALE"
None.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "Section 4.9" ", " "Host and Network Byte Orders",
.IR "\fB<arpa_inet.h>\fP",
.IR "\fB<inttypes.h>\fP",
.IR "\fB<sys_socket.h>\fP"
.P
The System Interfaces volume of POSIX.1\(hy2008,
.IR "\fIconnect\fR\^(\|)",
.IR "\fIgetsockopt\fR\^(\|)",
.IR "\fIhtonl\fR\^(\|)",
.IR "\fIsendmsg\fR\^(\|)",
.IR "\fIsendto\fR\^(\|)",
.IR "\fIsetsockopt\fR\^(\|)"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.unix.org/online.html .

Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .