19 #ifndef __NETINET_IN_H
20 #define __NETINET_IN_H
22 #include <sys/cdefs.h>
57 #define s6_addr __s6_addr.__s6_addr8
120 #define INADDR_ANY 0x00000000
126 #define INADDR_BROADCAST 0xFFFFFFFF
134 #define INADDR_NONE 0xFFFFFFFF
141 #define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, \
142 0, 0, 0, 0, 0, 0, 0, 0 }}}
149 #define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, \
150 0, 0, 0, 0, 0, 0, 0, 1 }}}
165 #define INET_ADDRSTRLEN 16
168 #define INET6_ADDRSTRLEN 46
174 #define IPPROTO_ICMP 1
177 #define IPPROTO_TCP 6
180 #define IPPROTO_UDP 17
183 #define IPPROTO_IPV6 41
186 #define IPPROTO_UDPLITE 136
221 #define IPV6_JOIN_GROUP 17
222 #define IPV6_LEAVE_GROUP 18
223 #define IPV6_MULTICAST_HOPS 19
224 #define IPV6_MULTICAST_IF 20
225 #define IPV6_MULTICAST_LOOP 21
226 #define IPV6_UNICAST_HOPS 22
227 #define IPV6_V6ONLY 23
242 #define UDP_NOCHECKSUM 25
257 #define UDPLITE_SEND_CSCOV 26
258 #define UDPLITE_RECV_CSCOV 27
269 #define IN6_IS_ADDR_UNSPECIFIED(a) \
270 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
271 (a)->__s6_addr.__s6_addr32[1] == 0 && \
272 (a)->__s6_addr.__s6_addr32[2] == 0 && \
273 (a)->__s6_addr.__s6_addr32[3] == 0)
283 #define IN6_IS_ADDR_LOOPBACK(a) \
284 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
285 (a)->__s6_addr.__s6_addr32[1] == 0 && \
286 (a)->__s6_addr.__s6_addr32[2] == 0 && \
287 (a)->__s6_addr.__s6_addr16[6] == 0 && \
288 (a)->__s6_addr.__s6_addr8[14] == 0 && \
289 (a)->__s6_addr.__s6_addr8[15] == 1)
299 #define IN6_IS_ADDR_V4MAPPED(a) \
300 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
301 (a)->__s6_addr.__s6_addr32[1] == 0 && \
302 (a)->__s6_addr.__s6_addr16[4] == 0 && \
303 (a)->__s6_addr.__s6_addr16[5] == 0xFFFF)
313 #define IN6_IS_ADDR_V4COMPAT(a) \
314 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
315 (a)->__s6_addr.__s6_addr32[1] == 0 && \
316 (a)->__s6_addr.__s6_addr32[2] == 0 && \
317 (a)->__s6_addr.__s6_addr32[3] != 0 && \
318 (a)->__s6_addr.__s6_addr8[15] != 1)
328 #define IN6_IS_ADDR_LINKLOCAL(a) \
329 (((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
330 (((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0x80))
340 #define IN6_IS_ADDR_SITELOCAL(a) \
341 (((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
342 (((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0xC0))
352 #define IN6_IS_ADDR_MULTICAST(a) \
353 ((a)->__s6_addr.__s6_addr8[0] == 0xFF)
364 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
365 (IN6_IS_ADDR_MULTICAST(a) && \
366 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x01))
377 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
378 (IN6_IS_ADDR_MULTICAST(a) && \
379 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x02))
390 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
391 (IN6_IS_ADDR_MULTICAST(a) && \
392 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x05))
403 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
404 (IN6_IS_ADDR_MULTICAST(a) && \
405 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x08))
416 #define IN6_IS_ADDR_MC_GLOBAL(a) \
417 (IN6_IS_ADDR_MULTICAST(a) && \
418 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x0E))
__uint8_t sa_family_t
Socket address family type.
Definition: socket.h:33
const struct in6_addr in6addr_loopback
IPv6 loopback address.
uint64_t __s6_addr64[2]
Definition: in.h:55
uint32_t sin6_flowinfo
Traffic class and flow information.
Definition: in.h:106
Structure used to store an IPv4 address for a socket.
Definition: in.h:76
sa_family_t sin_family
Family for the socket. Must be AF_INET.
Definition: in.h:78
uint16_t __s6_addr16[8]
Definition: in.h:53
uint16_t in_port_t
16-bit type used to store a value for an internet port.
Definition: in.h:35
uint8_t __s6_addr8[16]
Definition: in.h:52
in_port_t sin_port
Port for the socket. Must be in network byte order.
Definition: in.h:81
uint32_t sin6_scope_id
Set of interfaces for a scope.
Definition: in.h:112
const struct in6_addr in6addr_any
IPv6 local host address.
in_addr_t s_addr
Definition: in.h:44
Structure used to store an IPv6 address.
Definition: in.h:50
uint32_t __s6_addr32[4]
Definition: in.h:54
Structure used to store an IPv4 address.
Definition: in.h:43
uint32_t in_addr_t
32-bit value used to store an IPv4 address.
Definition: in.h:38
unsigned char sin_zero[8]
Empty space, ignored for all intents and purposes.
Definition: in.h:87
struct in_addr sin_addr
Address for the socket. Must be in network byte order.
Definition: in.h:84
Definitions for internet operations.
Structure used to store an IPv6 address for a socket.
Definition: in.h:98
sa_family_t sin6_family
Family for the socket. Must be AF_INET6.
Definition: in.h:100
union in6_addr::@0 __s6_addr
in_port_t sin6_port
Port for the socket. Must be in network byte order.
Definition: in.h:103
struct in6_addr sin6_addr
Address for the socket. Must be in network byte order.
Definition: in.h:109