2 * Copyright (C) 2009 Robert Shearman
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 /* FIXME: #include <in6addr.h> */
30 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
33 /* FIXME: should be in in6addr.h */
34 typedef struct WS(in_addr6
)
36 WS(u_char
) s6_addr
[16]; /* IPv6 address */
37 } IN6_ADDR
, *PIN6_ADDR
, *LPIN6_ADDR
;
39 typedef struct WS(sockaddr_in6_old
)
41 short sin6_family
; /* AF_INET6 */
42 WS(u_short
) sin6_port
; /* Transport level port number */
43 WS(u_long
) sin6_flowinfo
; /* IPv6 flow information */
44 struct WS(in_addr6
) sin6_addr
; /* IPv6 address */
45 } SOCKADDR_IN6_OLD
,*PSOCKADDR_IN6_OLD
, *LPSOCKADDR_IN6_OLD
;
47 typedef union sockaddr_gen
49 struct WS(sockaddr
) Address
;
50 struct WS(sockaddr_in
) AddressIn
;
51 struct WS(sockaddr_in6_old
) AddressIn6
;
54 /* Structure to keep interface specific information */
55 typedef struct _INTERFACE_INFO
57 WS(u_long
) iiFlags
; /* Interface flags */
58 WS(sockaddr_gen
) iiAddress
; /* Interface address */
59 WS(sockaddr_gen
) iiBroadcastAddress
; /* Broadcast address */
60 WS(sockaddr_gen
) iiNetmask
; /* Network mask */
61 } INTERFACE_INFO
, * LPINTERFACE_INFO
;
63 /* Possible flags for the iiFlags - bitmask */
65 #define IFF_UP 0x00000001 /* Interface is up */
66 #define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
67 #define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
68 #define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
69 #define IFF_MULTICAST 0x00000010 /* multicast is supported */
71 #define WS_IFF_UP 0x00000001 /* Interface is up */
72 #define WS_IFF_BROADCAST 0x00000002 /* Broadcast is supported */
73 #define WS_IFF_LOOPBACK 0x00000004 /* this is loopback interface */
74 #define WS_IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
75 #define WS_IFF_MULTICAST 0x00000010 /* multicast is supported */
76 #endif /* USE_WS_PREFIX */
83 #define IP_MULTICAST_IF 9
84 #define IP_MULTICAST_TTL 10
85 #define IP_MULTICAST_LOOP 11
86 #define IP_ADD_MEMBERSHIP 12
87 #define IP_DROP_MEMBERSHIP 13
88 #define IP_DONTFRAGMENT 14
89 #define IP_ADD_SOURCE_MEMBERSHIP 15
90 #define IP_DROP_SOURCE_MEMBERSHIP 16
91 #define IP_BLOCK_SOURCE 17
92 #define IP_UNBLOCK_SOURCE 18
94 #define IP_HOPLIMIT 21
95 #define IP_RECEIVE_BROADCAST 22
97 #define IP_RECVDSTADDR 25
99 #define IP_ADD_IFLIST 29
100 #define IP_DEL_IFLIST 30
101 #define IP_UNICAST_IF 31
103 #define IP_RECVRTHDR 38
105 #define WS_IP_OPTIONS 1
106 #define WS_IP_HDRINCL 2
109 #define WS_IP_MULTICAST_IF 9
110 #define WS_IP_MULTICAST_TTL 10
111 #define WS_IP_MULTICAST_LOOP 11
112 #define WS_IP_ADD_MEMBERSHIP 12
113 #define WS_IP_DROP_MEMBERSHIP 13
114 #define WS_IP_DONTFRAGMENT 14
115 #define WS_IP_ADD_SOURCE_MEMBERSHIP 15
116 #define WS_IP_DROP_SOURCE_MEMBERSHIP 16
117 #define WS_IP_BLOCK_SOURCE 17
118 #define WS_IP_UNBLOCK_SOURCE 18
119 #define WS_IP_PKTINFO 19
120 #define WS_IP_HOPLIMIT 21
121 #define WS_IP_RECEIVE_BROADCAST 22
122 #define WS_IP_RECVIF 24
123 #define WS_IP_RECVDSTADDR 25
124 #define WS_IP_IFLIST 28
125 #define WS_IP_ADD_IFLIST 29
126 #define WS_IP_DEL_IFLIST 30
127 #define WS_IP_UNICAST_IF 31
128 #define WS_IP_RTHDR 32
129 #define WS_IP_RECVRTHDR 38
130 #endif /* USE_WS_PREFIX */
132 typedef struct WS(sockaddr_in6
)
134 short sin6_family
; /* AF_INET6 */
135 WS(u_short
) sin6_port
; /* Transport level port number */
136 WS(u_long
) sin6_flowinfo
; /* IPv6 flow information */
137 struct WS(in_addr6
) sin6_addr
; /* IPv6 address */
138 WS(u_long
) sin6_scope_id
; /* IPv6 scope id */
139 } SOCKADDR_IN6
,*PSOCKADDR_IN6
, *LPSOCKADDR_IN6
;
142 * Multicast group information
147 struct WS(in_addr
) imr_multiaddr
;
148 struct WS(in_addr
) imr_interface
;
149 } WS(IP_MREQ
), *WS(PIP_MREQ
);
151 struct WS(ip_mreq_source
) {
152 struct WS(in_addr
) imr_multiaddr
;
153 struct WS(in_addr
) imr_sourceaddr
;
154 struct WS(in_addr
) imr_interface
;
155 } WS(IP_MREQ_SOURCE
), *WS(PIP_MREQ_SOURCE
);
157 struct WS(ip_msfilter
) {
158 struct WS(in_addr
) imsf_multiaddr
;
159 struct WS(in_addr
) imsf_interface
;
160 WS(u_long
) imsf_fmode
;
161 WS(u_long
) imsf_numsrc
;
162 struct WS(in_addr
) imsf_slist
[1];
163 } WS(IP_MSFILTER
), *WS(PIP_MSFILTER
);
165 #ifndef USE_WS_PREFIX
166 #define IPV6_OPTIONS 1
167 #define IPV6_HDRINCL 2
168 #define IPV6_UNICAST_HOPS 4
169 #define IPV6_MULTICAST_IF 9
170 #define IPV6_MULTICAST_HOPS 10
171 #define IPV6_MULTICAST_LOOP 11
172 #define IPV6_ADD_MEMBERSHIP 12
173 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
174 #define IPV6_DROP_MEMBERSHIP 13
175 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
176 #define IPV6_DONTFRAG 14
177 #define IPV6_PKTINFO 19
178 #define IPV6_HOPLIMIT 21
179 #define IPV6_PROTECTION_LEVEL 23
180 #define IPV6_RECVIF 24
181 #define IPV6_RECVDSTADDR 25
182 #define IPV6_CHECKSUM 26
183 #define IPV6_V6ONLY 27
184 #define IPV6_IFLIST 28
185 #define IPV6_ADD_IFLIST 29
186 #define IPV6_DEL_IFLIST 30
187 #define IPV6_UNICAST_IF 31
188 #define IPV6_RTHDR 32
189 #define IPV6_RECVRTHDR 38
191 #define WS_IPV6_OPTIONS 1
192 #define WS_IPV6_HDRINCL 2
193 #define WS_IPV6_UNICAST_HOPS 4
194 #define WS_IPV6_MULTICAST_IF 9
195 #define WS_IPV6_MULTICAST_HOPS 10
196 #define WS_IPV6_MULTICAST_LOOP 11
197 #define WS_IPV6_ADD_MEMBERSHIP 12
198 #define WS_IPV6_DROP_MEMBERSHIP 13
199 #define WS_IPV6_LEAVE_GROUP WS_IPV6_DROP_MEMBERSHIP
200 #define WS_IPV6_DONTFRAG 14
201 #define WS_IPV6_PKTINFO 19
202 #define WS_IPV6_HOPLIMIT 21
203 #define WS_IPV6_PROTECTION_LEVEL 23
204 #define WS_IPV6_RECVIF 24
205 #define WS_IPV6_RECVDSTADDR 25
206 #define WS_IPV6_CHECKSUM 26
207 #define WS_IPV6_V6ONLY 27
208 #define WS_IPV6_IFLIST 28
209 #define WS_IPV6_ADD_IFLIST 29
210 #define WS_IPV6_DEL_IFLIST 30
211 #define WS_IPV6_UNICAST_IF 31
212 #define WS_IPV6_RTHDR 32
213 #define WS_IPV6_RECVRTHDR 38
214 #endif /* USE_WS_PREFIX */
216 #ifndef USE_WS_PREFIX
217 #define TCP_OFFLOAD_NO_PREFERENCE 0
218 #define TCP_OFFLOAD_NOT_PREFERRED 1
219 #define TCP_OFFLOAD_PREFERRED 2
221 #define WS_TCP_OFFLOAD_NO_PREFERENCE 0
222 #define WS_TCP_OFFLOAD_NOT_PREFERRED 1
223 #define WS_TCP_OFFLOAD_PREFERRED 2
224 #endif /* USE_WS_PREFIX */
226 #ifndef USE_WS_PREFIX
227 /* TCP_NODELAY is defined elsewhere */
228 #define TCP_EXPEDITED_1122 2
229 #define TCP_KEEPALIVE 3
235 #define TCP_NOSYNRETRIES 9
236 #define TCP_TIMESTAMPS 10
237 #define TCP_OFFLOAD_PREFERENCE 11
238 #define TCP_CONGESTION_ALGORITHM 12
239 #define TCP_DELAY_FIN_ACK 13
241 /* WS_TCP_NODELAY is defined elsewhere */
242 #define WS_TCP_EXPEDITED_1122 2
243 #define WS_TCP_KEEPALIVE 3
244 #define WS_TCP_MAXSEG 4
245 #define WS_TCP_MAXRT 5
246 #define WS_TCP_STDURG 6
247 #define WS_TCP_NOURG 7
248 #define WS_TCP_ATMARK 8
249 #define WS_TCP_NOSYNRETRIES 9
250 #define WS_TCP_TIMESTAMPS 10
251 #define WS_TCP_OFFLOAD_PREFERENCE 11
252 #define WS_TCP_CONGESTION_ALGORITHM 12
253 #define WS_TCP_DELAY_FIN_ACK 13
254 #endif /* USE_WS_PREFIX */
256 #ifndef USE_WS_PREFIX
257 #define INET_ADDRSTRLEN 22
258 #define INET6_ADDRSTRLEN 65
260 #define WS_INET_ADDRSTRLEN 22
261 #define WS_INET6_ADDRSTRLEN 65
262 #endif /* USE_WS_PREFIX */
268 #endif /* __WS2IPDEF__ */