4 #define __NEED_in_addr_t
5 #define __NEED_in_port_t
6 #define __NEED_sa_family_t
7 #define __NEED_struct_in_addr
9 #define __NEED_uint16_t
10 #define __NEED_uint32_t
12 #include <bits/alltypes.h>
16 sa_family_t sin_family;
18 struct in_addr sin_addr;
25 uint8_t __s6_addr[16];
26 uint32_t __s6_addr32[4];
29 #define s6_addr __in6_union.__s6_addr
30 #define s6_addr32 __in6_union.__s6_addr32
34 sa_family_t sin6_family;
36 uint32_t sin6_flowinfo;
37 struct in6_addr sin6_addr;
38 uint32_t sin6_scope_id;
43 struct in6_addr ipv6mr_multiaddr;
44 unsigned ipv6mr_interface;
47 #define INADDR_ANY ((in_addr_t) 0x00000000)
48 #define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
49 #define INADDR_NONE ((in_addr_t) 0xffffffff)
50 #define INADDR_LOOPBACK ((in_addr_t) 0x7f000001)
52 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
53 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
55 extern const struct in6_addr in6addr_any, in6addr_loopback;
57 #undef INET_ADDRSTRLEN
58 #undef INET6_ADDRSTRLEN
59 #define INET_ADDRSTRLEN 16
60 #define INET6_ADDRSTRLEN 46
62 uint32_t htonl(uint32_t);
63 uint16_t htons(uint16_t);
64 uint32_t ntohl(uint32_t);
65 uint16_t ntohs(uint16_t);
68 #define IPPROTO_ICMP 1
69 #define IPPROTO_IGMP 2
70 #define IPPROTO_IPIP 4
73 #define IPPROTO_PUP 12
74 #define IPPROTO_UDP 17
75 #define IPPROTO_IDP 22
77 #define IPPROTO_IPV6 41
78 #define IPPROTO_ROUTING 43
79 #define IPPROTO_FRAGMENT 44
80 #define IPPROTO_RSVP 46
81 #define IPPROTO_GRE 47
82 #define IPPROTO_ESP 50
84 #define IPPROTO_ICMPV6 58
85 #define IPPROTO_NONE 59
86 #define IPPROTO_DSTOPTS 60
87 #define IPPROTO_MTP 92
88 #define IPPROTO_ENCAP 98
89 #define IPPROTO_PIM 103
90 #define IPPROTO_COMP 108
91 #define IPPROTO_RAW 255
93 #define IN6_IS_ADDR_UNSPECIFIED(a) \
94 (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
95 ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
97 #define IN6_IS_ADDR_LOOPBACK(a) \
98 (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
99 ((uint32_t *) (a))[2] == 0 && \
100 ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
101 ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
103 #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
105 #define IN6_IS_ADDR_LINKLOCAL(a) \
106 ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
108 #define IN6_IS_ADDR_SITELOCAL(a) \
109 ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
111 #define IN6_IS_ADDR_V4MAPPED(a) \
112 (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
113 ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
114 ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
116 #define IN6_IS_ADDR_V4COMPAT(a) \
117 (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
118 ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
120 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
121 (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
123 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
124 (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
126 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
127 (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
129 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
130 (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
132 #define IN6_IS_ADDR_MC_GLOBAL(a) \
133 (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
137 #define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
138 #define IN_CLASSA_NET 0xff000000
139 #define IN_CLASSA_NSHIFT 24
140 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
141 #define IN_CLASSA_MAX 128
142 #define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
143 #define IN_CLASSB_NET 0xffff0000
144 #define IN_CLASSB_NSHIFT 16
145 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
146 #define IN_CLASSB_MAX 65536
147 #define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
148 #define IN_CLASSC_NET 0xffffff00
149 #define IN_CLASSC_NSHIFT 8
150 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
151 #define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
152 #define IN_MULTICAST(a) IN_CLASSD(a)
153 #define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
154 #define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)