1netinet_in.h(0P)           POSIX Programmer's Manual          netinet_in.h(0P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       netinet/in.h — Internet address family
14

SYNOPSIS

16       #include <netinet/in.h>
17

DESCRIPTION

19       The <netinet/in.h> header shall define the following types:
20
21       in_port_t Equivalent to the type uint16_t as described in <inttypes.h>.
22
23       in_addr_t Equivalent to the type uint32_t as described in <inttypes.h>.
24
25       The  <netinet_in.h>  header  shall  define  the  sa_family_t  type   as
26       described in <sys/socket.h>.
27
28       The  <netinet_in.h>  header shall define the uint8_t and uint32_t types
29       as described in <inttypes.h>.  Inclusion of the  <netinet/in.h>  header
30       may also make visible all symbols from <inttypes.h> and <sys/socket.h>.
31
32       The  <netinet/in.h>  header  shall  define the in_addr structure, which
33       shall include at least the following member:
34
35           in_addr_t  s_addr
36
37       The <netinet/in.h> header shall define the sockaddr_in structure, which
38       shall include at least the following members:
39
40           sa_family_t     sin_family   AF_INET.
41           in_port_t       sin_port     Port number.
42           struct in_addr  sin_addr     IP address.
43
44       The sin_port and sin_addr members shall be in network byte order.
45
46       The  sockaddr_in  structure is used to store addresses for the Internet
47       address family.  Pointers to this type shall be cast by applications to
48       struct sockaddr * for use with socket functions.
49
50       The  <netinet/in.h>  header  shall define the in6_addr structure, which
51       shall include at least the following member:
52
53           uint8_t s6_addr[16]
54
55       This array is used to contain a 128-bit IPv6 address, stored in network
56       byte order.
57
58       The  <netinet/in.h>  header  shall  define  the sockaddr_in6 structure,
59       which shall include at least the following members:
60
61           sa_family_t      sin6_family    AF_INET6.
62           in_port_t        sin6_port      Port number.
63           uint32_t         sin6_flowinfo  IPv6 traffic class and flow information.
64           struct in6_addr  sin6_addr      IPv6 address.
65           uint32_t         sin6_scope_id  Set of interfaces for a scope.
66
67       The sin6_port and sin6_addr members shall be in network byte order.
68
69       The sockaddr_in6 structure shall be set to zero by an application prior
70       to  using it, since implementations are free to have additional, imple‐
71       mentation-defined fields in sockaddr_in6.
72
73       The sin6_scope_id field is a 32-bit integer that identifies  a  set  of
74       interfaces  as  appropriate for the scope of the address carried in the
75       sin6_addr field. For a link  scope  sin6_addr,  the  application  shall
76       ensure  that sin6_scope_id is a link index. For a site scope sin6_addr,
77       the application shall ensure that sin6_scope_id is a  site  index.  The
78       mapping of sin6_scope_id to an interface or set of interfaces is imple‐
79       mentation-defined.
80
81       The <netinet/in.h> header shall declare the  following  external  vari‐
82       able:
83
84           const struct in6_addr in6addr_any
85
86       This variable is initialized by the system to contain the wildcard IPv6
87       address. The <netinet/in.h> header also  defines  the  IN6ADDR_ANY_INIT
88       macro.  This  macro must be constant at compile time and can be used to
89       initialize a variable of type struct  in6_addr  to  the  IPv6  wildcard
90       address.
91
92       The  <netinet/in.h>  header  shall declare the following external vari‐
93       able:
94
95           const struct in6_addr in6addr_loopback
96
97       This variable is initialized by the system to contain the loopback IPv6
98       address.  The  <netinet/in.h>  header  also  defines  the IN6ADDR_LOOP‐
99       BACK_INIT macro. This macro must be constant at compile time and can be
100       used to initialize a variable of type struct in6_addr to the IPv6 loop‐
101       back address.
102
103       The <netinet/in.h> header shall define the ipv6_mreq  structure,  which
104       shall include at least the following members:
105
106           struct in6_addr  ipv6mr_multiaddr  IPv6 multicast address.
107           unsigned         ipv6mr_interface  Interface index.
108
109       The <netinet/in.h> header shall define the following symbolic constants
110       for use as values of the level argument of  getsockopt()  and  setsock‐
111       opt():
112
113       IPPROTO_IP      Internet protocol.
114
115       IPPROTO_IPV6    Internet Protocol Version 6.
116
117       IPPROTO_ICMP    Control message protocol.
118
119       IPPROTO_RAW     Raw IP Packets Protocol.
120
121       IPPROTO_TCP     Transmission control protocol.
122
123       IPPROTO_UDP     User datagram protocol.
124
125       The <netinet/in.h> header shall define the following symbolic constants
126       for  use  as  destination  addresses  for  connect(),  sendmsg(),   and
127       sendto():
128
129       INADDR_ANY      IPv4 local host address.
130
131       INADDR_BROADCAST
132                       IPv4 broadcast address.
133
134       The <netinet/in.h> header shall define the following symbolic constant,
135       with the value specified, to help applications declare buffers  of  the
136       proper size to store IPv4 addresses in string form:
137
138       INET_ADDRSTRLEN 16. Length of the string form for IP.
139
140       The htonl(), htons(), ntohl(), and ntohs() functions shall be available
141       as described in <arpa/inet.h>.  Inclusion of the <netinet/in.h>  header
142       may also make visible all symbols from <arpa/inet.h>.
143
144       The <netinet/in.h> header shall define the following symbolic constant,
145       with the value specified, to help applications declare buffers  of  the
146       proper size to store IPv6 addresses in string form:
147
148       INET6_ADDRSTRLEN
149                       46. Length of the string form for IPv6.
150
151       The  <netinet/in.h>  header  shall  define  the following symbolic con‐
152       stants, with distinct integer values, for use in the option_name  argu‐
153       ment  in  the  getsockopt() or setsockopt() functions at protocol level
154       IPPROTO_IPV6:
155
156       IPV6_JOIN_GROUP Join a multicast group.
157
158       IPV6_LEAVE_GROUP
159                       Quit a multicast group.
160
161       IPV6_MULTICAST_HOPS
162                       Multicast hop limit.
163
164       IPV6_MULTICAST_IF
165                       Interface to use for outgoing multicast packets.
166
167       IPV6_MULTICAST_LOOP
168                       Multicast packets  are  delivered  back  to  the  local
169                       application.
170
171       IPV6_UNICAST_HOPS
172                       Unicast hop limit.
173
174       IPV6_V6ONLY     Restrict AF_INET6 socket to IPv6 communications only.
175
176       The  <netinet/in.h>  header shall define the following macros that test
177       for special IPv6 addresses. Each macro is of type int and takes a  sin‐
178       gle argument of type const struct in6_addr *:
179
180       IN6_IS_ADDR_UNSPECIFIED
181             Unspecified address.
182
183       IN6_IS_ADDR_LOOPBACK
184             Loopback address.
185
186       IN6_IS_ADDR_MULTICAST
187             Multicast address.
188
189       IN6_IS_ADDR_LINKLOCAL
190             Unicast link-local address.
191
192       IN6_IS_ADDR_SITELOCAL
193             Unicast site-local address.
194
195       IN6_IS_ADDR_V4MAPPED
196             IPv4 mapped address.
197
198       IN6_IS_ADDR_V4COMPAT
199             IPv4-compatible address.
200
201       IN6_IS_ADDR_MC_NODELOCAL
202             Multicast node-local address.
203
204       IN6_IS_ADDR_MC_LINKLOCAL
205             Multicast link-local address.
206
207       IN6_IS_ADDR_MC_SITELOCAL
208             Multicast site-local address.
209
210       IN6_IS_ADDR_MC_ORGLOCAL
211             Multicast organization-local address.
212
213       IN6_IS_ADDR_MC_GLOBAL
214             Multicast global address.
215
216       The following sections are informative.
217

APPLICATION USAGE

219       None.
220

RATIONALE

222       None.
223

FUTURE DIRECTIONS

225       None.
226

SEE ALSO

228       Section 4.9, Host and Network Byte Orders, <arpa_inet.h>, <inttypes.h>,
229       <sys_socket.h>
230
231       The System Interfaces volume of POSIX.1‐2008, connect(),  getsockopt(),
232       htonl(), sendmsg(), sendto(), setsockopt()
233
235       Portions  of  this text are reprinted and reproduced in electronic form
236       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
237       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
238       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
239       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
240       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
241       event of any discrepancy between this version and the original IEEE and
242       The Open Group Standard, the original IEEE and The Open Group  Standard
243       is  the  referee document. The original Standard can be obtained online
244       at http://www.unix.org/online.html .
245
246       Any typographical or formatting errors that appear  in  this  page  are
247       most likely to have been introduced during the conversion of the source
248       files to man page format. To report such errors,  see  https://www.ker
249       nel.org/doc/man-pages/reporting_bugs.html .
250
251
252
253IEEE/The Open Group                  2013                     netinet_in.h(0P)
Impressum