Go to the documentation of this file.
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
214 #define IPV6_JOIN_GROUP 17
215 #define IPV6_LEAVE_GROUP 18
216 #define IPV6_MULTICAST_HOPS 19
217 #define IPV6_MULTICAST_IF 20
218 #define IPV6_MULTICAST_LOOP 21
219 #define IPV6_UNICAST_HOPS 22
220 #define IPV6_V6ONLY 23
231 #define IN6_IS_ADDR_UNSPECIFIED(a) \
232 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
233 (a)->__s6_addr.__s6_addr32[1] == 0 && \
234 (a)->__s6_addr.__s6_addr32[2] == 0 && \
235 (a)->__s6_addr.__s6_addr32[3] == 0)
245 #define IN6_IS_ADDR_LOOPBACK(a) \
246 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
247 (a)->__s6_addr.__s6_addr32[1] == 0 && \
248 (a)->__s6_addr.__s6_addr32[2] == 0 && \
249 (a)->__s6_addr.__s6_addr16[6] == 0 && \
250 (a)->__s6_addr.__s6_addr8[14] == 0 && \
251 (a)->__s6_addr.__s6_addr8[15] == 1)
261 #define IN6_IS_ADDR_V4MAPPED(a) \
262 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
263 (a)->__s6_addr.__s6_addr32[1] == 0 && \
264 (a)->__s6_addr.__s6_addr16[4] == 0 && \
265 (a)->__s6_addr.__s6_addr16[5] == 0xFFFF)
275 #define IN6_IS_ADDR_V4COMPAT(a) \
276 ((a)->__s6_addr.__s6_addr32[0] == 0 && \
277 (a)->__s6_addr.__s6_addr32[1] == 0 && \
278 (a)->__s6_addr.__s6_addr32[2] == 0 && \
279 (a)->__s6_addr.__s6_addr32[3] != 0 && \
280 (a)->__s6_addr.__s6_addr8[15] != 1)
290 #define IN6_IS_ADDR_LINKLOCAL(a) \
291 (((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
292 (((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0x80))
302 #define IN6_IS_ADDR_SITELOCAL(a) \
303 (((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
304 (((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0xC0))
313 #define IN6_IS_ADDR_MULTICAST(a) \
314 ((a)->__s6_addr.__s6_addr8[0] == 0xFF)
325 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
326 (IN6_IS_ADDR_MULTICAST(a) && \
327 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x01))
338 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
339 (IN6_IS_ADDR_MULTICAST(a) && \
340 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x02))
351 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
352 (IN6_IS_ADDR_MULTICAST(a) && \
353 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x05))
364 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
365 (IN6_IS_ADDR_MULTICAST(a) && \
366 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x08))
377 #define IN6_IS_ADDR_MC_GLOBAL(a) \
378 (IN6_IS_ADDR_MULTICAST(a) && \
379 (((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x0E))