Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

constdefs.c
Go to the documentation of this file.
1 /* autogenerated file */
2
3 static st_table *rsock_intern_family_hash;
4 static st_table *rsock_intern_family_noprefix_hash;
5 static st_table *rsock_intern_protocol_family_hash;
6 static st_table *rsock_intern_socktype_hash;
7 static st_table *rsock_intern_ipproto_hash;
8 static st_table *rsock_intern_iplevel_hash;
9 static st_table *rsock_intern_so_optname_hash;
10 static st_table *rsock_intern_ip_optname_hash;
11 static st_table *rsock_intern_ipv6_optname_hash;
12 static st_table *rsock_intern_tcp_optname_hash;
13 static st_table *rsock_intern_udp_optname_hash;
14 static st_table *rsock_intern_scm_optname_hash;
15 static st_table *rsock_intern_local_optname_hash;
16
17 #ifdef HAVE_LONG_LONG
18 #define INTEGER2NUM(n) \
19 (FIXNUM_MAX < (n) ? ULL2NUM(n) : \
20 FIXNUM_MIN > (LONG_LONG)(n) ? LL2NUM(n) : \
21 LONG2FIX(n))
22 #else
23 #define INTEGER2NUM(n) \
24 (FIXNUM_MAX < (n) ? ULONG2NUM(n) : \
25 FIXNUM_MIN > (long)(n) ? LONG2NUM(n) : \
26 LONG2FIX(n))
27 #endif
28
29 static void
30 init_constants(void)
31 {
32 /*
33 * Document-module: Socket::Constants
34 *
35 * Socket::Constants provides socket-related constants. All possible
36 * socket constants are listed in the documentation but they may not all
37 * be present on your platform.
38 *
39 * If the underlying platform doesn't define a constant the corresponding
40 * Ruby constant is not defined.
41 *
42 */
43 rb_mSockConst = rb_define_module_under(rb_cSocket, "Constants");
44
45 #if defined(SOCK_STREAM)
46 /* A stream socket provides a sequenced, reliable two-way connection for a byte stream */
47 rb_define_const(rb_cSocket, "SOCK_STREAM", INTEGER2NUM(SOCK_STREAM));
48 /* A stream socket provides a sequenced, reliable two-way connection for a byte stream */
49 rb_define_const(rb_mSockConst, "SOCK_STREAM", INTEGER2NUM(SOCK_STREAM));
50 #endif
51 #if defined(SOCK_DGRAM)
52 /* A datagram socket provides connectionless, unreliable messaging */
53 rb_define_const(rb_cSocket, "SOCK_DGRAM", INTEGER2NUM(SOCK_DGRAM));
54 /* A datagram socket provides connectionless, unreliable messaging */
55 rb_define_const(rb_mSockConst, "SOCK_DGRAM", INTEGER2NUM(SOCK_DGRAM));
56 #endif
57 #if defined(SOCK_RAW)
58 /* A raw socket provides low-level access for direct access or implementing network protocols */
59 rb_define_const(rb_cSocket, "SOCK_RAW", INTEGER2NUM(SOCK_RAW));
60 /* A raw socket provides low-level access for direct access or implementing network protocols */
61 rb_define_const(rb_mSockConst, "SOCK_RAW", INTEGER2NUM(SOCK_RAW));
62 #endif
63 #if defined(SOCK_RDM)
64 /* A reliable datagram socket provides reliable delivery of messages */
65 rb_define_const(rb_cSocket, "SOCK_RDM", INTEGER2NUM(SOCK_RDM));
66 /* A reliable datagram socket provides reliable delivery of messages */
67 rb_define_const(rb_mSockConst, "SOCK_RDM", INTEGER2NUM(SOCK_RDM));
68 #endif
69 #if defined(SOCK_SEQPACKET)
70 /* A sequential packet socket provides sequenced, reliable two-way connection for datagrams */
71 rb_define_const(rb_cSocket, "SOCK_SEQPACKET", INTEGER2NUM(SOCK_SEQPACKET));
72 /* A sequential packet socket provides sequenced, reliable two-way connection for datagrams */
73 rb_define_const(rb_mSockConst, "SOCK_SEQPACKET", INTEGER2NUM(SOCK_SEQPACKET));
74 #endif
75 #if defined(SOCK_PACKET)
76 /* Device-level packet access */
77 rb_define_const(rb_cSocket, "SOCK_PACKET", INTEGER2NUM(SOCK_PACKET));
78 /* Device-level packet access */
79 rb_define_const(rb_mSockConst, "SOCK_PACKET", INTEGER2NUM(SOCK_PACKET));
80 #endif
81 #if defined(AF_UNSPEC)
82 /* Unspecified protocol, any supported address family */
83 rb_define_const(rb_cSocket, "AF_UNSPEC", INTEGER2NUM(AF_UNSPEC));
84 /* Unspecified protocol, any supported address family */
85 rb_define_const(rb_mSockConst, "AF_UNSPEC", INTEGER2NUM(AF_UNSPEC));
86 #endif
87 #if defined(PF_UNSPEC)
88 /* Unspecified protocol, any supported address family */
89 rb_define_const(rb_cSocket, "PF_UNSPEC", INTEGER2NUM(PF_UNSPEC));
90 /* Unspecified protocol, any supported address family */
91 rb_define_const(rb_mSockConst, "PF_UNSPEC", INTEGER2NUM(PF_UNSPEC));
92 #endif
93 #if defined(AF_INET)
94 /* IPv4 protocol */
95 rb_define_const(rb_cSocket, "AF_INET", INTEGER2NUM(AF_INET));
96 /* IPv4 protocol */
97 rb_define_const(rb_mSockConst, "AF_INET", INTEGER2NUM(AF_INET));
98 #endif
99 #if defined(PF_INET)
100 /* IPv4 protocol */
101 rb_define_const(rb_cSocket, "PF_INET", INTEGER2NUM(PF_INET));
102 /* IPv4 protocol */
103 rb_define_const(rb_mSockConst, "PF_INET", INTEGER2NUM(PF_INET));
104 #endif
105 #if defined(INET6)
106 #if defined(AF_INET6)
107 /* IPv6 protocol */
108 rb_define_const(rb_cSocket, "AF_INET6", INTEGER2NUM(AF_INET6));
109 /* IPv6 protocol */
110 rb_define_const(rb_mSockConst, "AF_INET6", INTEGER2NUM(AF_INET6));
111 #endif
112 #endif
113 #if defined(INET6)
114 #if defined(PF_INET6)
115 /* IPv6 protocol */
116 rb_define_const(rb_cSocket, "PF_INET6", INTEGER2NUM(PF_INET6));
117 /* IPv6 protocol */
118 rb_define_const(rb_mSockConst, "PF_INET6", INTEGER2NUM(PF_INET6));
119 #endif
120 #endif
121 #if defined(AF_UNIX)
122 /* UNIX sockets */
123 rb_define_const(rb_cSocket, "AF_UNIX", INTEGER2NUM(AF_UNIX));
124 /* UNIX sockets */
125 rb_define_const(rb_mSockConst, "AF_UNIX", INTEGER2NUM(AF_UNIX));
126 #endif
127 #if defined(PF_UNIX)
128 /* UNIX sockets */
129 rb_define_const(rb_cSocket, "PF_UNIX", INTEGER2NUM(PF_UNIX));
130 /* UNIX sockets */
131 rb_define_const(rb_mSockConst, "PF_UNIX", INTEGER2NUM(PF_UNIX));
132 #endif
133 #if defined(AF_AX25)
134 /* AX.25 protocol */
135 rb_define_const(rb_cSocket, "AF_AX25", INTEGER2NUM(AF_AX25));
136 /* AX.25 protocol */
137 rb_define_const(rb_mSockConst, "AF_AX25", INTEGER2NUM(AF_AX25));
138 #endif
139 #if defined(PF_AX25)
140 /* AX.25 protocol */
141 rb_define_const(rb_cSocket, "PF_AX25", INTEGER2NUM(PF_AX25));
142 /* AX.25 protocol */
143 rb_define_const(rb_mSockConst, "PF_AX25", INTEGER2NUM(PF_AX25));
144 #endif
145 #if defined(AF_IPX)
146 /* IPX protocol */
147 rb_define_const(rb_cSocket, "AF_IPX", INTEGER2NUM(AF_IPX));
148 /* IPX protocol */
149 rb_define_const(rb_mSockConst, "AF_IPX", INTEGER2NUM(AF_IPX));
150 #endif
151 #if defined(PF_IPX)
152 /* IPX protocol */
153 rb_define_const(rb_cSocket, "PF_IPX", INTEGER2NUM(PF_IPX));
154 /* IPX protocol */
155 rb_define_const(rb_mSockConst, "PF_IPX", INTEGER2NUM(PF_IPX));
156 #endif
157 #if defined(AF_APPLETALK)
158 /* AppleTalk protocol */
159 rb_define_const(rb_cSocket, "AF_APPLETALK", INTEGER2NUM(AF_APPLETALK));
160 /* AppleTalk protocol */
161 rb_define_const(rb_mSockConst, "AF_APPLETALK", INTEGER2NUM(AF_APPLETALK));
162 #endif
163 #if defined(PF_APPLETALK)
164 /* AppleTalk protocol */
165 rb_define_const(rb_cSocket, "PF_APPLETALK", INTEGER2NUM(PF_APPLETALK));
166 /* AppleTalk protocol */
167 rb_define_const(rb_mSockConst, "PF_APPLETALK", INTEGER2NUM(PF_APPLETALK));
168 #endif
169 #if defined(AF_LOCAL)
170 /* Host-internal protocols */
171 rb_define_const(rb_cSocket, "AF_LOCAL", INTEGER2NUM(AF_LOCAL));
172 /* Host-internal protocols */
173 rb_define_const(rb_mSockConst, "AF_LOCAL", INTEGER2NUM(AF_LOCAL));
174 #endif
175 #if defined(PF_LOCAL)
176 /* Host-internal protocols */
177 rb_define_const(rb_cSocket, "PF_LOCAL", INTEGER2NUM(PF_LOCAL));
178 /* Host-internal protocols */
179 rb_define_const(rb_mSockConst, "PF_LOCAL", INTEGER2NUM(PF_LOCAL));
180 #endif
181 #if defined(AF_IMPLINK)
182 /* ARPANET IMP protocol */
183 rb_define_const(rb_cSocket, "AF_IMPLINK", INTEGER2NUM(AF_IMPLINK));
184 /* ARPANET IMP protocol */
185 rb_define_const(rb_mSockConst, "AF_IMPLINK", INTEGER2NUM(AF_IMPLINK));
186 #endif
187 #if defined(PF_IMPLINK)
188 /* ARPANET IMP protocol */
189 rb_define_const(rb_cSocket, "PF_IMPLINK", INTEGER2NUM(PF_IMPLINK));
190 /* ARPANET IMP protocol */
191 rb_define_const(rb_mSockConst, "PF_IMPLINK", INTEGER2NUM(PF_IMPLINK));
192 #endif
193 #if defined(AF_PUP)
194 /* PARC Universal Packet protocol */
195 rb_define_const(rb_cSocket, "AF_PUP", INTEGER2NUM(AF_PUP));
196 /* PARC Universal Packet protocol */
197 rb_define_const(rb_mSockConst, "AF_PUP", INTEGER2NUM(AF_PUP));
198 #endif
199 #if defined(PF_PUP)
200 /* PARC Universal Packet protocol */
201 rb_define_const(rb_cSocket, "PF_PUP", INTEGER2NUM(PF_PUP));
202 /* PARC Universal Packet protocol */
203 rb_define_const(rb_mSockConst, "PF_PUP", INTEGER2NUM(PF_PUP));
204 #endif
205 #if defined(AF_CHAOS)
206 /* MIT CHAOS protocols */
207 rb_define_const(rb_cSocket, "AF_CHAOS", INTEGER2NUM(AF_CHAOS));
208 /* MIT CHAOS protocols */
209 rb_define_const(rb_mSockConst, "AF_CHAOS", INTEGER2NUM(AF_CHAOS));
210 #endif
211 #if defined(PF_CHAOS)
212 /* MIT CHAOS protocols */
213 rb_define_const(rb_cSocket, "PF_CHAOS", INTEGER2NUM(PF_CHAOS));
214 /* MIT CHAOS protocols */
215 rb_define_const(rb_mSockConst, "PF_CHAOS", INTEGER2NUM(PF_CHAOS));
216 #endif
217 #if defined(AF_NS)
218 /* XEROX NS protocols */
219 rb_define_const(rb_cSocket, "AF_NS", INTEGER2NUM(AF_NS));
220 /* XEROX NS protocols */
221 rb_define_const(rb_mSockConst, "AF_NS", INTEGER2NUM(AF_NS));
222 #endif
223 #if defined(PF_NS)
224 /* XEROX NS protocols */
225 rb_define_const(rb_cSocket, "PF_NS", INTEGER2NUM(PF_NS));
226 /* XEROX NS protocols */
227 rb_define_const(rb_mSockConst, "PF_NS", INTEGER2NUM(PF_NS));
228 #endif
229 #if defined(AF_ISO)
230 /* ISO Open Systems Interconnection protocols */
231 rb_define_const(rb_cSocket, "AF_ISO", INTEGER2NUM(AF_ISO));
232 /* ISO Open Systems Interconnection protocols */
233 rb_define_const(rb_mSockConst, "AF_ISO", INTEGER2NUM(AF_ISO));
234 #endif
235 #if defined(PF_ISO)
236 /* ISO Open Systems Interconnection protocols */
237 rb_define_const(rb_cSocket, "PF_ISO", INTEGER2NUM(PF_ISO));
238 /* ISO Open Systems Interconnection protocols */
239 rb_define_const(rb_mSockConst, "PF_ISO", INTEGER2NUM(PF_ISO));
240 #endif
241 #if defined(AF_OSI)
242 /* ISO Open Systems Interconnection protocols */
243 rb_define_const(rb_cSocket, "AF_OSI", INTEGER2NUM(AF_OSI));
244 /* ISO Open Systems Interconnection protocols */
245 rb_define_const(rb_mSockConst, "AF_OSI", INTEGER2NUM(AF_OSI));
246 #endif
247 #if defined(PF_OSI)
248 /* ISO Open Systems Interconnection protocols */
249 rb_define_const(rb_cSocket, "PF_OSI", INTEGER2NUM(PF_OSI));
250 /* ISO Open Systems Interconnection protocols */
251 rb_define_const(rb_mSockConst, "PF_OSI", INTEGER2NUM(PF_OSI));
252 #endif
253 #if defined(AF_ECMA)
254 /* European Computer Manufacturers protocols */
255 rb_define_const(rb_cSocket, "AF_ECMA", INTEGER2NUM(AF_ECMA));
256 /* European Computer Manufacturers protocols */
257 rb_define_const(rb_mSockConst, "AF_ECMA", INTEGER2NUM(AF_ECMA));
258 #endif
259 #if defined(PF_ECMA)
260 /* European Computer Manufacturers protocols */
261 rb_define_const(rb_cSocket, "PF_ECMA", INTEGER2NUM(PF_ECMA));
262 /* European Computer Manufacturers protocols */
263 rb_define_const(rb_mSockConst, "PF_ECMA", INTEGER2NUM(PF_ECMA));
264 #endif
265 #if defined(AF_DATAKIT)
266 /* Datakit protocol */
267 rb_define_const(rb_cSocket, "AF_DATAKIT", INTEGER2NUM(AF_DATAKIT));
268 /* Datakit protocol */
269 rb_define_const(rb_mSockConst, "AF_DATAKIT", INTEGER2NUM(AF_DATAKIT));
270 #endif
271 #if defined(PF_DATAKIT)
272 /* Datakit protocol */
273 rb_define_const(rb_cSocket, "PF_DATAKIT", INTEGER2NUM(PF_DATAKIT));
274 /* Datakit protocol */
275 rb_define_const(rb_mSockConst, "PF_DATAKIT", INTEGER2NUM(PF_DATAKIT));
276 #endif
277 #if defined(AF_CCITT)
278 /* CCITT (now ITU-T) protocols */
279 rb_define_const(rb_cSocket, "AF_CCITT", INTEGER2NUM(AF_CCITT));
280 /* CCITT (now ITU-T) protocols */
281 rb_define_const(rb_mSockConst, "AF_CCITT", INTEGER2NUM(AF_CCITT));
282 #endif
283 #if defined(PF_CCITT)
284 /* CCITT (now ITU-T) protocols */
285 rb_define_const(rb_cSocket, "PF_CCITT", INTEGER2NUM(PF_CCITT));
286 /* CCITT (now ITU-T) protocols */
287 rb_define_const(rb_mSockConst, "PF_CCITT", INTEGER2NUM(PF_CCITT));
288 #endif
289 #if defined(AF_SNA)
290 /* IBM SNA protocol */
291 rb_define_const(rb_cSocket, "AF_SNA", INTEGER2NUM(AF_SNA));
292 /* IBM SNA protocol */
293 rb_define_const(rb_mSockConst, "AF_SNA", INTEGER2NUM(AF_SNA));
294 #endif
295 #if defined(PF_SNA)
296 /* IBM SNA protocol */
297 rb_define_const(rb_cSocket, "PF_SNA", INTEGER2NUM(PF_SNA));
298 /* IBM SNA protocol */
299 rb_define_const(rb_mSockConst, "PF_SNA", INTEGER2NUM(PF_SNA));
300 #endif
301 #if defined(AF_DEC)
302 /* DECnet protocol */
303 rb_define_const(rb_cSocket, "AF_DEC", INTEGER2NUM(AF_DEC));
304 /* DECnet protocol */
305 rb_define_const(rb_mSockConst, "AF_DEC", INTEGER2NUM(AF_DEC));
306 #endif
307 #if defined(PF_DEC)
308 /* DECnet protocol */
309 rb_define_const(rb_cSocket, "PF_DEC", INTEGER2NUM(PF_DEC));
310 /* DECnet protocol */
311 rb_define_const(rb_mSockConst, "PF_DEC", INTEGER2NUM(PF_DEC));
312 #endif
313 #if defined(AF_DLI)
314 /* DEC Direct Data Link Interface protocol */
315 rb_define_const(rb_cSocket, "AF_DLI", INTEGER2NUM(AF_DLI));
316 /* DEC Direct Data Link Interface protocol */
317 rb_define_const(rb_mSockConst, "AF_DLI", INTEGER2NUM(AF_DLI));
318 #endif
319 #if defined(PF_DLI)
320 /* DEC Direct Data Link Interface protocol */
321 rb_define_const(rb_cSocket, "PF_DLI", INTEGER2NUM(PF_DLI));
322 /* DEC Direct Data Link Interface protocol */
323 rb_define_const(rb_mSockConst, "PF_DLI", INTEGER2NUM(PF_DLI));
324 #endif
325 #if defined(AF_LAT)
326 /* Local Area Transport protocol */
327 rb_define_const(rb_cSocket, "AF_LAT", INTEGER2NUM(AF_LAT));
328 /* Local Area Transport protocol */
329 rb_define_const(rb_mSockConst, "AF_LAT", INTEGER2NUM(AF_LAT));
330 #endif
331 #if defined(PF_LAT)
332 /* Local Area Transport protocol */
333 rb_define_const(rb_cSocket, "PF_LAT", INTEGER2NUM(PF_LAT));
334 /* Local Area Transport protocol */
335 rb_define_const(rb_mSockConst, "PF_LAT", INTEGER2NUM(PF_LAT));
336 #endif
337 #if defined(AF_HYLINK)
338 /* NSC Hyperchannel protocol */
339 rb_define_const(rb_cSocket, "AF_HYLINK", INTEGER2NUM(AF_HYLINK));
340 /* NSC Hyperchannel protocol */
341 rb_define_const(rb_mSockConst, "AF_HYLINK", INTEGER2NUM(AF_HYLINK));
342 #endif
343 #if defined(PF_HYLINK)
344 /* NSC Hyperchannel protocol */
345 rb_define_const(rb_cSocket, "PF_HYLINK", INTEGER2NUM(PF_HYLINK));
346 /* NSC Hyperchannel protocol */
347 rb_define_const(rb_mSockConst, "PF_HYLINK", INTEGER2NUM(PF_HYLINK));
348 #endif
349 #if defined(AF_ROUTE)
350 /* Internal routing protocol */
351 rb_define_const(rb_cSocket, "AF_ROUTE", INTEGER2NUM(AF_ROUTE));
352 /* Internal routing protocol */
353 rb_define_const(rb_mSockConst, "AF_ROUTE", INTEGER2NUM(AF_ROUTE));
354 #endif
355 #if defined(PF_ROUTE)
356 /* Internal routing protocol */
357 rb_define_const(rb_cSocket, "PF_ROUTE", INTEGER2NUM(PF_ROUTE));
358 /* Internal routing protocol */
359 rb_define_const(rb_mSockConst, "PF_ROUTE", INTEGER2NUM(PF_ROUTE));
360 #endif
361 #if defined(AF_LINK)
362 /* Link layer interface */
363 rb_define_const(rb_cSocket, "AF_LINK", INTEGER2NUM(AF_LINK));
364 /* Link layer interface */
365 rb_define_const(rb_mSockConst, "AF_LINK", INTEGER2NUM(AF_LINK));
366 #endif
367 #if defined(PF_LINK)
368 /* Link layer interface */
369 rb_define_const(rb_cSocket, "PF_LINK", INTEGER2NUM(PF_LINK));
370 /* Link layer interface */
371 rb_define_const(rb_mSockConst, "PF_LINK", INTEGER2NUM(PF_LINK));
372 #endif
373 #if defined(AF_COIP)
374 /* Connection-oriented IP */
375 rb_define_const(rb_cSocket, "AF_COIP", INTEGER2NUM(AF_COIP));
376 /* Connection-oriented IP */
377 rb_define_const(rb_mSockConst, "AF_COIP", INTEGER2NUM(AF_COIP));
378 #endif
379 #if defined(PF_COIP)
380 /* Connection-oriented IP */
381 rb_define_const(rb_cSocket, "PF_COIP", INTEGER2NUM(PF_COIP));
382 /* Connection-oriented IP */
383 rb_define_const(rb_mSockConst, "PF_COIP", INTEGER2NUM(PF_COIP));
384 #endif
385 #if defined(AF_CNT)
386 /* Computer Network Technology */
387 rb_define_const(rb_cSocket, "AF_CNT", INTEGER2NUM(AF_CNT));
388 /* Computer Network Technology */
389 rb_define_const(rb_mSockConst, "AF_CNT", INTEGER2NUM(AF_CNT));
390 #endif
391 #if defined(PF_CNT)
392 /* Computer Network Technology */
393 rb_define_const(rb_cSocket, "PF_CNT", INTEGER2NUM(PF_CNT));
394 /* Computer Network Technology */
395 rb_define_const(rb_mSockConst, "PF_CNT", INTEGER2NUM(PF_CNT));
396 #endif
397 #if defined(AF_SIP)
398 /* Simple Internet Protocol */
399 rb_define_const(rb_cSocket, "AF_SIP", INTEGER2NUM(AF_SIP));
400 /* Simple Internet Protocol */
401 rb_define_const(rb_mSockConst, "AF_SIP", INTEGER2NUM(AF_SIP));
402 #endif
403 #if defined(PF_SIP)
404 /* Simple Internet Protocol */
405 rb_define_const(rb_cSocket, "PF_SIP", INTEGER2NUM(PF_SIP));
406 /* Simple Internet Protocol */
407 rb_define_const(rb_mSockConst, "PF_SIP", INTEGER2NUM(PF_SIP));
408 #endif
409 #if defined(AF_NDRV)
410 /* Network driver raw access */
411 rb_define_const(rb_cSocket, "AF_NDRV", INTEGER2NUM(AF_NDRV));
412 /* Network driver raw access */
413 rb_define_const(rb_mSockConst, "AF_NDRV", INTEGER2NUM(AF_NDRV));
414 #endif
415 #if defined(PF_NDRV)
416 /* Network driver raw access */
417 rb_define_const(rb_cSocket, "PF_NDRV", INTEGER2NUM(PF_NDRV));
418 /* Network driver raw access */
419 rb_define_const(rb_mSockConst, "PF_NDRV", INTEGER2NUM(PF_NDRV));
420 #endif
421 #if defined(AF_ISDN)
422 /* Integrated Services Digital Network */
423 rb_define_const(rb_cSocket, "AF_ISDN", INTEGER2NUM(AF_ISDN));
424 /* Integrated Services Digital Network */
425 rb_define_const(rb_mSockConst, "AF_ISDN", INTEGER2NUM(AF_ISDN));
426 #endif
427 #if defined(PF_ISDN)
428 /* Integrated Services Digital Network */
429 rb_define_const(rb_cSocket, "PF_ISDN", INTEGER2NUM(PF_ISDN));
430 /* Integrated Services Digital Network */
431 rb_define_const(rb_mSockConst, "PF_ISDN", INTEGER2NUM(PF_ISDN));
432 #endif
433 #if defined(AF_NATM)
434 /* Native ATM access */
435 rb_define_const(rb_cSocket, "AF_NATM", INTEGER2NUM(AF_NATM));
436 /* Native ATM access */
437 rb_define_const(rb_mSockConst, "AF_NATM", INTEGER2NUM(AF_NATM));
438 #endif
439 #if defined(PF_NATM)
440 /* Native ATM access */
441 rb_define_const(rb_cSocket, "PF_NATM", INTEGER2NUM(PF_NATM));
442 /* Native ATM access */
443 rb_define_const(rb_mSockConst, "PF_NATM", INTEGER2NUM(PF_NATM));
444 #endif
445 #if defined(AF_SYSTEM)
446 /* */
447 rb_define_const(rb_cSocket, "AF_SYSTEM", INTEGER2NUM(AF_SYSTEM));
448 /* */
449 rb_define_const(rb_mSockConst, "AF_SYSTEM", INTEGER2NUM(AF_SYSTEM));
450 #endif
451 #if defined(PF_SYSTEM)
452 /* */
453 rb_define_const(rb_cSocket, "PF_SYSTEM", INTEGER2NUM(PF_SYSTEM));
454 /* */
455 rb_define_const(rb_mSockConst, "PF_SYSTEM", INTEGER2NUM(PF_SYSTEM));
456 #endif
457 #if defined(AF_NETBIOS)
458 /* NetBIOS */
459 rb_define_const(rb_cSocket, "AF_NETBIOS", INTEGER2NUM(AF_NETBIOS));
460 /* NetBIOS */
461 rb_define_const(rb_mSockConst, "AF_NETBIOS", INTEGER2NUM(AF_NETBIOS));
462 #endif
463 #if defined(PF_NETBIOS)
464 /* NetBIOS */
465 rb_define_const(rb_cSocket, "PF_NETBIOS", INTEGER2NUM(PF_NETBIOS));
466 /* NetBIOS */
467 rb_define_const(rb_mSockConst, "PF_NETBIOS", INTEGER2NUM(PF_NETBIOS));
468 #endif
469 #if defined(AF_PPP)
470 /* Point-to-Point Protocol */
471 rb_define_const(rb_cSocket, "AF_PPP", INTEGER2NUM(AF_PPP));
472 /* Point-to-Point Protocol */
473 rb_define_const(rb_mSockConst, "AF_PPP", INTEGER2NUM(AF_PPP));
474 #endif
475 #if defined(PF_PPP)
476 /* Point-to-Point Protocol */
477 rb_define_const(rb_cSocket, "PF_PPP", INTEGER2NUM(PF_PPP));
478 /* Point-to-Point Protocol */
479 rb_define_const(rb_mSockConst, "PF_PPP", INTEGER2NUM(PF_PPP));
480 #endif
481 #if defined(AF_ATM)
482 /* Asynchronous Transfer Mode */
483 rb_define_const(rb_cSocket, "AF_ATM", INTEGER2NUM(AF_ATM));
484 /* Asynchronous Transfer Mode */
485 rb_define_const(rb_mSockConst, "AF_ATM", INTEGER2NUM(AF_ATM));
486 #endif
487 #if defined(PF_ATM)
488 /* Asynchronous Transfer Mode */
489 rb_define_const(rb_cSocket, "PF_ATM", INTEGER2NUM(PF_ATM));
490 /* Asynchronous Transfer Mode */
491 rb_define_const(rb_mSockConst, "PF_ATM", INTEGER2NUM(PF_ATM));
492 #endif
493 #if defined(AF_NETGRAPH)
494 /* Netgraph sockets */
495 rb_define_const(rb_cSocket, "AF_NETGRAPH", INTEGER2NUM(AF_NETGRAPH));
496 /* Netgraph sockets */
497 rb_define_const(rb_mSockConst, "AF_NETGRAPH", INTEGER2NUM(AF_NETGRAPH));
498 #endif
499 #if defined(PF_NETGRAPH)
500 /* Netgraph sockets */
501 rb_define_const(rb_cSocket, "PF_NETGRAPH", INTEGER2NUM(PF_NETGRAPH));
502 /* Netgraph sockets */
503 rb_define_const(rb_mSockConst, "PF_NETGRAPH", INTEGER2NUM(PF_NETGRAPH));
504 #endif
505 #if defined(AF_MAX)
506 /* Maximum address family for this platform */
507 rb_define_const(rb_cSocket, "AF_MAX", INTEGER2NUM(AF_MAX));
508 /* Maximum address family for this platform */
509 rb_define_const(rb_mSockConst, "AF_MAX", INTEGER2NUM(AF_MAX));
510 #endif
511 #if defined(PF_MAX)
512 /* Maximum address family for this platform */
513 rb_define_const(rb_cSocket, "PF_MAX", INTEGER2NUM(PF_MAX));
514 /* Maximum address family for this platform */
515 rb_define_const(rb_mSockConst, "PF_MAX", INTEGER2NUM(PF_MAX));
516 #endif
517 #if defined(AF_PACKET)
518 /* Direct link-layer access */
519 rb_define_const(rb_cSocket, "AF_PACKET", INTEGER2NUM(AF_PACKET));
520 /* Direct link-layer access */
521 rb_define_const(rb_mSockConst, "AF_PACKET", INTEGER2NUM(AF_PACKET));
522 #endif
523 #if defined(PF_PACKET)
524 /* Direct link-layer access */
525 rb_define_const(rb_cSocket, "PF_PACKET", INTEGER2NUM(PF_PACKET));
526 /* Direct link-layer access */
527 rb_define_const(rb_mSockConst, "PF_PACKET", INTEGER2NUM(PF_PACKET));
528 #endif
529 #if defined(AF_E164)
530 /* CCITT (ITU-T) E.164 recommendation */
531 rb_define_const(rb_cSocket, "AF_E164", INTEGER2NUM(AF_E164));
532 /* CCITT (ITU-T) E.164 recommendation */
533 rb_define_const(rb_mSockConst, "AF_E164", INTEGER2NUM(AF_E164));
534 #endif
535 #if defined(PF_XTP)
536 /* eXpress Transfer Protocol */
537 rb_define_const(rb_cSocket, "PF_XTP", INTEGER2NUM(PF_XTP));
538 /* eXpress Transfer Protocol */
539 rb_define_const(rb_mSockConst, "PF_XTP", INTEGER2NUM(PF_XTP));
540 #endif
541 #if defined(PF_RTIP)
542 /* */
543 rb_define_const(rb_cSocket, "PF_RTIP", INTEGER2NUM(PF_RTIP));
544 /* */
545 rb_define_const(rb_mSockConst, "PF_RTIP", INTEGER2NUM(PF_RTIP));
546 #endif
547 #if defined(PF_PIP)
548 /* */
549 rb_define_const(rb_cSocket, "PF_PIP", INTEGER2NUM(PF_PIP));
550 /* */
551 rb_define_const(rb_mSockConst, "PF_PIP", INTEGER2NUM(PF_PIP));
552 #endif
553 #if defined(PF_KEY)
554 /* */
555 rb_define_const(rb_cSocket, "PF_KEY", INTEGER2NUM(PF_KEY));
556 /* */
557 rb_define_const(rb_mSockConst, "PF_KEY", INTEGER2NUM(PF_KEY));
558 #endif
559 #if defined(MSG_OOB)
560 /* Process out-of-band data */
561 rb_define_const(rb_cSocket, "MSG_OOB", INTEGER2NUM(MSG_OOB));
562 /* Process out-of-band data */
563 rb_define_const(rb_mSockConst, "MSG_OOB", INTEGER2NUM(MSG_OOB));
564 #endif
565 #if defined(MSG_PEEK)
566 /* Peek at incoming message */
567 rb_define_const(rb_cSocket, "MSG_PEEK", INTEGER2NUM(MSG_PEEK));
568 /* Peek at incoming message */
569 rb_define_const(rb_mSockConst, "MSG_PEEK", INTEGER2NUM(MSG_PEEK));
570 #endif
571 #if defined(MSG_DONTROUTE)
572 /* Send without using the routing tables */
573 rb_define_const(rb_cSocket, "MSG_DONTROUTE", INTEGER2NUM(MSG_DONTROUTE));
574 /* Send without using the routing tables */
575 rb_define_const(rb_mSockConst, "MSG_DONTROUTE", INTEGER2NUM(MSG_DONTROUTE));
576 #endif
577 #if defined(MSG_EOR)
578 /* Data completes record */
579 rb_define_const(rb_cSocket, "MSG_EOR", INTEGER2NUM(MSG_EOR));
580 /* Data completes record */
581 rb_define_const(rb_mSockConst, "MSG_EOR", INTEGER2NUM(MSG_EOR));
582 #endif
583 #if defined(MSG_TRUNC)
584 /* Data discarded before delivery */
585 rb_define_const(rb_cSocket, "MSG_TRUNC", INTEGER2NUM(MSG_TRUNC));
586 /* Data discarded before delivery */
587 rb_define_const(rb_mSockConst, "MSG_TRUNC", INTEGER2NUM(MSG_TRUNC));
588 #endif
589 #if defined(MSG_CTRUNC)
590 /* Control data lost before delivery */
591 rb_define_const(rb_cSocket, "MSG_CTRUNC", INTEGER2NUM(MSG_CTRUNC));
592 /* Control data lost before delivery */
593 rb_define_const(rb_mSockConst, "MSG_CTRUNC", INTEGER2NUM(MSG_CTRUNC));
594 #endif
595 #if defined(MSG_WAITALL)
596 /* Wait for full request or error */
597 rb_define_const(rb_cSocket, "MSG_WAITALL", INTEGER2NUM(MSG_WAITALL));
598 /* Wait for full request or error */
599 rb_define_const(rb_mSockConst, "MSG_WAITALL", INTEGER2NUM(MSG_WAITALL));
600 #endif
601 #if defined(MSG_DONTWAIT)
602 /* This message should be non-blocking */
603 rb_define_const(rb_cSocket, "MSG_DONTWAIT", INTEGER2NUM(MSG_DONTWAIT));
604 /* This message should be non-blocking */
605 rb_define_const(rb_mSockConst, "MSG_DONTWAIT", INTEGER2NUM(MSG_DONTWAIT));
606 #endif
607 #if defined(MSG_EOF)
608 /* Data completes connection */
609 rb_define_const(rb_cSocket, "MSG_EOF", INTEGER2NUM(MSG_EOF));
610 /* Data completes connection */
611 rb_define_const(rb_mSockConst, "MSG_EOF", INTEGER2NUM(MSG_EOF));
612 #endif
613 #if defined(MSG_FLUSH)
614 /* Start of a hold sequence. Dumps to so_temp */
615 rb_define_const(rb_cSocket, "MSG_FLUSH", INTEGER2NUM(MSG_FLUSH));
616 /* Start of a hold sequence. Dumps to so_temp */
617 rb_define_const(rb_mSockConst, "MSG_FLUSH", INTEGER2NUM(MSG_FLUSH));
618 #endif
619 #if defined(MSG_HOLD)
620 /* Hold fragment in so_temp */
621 rb_define_const(rb_cSocket, "MSG_HOLD", INTEGER2NUM(MSG_HOLD));
622 /* Hold fragment in so_temp */
623 rb_define_const(rb_mSockConst, "MSG_HOLD", INTEGER2NUM(MSG_HOLD));
624 #endif
625 #if defined(MSG_SEND)
626 /* Send the packet in so_temp */
627 rb_define_const(rb_cSocket, "MSG_SEND", INTEGER2NUM(MSG_SEND));
628 /* Send the packet in so_temp */
629 rb_define_const(rb_mSockConst, "MSG_SEND", INTEGER2NUM(MSG_SEND));
630 #endif
631 #if defined(MSG_HAVEMORE)
632 /* Data ready to be read */
633 rb_define_const(rb_cSocket, "MSG_HAVEMORE", INTEGER2NUM(MSG_HAVEMORE));
634 /* Data ready to be read */
635 rb_define_const(rb_mSockConst, "MSG_HAVEMORE", INTEGER2NUM(MSG_HAVEMORE));
636 #endif
637 #if defined(MSG_RCVMORE)
638 /* Data remains in the current packet */
639 rb_define_const(rb_cSocket, "MSG_RCVMORE", INTEGER2NUM(MSG_RCVMORE));
640 /* Data remains in the current packet */
641 rb_define_const(rb_mSockConst, "MSG_RCVMORE", INTEGER2NUM(MSG_RCVMORE));
642 #endif
643 #if defined(MSG_COMPAT)
644 /* End of record */
645 rb_define_const(rb_cSocket, "MSG_COMPAT", INTEGER2NUM(MSG_COMPAT));
646 /* End of record */
647 rb_define_const(rb_mSockConst, "MSG_COMPAT", INTEGER2NUM(MSG_COMPAT));
648 #endif
649 #if defined(MSG_PROXY)
650 /* Wait for full request */
651 rb_define_const(rb_cSocket, "MSG_PROXY", INTEGER2NUM(MSG_PROXY));
652 /* Wait for full request */
653 rb_define_const(rb_mSockConst, "MSG_PROXY", INTEGER2NUM(MSG_PROXY));
654 #endif
655 #if defined(MSG_FIN)
656 /* */
657 rb_define_const(rb_cSocket, "MSG_FIN", INTEGER2NUM(MSG_FIN));
658 /* */
659 rb_define_const(rb_mSockConst, "MSG_FIN", INTEGER2NUM(MSG_FIN));
660 #endif
661 #if defined(MSG_SYN)
662 /* */
663 rb_define_const(rb_cSocket, "MSG_SYN", INTEGER2NUM(MSG_SYN));
664 /* */
665 rb_define_const(rb_mSockConst, "MSG_SYN", INTEGER2NUM(MSG_SYN));
666 #endif
667 #if defined(MSG_CONFIRM)
668 /* Confirm path validity */
669 rb_define_const(rb_cSocket, "MSG_CONFIRM", INTEGER2NUM(MSG_CONFIRM));
670 /* Confirm path validity */
671 rb_define_const(rb_mSockConst, "MSG_CONFIRM", INTEGER2NUM(MSG_CONFIRM));
672 #endif
673 #if defined(MSG_RST)
674 /* */
675 rb_define_const(rb_cSocket, "MSG_RST", INTEGER2NUM(MSG_RST));
676 /* */
677 rb_define_const(rb_mSockConst, "MSG_RST", INTEGER2NUM(MSG_RST));
678 #endif
679 #if defined(MSG_ERRQUEUE)
680 /* Fetch message from error queue */
681 rb_define_const(rb_cSocket, "MSG_ERRQUEUE", INTEGER2NUM(MSG_ERRQUEUE));
682 /* Fetch message from error queue */
683 rb_define_const(rb_mSockConst, "MSG_ERRQUEUE", INTEGER2NUM(MSG_ERRQUEUE));
684 #endif
685 #if defined(MSG_NOSIGNAL)
686 /* Do not generate SIGPIPE */
687 rb_define_const(rb_cSocket, "MSG_NOSIGNAL", INTEGER2NUM(MSG_NOSIGNAL));
688 /* Do not generate SIGPIPE */
689 rb_define_const(rb_mSockConst, "MSG_NOSIGNAL", INTEGER2NUM(MSG_NOSIGNAL));
690 #endif
691 #if defined(MSG_MORE)
692 /* Sender will send more */
693 rb_define_const(rb_cSocket, "MSG_MORE", INTEGER2NUM(MSG_MORE));
694 /* Sender will send more */
695 rb_define_const(rb_mSockConst, "MSG_MORE", INTEGER2NUM(MSG_MORE));
696 #endif
697 #if defined(MSG_FASTOPEN)
698 /* Reduce step of the handshake process */
699 rb_define_const(rb_cSocket, "MSG_FASTOPEN", INTEGER2NUM(MSG_FASTOPEN));
700 /* Reduce step of the handshake process */
701 rb_define_const(rb_mSockConst, "MSG_FASTOPEN", INTEGER2NUM(MSG_FASTOPEN));
702 #endif
703 #if defined(SOL_SOCKET)
704 /* Socket-level options */
705 rb_define_const(rb_cSocket, "SOL_SOCKET", INTEGER2NUM(SOL_SOCKET));
706 /* Socket-level options */
707 rb_define_const(rb_mSockConst, "SOL_SOCKET", INTEGER2NUM(SOL_SOCKET));
708 #endif
709 #if defined(SOL_IP)
710 /* IP socket options */
711 rb_define_const(rb_cSocket, "SOL_IP", INTEGER2NUM(SOL_IP));
712 /* IP socket options */
713 rb_define_const(rb_mSockConst, "SOL_IP", INTEGER2NUM(SOL_IP));
714 #endif
715 #if defined(SOL_IPX)
716 /* IPX socket options */
717 rb_define_const(rb_cSocket, "SOL_IPX", INTEGER2NUM(SOL_IPX));
718 /* IPX socket options */
719 rb_define_const(rb_mSockConst, "SOL_IPX", INTEGER2NUM(SOL_IPX));
720 #endif
721 #if defined(SOL_AX25)
722 /* AX.25 socket options */
723 rb_define_const(rb_cSocket, "SOL_AX25", INTEGER2NUM(SOL_AX25));
724 /* AX.25 socket options */
725 rb_define_const(rb_mSockConst, "SOL_AX25", INTEGER2NUM(SOL_AX25));
726 #endif
727 #if defined(SOL_ATALK)
728 /* AppleTalk socket options */
729 rb_define_const(rb_cSocket, "SOL_ATALK", INTEGER2NUM(SOL_ATALK));
730 /* AppleTalk socket options */
731 rb_define_const(rb_mSockConst, "SOL_ATALK", INTEGER2NUM(SOL_ATALK));
732 #endif
733 #if defined(SOL_TCP)
734 /* TCP socket options */
735 rb_define_const(rb_cSocket, "SOL_TCP", INTEGER2NUM(SOL_TCP));
736 /* TCP socket options */
737 rb_define_const(rb_mSockConst, "SOL_TCP", INTEGER2NUM(SOL_TCP));
738 #endif
739 #if defined(SOL_UDP)
740 /* UDP socket options */
741 rb_define_const(rb_cSocket, "SOL_UDP", INTEGER2NUM(SOL_UDP));
742 /* UDP socket options */
743 rb_define_const(rb_mSockConst, "SOL_UDP", INTEGER2NUM(SOL_UDP));
744 #endif
745 #if defined(IPPROTO_IP)
746 /* Dummy protocol for IP */
747 rb_define_const(rb_cSocket, "IPPROTO_IP", INTEGER2NUM(IPPROTO_IP));
748 /* Dummy protocol for IP */
749 rb_define_const(rb_mSockConst, "IPPROTO_IP", INTEGER2NUM(IPPROTO_IP));
750 #endif
751 #if defined(IPPROTO_ICMP)
752 /* Control message protocol */
753 rb_define_const(rb_cSocket, "IPPROTO_ICMP", INTEGER2NUM(IPPROTO_ICMP));
754 /* Control message protocol */
755 rb_define_const(rb_mSockConst, "IPPROTO_ICMP", INTEGER2NUM(IPPROTO_ICMP));
756 #endif
757 #if defined(IPPROTO_IGMP)
758 /* Group Management Protocol */
759 rb_define_const(rb_cSocket, "IPPROTO_IGMP", INTEGER2NUM(IPPROTO_IGMP));
760 /* Group Management Protocol */
761 rb_define_const(rb_mSockConst, "IPPROTO_IGMP", INTEGER2NUM(IPPROTO_IGMP));
762 #endif
763 #if defined(IPPROTO_GGP)
764 /* Gateway to Gateway Protocol */
765 rb_define_const(rb_cSocket, "IPPROTO_GGP", INTEGER2NUM(IPPROTO_GGP));
766 /* Gateway to Gateway Protocol */
767 rb_define_const(rb_mSockConst, "IPPROTO_GGP", INTEGER2NUM(IPPROTO_GGP));
768 #endif
769 #if defined(IPPROTO_TCP)
770 /* TCP */
771 rb_define_const(rb_cSocket, "IPPROTO_TCP", INTEGER2NUM(IPPROTO_TCP));
772 /* TCP */
773 rb_define_const(rb_mSockConst, "IPPROTO_TCP", INTEGER2NUM(IPPROTO_TCP));
774 #endif
775 #if defined(IPPROTO_EGP)
776 /* Exterior Gateway Protocol */
777 rb_define_const(rb_cSocket, "IPPROTO_EGP", INTEGER2NUM(IPPROTO_EGP));
778 /* Exterior Gateway Protocol */
779 rb_define_const(rb_mSockConst, "IPPROTO_EGP", INTEGER2NUM(IPPROTO_EGP));
780 #endif
781 #if defined(IPPROTO_PUP)
782 /* PARC Universal Packet protocol */
783 rb_define_const(rb_cSocket, "IPPROTO_PUP", INTEGER2NUM(IPPROTO_PUP));
784 /* PARC Universal Packet protocol */
785 rb_define_const(rb_mSockConst, "IPPROTO_PUP", INTEGER2NUM(IPPROTO_PUP));
786 #endif
787 #if defined(IPPROTO_UDP)
788 /* UDP */
789 rb_define_const(rb_cSocket, "IPPROTO_UDP", INTEGER2NUM(IPPROTO_UDP));
790 /* UDP */
791 rb_define_const(rb_mSockConst, "IPPROTO_UDP", INTEGER2NUM(IPPROTO_UDP));
792 #endif
793 #if defined(IPPROTO_IDP)
794 /* XNS IDP */
795 rb_define_const(rb_cSocket, "IPPROTO_IDP", INTEGER2NUM(IPPROTO_IDP));
796 /* XNS IDP */
797 rb_define_const(rb_mSockConst, "IPPROTO_IDP", INTEGER2NUM(IPPROTO_IDP));
798 #endif
799 #if defined(IPPROTO_HELLO)
800 /* "hello" routing protocol */
801 rb_define_const(rb_cSocket, "IPPROTO_HELLO", INTEGER2NUM(IPPROTO_HELLO));
802 /* "hello" routing protocol */
803 rb_define_const(rb_mSockConst, "IPPROTO_HELLO", INTEGER2NUM(IPPROTO_HELLO));
804 #endif
805 #if defined(IPPROTO_ND)
806 /* Sun net disk protocol */
807 rb_define_const(rb_cSocket, "IPPROTO_ND", INTEGER2NUM(IPPROTO_ND));
808 /* Sun net disk protocol */
809 rb_define_const(rb_mSockConst, "IPPROTO_ND", INTEGER2NUM(IPPROTO_ND));
810 #endif
811 #if defined(IPPROTO_TP)
812 /* ISO transport protocol class 4 */
813 rb_define_const(rb_cSocket, "IPPROTO_TP", INTEGER2NUM(IPPROTO_TP));
814 /* ISO transport protocol class 4 */
815 rb_define_const(rb_mSockConst, "IPPROTO_TP", INTEGER2NUM(IPPROTO_TP));
816 #endif
817 #if defined(IPPROTO_XTP)
818 /* Xpress Transport Protocol */
819 rb_define_const(rb_cSocket, "IPPROTO_XTP", INTEGER2NUM(IPPROTO_XTP));
820 /* Xpress Transport Protocol */
821 rb_define_const(rb_mSockConst, "IPPROTO_XTP", INTEGER2NUM(IPPROTO_XTP));
822 #endif
823 #if defined(IPPROTO_EON)
824 /* ISO cnlp */
825 rb_define_const(rb_cSocket, "IPPROTO_EON", INTEGER2NUM(IPPROTO_EON));
826 /* ISO cnlp */
827 rb_define_const(rb_mSockConst, "IPPROTO_EON", INTEGER2NUM(IPPROTO_EON));
828 #endif
829 #if defined(IPPROTO_BIP)
830 /* */
831 rb_define_const(rb_cSocket, "IPPROTO_BIP", INTEGER2NUM(IPPROTO_BIP));
832 /* */
833 rb_define_const(rb_mSockConst, "IPPROTO_BIP", INTEGER2NUM(IPPROTO_BIP));
834 #endif
835 #if defined(IPPROTO_AH)
836 /* IP6 auth header */
837 rb_define_const(rb_cSocket, "IPPROTO_AH", INTEGER2NUM(IPPROTO_AH));
838 /* IP6 auth header */
839 rb_define_const(rb_mSockConst, "IPPROTO_AH", INTEGER2NUM(IPPROTO_AH));
840 #endif
841 #if defined(IPPROTO_DSTOPTS)
842 /* IP6 destination option */
843 rb_define_const(rb_cSocket, "IPPROTO_DSTOPTS", INTEGER2NUM(IPPROTO_DSTOPTS));
844 /* IP6 destination option */
845 rb_define_const(rb_mSockConst, "IPPROTO_DSTOPTS", INTEGER2NUM(IPPROTO_DSTOPTS));
846 #endif
847 #if defined(IPPROTO_ESP)
848 /* IP6 Encapsulated Security Payload */
849 rb_define_const(rb_cSocket, "IPPROTO_ESP", INTEGER2NUM(IPPROTO_ESP));
850 /* IP6 Encapsulated Security Payload */
851 rb_define_const(rb_mSockConst, "IPPROTO_ESP", INTEGER2NUM(IPPROTO_ESP));
852 #endif
853 #if defined(IPPROTO_FRAGMENT)
854 /* IP6 fragmentation header */
855 rb_define_const(rb_cSocket, "IPPROTO_FRAGMENT", INTEGER2NUM(IPPROTO_FRAGMENT));
856 /* IP6 fragmentation header */
857 rb_define_const(rb_mSockConst, "IPPROTO_FRAGMENT", INTEGER2NUM(IPPROTO_FRAGMENT));
858 #endif
859 #if defined(IPPROTO_HOPOPTS)
860 /* IP6 hop-by-hop options */
861 rb_define_const(rb_cSocket, "IPPROTO_HOPOPTS", INTEGER2NUM(IPPROTO_HOPOPTS));
862 /* IP6 hop-by-hop options */
863 rb_define_const(rb_mSockConst, "IPPROTO_HOPOPTS", INTEGER2NUM(IPPROTO_HOPOPTS));
864 #endif
865 #if defined(IPPROTO_ICMPV6)
866 /* ICMP6 */
867 rb_define_const(rb_cSocket, "IPPROTO_ICMPV6", INTEGER2NUM(IPPROTO_ICMPV6));
868 /* ICMP6 */
869 rb_define_const(rb_mSockConst, "IPPROTO_ICMPV6", INTEGER2NUM(IPPROTO_ICMPV6));
870 #endif
871 #if defined(IPPROTO_IPV6)
872 /* IP6 header */
873 rb_define_const(rb_cSocket, "IPPROTO_IPV6", INTEGER2NUM(IPPROTO_IPV6));
874 /* IP6 header */
875 rb_define_const(rb_mSockConst, "IPPROTO_IPV6", INTEGER2NUM(IPPROTO_IPV6));
876 #endif
877 #if defined(IPPROTO_NONE)
878 /* IP6 no next header */
879 rb_define_const(rb_cSocket, "IPPROTO_NONE", INTEGER2NUM(IPPROTO_NONE));
880 /* IP6 no next header */
881 rb_define_const(rb_mSockConst, "IPPROTO_NONE", INTEGER2NUM(IPPROTO_NONE));
882 #endif
883 #if defined(IPPROTO_ROUTING)
884 /* IP6 routing header */
885 rb_define_const(rb_cSocket, "IPPROTO_ROUTING", INTEGER2NUM(IPPROTO_ROUTING));
886 /* IP6 routing header */
887 rb_define_const(rb_mSockConst, "IPPROTO_ROUTING", INTEGER2NUM(IPPROTO_ROUTING));
888 #endif
889 #if defined(IPPROTO_RAW)
890 /* Raw IP packet */
891 rb_define_const(rb_cSocket, "IPPROTO_RAW", INTEGER2NUM(IPPROTO_RAW));
892 /* Raw IP packet */
893 rb_define_const(rb_mSockConst, "IPPROTO_RAW", INTEGER2NUM(IPPROTO_RAW));
894 #endif
895 #if defined(IPPROTO_MAX)
896 /* Maximum IPPROTO constant */
897 rb_define_const(rb_cSocket, "IPPROTO_MAX", INTEGER2NUM(IPPROTO_MAX));
898 /* Maximum IPPROTO constant */
899 rb_define_const(rb_mSockConst, "IPPROTO_MAX", INTEGER2NUM(IPPROTO_MAX));
900 #endif
901 #if defined(IPPORT_RESERVED)
902 /* Default minimum address for bind or connect */
903 rb_define_const(rb_cSocket, "IPPORT_RESERVED", INTEGER2NUM(IPPORT_RESERVED));
904 /* Default minimum address for bind or connect */
905 rb_define_const(rb_mSockConst, "IPPORT_RESERVED", INTEGER2NUM(IPPORT_RESERVED));
906 #endif
907 #if defined(IPPORT_USERRESERVED)
908 /* Default maximum address for bind or connect */
909 rb_define_const(rb_cSocket, "IPPORT_USERRESERVED", INTEGER2NUM(IPPORT_USERRESERVED));
910 /* Default maximum address for bind or connect */
911 rb_define_const(rb_mSockConst, "IPPORT_USERRESERVED", INTEGER2NUM(IPPORT_USERRESERVED));
912 #endif
913 #if defined(INADDR_ANY)
914 /* A socket bound to INADDR_ANY receives packets from all interfaces and sends from the default IP address */
915 rb_define_const(rb_cSocket, "INADDR_ANY", INTEGER2NUM(INADDR_ANY));
916 /* A socket bound to INADDR_ANY receives packets from all interfaces and sends from the default IP address */
917 rb_define_const(rb_mSockConst, "INADDR_ANY", INTEGER2NUM(INADDR_ANY));
918 #endif
919 #if defined(INADDR_BROADCAST)
920 /* The network broadcast address */
921 rb_define_const(rb_cSocket, "INADDR_BROADCAST", INTEGER2NUM(INADDR_BROADCAST));
922 /* The network broadcast address */
923 rb_define_const(rb_mSockConst, "INADDR_BROADCAST", INTEGER2NUM(INADDR_BROADCAST));
924 #endif
925 #if defined(INADDR_LOOPBACK)
926 /* The loopback address */
927 rb_define_const(rb_cSocket, "INADDR_LOOPBACK", INTEGER2NUM(INADDR_LOOPBACK));
928 /* The loopback address */
929 rb_define_const(rb_mSockConst, "INADDR_LOOPBACK", INTEGER2NUM(INADDR_LOOPBACK));
930 #endif
931 #if defined(INADDR_UNSPEC_GROUP)
932 /* The reserved multicast group */
933 rb_define_const(rb_cSocket, "INADDR_UNSPEC_GROUP", INTEGER2NUM(INADDR_UNSPEC_GROUP));
934 /* The reserved multicast group */
935 rb_define_const(rb_mSockConst, "INADDR_UNSPEC_GROUP", INTEGER2NUM(INADDR_UNSPEC_GROUP));
936 #endif
937 #if defined(INADDR_ALLHOSTS_GROUP)
938 /* Multicast group for all systems on this subset */
939 rb_define_const(rb_cSocket, "INADDR_ALLHOSTS_GROUP", INTEGER2NUM(INADDR_ALLHOSTS_GROUP));
940 /* Multicast group for all systems on this subset */
941 rb_define_const(rb_mSockConst, "INADDR_ALLHOSTS_GROUP", INTEGER2NUM(INADDR_ALLHOSTS_GROUP));
942 #endif
943 #if defined(INADDR_MAX_LOCAL_GROUP)
944 /* The last local network multicast group */
945 rb_define_const(rb_cSocket, "INADDR_MAX_LOCAL_GROUP", INTEGER2NUM(INADDR_MAX_LOCAL_GROUP));
946 /* The last local network multicast group */
947 rb_define_const(rb_mSockConst, "INADDR_MAX_LOCAL_GROUP", INTEGER2NUM(INADDR_MAX_LOCAL_GROUP));
948 #endif
949 #if defined(INADDR_NONE)
950 /* A bitmask for matching no valid IP address */
951 rb_define_const(rb_cSocket, "INADDR_NONE", INTEGER2NUM(INADDR_NONE));
952 /* A bitmask for matching no valid IP address */
953 rb_define_const(rb_mSockConst, "INADDR_NONE", INTEGER2NUM(INADDR_NONE));
954 #endif
955 #if defined(IP_OPTIONS)
956 /* IP options to be included in packets */
957 rb_define_const(rb_cSocket, "IP_OPTIONS", INTEGER2NUM(IP_OPTIONS));
958 /* IP options to be included in packets */
959 rb_define_const(rb_mSockConst, "IP_OPTIONS", INTEGER2NUM(IP_OPTIONS));
960 #endif
961 #if defined(IP_HDRINCL)
962 /* Header is included with data */
963 rb_define_const(rb_cSocket, "IP_HDRINCL", INTEGER2NUM(IP_HDRINCL));
964 /* Header is included with data */
965 rb_define_const(rb_mSockConst, "IP_HDRINCL", INTEGER2NUM(IP_HDRINCL));
966 #endif
967 #if defined(IP_TOS)
968 /* IP type-of-service */
969 rb_define_const(rb_cSocket, "IP_TOS", INTEGER2NUM(IP_TOS));
970 /* IP type-of-service */
971 rb_define_const(rb_mSockConst, "IP_TOS", INTEGER2NUM(IP_TOS));
972 #endif
973 #if defined(IP_TTL)
974 /* IP time-to-live */
975 rb_define_const(rb_cSocket, "IP_TTL", INTEGER2NUM(IP_TTL));
976 /* IP time-to-live */
977 rb_define_const(rb_mSockConst, "IP_TTL", INTEGER2NUM(IP_TTL));
978 #endif
979 #if defined(IP_RECVOPTS)
980 /* Receive all IP options with datagram */
981 rb_define_const(rb_cSocket, "IP_RECVOPTS", INTEGER2NUM(IP_RECVOPTS));
982 /* Receive all IP options with datagram */
983 rb_define_const(rb_mSockConst, "IP_RECVOPTS", INTEGER2NUM(IP_RECVOPTS));
984 #endif
985 #if defined(IP_RECVRETOPTS)
986 /* Receive all IP options for response */
987 rb_define_const(rb_cSocket, "IP_RECVRETOPTS", INTEGER2NUM(IP_RECVRETOPTS));
988 /* Receive all IP options for response */
989 rb_define_const(rb_mSockConst, "IP_RECVRETOPTS", INTEGER2NUM(IP_RECVRETOPTS));
990 #endif
991 #if defined(IP_RECVDSTADDR)
992 /* Receive IP destination address with datagram */
993 rb_define_const(rb_cSocket, "IP_RECVDSTADDR", INTEGER2NUM(IP_RECVDSTADDR));
994 /* Receive IP destination address with datagram */
995 rb_define_const(rb_mSockConst, "IP_RECVDSTADDR", INTEGER2NUM(IP_RECVDSTADDR));
996 #endif
997 #if defined(IP_RETOPTS)
998 /* IP options to be included in datagrams */
999 rb_define_const(rb_cSocket, "IP_RETOPTS", INTEGER2NUM(IP_RETOPTS));
1000 /* IP options to be included in datagrams */
1001 rb_define_const(rb_mSockConst, "IP_RETOPTS", INTEGER2NUM(IP_RETOPTS));
1002 #endif
1003 #if defined(IP_MINTTL)
1004 /* Minimum TTL allowed for received packets */
1005 rb_define_const(rb_cSocket, "IP_MINTTL", INTEGER2NUM(IP_MINTTL));
1006 /* Minimum TTL allowed for received packets */
1007 rb_define_const(rb_mSockConst, "IP_MINTTL", INTEGER2NUM(IP_MINTTL));
1008 #endif
1009 #if defined(IP_DONTFRAG)
1010 /* Don't fragment packets */
1011 rb_define_const(rb_cSocket, "IP_DONTFRAG", INTEGER2NUM(IP_DONTFRAG));
1012 /* Don't fragment packets */
1013 rb_define_const(rb_mSockConst, "IP_DONTFRAG", INTEGER2NUM(IP_DONTFRAG));
1014 #endif
1015 #if defined(IP_SENDSRCADDR)
1016 /* Source address for outgoing UDP datagrams */
1017 rb_define_const(rb_cSocket, "IP_SENDSRCADDR", INTEGER2NUM(IP_SENDSRCADDR));
1018 /* Source address for outgoing UDP datagrams */
1019 rb_define_const(rb_mSockConst, "IP_SENDSRCADDR", INTEGER2NUM(IP_SENDSRCADDR));
1020 #endif
1021 #if defined(IP_ONESBCAST)
1022 /* Force outgoing broadcast datagrams to have the undirected broadcast address */
1023 rb_define_const(rb_cSocket, "IP_ONESBCAST", INTEGER2NUM(IP_ONESBCAST));
1024 /* Force outgoing broadcast datagrams to have the undirected broadcast address */
1025 rb_define_const(rb_mSockConst, "IP_ONESBCAST", INTEGER2NUM(IP_ONESBCAST));
1026 #endif
1027 #if defined(IP_RECVTTL)
1028 /* Receive IP TTL with datagrams */
1029 rb_define_const(rb_cSocket, "IP_RECVTTL", INTEGER2NUM(IP_RECVTTL));
1030 /* Receive IP TTL with datagrams */
1031 rb_define_const(rb_mSockConst, "IP_RECVTTL", INTEGER2NUM(IP_RECVTTL));
1032 #endif
1033 #if defined(IP_RECVIF)
1034 /* Receive interface information with datagrams */
1035 rb_define_const(rb_cSocket, "IP_RECVIF", INTEGER2NUM(IP_RECVIF));
1036 /* Receive interface information with datagrams */
1037 rb_define_const(rb_mSockConst, "IP_RECVIF", INTEGER2NUM(IP_RECVIF));
1038 #endif
1039 #if defined(IP_RECVSLLA)
1040 /* Receive link-layer address with datagrams */
1041 rb_define_const(rb_cSocket, "IP_RECVSLLA", INTEGER2NUM(IP_RECVSLLA));
1042 /* Receive link-layer address with datagrams */
1043 rb_define_const(rb_mSockConst, "IP_RECVSLLA", INTEGER2NUM(IP_RECVSLLA));
1044 #endif
1045 #if defined(IP_PORTRANGE)
1046 /* Set the port range for sockets with unspecified port numbers */
1047 rb_define_const(rb_cSocket, "IP_PORTRANGE", INTEGER2NUM(IP_PORTRANGE));
1048 /* Set the port range for sockets with unspecified port numbers */
1049 rb_define_const(rb_mSockConst, "IP_PORTRANGE", INTEGER2NUM(IP_PORTRANGE));
1050 #endif
1051 #if defined(IP_MULTICAST_IF)
1052 /* IP multicast interface */
1053 rb_define_const(rb_cSocket, "IP_MULTICAST_IF", INTEGER2NUM(IP_MULTICAST_IF));
1054 /* IP multicast interface */
1055 rb_define_const(rb_mSockConst, "IP_MULTICAST_IF", INTEGER2NUM(IP_MULTICAST_IF));
1056 #endif
1057 #if defined(IP_MULTICAST_TTL)
1058 /* IP multicast TTL */
1059 rb_define_const(rb_cSocket, "IP_MULTICAST_TTL", INTEGER2NUM(IP_MULTICAST_TTL));
1060 /* IP multicast TTL */
1061 rb_define_const(rb_mSockConst, "IP_MULTICAST_TTL", INTEGER2NUM(IP_MULTICAST_TTL));
1062 #endif
1063 #if defined(IP_MULTICAST_LOOP)
1064 /* IP multicast loopback */
1065 rb_define_const(rb_cSocket, "IP_MULTICAST_LOOP", INTEGER2NUM(IP_MULTICAST_LOOP));
1066 /* IP multicast loopback */
1067 rb_define_const(rb_mSockConst, "IP_MULTICAST_LOOP", INTEGER2NUM(IP_MULTICAST_LOOP));
1068 #endif
1069 #if defined(IP_ADD_MEMBERSHIP)
1070 /* Add a multicast group membership */
1071 rb_define_const(rb_cSocket, "IP_ADD_MEMBERSHIP", INTEGER2NUM(IP_ADD_MEMBERSHIP));
1072 /* Add a multicast group membership */
1073 rb_define_const(rb_mSockConst, "IP_ADD_MEMBERSHIP", INTEGER2NUM(IP_ADD_MEMBERSHIP));
1074 #endif
1075 #if defined(IP_DROP_MEMBERSHIP)
1076 /* Drop a multicast group membership */
1077 rb_define_const(rb_cSocket, "IP_DROP_MEMBERSHIP", INTEGER2NUM(IP_DROP_MEMBERSHIP));
1078 /* Drop a multicast group membership */
1079 rb_define_const(rb_mSockConst, "IP_DROP_MEMBERSHIP", INTEGER2NUM(IP_DROP_MEMBERSHIP));
1080 #endif
1081 #if defined(IP_DEFAULT_MULTICAST_TTL)
1082 /* Default multicast TTL */
1083 rb_define_const(rb_cSocket, "IP_DEFAULT_MULTICAST_TTL", INTEGER2NUM(IP_DEFAULT_MULTICAST_TTL));
1084 /* Default multicast TTL */
1085 rb_define_const(rb_mSockConst, "IP_DEFAULT_MULTICAST_TTL", INTEGER2NUM(IP_DEFAULT_MULTICAST_TTL));
1086 #endif
1087 #if defined(IP_DEFAULT_MULTICAST_LOOP)
1088 /* Default multicast loopback */
1089 rb_define_const(rb_cSocket, "IP_DEFAULT_MULTICAST_LOOP", INTEGER2NUM(IP_DEFAULT_MULTICAST_LOOP));
1090 /* Default multicast loopback */
1091 rb_define_const(rb_mSockConst, "IP_DEFAULT_MULTICAST_LOOP", INTEGER2NUM(IP_DEFAULT_MULTICAST_LOOP));
1092 #endif
1093 #if defined(IP_MAX_MEMBERSHIPS)
1094 /* Maximum number multicast groups a socket can join */
1095 rb_define_const(rb_cSocket, "IP_MAX_MEMBERSHIPS", INTEGER2NUM(IP_MAX_MEMBERSHIPS));
1096 /* Maximum number multicast groups a socket can join */
1097 rb_define_const(rb_mSockConst, "IP_MAX_MEMBERSHIPS", INTEGER2NUM(IP_MAX_MEMBERSHIPS));
1098 #endif
1099 #if defined(IP_ROUTER_ALERT)
1100 /* Notify transit routers to more closely examine the contents of an IP packet */
1101 rb_define_const(rb_cSocket, "IP_ROUTER_ALERT", INTEGER2NUM(IP_ROUTER_ALERT));
1102 /* Notify transit routers to more closely examine the contents of an IP packet */
1103 rb_define_const(rb_mSockConst, "IP_ROUTER_ALERT", INTEGER2NUM(IP_ROUTER_ALERT));
1104 #endif
1105 #if defined(IP_PKTINFO)
1106 /* Receive packet information with datagrams */
1107 rb_define_const(rb_cSocket, "IP_PKTINFO", INTEGER2NUM(IP_PKTINFO));
1108 /* Receive packet information with datagrams */
1109 rb_define_const(rb_mSockConst, "IP_PKTINFO", INTEGER2NUM(IP_PKTINFO));
1110 #endif
1111 #if defined(IP_PKTOPTIONS)
1112 /* Receive packet options with datagrams */
1113 rb_define_const(rb_cSocket, "IP_PKTOPTIONS", INTEGER2NUM(IP_PKTOPTIONS));
1114 /* Receive packet options with datagrams */
1115 rb_define_const(rb_mSockConst, "IP_PKTOPTIONS", INTEGER2NUM(IP_PKTOPTIONS));
1116 #endif
1117 #if defined(IP_MTU_DISCOVER)
1118 /* Path MTU discovery */
1119 rb_define_const(rb_cSocket, "IP_MTU_DISCOVER", INTEGER2NUM(IP_MTU_DISCOVER));
1120 /* Path MTU discovery */
1121 rb_define_const(rb_mSockConst, "IP_MTU_DISCOVER", INTEGER2NUM(IP_MTU_DISCOVER));
1122 #endif
1123 #if defined(IP_RECVERR)
1124 /* Enable extended reliable error message passing */
1125 rb_define_const(rb_cSocket, "IP_RECVERR", INTEGER2NUM(IP_RECVERR));
1126 /* Enable extended reliable error message passing */
1127 rb_define_const(rb_mSockConst, "IP_RECVERR", INTEGER2NUM(IP_RECVERR));
1128 #endif
1129 #if defined(IP_RECVTOS)
1130 /* Receive TOS with incoming packets */
1131 rb_define_const(rb_cSocket, "IP_RECVTOS", INTEGER2NUM(IP_RECVTOS));
1132 /* Receive TOS with incoming packets */
1133 rb_define_const(rb_mSockConst, "IP_RECVTOS", INTEGER2NUM(IP_RECVTOS));
1134 #endif
1135 #if defined(IP_MTU)
1136 /* The Maximum Transmission Unit of the socket */
1137 rb_define_const(rb_cSocket, "IP_MTU", INTEGER2NUM(IP_MTU));
1138 /* The Maximum Transmission Unit of the socket */
1139 rb_define_const(rb_mSockConst, "IP_MTU", INTEGER2NUM(IP_MTU));
1140 #endif
1141 #if defined(IP_FREEBIND)
1142 /* Allow binding to nonexistent IP addresses */
1143 rb_define_const(rb_cSocket, "IP_FREEBIND", INTEGER2NUM(IP_FREEBIND));
1144 /* Allow binding to nonexistent IP addresses */
1145 rb_define_const(rb_mSockConst, "IP_FREEBIND", INTEGER2NUM(IP_FREEBIND));
1146 #endif
1147 #if defined(IP_IPSEC_POLICY)
1148 /* IPsec security policy */
1149 rb_define_const(rb_cSocket, "IP_IPSEC_POLICY", INTEGER2NUM(IP_IPSEC_POLICY));
1150 /* IPsec security policy */
1151 rb_define_const(rb_mSockConst, "IP_IPSEC_POLICY", INTEGER2NUM(IP_IPSEC_POLICY));
1152 #endif
1153 #if defined(IP_XFRM_POLICY)
1154 /* */
1155 rb_define_const(rb_cSocket, "IP_XFRM_POLICY", INTEGER2NUM(IP_XFRM_POLICY));
1156 /* */
1157 rb_define_const(rb_mSockConst, "IP_XFRM_POLICY", INTEGER2NUM(IP_XFRM_POLICY));
1158 #endif
1159 #if defined(IP_PASSSEC)
1160 /* Retrieve security context with datagram */
1161 rb_define_const(rb_cSocket, "IP_PASSSEC", INTEGER2NUM(IP_PASSSEC));
1162 /* Retrieve security context with datagram */
1163 rb_define_const(rb_mSockConst, "IP_PASSSEC", INTEGER2NUM(IP_PASSSEC));
1164 #endif
1165 #if defined(IP_TRANSPARENT)
1166 /* Transparent proxy */
1167 rb_define_const(rb_cSocket, "IP_TRANSPARENT", INTEGER2NUM(IP_TRANSPARENT));
1168 /* Transparent proxy */
1169 rb_define_const(rb_mSockConst, "IP_TRANSPARENT", INTEGER2NUM(IP_TRANSPARENT));
1170 #endif
1171 #if defined(IP_PMTUDISC_DONT)
1172 /* Never send DF frames */
1173 rb_define_const(rb_cSocket, "IP_PMTUDISC_DONT", INTEGER2NUM(IP_PMTUDISC_DONT));
1174 /* Never send DF frames */
1175 rb_define_const(rb_mSockConst, "IP_PMTUDISC_DONT", INTEGER2NUM(IP_PMTUDISC_DONT));
1176 #endif
1177 #if defined(IP_PMTUDISC_WANT)
1178 /* Use per-route hints */
1179 rb_define_const(rb_cSocket, "IP_PMTUDISC_WANT", INTEGER2NUM(IP_PMTUDISC_WANT));
1180 /* Use per-route hints */
1181 rb_define_const(rb_mSockConst, "IP_PMTUDISC_WANT", INTEGER2NUM(IP_PMTUDISC_WANT));
1182 #endif
1183 #if defined(IP_PMTUDISC_DO)
1184 /* Always send DF frames */
1185 rb_define_const(rb_cSocket, "IP_PMTUDISC_DO", INTEGER2NUM(IP_PMTUDISC_DO));
1186 /* Always send DF frames */
1187 rb_define_const(rb_mSockConst, "IP_PMTUDISC_DO", INTEGER2NUM(IP_PMTUDISC_DO));
1188 #endif
1189 #if defined(IP_UNBLOCK_SOURCE)
1190 /* Unblock IPv4 multicast packets with a give source address */
1191 rb_define_const(rb_cSocket, "IP_UNBLOCK_SOURCE", INTEGER2NUM(IP_UNBLOCK_SOURCE));
1192 /* Unblock IPv4 multicast packets with a give source address */
1193 rb_define_const(rb_mSockConst, "IP_UNBLOCK_SOURCE", INTEGER2NUM(IP_UNBLOCK_SOURCE));
1194 #endif
1195 #if defined(IP_BLOCK_SOURCE)
1196 /* Block IPv4 multicast packets with a give source address */
1197 rb_define_const(rb_cSocket, "IP_BLOCK_SOURCE", INTEGER2NUM(IP_BLOCK_SOURCE));
1198 /* Block IPv4 multicast packets with a give source address */
1199 rb_define_const(rb_mSockConst, "IP_BLOCK_SOURCE", INTEGER2NUM(IP_BLOCK_SOURCE));
1200 #endif
1201 #if defined(IP_ADD_SOURCE_MEMBERSHIP)
1202 /* Add a multicast group membership */
1203 rb_define_const(rb_cSocket, "IP_ADD_SOURCE_MEMBERSHIP", INTEGER2NUM(IP_ADD_SOURCE_MEMBERSHIP));
1204 /* Add a multicast group membership */
1205 rb_define_const(rb_mSockConst, "IP_ADD_SOURCE_MEMBERSHIP", INTEGER2NUM(IP_ADD_SOURCE_MEMBERSHIP));
1206 #endif
1207 #if defined(IP_DROP_SOURCE_MEMBERSHIP)
1208 /* Drop a multicast group membership */
1209 rb_define_const(rb_cSocket, "IP_DROP_SOURCE_MEMBERSHIP", INTEGER2NUM(IP_DROP_SOURCE_MEMBERSHIP));
1210 /* Drop a multicast group membership */
1211 rb_define_const(rb_mSockConst, "IP_DROP_SOURCE_MEMBERSHIP", INTEGER2NUM(IP_DROP_SOURCE_MEMBERSHIP));
1212 #endif
1213 #if defined(IP_MSFILTER)
1214 /* Multicast source filtering */
1215 rb_define_const(rb_cSocket, "IP_MSFILTER", INTEGER2NUM(IP_MSFILTER));
1216 /* Multicast source filtering */
1217 rb_define_const(rb_mSockConst, "IP_MSFILTER", INTEGER2NUM(IP_MSFILTER));
1218 #endif
1219 #if defined(MCAST_JOIN_GROUP)
1220 /* Join a multicast group */
1221 rb_define_const(rb_cSocket, "MCAST_JOIN_GROUP", INTEGER2NUM(MCAST_JOIN_GROUP));
1222 /* Join a multicast group */
1223 rb_define_const(rb_mSockConst, "MCAST_JOIN_GROUP", INTEGER2NUM(MCAST_JOIN_GROUP));
1224 #endif
1225 #if defined(MCAST_BLOCK_SOURCE)
1226 /* Block multicast packets from this source */
1227 rb_define_const(rb_cSocket, "MCAST_BLOCK_SOURCE", INTEGER2NUM(MCAST_BLOCK_SOURCE));
1228 /* Block multicast packets from this source */
1229 rb_define_const(rb_mSockConst, "MCAST_BLOCK_SOURCE", INTEGER2NUM(MCAST_BLOCK_SOURCE));
1230 #endif
1231 #if defined(MCAST_UNBLOCK_SOURCE)
1232 /* Unblock multicast packets from this source */
1233 rb_define_const(rb_cSocket, "MCAST_UNBLOCK_SOURCE", INTEGER2NUM(MCAST_UNBLOCK_SOURCE));
1234 /* Unblock multicast packets from this source */
1235 rb_define_const(rb_mSockConst, "MCAST_UNBLOCK_SOURCE", INTEGER2NUM(MCAST_UNBLOCK_SOURCE));
1236 #endif
1237 #if defined(MCAST_LEAVE_GROUP)
1238 /* Leave a multicast group */
1239 rb_define_const(rb_cSocket, "MCAST_LEAVE_GROUP", INTEGER2NUM(MCAST_LEAVE_GROUP));
1240 /* Leave a multicast group */
1241 rb_define_const(rb_mSockConst, "MCAST_LEAVE_GROUP", INTEGER2NUM(MCAST_LEAVE_GROUP));
1242 #endif
1243 #if defined(MCAST_JOIN_SOURCE_GROUP)
1244 /* Join a multicast source group */
1245 rb_define_const(rb_cSocket, "MCAST_JOIN_SOURCE_GROUP", INTEGER2NUM(MCAST_JOIN_SOURCE_GROUP));
1246 /* Join a multicast source group */
1247 rb_define_const(rb_mSockConst, "MCAST_JOIN_SOURCE_GROUP", INTEGER2NUM(MCAST_JOIN_SOURCE_GROUP));
1248 #endif
1249 #if defined(MCAST_LEAVE_SOURCE_GROUP)
1250 /* Leave a multicast source group */
1251 rb_define_const(rb_cSocket, "MCAST_LEAVE_SOURCE_GROUP", INTEGER2NUM(MCAST_LEAVE_SOURCE_GROUP));
1252 /* Leave a multicast source group */
1253 rb_define_const(rb_mSockConst, "MCAST_LEAVE_SOURCE_GROUP", INTEGER2NUM(MCAST_LEAVE_SOURCE_GROUP));
1254 #endif
1255 #if defined(MCAST_MSFILTER)
1256 /* Multicast source filtering */
1257 rb_define_const(rb_cSocket, "MCAST_MSFILTER", INTEGER2NUM(MCAST_MSFILTER));
1258 /* Multicast source filtering */
1259 rb_define_const(rb_mSockConst, "MCAST_MSFILTER", INTEGER2NUM(MCAST_MSFILTER));
1260 #endif
1261 #if defined(MCAST_EXCLUDE)
1262 /* Exclusive multicast source filter */
1263 rb_define_const(rb_cSocket, "MCAST_EXCLUDE", INTEGER2NUM(MCAST_EXCLUDE));
1264 /* Exclusive multicast source filter */
1265 rb_define_const(rb_mSockConst, "MCAST_EXCLUDE", INTEGER2NUM(MCAST_EXCLUDE));
1266 #endif
1267 #if defined(MCAST_INCLUDE)
1268 /* Inclusive multicast source filter */
1269 rb_define_const(rb_cSocket, "MCAST_INCLUDE", INTEGER2NUM(MCAST_INCLUDE));
1270 /* Inclusive multicast source filter */
1271 rb_define_const(rb_mSockConst, "MCAST_INCLUDE", INTEGER2NUM(MCAST_INCLUDE));
1272 #endif
1273 #if defined(SO_DEBUG)
1274 /* Debug info recording */
1275 rb_define_const(rb_cSocket, "SO_DEBUG", INTEGER2NUM(SO_DEBUG));
1276 /* Debug info recording */
1277 rb_define_const(rb_mSockConst, "SO_DEBUG", INTEGER2NUM(SO_DEBUG));
1278 #endif
1279 #if defined(SO_REUSEADDR)
1280 /* Allow local address reuse */
1281 rb_define_const(rb_cSocket, "SO_REUSEADDR", INTEGER2NUM(SO_REUSEADDR));
1282 /* Allow local address reuse */
1283 rb_define_const(rb_mSockConst, "SO_REUSEADDR", INTEGER2NUM(SO_REUSEADDR));
1284 #endif
1285 #if defined(SO_REUSEPORT)
1286 /* Allow local address and port reuse */
1287 rb_define_const(rb_cSocket, "SO_REUSEPORT", INTEGER2NUM(SO_REUSEPORT));
1288 /* Allow local address and port reuse */
1289 rb_define_const(rb_mSockConst, "SO_REUSEPORT", INTEGER2NUM(SO_REUSEPORT));
1290 #endif
1291 #if defined(SO_TYPE)
1292 /* Get the socket type */
1293 rb_define_const(rb_cSocket, "SO_TYPE", INTEGER2NUM(SO_TYPE));
1294 /* Get the socket type */
1295 rb_define_const(rb_mSockConst, "SO_TYPE", INTEGER2NUM(SO_TYPE));
1296 #endif
1297 #if defined(SO_ERROR)
1298 /* Get and clear the error status */
1299 rb_define_const(rb_cSocket, "SO_ERROR", INTEGER2NUM(SO_ERROR));
1300 /* Get and clear the error status */
1301 rb_define_const(rb_mSockConst, "SO_ERROR", INTEGER2NUM(SO_ERROR));
1302 #endif
1303 #if defined(SO_DONTROUTE)
1304 /* Use interface addresses */
1305 rb_define_const(rb_cSocket, "SO_DONTROUTE", INTEGER2NUM(SO_DONTROUTE));
1306 /* Use interface addresses */
1307 rb_define_const(rb_mSockConst, "SO_DONTROUTE", INTEGER2NUM(SO_DONTROUTE));
1308 #endif
1309 #if defined(SO_BROADCAST)
1310 /* Permit sending of broadcast messages */
1311 rb_define_const(rb_cSocket, "SO_BROADCAST", INTEGER2NUM(SO_BROADCAST));
1312 /* Permit sending of broadcast messages */
1313 rb_define_const(rb_mSockConst, "SO_BROADCAST", INTEGER2NUM(SO_BROADCAST));
1314 #endif
1315 #if defined(SO_SNDBUF)
1316 /* Send buffer size */
1317 rb_define_const(rb_cSocket, "SO_SNDBUF", INTEGER2NUM(SO_SNDBUF));
1318 /* Send buffer size */
1319 rb_define_const(rb_mSockConst, "SO_SNDBUF", INTEGER2NUM(SO_SNDBUF));
1320 #endif
1321 #if defined(SO_RCVBUF)
1322 /* Receive buffer size */
1323 rb_define_const(rb_cSocket, "SO_RCVBUF", INTEGER2NUM(SO_RCVBUF));
1324 /* Receive buffer size */
1325 rb_define_const(rb_mSockConst, "SO_RCVBUF", INTEGER2NUM(SO_RCVBUF));
1326 #endif
1327 #if defined(SO_SNDBUFFORCE)
1328 /* Send buffer size without wmem_max limit (Linux 2.6.14) */
1329 rb_define_const(rb_cSocket, "SO_SNDBUFFORCE", INTEGER2NUM(SO_SNDBUFFORCE));
1330 /* Send buffer size without wmem_max limit (Linux 2.6.14) */
1331 rb_define_const(rb_mSockConst, "SO_SNDBUFFORCE", INTEGER2NUM(SO_SNDBUFFORCE));
1332 #endif
1333 #if defined(SO_RCVBUFFORCE)
1334 /* Receive buffer size without rmem_max limit (Linux 2.6.14) */
1335 rb_define_const(rb_cSocket, "SO_RCVBUFFORCE", INTEGER2NUM(SO_RCVBUFFORCE));
1336 /* Receive buffer size without rmem_max limit (Linux 2.6.14) */
1337 rb_define_const(rb_mSockConst, "SO_RCVBUFFORCE", INTEGER2NUM(SO_RCVBUFFORCE));
1338 #endif
1339 #if defined(SO_KEEPALIVE)
1340 /* Keep connections alive */
1341 rb_define_const(rb_cSocket, "SO_KEEPALIVE", INTEGER2NUM(SO_KEEPALIVE));
1342 /* Keep connections alive */
1343 rb_define_const(rb_mSockConst, "SO_KEEPALIVE", INTEGER2NUM(SO_KEEPALIVE));
1344 #endif
1345 #if defined(SO_OOBINLINE)
1346 /* Leave received out-of-band data in-line */
1347 rb_define_const(rb_cSocket, "SO_OOBINLINE", INTEGER2NUM(SO_OOBINLINE));
1348 /* Leave received out-of-band data in-line */
1349 rb_define_const(rb_mSockConst, "SO_OOBINLINE", INTEGER2NUM(SO_OOBINLINE));
1350 #endif
1351 #if defined(SO_NO_CHECK)
1352 /* Disable checksums */
1353 rb_define_const(rb_cSocket, "SO_NO_CHECK", INTEGER2NUM(SO_NO_CHECK));
1354 /* Disable checksums */
1355 rb_define_const(rb_mSockConst, "SO_NO_CHECK", INTEGER2NUM(SO_NO_CHECK));
1356 #endif
1357 #if defined(SO_PRIORITY)
1358 /* The protocol-defined priority for all packets on this socket */
1359 rb_define_const(rb_cSocket, "SO_PRIORITY", INTEGER2NUM(SO_PRIORITY));
1360 /* The protocol-defined priority for all packets on this socket */
1361 rb_define_const(rb_mSockConst, "SO_PRIORITY", INTEGER2NUM(SO_PRIORITY));
1362 #endif
1363 #if defined(SO_LINGER)
1364 /* Linger on close if data is present */
1365 rb_define_const(rb_cSocket, "SO_LINGER", INTEGER2NUM(SO_LINGER));
1366 /* Linger on close if data is present */
1367 rb_define_const(rb_mSockConst, "SO_LINGER", INTEGER2NUM(SO_LINGER));
1368 #endif
1369 #if defined(SO_PASSCRED)
1370 /* Receive SCM_CREDENTIALS messages */
1371 rb_define_const(rb_cSocket, "SO_PASSCRED", INTEGER2NUM(SO_PASSCRED));
1372 /* Receive SCM_CREDENTIALS messages */
1373 rb_define_const(rb_mSockConst, "SO_PASSCRED", INTEGER2NUM(SO_PASSCRED));
1374 #endif
1375 #if defined(SO_PEERCRED)
1376 /* The credentials of the foreign process connected to this socket */
1377 rb_define_const(rb_cSocket, "SO_PEERCRED", INTEGER2NUM(SO_PEERCRED));
1378 /* The credentials of the foreign process connected to this socket */
1379 rb_define_const(rb_mSockConst, "SO_PEERCRED", INTEGER2NUM(SO_PEERCRED));
1380 #endif
1381 #if defined(SO_RCVLOWAT)
1382 /* Receive low-water mark */
1383 rb_define_const(rb_cSocket, "SO_RCVLOWAT", INTEGER2NUM(SO_RCVLOWAT));
1384 /* Receive low-water mark */
1385 rb_define_const(rb_mSockConst, "SO_RCVLOWAT", INTEGER2NUM(SO_RCVLOWAT));
1386 #endif
1387 #if defined(SO_SNDLOWAT)
1388 /* Send low-water mark */
1389 rb_define_const(rb_cSocket, "SO_SNDLOWAT", INTEGER2NUM(SO_SNDLOWAT));
1390 /* Send low-water mark */
1391 rb_define_const(rb_mSockConst, "SO_SNDLOWAT", INTEGER2NUM(SO_SNDLOWAT));
1392 #endif
1393 #if defined(SO_RCVTIMEO)
1394 /* Receive timeout */
1395 rb_define_const(rb_cSocket, "SO_RCVTIMEO", INTEGER2NUM(SO_RCVTIMEO));
1396 /* Receive timeout */
1397 rb_define_const(rb_mSockConst, "SO_RCVTIMEO", INTEGER2NUM(SO_RCVTIMEO));
1398 #endif
1399 #if defined(SO_SNDTIMEO)
1400 /* Send timeout */
1401 rb_define_const(rb_cSocket, "SO_SNDTIMEO", INTEGER2NUM(SO_SNDTIMEO));
1402 /* Send timeout */
1403 rb_define_const(rb_mSockConst, "SO_SNDTIMEO", INTEGER2NUM(SO_SNDTIMEO));
1404 #endif
1405 #if defined(SO_ACCEPTCONN)
1406 /* Socket has had listen() called on it */
1407 rb_define_const(rb_cSocket, "SO_ACCEPTCONN", INTEGER2NUM(SO_ACCEPTCONN));
1408 /* Socket has had listen() called on it */
1409 rb_define_const(rb_mSockConst, "SO_ACCEPTCONN", INTEGER2NUM(SO_ACCEPTCONN));
1410 #endif
1411 #if defined(SO_USELOOPBACK)
1412 /* Bypass hardware when possible */
1413 rb_define_const(rb_cSocket, "SO_USELOOPBACK", INTEGER2NUM(SO_USELOOPBACK));
1414 /* Bypass hardware when possible */
1415 rb_define_const(rb_mSockConst, "SO_USELOOPBACK", INTEGER2NUM(SO_USELOOPBACK));
1416 #endif
1417 #if defined(SO_ACCEPTFILTER)
1418 /* There is an accept filter */
1419 rb_define_const(rb_cSocket, "SO_ACCEPTFILTER", INTEGER2NUM(SO_ACCEPTFILTER));
1420 /* There is an accept filter */
1421 rb_define_const(rb_mSockConst, "SO_ACCEPTFILTER", INTEGER2NUM(SO_ACCEPTFILTER));
1422 #endif
1423 #if defined(SO_DONTTRUNC)
1424 /* Retain unread data */
1425 rb_define_const(rb_cSocket, "SO_DONTTRUNC", INTEGER2NUM(SO_DONTTRUNC));
1426 /* Retain unread data */
1427 rb_define_const(rb_mSockConst, "SO_DONTTRUNC", INTEGER2NUM(SO_DONTTRUNC));
1428 #endif
1429 #if defined(SO_WANTMORE)
1430 /* Give a hint when more data is ready */
1431 rb_define_const(rb_cSocket, "SO_WANTMORE", INTEGER2NUM(SO_WANTMORE));
1432 /* Give a hint when more data is ready */
1433 rb_define_const(rb_mSockConst, "SO_WANTMORE", INTEGER2NUM(SO_WANTMORE));
1434 #endif
1435 #if defined(SO_WANTOOBFLAG)
1436 /* OOB data is wanted in MSG_FLAG on receive */
1437 rb_define_const(rb_cSocket, "SO_WANTOOBFLAG", INTEGER2NUM(SO_WANTOOBFLAG));
1438 /* OOB data is wanted in MSG_FLAG on receive */
1439 rb_define_const(rb_mSockConst, "SO_WANTOOBFLAG", INTEGER2NUM(SO_WANTOOBFLAG));
1440 #endif
1441 #if defined(SO_NREAD)
1442 /* Get first packet byte count */
1443 rb_define_const(rb_cSocket, "SO_NREAD", INTEGER2NUM(SO_NREAD));
1444 /* Get first packet byte count */
1445 rb_define_const(rb_mSockConst, "SO_NREAD", INTEGER2NUM(SO_NREAD));
1446 #endif
1447 #if defined(SO_NKE)
1448 /* Install socket-level Network Kernel Extension */
1449 rb_define_const(rb_cSocket, "SO_NKE", INTEGER2NUM(SO_NKE));
1450 /* Install socket-level Network Kernel Extension */
1451 rb_define_const(rb_mSockConst, "SO_NKE", INTEGER2NUM(SO_NKE));
1452 #endif
1453 #if defined(SO_NOSIGPIPE)
1454 /* Don't SIGPIPE on EPIPE */
1455 rb_define_const(rb_cSocket, "SO_NOSIGPIPE", INTEGER2NUM(SO_NOSIGPIPE));
1456 /* Don't SIGPIPE on EPIPE */
1457 rb_define_const(rb_mSockConst, "SO_NOSIGPIPE", INTEGER2NUM(SO_NOSIGPIPE));
1458 #endif
1459 #if defined(SO_SECURITY_AUTHENTICATION)
1460 /* */
1461 rb_define_const(rb_cSocket, "SO_SECURITY_AUTHENTICATION", INTEGER2NUM(SO_SECURITY_AUTHENTICATION));
1462 /* */
1463 rb_define_const(rb_mSockConst, "SO_SECURITY_AUTHENTICATION", INTEGER2NUM(SO_SECURITY_AUTHENTICATION));
1464 #endif
1465 #if defined(SO_SECURITY_ENCRYPTION_TRANSPORT)
1466 /* */
1467 rb_define_const(rb_cSocket, "SO_SECURITY_ENCRYPTION_TRANSPORT", INTEGER2NUM(SO_SECURITY_ENCRYPTION_TRANSPORT));
1468 /* */
1469 rb_define_const(rb_mSockConst, "SO_SECURITY_ENCRYPTION_TRANSPORT", INTEGER2NUM(SO_SECURITY_ENCRYPTION_TRANSPORT));
1470 #endif
1471 #if defined(SO_SECURITY_ENCRYPTION_NETWORK)
1472 /* */
1473 rb_define_const(rb_cSocket, "SO_SECURITY_ENCRYPTION_NETWORK", INTEGER2NUM(SO_SECURITY_ENCRYPTION_NETWORK));
1474 /* */
1475 rb_define_const(rb_mSockConst, "SO_SECURITY_ENCRYPTION_NETWORK", INTEGER2NUM(SO_SECURITY_ENCRYPTION_NETWORK));
1476 #endif
1477 #if defined(SO_BINDTODEVICE)
1478 /* Only send packets from the given interface */
1479 rb_define_const(rb_cSocket, "SO_BINDTODEVICE", INTEGER2NUM(SO_BINDTODEVICE));
1480 /* Only send packets from the given interface */
1481 rb_define_const(rb_mSockConst, "SO_BINDTODEVICE", INTEGER2NUM(SO_BINDTODEVICE));
1482 #endif
1483 #if defined(SO_ATTACH_FILTER)
1484 /* Attach an accept filter */
1485 rb_define_const(rb_cSocket, "SO_ATTACH_FILTER", INTEGER2NUM(SO_ATTACH_FILTER));
1486 /* Attach an accept filter */
1487 rb_define_const(rb_mSockConst, "SO_ATTACH_FILTER", INTEGER2NUM(SO_ATTACH_FILTER));
1488 #endif
1489 #if defined(SO_DETACH_FILTER)
1490 /* Detach an accept filter */
1491 rb_define_const(rb_cSocket, "SO_DETACH_FILTER", INTEGER2NUM(SO_DETACH_FILTER));
1492 /* Detach an accept filter */
1493 rb_define_const(rb_mSockConst, "SO_DETACH_FILTER", INTEGER2NUM(SO_DETACH_FILTER));
1494 #endif
1495 #if defined(SO_GET_FILTER)
1496 /* Obtain filter set by SO_ATTACH_FILTER (Linux 3.8) */
1497 rb_define_const(rb_cSocket, "SO_GET_FILTER", INTEGER2NUM(SO_GET_FILTER));
1498 /* Obtain filter set by SO_ATTACH_FILTER (Linux 3.8) */
1499 rb_define_const(rb_mSockConst, "SO_GET_FILTER", INTEGER2NUM(SO_GET_FILTER));
1500 #endif
1501 #if defined(SO_PEERNAME)
1502 /* Name of the connecting user */
1503 rb_define_const(rb_cSocket, "SO_PEERNAME", INTEGER2NUM(SO_PEERNAME));
1504 /* Name of the connecting user */
1505 rb_define_const(rb_mSockConst, "SO_PEERNAME", INTEGER2NUM(SO_PEERNAME));
1506 #endif
1507 #if defined(SO_TIMESTAMP)
1508 /* Receive timestamp with datagrams (timeval) */
1509 rb_define_const(rb_cSocket, "SO_TIMESTAMP", INTEGER2NUM(SO_TIMESTAMP));
1510 /* Receive timestamp with datagrams (timeval) */
1511 rb_define_const(rb_mSockConst, "SO_TIMESTAMP", INTEGER2NUM(SO_TIMESTAMP));
1512 #endif
1513 #if defined(SO_TIMESTAMPNS)
1514 /* Receive nanosecond timestamp with datagrams (timespec) */
1515 rb_define_const(rb_cSocket, "SO_TIMESTAMPNS", INTEGER2NUM(SO_TIMESTAMPNS));
1516 /* Receive nanosecond timestamp with datagrams (timespec) */
1517 rb_define_const(rb_mSockConst, "SO_TIMESTAMPNS", INTEGER2NUM(SO_TIMESTAMPNS));
1518 #endif
1519 #if defined(SO_BINTIME)
1520 /* Receive timestamp with datagrams (bintime) */
1521 rb_define_const(rb_cSocket, "SO_BINTIME", INTEGER2NUM(SO_BINTIME));
1522 /* Receive timestamp with datagrams (bintime) */
1523 rb_define_const(rb_mSockConst, "SO_BINTIME", INTEGER2NUM(SO_BINTIME));
1524 #endif
1525 #if defined(SO_RECVUCRED)
1526 /* Receive user credentials with datagram */
1527 rb_define_const(rb_cSocket, "SO_RECVUCRED", INTEGER2NUM(SO_RECVUCRED));
1528 /* Receive user credentials with datagram */
1529 rb_define_const(rb_mSockConst, "SO_RECVUCRED", INTEGER2NUM(SO_RECVUCRED));
1530 #endif
1531 #if defined(SO_MAC_EXEMPT)
1532 /* Mandatory Access Control exemption for unlabeled peers */
1533 rb_define_const(rb_cSocket, "SO_MAC_EXEMPT", INTEGER2NUM(SO_MAC_EXEMPT));
1534 /* Mandatory Access Control exemption for unlabeled peers */
1535 rb_define_const(rb_mSockConst, "SO_MAC_EXEMPT", INTEGER2NUM(SO_MAC_EXEMPT));
1536 #endif
1537 #if defined(SO_ALLZONES)
1538 /* Bypass zone boundaries */
1539 rb_define_const(rb_cSocket, "SO_ALLZONES", INTEGER2NUM(SO_ALLZONES));
1540 /* Bypass zone boundaries */
1541 rb_define_const(rb_mSockConst, "SO_ALLZONES", INTEGER2NUM(SO_ALLZONES));
1542 #endif
1543 #if defined(SO_PEERSEC)
1544 /* Obtain the security credentials (Linux 2.6.2) */
1545 rb_define_const(rb_cSocket, "SO_PEERSEC", INTEGER2NUM(SO_PEERSEC));
1546 /* Obtain the security credentials (Linux 2.6.2) */
1547 rb_define_const(rb_mSockConst, "SO_PEERSEC", INTEGER2NUM(SO_PEERSEC));
1548 #endif
1549 #if defined(SO_PASSSEC)
1550 /* Toggle security context passing (Linux 2.6.18) */
1551 rb_define_const(rb_cSocket, "SO_PASSSEC", INTEGER2NUM(SO_PASSSEC));
1552 /* Toggle security context passing (Linux 2.6.18) */
1553 rb_define_const(rb_mSockConst, "SO_PASSSEC", INTEGER2NUM(SO_PASSSEC));
1554 #endif
1555 #if defined(SO_MARK)
1556 /* Set the mark for mark-based routing (Linux 2.6.25) */
1557 rb_define_const(rb_cSocket, "SO_MARK", INTEGER2NUM(SO_MARK));
1558 /* Set the mark for mark-based routing (Linux 2.6.25) */
1559 rb_define_const(rb_mSockConst, "SO_MARK", INTEGER2NUM(SO_MARK));
1560 #endif
1561 #if defined(SO_TIMESTAMPING)
1562 /* Time stamping of incoming and outgoing packets (Linux 2.6.30) */
1563 rb_define_const(rb_cSocket, "SO_TIMESTAMPING", INTEGER2NUM(SO_TIMESTAMPING));
1564 /* Time stamping of incoming and outgoing packets (Linux 2.6.30) */
1565 rb_define_const(rb_mSockConst, "SO_TIMESTAMPING", INTEGER2NUM(SO_TIMESTAMPING));
1566 #endif
1567 #if defined(SO_PROTOCOL)
1568 /* Protocol given for socket() (Linux 2.6.32) */
1569 rb_define_const(rb_cSocket, "SO_PROTOCOL", INTEGER2NUM(SO_PROTOCOL));
1570 /* Protocol given for socket() (Linux 2.6.32) */
1571 rb_define_const(rb_mSockConst, "SO_PROTOCOL", INTEGER2NUM(SO_PROTOCOL));
1572 #endif
1573 #if defined(SO_DOMAIN)
1574 /* Domain given for socket() (Linux 2.6.32) */
1575 rb_define_const(rb_cSocket, "SO_DOMAIN", INTEGER2NUM(SO_DOMAIN));
1576 /* Domain given for socket() (Linux 2.6.32) */
1577 rb_define_const(rb_mSockConst, "SO_DOMAIN", INTEGER2NUM(SO_DOMAIN));
1578 #endif
1579 #if defined(SO_RXQ_OVFL)
1580 /* Toggle cmsg for number of packets dropped (Linux 2.6.33) */
1581 rb_define_const(rb_cSocket, "SO_RXQ_OVFL", INTEGER2NUM(SO_RXQ_OVFL));
1582 /* Toggle cmsg for number of packets dropped (Linux 2.6.33) */
1583 rb_define_const(rb_mSockConst, "SO_RXQ_OVFL", INTEGER2NUM(SO_RXQ_OVFL));
1584 #endif
1585 #if defined(SO_WIFI_STATUS)
1586 /* Toggle cmsg for wifi status (Linux 3.3) */
1587 rb_define_const(rb_cSocket, "SO_WIFI_STATUS", INTEGER2NUM(SO_WIFI_STATUS));
1588 /* Toggle cmsg for wifi status (Linux 3.3) */
1589 rb_define_const(rb_mSockConst, "SO_WIFI_STATUS", INTEGER2NUM(SO_WIFI_STATUS));
1590 #endif
1591 #if defined(SO_PEEK_OFF)
1592 /* Set the peek offset (Linux 3.4) */
1593 rb_define_const(rb_cSocket, "SO_PEEK_OFF", INTEGER2NUM(SO_PEEK_OFF));
1594 /* Set the peek offset (Linux 3.4) */
1595 rb_define_const(rb_mSockConst, "SO_PEEK_OFF", INTEGER2NUM(SO_PEEK_OFF));
1596 #endif
1597 #if defined(SO_NOFCS)
1598 /* Set netns of a socket (Linux 3.4) */
1599 rb_define_const(rb_cSocket, "SO_NOFCS", INTEGER2NUM(SO_NOFCS));
1600 /* Set netns of a socket (Linux 3.4) */
1601 rb_define_const(rb_mSockConst, "SO_NOFCS", INTEGER2NUM(SO_NOFCS));
1602 #endif
1603 #if defined(SO_LOCK_FILTER)
1604 /* Lock the filter attached to a socket (Linux 3.9) */
1605 rb_define_const(rb_cSocket, "SO_LOCK_FILTER", INTEGER2NUM(SO_LOCK_FILTER));
1606 /* Lock the filter attached to a socket (Linux 3.9) */
1607 rb_define_const(rb_mSockConst, "SO_LOCK_FILTER", INTEGER2NUM(SO_LOCK_FILTER));
1608 #endif
1609 #if defined(SO_SELECT_ERR_QUEUE)
1610 /* Make select() detect socket error queue with errorfds (Linux 3.10) */
1611 rb_define_const(rb_cSocket, "SO_SELECT_ERR_QUEUE", INTEGER2NUM(SO_SELECT_ERR_QUEUE));
1612 /* Make select() detect socket error queue with errorfds (Linux 3.10) */
1613 rb_define_const(rb_mSockConst, "SO_SELECT_ERR_QUEUE", INTEGER2NUM(SO_SELECT_ERR_QUEUE));
1614 #endif
1615 #if defined(SO_BUSY_POLL)
1616 /* Set the threshold in microseconds for low latency polling (Linux 3.11) */
1617 rb_define_const(rb_cSocket, "SO_BUSY_POLL", INTEGER2NUM(SO_BUSY_POLL));
1618 /* Set the threshold in microseconds for low latency polling (Linux 3.11) */
1619 rb_define_const(rb_mSockConst, "SO_BUSY_POLL", INTEGER2NUM(SO_BUSY_POLL));
1620 #endif
1621 #if defined(SO_MAX_PACING_RATE)
1622 /* Cap the rate computed by transport layer. [bytes per second] (Linux 3.13) */
1623 rb_define_const(rb_cSocket, "SO_MAX_PACING_RATE", INTEGER2NUM(SO_MAX_PACING_RATE));
1624 /* Cap the rate computed by transport layer. [bytes per second] (Linux 3.13) */
1625 rb_define_const(rb_mSockConst, "SO_MAX_PACING_RATE", INTEGER2NUM(SO_MAX_PACING_RATE));
1626 #endif
1627 #if defined(SO_BPF_EXTENSIONS)
1628 /* Query supported BPF extensions (Linux 3.14) */
1629 rb_define_const(rb_cSocket, "SO_BPF_EXTENSIONS", INTEGER2NUM(SO_BPF_EXTENSIONS));
1630 /* Query supported BPF extensions (Linux 3.14) */
1631 rb_define_const(rb_mSockConst, "SO_BPF_EXTENSIONS", INTEGER2NUM(SO_BPF_EXTENSIONS));
1632 #endif
1633 #if defined(SOPRI_INTERACTIVE)
1634 /* Interactive socket priority */
1635 rb_define_const(rb_cSocket, "SOPRI_INTERACTIVE", INTEGER2NUM(SOPRI_INTERACTIVE));
1636 /* Interactive socket priority */
1637 rb_define_const(rb_mSockConst, "SOPRI_INTERACTIVE", INTEGER2NUM(SOPRI_INTERACTIVE));
1638 #endif
1639 #if defined(SOPRI_NORMAL)
1640 /* Normal socket priority */
1641 rb_define_const(rb_cSocket, "SOPRI_NORMAL", INTEGER2NUM(SOPRI_NORMAL));
1642 /* Normal socket priority */
1643 rb_define_const(rb_mSockConst, "SOPRI_NORMAL", INTEGER2NUM(SOPRI_NORMAL));
1644 #endif
1645 #if defined(SOPRI_BACKGROUND)
1646 /* Background socket priority */
1647 rb_define_const(rb_cSocket, "SOPRI_BACKGROUND", INTEGER2NUM(SOPRI_BACKGROUND));
1648 /* Background socket priority */
1649 rb_define_const(rb_mSockConst, "SOPRI_BACKGROUND", INTEGER2NUM(SOPRI_BACKGROUND));
1650 #endif
1651 #if defined(IPX_TYPE)
1652 /* */
1653 rb_define_const(rb_cSocket, "IPX_TYPE", INTEGER2NUM(IPX_TYPE));
1654 /* */
1655 rb_define_const(rb_mSockConst, "IPX_TYPE", INTEGER2NUM(IPX_TYPE));
1656 #endif
1657 #if defined(TCP_NODELAY)
1658 /* Don't delay sending to coalesce packets */
1659 rb_define_const(rb_cSocket, "TCP_NODELAY", INTEGER2NUM(TCP_NODELAY));
1660 /* Don't delay sending to coalesce packets */
1661 rb_define_const(rb_mSockConst, "TCP_NODELAY", INTEGER2NUM(TCP_NODELAY));
1662 #endif
1663 #if defined(TCP_MAXSEG)
1664 /* Set maximum segment size */
1665 rb_define_const(rb_cSocket, "TCP_MAXSEG", INTEGER2NUM(TCP_MAXSEG));
1666 /* Set maximum segment size */
1667 rb_define_const(rb_mSockConst, "TCP_MAXSEG", INTEGER2NUM(TCP_MAXSEG));
1668 #endif
1669 #if defined(TCP_CORK)
1670 /* Don't send partial frames (Linux 2.2, glibc 2.2) */
1671 rb_define_const(rb_cSocket, "TCP_CORK", INTEGER2NUM(TCP_CORK));
1672 /* Don't send partial frames (Linux 2.2, glibc 2.2) */
1673 rb_define_const(rb_mSockConst, "TCP_CORK", INTEGER2NUM(TCP_CORK));
1674 #endif
1675 #if defined(TCP_DEFER_ACCEPT)
1676 /* Don't notify a listening socket until data is ready (Linux 2.4, glibc 2.2) */
1677 rb_define_const(rb_cSocket, "TCP_DEFER_ACCEPT", INTEGER2NUM(TCP_DEFER_ACCEPT));
1678 /* Don't notify a listening socket until data is ready (Linux 2.4, glibc 2.2) */
1679 rb_define_const(rb_mSockConst, "TCP_DEFER_ACCEPT", INTEGER2NUM(TCP_DEFER_ACCEPT));
1680 #endif
1681 #if defined(TCP_INFO)
1682 /* Retrieve information about this socket (Linux 2.4, glibc 2.2) */
1683 rb_define_const(rb_cSocket, "TCP_INFO", INTEGER2NUM(TCP_INFO));
1684 /* Retrieve information about this socket (Linux 2.4, glibc 2.2) */
1685 rb_define_const(rb_mSockConst, "TCP_INFO", INTEGER2NUM(TCP_INFO));
1686 #endif
1687 #if defined(TCP_KEEPCNT)
1688 /* Maximum number of keepalive probes allowed before dropping a connection (Linux 2.4, glibc 2.2) */
1689 rb_define_const(rb_cSocket, "TCP_KEEPCNT", INTEGER2NUM(TCP_KEEPCNT));
1690 /* Maximum number of keepalive probes allowed before dropping a connection (Linux 2.4, glibc 2.2) */
1691 rb_define_const(rb_mSockConst, "TCP_KEEPCNT", INTEGER2NUM(TCP_KEEPCNT));
1692 #endif
1693 #if defined(TCP_KEEPIDLE)
1694 /* Idle time before keepalive probes are sent (Linux 2.4, glibc 2.2) */
1695 rb_define_const(rb_cSocket, "TCP_KEEPIDLE", INTEGER2NUM(TCP_KEEPIDLE));
1696 /* Idle time before keepalive probes are sent (Linux 2.4, glibc 2.2) */
1697 rb_define_const(rb_mSockConst, "TCP_KEEPIDLE", INTEGER2NUM(TCP_KEEPIDLE));
1698 #endif
1699 #if defined(TCP_KEEPINTVL)
1700 /* Time between keepalive probes (Linux 2.4, glibc 2.2) */
1701 rb_define_const(rb_cSocket, "TCP_KEEPINTVL", INTEGER2NUM(TCP_KEEPINTVL));
1702 /* Time between keepalive probes (Linux 2.4, glibc 2.2) */
1703 rb_define_const(rb_mSockConst, "TCP_KEEPINTVL", INTEGER2NUM(TCP_KEEPINTVL));
1704 #endif
1705 #if defined(TCP_LINGER2)
1706 /* Lifetime of orphaned FIN_WAIT2 sockets (Linux 2.4, glibc 2.2) */
1707 rb_define_const(rb_cSocket, "TCP_LINGER2", INTEGER2NUM(TCP_LINGER2));
1708 /* Lifetime of orphaned FIN_WAIT2 sockets (Linux 2.4, glibc 2.2) */
1709 rb_define_const(rb_mSockConst, "TCP_LINGER2", INTEGER2NUM(TCP_LINGER2));
1710 #endif
1711 #if defined(TCP_MD5SIG)
1712 /* Use MD5 digests (RFC2385, Linux 2.6.20, glibc 2.7) */
1713 rb_define_const(rb_cSocket, "TCP_MD5SIG", INTEGER2NUM(TCP_MD5SIG));
1714 /* Use MD5 digests (RFC2385, Linux 2.6.20, glibc 2.7) */
1715 rb_define_const(rb_mSockConst, "TCP_MD5SIG", INTEGER2NUM(TCP_MD5SIG));
1716 #endif
1717 #if defined(TCP_NOOPT)
1718 /* Don't use TCP options */
1719 rb_define_const(rb_cSocket, "TCP_NOOPT", INTEGER2NUM(TCP_NOOPT));
1720 /* Don't use TCP options */
1721 rb_define_const(rb_mSockConst, "TCP_NOOPT", INTEGER2NUM(TCP_NOOPT));
1722 #endif
1723 #if defined(TCP_NOPUSH)
1724 /* Don't push the last block of write */
1725 rb_define_const(rb_cSocket, "TCP_NOPUSH", INTEGER2NUM(TCP_NOPUSH));
1726 /* Don't push the last block of write */
1727 rb_define_const(rb_mSockConst, "TCP_NOPUSH", INTEGER2NUM(TCP_NOPUSH));
1728 #endif
1729 #if defined(TCP_QUICKACK)
1730 /* Enable quickack mode (Linux 2.4.4, glibc 2.3) */
1731 rb_define_const(rb_cSocket, "TCP_QUICKACK", INTEGER2NUM(TCP_QUICKACK));
1732 /* Enable quickack mode (Linux 2.4.4, glibc 2.3) */
1733 rb_define_const(rb_mSockConst, "TCP_QUICKACK", INTEGER2NUM(TCP_QUICKACK));
1734 #endif
1735 #if defined(TCP_SYNCNT)
1736 /* Number of SYN retransmits before a connection is dropped (Linux 2.4, glibc 2.2) */
1737 rb_define_const(rb_cSocket, "TCP_SYNCNT", INTEGER2NUM(TCP_SYNCNT));
1738 /* Number of SYN retransmits before a connection is dropped (Linux 2.4, glibc 2.2) */
1739 rb_define_const(rb_mSockConst, "TCP_SYNCNT", INTEGER2NUM(TCP_SYNCNT));
1740 #endif
1741 #if defined(TCP_WINDOW_CLAMP)
1742 /* Clamp the size of the advertised window (Linux 2.4, glibc 2.2) */
1743 rb_define_const(rb_cSocket, "TCP_WINDOW_CLAMP", INTEGER2NUM(TCP_WINDOW_CLAMP));
1744 /* Clamp the size of the advertised window (Linux 2.4, glibc 2.2) */
1745 rb_define_const(rb_mSockConst, "TCP_WINDOW_CLAMP", INTEGER2NUM(TCP_WINDOW_CLAMP));
1746 #endif
1747 #if defined(TCP_FASTOPEN)
1748 /* Reduce step of the handshake process (Linux 3.7, glibc 2.18) */
1749 rb_define_const(rb_cSocket, "TCP_FASTOPEN", INTEGER2NUM(TCP_FASTOPEN));
1750 /* Reduce step of the handshake process (Linux 3.7, glibc 2.18) */
1751 rb_define_const(rb_mSockConst, "TCP_FASTOPEN", INTEGER2NUM(TCP_FASTOPEN));
1752 #endif
1753 #if defined(TCP_CONGESTION)
1754 /* TCP congestion control algorithm (Linux 2.6.13, glibc 2.6) */
1755 rb_define_const(rb_cSocket, "TCP_CONGESTION", INTEGER2NUM(TCP_CONGESTION));
1756 /* TCP congestion control algorithm (Linux 2.6.13, glibc 2.6) */
1757 rb_define_const(rb_mSockConst, "TCP_CONGESTION", INTEGER2NUM(TCP_CONGESTION));
1758 #endif
1759 #if defined(TCP_COOKIE_TRANSACTIONS)
1760 /* TCP Cookie Transactions (Linux 2.6.33, glibc 2.18) */
1761 rb_define_const(rb_cSocket, "TCP_COOKIE_TRANSACTIONS", INTEGER2NUM(TCP_COOKIE_TRANSACTIONS));
1762 /* TCP Cookie Transactions (Linux 2.6.33, glibc 2.18) */
1763 rb_define_const(rb_mSockConst, "TCP_COOKIE_TRANSACTIONS", INTEGER2NUM(TCP_COOKIE_TRANSACTIONS));
1764 #endif
1765 #if defined(TCP_QUEUE_SEQ)
1766 /* Sequence of a queue for repair mode (Linux 3.5, glibc 2.18) */
1767 rb_define_const(rb_cSocket, "TCP_QUEUE_SEQ", INTEGER2NUM(TCP_QUEUE_SEQ));
1768 /* Sequence of a queue for repair mode (Linux 3.5, glibc 2.18) */
1769 rb_define_const(rb_mSockConst, "TCP_QUEUE_SEQ", INTEGER2NUM(TCP_QUEUE_SEQ));
1770 #endif
1771 #if defined(TCP_REPAIR)
1772 /* Repair mode (Linux 3.5, glibc 2.18) */
1773 rb_define_const(rb_cSocket, "TCP_REPAIR", INTEGER2NUM(TCP_REPAIR));
1774 /* Repair mode (Linux 3.5, glibc 2.18) */
1775 rb_define_const(rb_mSockConst, "TCP_REPAIR", INTEGER2NUM(TCP_REPAIR));
1776 #endif
1777 #if defined(TCP_REPAIR_OPTIONS)
1778 /* Options for repair mode (Linux 3.5, glibc 2.18) */
1779 rb_define_const(rb_cSocket, "TCP_REPAIR_OPTIONS", INTEGER2NUM(TCP_REPAIR_OPTIONS));
1780 /* Options for repair mode (Linux 3.5, glibc 2.18) */
1781 rb_define_const(rb_mSockConst, "TCP_REPAIR_OPTIONS", INTEGER2NUM(TCP_REPAIR_OPTIONS));
1782 #endif
1783 #if defined(TCP_REPAIR_QUEUE)
1784 /* Queue for repair mode (Linux 3.5, glibc 2.18) */
1785 rb_define_const(rb_cSocket, "TCP_REPAIR_QUEUE", INTEGER2NUM(TCP_REPAIR_QUEUE));
1786 /* Queue for repair mode (Linux 3.5, glibc 2.18) */
1787 rb_define_const(rb_mSockConst, "TCP_REPAIR_QUEUE", INTEGER2NUM(TCP_REPAIR_QUEUE));
1788 #endif
1789 #if defined(TCP_THIN_DUPACK)
1790 /* Duplicated acknowledgments handling for thin-streams (Linux 2.6.34, glibc 2.18) */
1791 rb_define_const(rb_cSocket, "TCP_THIN_DUPACK", INTEGER2NUM(TCP_THIN_DUPACK));
1792 /* Duplicated acknowledgments handling for thin-streams (Linux 2.6.34, glibc 2.18) */
1793 rb_define_const(rb_mSockConst, "TCP_THIN_DUPACK", INTEGER2NUM(TCP_THIN_DUPACK));
1794 #endif
1795 #if defined(TCP_THIN_LINEAR_TIMEOUTS)
1796 /* Linear timeouts for thin-streams (Linux 2.6.34, glibc 2.18) */
1797 rb_define_const(rb_cSocket, "TCP_THIN_LINEAR_TIMEOUTS", INTEGER2NUM(TCP_THIN_LINEAR_TIMEOUTS));
1798 /* Linear timeouts for thin-streams (Linux 2.6.34, glibc 2.18) */
1799 rb_define_const(rb_mSockConst, "TCP_THIN_LINEAR_TIMEOUTS", INTEGER2NUM(TCP_THIN_LINEAR_TIMEOUTS));
1800 #endif
1801 #if defined(TCP_TIMESTAMP)
1802 /* TCP timestamp (Linux 3.9, glibc 2.18) */
1803 rb_define_const(rb_cSocket, "TCP_TIMESTAMP", INTEGER2NUM(TCP_TIMESTAMP));
1804 /* TCP timestamp (Linux 3.9, glibc 2.18) */
1805 rb_define_const(rb_mSockConst, "TCP_TIMESTAMP", INTEGER2NUM(TCP_TIMESTAMP));
1806 #endif
1807 #if defined(TCP_USER_TIMEOUT)
1808 /* Max timeout before a TCP connection is aborted (Linux 2.6.37, glibc 2.18) */
1809 rb_define_const(rb_cSocket, "TCP_USER_TIMEOUT", INTEGER2NUM(TCP_USER_TIMEOUT));
1810 /* Max timeout before a TCP connection is aborted (Linux 2.6.37, glibc 2.18) */
1811 rb_define_const(rb_mSockConst, "TCP_USER_TIMEOUT", INTEGER2NUM(TCP_USER_TIMEOUT));
1812 #endif
1813 #if defined(UDP_CORK)
1814 /* Don't send partial frames (Linux 2.5.44, glibc 2.11) */
1815 rb_define_const(rb_cSocket, "UDP_CORK", INTEGER2NUM(UDP_CORK));
1816 /* Don't send partial frames (Linux 2.5.44, glibc 2.11) */
1817 rb_define_const(rb_mSockConst, "UDP_CORK", INTEGER2NUM(UDP_CORK));
1818 #endif
1819 #if defined(EAI_ADDRFAMILY)
1820 /* Address family for hostname not supported */
1821 rb_define_const(rb_cSocket, "EAI_ADDRFAMILY", INTEGER2NUM(EAI_ADDRFAMILY));
1822 /* Address family for hostname not supported */
1823 rb_define_const(rb_mSockConst, "EAI_ADDRFAMILY", INTEGER2NUM(EAI_ADDRFAMILY));
1824 #endif
1825 #if defined(EAI_AGAIN)
1826 /* Temporary failure in name resolution */
1827 rb_define_const(rb_cSocket, "EAI_AGAIN", INTEGER2NUM(EAI_AGAIN));
1828 /* Temporary failure in name resolution */
1829 rb_define_const(rb_mSockConst, "EAI_AGAIN", INTEGER2NUM(EAI_AGAIN));
1830 #endif
1831 #if defined(EAI_BADFLAGS)
1832 /* Invalid flags */
1833 rb_define_const(rb_cSocket, "EAI_BADFLAGS", INTEGER2NUM(EAI_BADFLAGS));
1834 /* Invalid flags */
1835 rb_define_const(rb_mSockConst, "EAI_BADFLAGS", INTEGER2NUM(EAI_BADFLAGS));
1836 #endif
1837 #if defined(EAI_FAIL)
1838 /* Non-recoverable failure in name resolution */
1839 rb_define_const(rb_cSocket, "EAI_FAIL", INTEGER2NUM(EAI_FAIL));
1840 /* Non-recoverable failure in name resolution */
1841 rb_define_const(rb_mSockConst, "EAI_FAIL", INTEGER2NUM(EAI_FAIL));
1842 #endif
1843 #if defined(EAI_FAMILY)
1844 /* Address family not supported */
1845 rb_define_const(rb_cSocket, "EAI_FAMILY", INTEGER2NUM(EAI_FAMILY));
1846 /* Address family not supported */
1847 rb_define_const(rb_mSockConst, "EAI_FAMILY", INTEGER2NUM(EAI_FAMILY));
1848 #endif
1849 #if defined(EAI_MEMORY)
1850 /* Memory allocation failure */
1851 rb_define_const(rb_cSocket, "EAI_MEMORY", INTEGER2NUM(EAI_MEMORY));
1852 /* Memory allocation failure */
1853 rb_define_const(rb_mSockConst, "EAI_MEMORY", INTEGER2NUM(EAI_MEMORY));
1854 #endif
1855 #if defined(EAI_NODATA)
1856 /* No address associated with hostname */
1857 rb_define_const(rb_cSocket, "EAI_NODATA", INTEGER2NUM(EAI_NODATA));
1858 /* No address associated with hostname */
1859 rb_define_const(rb_mSockConst, "EAI_NODATA", INTEGER2NUM(EAI_NODATA));
1860 #endif
1861 #if defined(EAI_NONAME)
1862 /* Hostname nor servname, or not known */
1863 rb_define_const(rb_cSocket, "EAI_NONAME", INTEGER2NUM(EAI_NONAME));
1864 /* Hostname nor servname, or not known */
1865 rb_define_const(rb_mSockConst, "EAI_NONAME", INTEGER2NUM(EAI_NONAME));
1866 #endif
1867 #if defined(EAI_OVERFLOW)
1868 /* Argument buffer overflow */
1869 rb_define_const(rb_cSocket, "EAI_OVERFLOW", INTEGER2NUM(EAI_OVERFLOW));
1870 /* Argument buffer overflow */
1871 rb_define_const(rb_mSockConst, "EAI_OVERFLOW", INTEGER2NUM(EAI_OVERFLOW));
1872 #endif
1873 #if defined(EAI_SERVICE)
1874 /* Servname not supported for socket type */
1875 rb_define_const(rb_cSocket, "EAI_SERVICE", INTEGER2NUM(EAI_SERVICE));
1876 /* Servname not supported for socket type */
1877 rb_define_const(rb_mSockConst, "EAI_SERVICE", INTEGER2NUM(EAI_SERVICE));
1878 #endif
1879 #if defined(EAI_SOCKTYPE)
1880 /* Socket type not supported */
1881 rb_define_const(rb_cSocket, "EAI_SOCKTYPE", INTEGER2NUM(EAI_SOCKTYPE));
1882 /* Socket type not supported */
1883 rb_define_const(rb_mSockConst, "EAI_SOCKTYPE", INTEGER2NUM(EAI_SOCKTYPE));
1884 #endif
1885 #if defined(EAI_SYSTEM)
1886 /* System error returned in errno */
1887 rb_define_const(rb_cSocket, "EAI_SYSTEM", INTEGER2NUM(EAI_SYSTEM));
1888 /* System error returned in errno */
1889 rb_define_const(rb_mSockConst, "EAI_SYSTEM", INTEGER2NUM(EAI_SYSTEM));
1890 #endif
1891 #if defined(EAI_BADHINTS)
1892 /* Invalid value for hints */
1893 rb_define_const(rb_cSocket, "EAI_BADHINTS", INTEGER2NUM(EAI_BADHINTS));
1894 /* Invalid value for hints */
1895 rb_define_const(rb_mSockConst, "EAI_BADHINTS", INTEGER2NUM(EAI_BADHINTS));
1896 #endif
1897 #if defined(EAI_PROTOCOL)
1898 /* Resolved protocol is unknown */
1899 rb_define_const(rb_cSocket, "EAI_PROTOCOL", INTEGER2NUM(EAI_PROTOCOL));
1900 /* Resolved protocol is unknown */
1901 rb_define_const(rb_mSockConst, "EAI_PROTOCOL", INTEGER2NUM(EAI_PROTOCOL));
1902 #endif
1903 #if defined(EAI_MAX)
1904 /* Maximum error code from getaddrinfo */
1905 rb_define_const(rb_cSocket, "EAI_MAX", INTEGER2NUM(EAI_MAX));
1906 /* Maximum error code from getaddrinfo */
1907 rb_define_const(rb_mSockConst, "EAI_MAX", INTEGER2NUM(EAI_MAX));
1908 #endif
1909 #if defined(AI_PASSIVE)
1910 /* Get address to use with bind() */
1911 rb_define_const(rb_cSocket, "AI_PASSIVE", INTEGER2NUM(AI_PASSIVE));
1912 /* Get address to use with bind() */
1913 rb_define_const(rb_mSockConst, "AI_PASSIVE", INTEGER2NUM(AI_PASSIVE));
1914 #endif
1915 #if defined(AI_CANONNAME)
1916 /* Fill in the canonical name */
1917 rb_define_const(rb_cSocket, "AI_CANONNAME", INTEGER2NUM(AI_CANONNAME));
1918 /* Fill in the canonical name */
1919 rb_define_const(rb_mSockConst, "AI_CANONNAME", INTEGER2NUM(AI_CANONNAME));
1920 #endif
1921 #if defined(AI_NUMERICHOST)
1922 /* Prevent host name resolution */
1923 rb_define_const(rb_cSocket, "AI_NUMERICHOST", INTEGER2NUM(AI_NUMERICHOST));
1924 /* Prevent host name resolution */
1925 rb_define_const(rb_mSockConst, "AI_NUMERICHOST", INTEGER2NUM(AI_NUMERICHOST));
1926 #endif
1927 #if defined(AI_NUMERICSERV)
1928 /* Prevent service name resolution */
1929 rb_define_const(rb_cSocket, "AI_NUMERICSERV", INTEGER2NUM(AI_NUMERICSERV));
1930 /* Prevent service name resolution */
1931 rb_define_const(rb_mSockConst, "AI_NUMERICSERV", INTEGER2NUM(AI_NUMERICSERV));
1932 #endif
1933 #if defined(AI_MASK)
1934 /* Valid flag mask for getaddrinfo (not for application use) */
1935 rb_define_const(rb_cSocket, "AI_MASK", INTEGER2NUM(AI_MASK));
1936 /* Valid flag mask for getaddrinfo (not for application use) */
1937 rb_define_const(rb_mSockConst, "AI_MASK", INTEGER2NUM(AI_MASK));
1938 #endif
1939 #if defined(AI_ALL)
1940 /* Allow all addresses */
1941 rb_define_const(rb_cSocket, "AI_ALL", INTEGER2NUM(AI_ALL));
1942 /* Allow all addresses */
1943 rb_define_const(rb_mSockConst, "AI_ALL", INTEGER2NUM(AI_ALL));
1944 #endif
1945 #if defined(AI_V4MAPPED_CFG)
1946 /* Accept IPv4 mapped addresses if the kernel supports it */
1947 rb_define_const(rb_cSocket, "AI_V4MAPPED_CFG", INTEGER2NUM(AI_V4MAPPED_CFG));
1948 /* Accept IPv4 mapped addresses if the kernel supports it */
1949 rb_define_const(rb_mSockConst, "AI_V4MAPPED_CFG", INTEGER2NUM(AI_V4MAPPED_CFG));
1950 #endif
1951 #if defined(AI_ADDRCONFIG)
1952 /* Accept only if any address is assigned */
1953 rb_define_const(rb_cSocket, "AI_ADDRCONFIG", INTEGER2NUM(AI_ADDRCONFIG));
1954 /* Accept only if any address is assigned */
1955 rb_define_const(rb_mSockConst, "AI_ADDRCONFIG", INTEGER2NUM(AI_ADDRCONFIG));
1956 #endif
1957 #if defined(AI_V4MAPPED)
1958 /* Accept IPv4-mapped IPv6 addresses */
1959 rb_define_const(rb_cSocket, "AI_V4MAPPED", INTEGER2NUM(AI_V4MAPPED));
1960 /* Accept IPv4-mapped IPv6 addresses */
1961 rb_define_const(rb_mSockConst, "AI_V4MAPPED", INTEGER2NUM(AI_V4MAPPED));
1962 #endif
1963 #if defined(AI_DEFAULT)
1964 /* Default flags for getaddrinfo */
1965 rb_define_const(rb_cSocket, "AI_DEFAULT", INTEGER2NUM(AI_DEFAULT));
1966 /* Default flags for getaddrinfo */
1967 rb_define_const(rb_mSockConst, "AI_DEFAULT", INTEGER2NUM(AI_DEFAULT));
1968 #endif
1969 #if defined(NI_MAXHOST)
1970 /* Maximum length of a hostname */
1971 rb_define_const(rb_cSocket, "NI_MAXHOST", INTEGER2NUM(NI_MAXHOST));
1972 /* Maximum length of a hostname */
1973 rb_define_const(rb_mSockConst, "NI_MAXHOST", INTEGER2NUM(NI_MAXHOST));
1974 #endif
1975 #if defined(NI_MAXSERV)
1976 /* Maximum length of a service name */
1977 rb_define_const(rb_cSocket, "NI_MAXSERV", INTEGER2NUM(NI_MAXSERV));
1978 /* Maximum length of a service name */
1979 rb_define_const(rb_mSockConst, "NI_MAXSERV", INTEGER2NUM(NI_MAXSERV));
1980 #endif
1981 #if defined(NI_NOFQDN)
1982 /* An FQDN is not required for local hosts, return only the local part */
1983 rb_define_const(rb_cSocket, "NI_NOFQDN", INTEGER2NUM(NI_NOFQDN));
1984 /* An FQDN is not required for local hosts, return only the local part */
1985 rb_define_const(rb_mSockConst, "NI_NOFQDN", INTEGER2NUM(NI_NOFQDN));
1986 #endif
1987 #if defined(NI_NUMERICHOST)
1988 /* Return a numeric address */
1989 rb_define_const(rb_cSocket, "NI_NUMERICHOST", INTEGER2NUM(NI_NUMERICHOST));
1990 /* Return a numeric address */
1991 rb_define_const(rb_mSockConst, "NI_NUMERICHOST", INTEGER2NUM(NI_NUMERICHOST));
1992 #endif
1993 #if defined(NI_NAMEREQD)
1994 /* A name is required */
1995 rb_define_const(rb_cSocket, "NI_NAMEREQD", INTEGER2NUM(NI_NAMEREQD));
1996 /* A name is required */
1997 rb_define_const(rb_mSockConst, "NI_NAMEREQD", INTEGER2NUM(NI_NAMEREQD));
1998 #endif
1999 #if defined(NI_NUMERICSERV)
2000 /* Return the service name as a digit string */
2001 rb_define_const(rb_cSocket, "NI_NUMERICSERV", INTEGER2NUM(NI_NUMERICSERV));
2002 /* Return the service name as a digit string */
2003 rb_define_const(rb_mSockConst, "NI_NUMERICSERV", INTEGER2NUM(NI_NUMERICSERV));
2004 #endif
2005 #if defined(NI_DGRAM)
2006 /* The service specified is a datagram service (looks up UDP ports) */
2007 rb_define_const(rb_cSocket, "NI_DGRAM", INTEGER2NUM(NI_DGRAM));
2008 /* The service specified is a datagram service (looks up UDP ports) */
2009 rb_define_const(rb_mSockConst, "NI_DGRAM", INTEGER2NUM(NI_DGRAM));
2010 #endif
2011 #if defined(SHUT_RD)
2012 /* Shut down the reading side of the socket */
2013 rb_define_const(rb_cSocket, "SHUT_RD", INTEGER2NUM(SHUT_RD));
2014 /* Shut down the reading side of the socket */
2015 rb_define_const(rb_mSockConst, "SHUT_RD", INTEGER2NUM(SHUT_RD));
2016 #endif
2017 #if defined(SHUT_WR)
2018 /* Shut down the writing side of the socket */
2019 rb_define_const(rb_cSocket, "SHUT_WR", INTEGER2NUM(SHUT_WR));
2020 /* Shut down the writing side of the socket */
2021 rb_define_const(rb_mSockConst, "SHUT_WR", INTEGER2NUM(SHUT_WR));
2022 #endif
2023 #if defined(SHUT_RDWR)
2024 /* Shut down the both sides of the socket */
2025 rb_define_const(rb_cSocket, "SHUT_RDWR", INTEGER2NUM(SHUT_RDWR));
2026 /* Shut down the both sides of the socket */
2027 rb_define_const(rb_mSockConst, "SHUT_RDWR", INTEGER2NUM(SHUT_RDWR));
2028 #endif
2029 #if defined(INET6)
2030 #if defined(IPV6_JOIN_GROUP)
2031 /* Join a group membership */
2032 rb_define_const(rb_cSocket, "IPV6_JOIN_GROUP", INTEGER2NUM(IPV6_JOIN_GROUP));
2033 /* Join a group membership */
2034 rb_define_const(rb_mSockConst, "IPV6_JOIN_GROUP", INTEGER2NUM(IPV6_JOIN_GROUP));
2035 #endif
2036 #endif
2037 #if defined(INET6)
2038 #if defined(IPV6_LEAVE_GROUP)
2039 /* Leave a group membership */
2040 rb_define_const(rb_cSocket, "IPV6_LEAVE_GROUP", INTEGER2NUM(IPV6_LEAVE_GROUP));
2041 /* Leave a group membership */
2042 rb_define_const(rb_mSockConst, "IPV6_LEAVE_GROUP", INTEGER2NUM(IPV6_LEAVE_GROUP));
2043 #endif
2044 #endif
2045 #if defined(INET6)
2046 #if defined(IPV6_MULTICAST_HOPS)
2047 /* IP6 multicast hops */
2048 rb_define_const(rb_cSocket, "IPV6_MULTICAST_HOPS", INTEGER2NUM(IPV6_MULTICAST_HOPS));
2049 /* IP6 multicast hops */
2050 rb_define_const(rb_mSockConst, "IPV6_MULTICAST_HOPS", INTEGER2NUM(IPV6_MULTICAST_HOPS));
2051 #endif
2052 #endif
2053 #if defined(INET6)
2054 #if defined(IPV6_MULTICAST_IF)
2055 /* IP6 multicast interface */
2056 rb_define_const(rb_cSocket, "IPV6_MULTICAST_IF", INTEGER2NUM(IPV6_MULTICAST_IF));
2057 /* IP6 multicast interface */
2058 rb_define_const(rb_mSockConst, "IPV6_MULTICAST_IF", INTEGER2NUM(IPV6_MULTICAST_IF));
2059 #endif
2060 #endif
2061 #if defined(INET6)
2062 #if defined(IPV6_MULTICAST_LOOP)
2063 /* IP6 multicast loopback */
2064 rb_define_const(rb_cSocket, "IPV6_MULTICAST_LOOP", INTEGER2NUM(IPV6_MULTICAST_LOOP));
2065 /* IP6 multicast loopback */
2066 rb_define_const(rb_mSockConst, "IPV6_MULTICAST_LOOP", INTEGER2NUM(IPV6_MULTICAST_LOOP));
2067 #endif
2068 #endif
2069 #if defined(INET6)
2070 #if defined(IPV6_UNICAST_HOPS)
2071 /* IP6 unicast hops */
2072 rb_define_const(rb_cSocket, "IPV6_UNICAST_HOPS", INTEGER2NUM(IPV6_UNICAST_HOPS));
2073 /* IP6 unicast hops */
2074 rb_define_const(rb_mSockConst, "IPV6_UNICAST_HOPS", INTEGER2NUM(IPV6_UNICAST_HOPS));
2075 #endif
2076 #endif
2077 #if defined(INET6)
2078 #if defined(IPV6_V6ONLY)
2079 /* Only bind IPv6 with a wildcard bind */
2080 rb_define_const(rb_cSocket, "IPV6_V6ONLY", INTEGER2NUM(IPV6_V6ONLY));
2081 /* Only bind IPv6 with a wildcard bind */
2082 rb_define_const(rb_mSockConst, "IPV6_V6ONLY", INTEGER2NUM(IPV6_V6ONLY));
2083 #endif
2084 #endif
2085 #if defined(INET6)
2086 #if defined(IPV6_CHECKSUM)
2087 /* Checksum offset for raw sockets */
2088 rb_define_const(rb_cSocket, "IPV6_CHECKSUM", INTEGER2NUM(IPV6_CHECKSUM));
2089 /* Checksum offset for raw sockets */
2090 rb_define_const(rb_mSockConst, "IPV6_CHECKSUM", INTEGER2NUM(IPV6_CHECKSUM));
2091 #endif
2092 #endif
2093 #if defined(INET6)
2094 #if defined(IPV6_DONTFRAG)
2095 /* Don't fragment packets */
2096 rb_define_const(rb_cSocket, "IPV6_DONTFRAG", INTEGER2NUM(IPV6_DONTFRAG));
2097 /* Don't fragment packets */
2098 rb_define_const(rb_mSockConst, "IPV6_DONTFRAG", INTEGER2NUM(IPV6_DONTFRAG));
2099 #endif
2100 #endif
2101 #if defined(INET6)
2102 #if defined(IPV6_DSTOPTS)
2103 /* Destination option */
2104 rb_define_const(rb_cSocket, "IPV6_DSTOPTS", INTEGER2NUM(IPV6_DSTOPTS));
2105 /* Destination option */
2106 rb_define_const(rb_mSockConst, "IPV6_DSTOPTS", INTEGER2NUM(IPV6_DSTOPTS));
2107 #endif
2108 #endif
2109 #if defined(INET6)
2110 #if defined(IPV6_HOPLIMIT)
2111 /* Hop limit */
2112 rb_define_const(rb_cSocket, "IPV6_HOPLIMIT", INTEGER2NUM(IPV6_HOPLIMIT));
2113 /* Hop limit */
2114 rb_define_const(rb_mSockConst, "IPV6_HOPLIMIT", INTEGER2NUM(IPV6_HOPLIMIT));
2115 #endif
2116 #endif
2117 #if defined(INET6)
2118 #if defined(IPV6_HOPOPTS)
2119 /* Hop-by-hop option */
2120 rb_define_const(rb_cSocket, "IPV6_HOPOPTS", INTEGER2NUM(IPV6_HOPOPTS));
2121 /* Hop-by-hop option */
2122 rb_define_const(rb_mSockConst, "IPV6_HOPOPTS", INTEGER2NUM(IPV6_HOPOPTS));
2123 #endif
2124 #endif
2125 #if defined(INET6)
2126 #if defined(IPV6_NEXTHOP)
2127 /* Next hop address */
2128 rb_define_const(rb_cSocket, "IPV6_NEXTHOP", INTEGER2NUM(IPV6_NEXTHOP));
2129 /* Next hop address */
2130 rb_define_const(rb_mSockConst, "IPV6_NEXTHOP", INTEGER2NUM(IPV6_NEXTHOP));
2131 #endif
2132 #endif
2133 #if defined(INET6)
2134 #if defined(IPV6_PATHMTU)
2135 /* Retrieve current path MTU */
2136 rb_define_const(rb_cSocket, "IPV6_PATHMTU", INTEGER2NUM(IPV6_PATHMTU));
2137 /* Retrieve current path MTU */
2138 rb_define_const(rb_mSockConst, "IPV6_PATHMTU", INTEGER2NUM(IPV6_PATHMTU));
2139 #endif
2140 #endif
2141 #if defined(INET6)
2142 #if defined(IPV6_PKTINFO)
2143 /* Receive packet information with datagram */
2144 rb_define_const(rb_cSocket, "IPV6_PKTINFO", INTEGER2NUM(IPV6_PKTINFO));
2145 /* Receive packet information with datagram */
2146 rb_define_const(rb_mSockConst, "IPV6_PKTINFO", INTEGER2NUM(IPV6_PKTINFO));
2147 #endif
2148 #endif
2149 #if defined(INET6)
2150 #if defined(IPV6_RECVDSTOPTS)
2151 /* Receive all IP6 options for response */
2152 rb_define_const(rb_cSocket, "IPV6_RECVDSTOPTS", INTEGER2NUM(IPV6_RECVDSTOPTS));
2153 /* Receive all IP6 options for response */
2154 rb_define_const(rb_mSockConst, "IPV6_RECVDSTOPTS", INTEGER2NUM(IPV6_RECVDSTOPTS));
2155 #endif
2156 #endif
2157 #if defined(INET6)
2158 #if defined(IPV6_RECVHOPLIMIT)
2159 /* Receive hop limit with datagram */
2160 rb_define_const(rb_cSocket, "IPV6_RECVHOPLIMIT", INTEGER2NUM(IPV6_RECVHOPLIMIT));
2161 /* Receive hop limit with datagram */
2162 rb_define_const(rb_mSockConst, "IPV6_RECVHOPLIMIT", INTEGER2NUM(IPV6_RECVHOPLIMIT));
2163 #endif
2164 #endif
2165 #if defined(INET6)
2166 #if defined(IPV6_RECVHOPOPTS)
2167 /* Receive hop-by-hop options */
2168 rb_define_const(rb_cSocket, "IPV6_RECVHOPOPTS", INTEGER2NUM(IPV6_RECVHOPOPTS));
2169 /* Receive hop-by-hop options */
2170 rb_define_const(rb_mSockConst, "IPV6_RECVHOPOPTS", INTEGER2NUM(IPV6_RECVHOPOPTS));
2171 #endif
2172 #endif
2173 #if defined(INET6)
2174 #if defined(IPV6_RECVPKTINFO)
2175 /* Receive destination IP address and incoming interface */
2176 rb_define_const(rb_cSocket, "IPV6_RECVPKTINFO", INTEGER2NUM(IPV6_RECVPKTINFO));
2177 /* Receive destination IP address and incoming interface */
2178 rb_define_const(rb_mSockConst, "IPV6_RECVPKTINFO", INTEGER2NUM(IPV6_RECVPKTINFO));
2179 #endif
2180 #endif
2181 #if defined(INET6)
2182 #if defined(IPV6_RECVRTHDR)
2183 /* Receive routing header */
2184 rb_define_const(rb_cSocket, "IPV6_RECVRTHDR", INTEGER2NUM(IPV6_RECVRTHDR));
2185 /* Receive routing header */
2186 rb_define_const(rb_mSockConst, "IPV6_RECVRTHDR", INTEGER2NUM(IPV6_RECVRTHDR));
2187 #endif
2188 #endif
2189 #if defined(INET6)
2190 #if defined(IPV6_RECVTCLASS)
2191 /* Receive traffic class */
2192 rb_define_const(rb_cSocket, "IPV6_RECVTCLASS", INTEGER2NUM(IPV6_RECVTCLASS));
2193 /* Receive traffic class */
2194 rb_define_const(rb_mSockConst, "IPV6_RECVTCLASS", INTEGER2NUM(IPV6_RECVTCLASS));
2195 #endif
2196 #endif
2197 #if defined(INET6)
2198 #if defined(IPV6_RTHDR)
2199 /* Allows removal of sticky routing headers */
2200 rb_define_const(rb_cSocket, "IPV6_RTHDR", INTEGER2NUM(IPV6_RTHDR));
2201 /* Allows removal of sticky routing headers */
2202 rb_define_const(rb_mSockConst, "IPV6_RTHDR", INTEGER2NUM(IPV6_RTHDR));
2203 #endif
2204 #endif
2205 #if defined(INET6)
2206 #if defined(IPV6_RTHDRDSTOPTS)
2207 /* Allows removal of sticky destination options header */
2208 rb_define_const(rb_cSocket, "IPV6_RTHDRDSTOPTS", INTEGER2NUM(IPV6_RTHDRDSTOPTS));
2209 /* Allows removal of sticky destination options header */
2210 rb_define_const(rb_mSockConst, "IPV6_RTHDRDSTOPTS", INTEGER2NUM(IPV6_RTHDRDSTOPTS));
2211 #endif
2212 #endif
2213 #if defined(INET6)
2214 #if defined(IPV6_RTHDR_TYPE_0)
2215 /* Routing header type 0 */
2216 rb_define_const(rb_cSocket, "IPV6_RTHDR_TYPE_0", INTEGER2NUM(IPV6_RTHDR_TYPE_0));
2217 /* Routing header type 0 */
2218 rb_define_const(rb_mSockConst, "IPV6_RTHDR_TYPE_0", INTEGER2NUM(IPV6_RTHDR_TYPE_0));
2219 #endif
2220 #endif
2221 #if defined(INET6)
2222 #if defined(IPV6_RECVPATHMTU)
2223 /* Receive current path MTU with datagram */
2224 rb_define_const(rb_cSocket, "IPV6_RECVPATHMTU", INTEGER2NUM(IPV6_RECVPATHMTU));
2225 /* Receive current path MTU with datagram */
2226 rb_define_const(rb_mSockConst, "IPV6_RECVPATHMTU", INTEGER2NUM(IPV6_RECVPATHMTU));
2227 #endif
2228 #endif
2229 #if defined(INET6)
2230 #if defined(IPV6_TCLASS)
2231 /* Specify the traffic class */
2232 rb_define_const(rb_cSocket, "IPV6_TCLASS", INTEGER2NUM(IPV6_TCLASS));
2233 /* Specify the traffic class */
2234 rb_define_const(rb_mSockConst, "IPV6_TCLASS", INTEGER2NUM(IPV6_TCLASS));
2235 #endif
2236 #endif
2237 #if defined(INET6)
2238 #if defined(IPV6_USE_MIN_MTU)
2239 /* Use the minimum MTU size */
2240 rb_define_const(rb_cSocket, "IPV6_USE_MIN_MTU", INTEGER2NUM(IPV6_USE_MIN_MTU));
2241 /* Use the minimum MTU size */
2242 rb_define_const(rb_mSockConst, "IPV6_USE_MIN_MTU", INTEGER2NUM(IPV6_USE_MIN_MTU));
2243 #endif
2244 #endif
2245 #if defined(INET_ADDRSTRLEN)
2246 /* Maximum length of an IPv4 address string */
2247 rb_define_const(rb_cSocket, "INET_ADDRSTRLEN", INTEGER2NUM(INET_ADDRSTRLEN));
2248 /* Maximum length of an IPv4 address string */
2249 rb_define_const(rb_mSockConst, "INET_ADDRSTRLEN", INTEGER2NUM(INET_ADDRSTRLEN));
2250 #endif
2251 #if defined(INET6_ADDRSTRLEN)
2252 /* Maximum length of an IPv6 address string */
2253 rb_define_const(rb_cSocket, "INET6_ADDRSTRLEN", INTEGER2NUM(INET6_ADDRSTRLEN));
2254 /* Maximum length of an IPv6 address string */
2255 rb_define_const(rb_mSockConst, "INET6_ADDRSTRLEN", INTEGER2NUM(INET6_ADDRSTRLEN));
2256 #endif
2257 #if defined(IFNAMSIZ)
2258 /* Maximum interface name size */
2259 rb_define_const(rb_cSocket, "IFNAMSIZ", INTEGER2NUM(IFNAMSIZ));
2260 /* Maximum interface name size */
2261 rb_define_const(rb_mSockConst, "IFNAMSIZ", INTEGER2NUM(IFNAMSIZ));
2262 #endif
2263 #if defined(IF_NAMESIZE)
2264 /* Maximum interface name size */
2265 rb_define_const(rb_cSocket, "IF_NAMESIZE", INTEGER2NUM(IF_NAMESIZE));
2266 /* Maximum interface name size */
2267 rb_define_const(rb_mSockConst, "IF_NAMESIZE", INTEGER2NUM(IF_NAMESIZE));
2268 #endif
2269 #if defined(SOMAXCONN)
2270 /* Maximum connection requests that may be queued for a socket */
2271 rb_define_const(rb_cSocket, "SOMAXCONN", INTEGER2NUM(SOMAXCONN));
2272 /* Maximum connection requests that may be queued for a socket */
2273 rb_define_const(rb_mSockConst, "SOMAXCONN", INTEGER2NUM(SOMAXCONN));
2274 #endif
2275 #if defined(SCM_RIGHTS)
2276 /* Access rights */
2277 rb_define_const(rb_cSocket, "SCM_RIGHTS", INTEGER2NUM(SCM_RIGHTS));
2278 /* Access rights */
2279 rb_define_const(rb_mSockConst, "SCM_RIGHTS", INTEGER2NUM(SCM_RIGHTS));
2280 #endif
2281 #if defined(SCM_TIMESTAMP)
2282 /* Timestamp (timeval) */
2283 rb_define_const(rb_cSocket, "SCM_TIMESTAMP", INTEGER2NUM(SCM_TIMESTAMP));
2284 /* Timestamp (timeval) */
2285 rb_define_const(rb_mSockConst, "SCM_TIMESTAMP", INTEGER2NUM(SCM_TIMESTAMP));
2286 #endif
2287 #if defined(SCM_TIMESTAMPNS)
2288 /* Timespec (timespec) */
2289 rb_define_const(rb_cSocket, "SCM_TIMESTAMPNS", INTEGER2NUM(SCM_TIMESTAMPNS));
2290 /* Timespec (timespec) */
2291 rb_define_const(rb_mSockConst, "SCM_TIMESTAMPNS", INTEGER2NUM(SCM_TIMESTAMPNS));
2292 #endif
2293 #if defined(SCM_TIMESTAMPING)
2294 /* Timestamp (timespec list) (Linux 2.6.30) */
2295 rb_define_const(rb_cSocket, "SCM_TIMESTAMPING", INTEGER2NUM(SCM_TIMESTAMPING));
2296 /* Timestamp (timespec list) (Linux 2.6.30) */
2297 rb_define_const(rb_mSockConst, "SCM_TIMESTAMPING", INTEGER2NUM(SCM_TIMESTAMPING));
2298 #endif
2299 #if defined(SCM_BINTIME)
2300 /* Timestamp (bintime) */
2301 rb_define_const(rb_cSocket, "SCM_BINTIME", INTEGER2NUM(SCM_BINTIME));
2302 /* Timestamp (bintime) */
2303 rb_define_const(rb_mSockConst, "SCM_BINTIME", INTEGER2NUM(SCM_BINTIME));
2304 #endif
2305 #if defined(SCM_CREDENTIALS)
2306 /* The sender's credentials */
2307 rb_define_const(rb_cSocket, "SCM_CREDENTIALS", INTEGER2NUM(SCM_CREDENTIALS));
2308 /* The sender's credentials */
2309 rb_define_const(rb_mSockConst, "SCM_CREDENTIALS", INTEGER2NUM(SCM_CREDENTIALS));
2310 #endif
2311 #if defined(SCM_CREDS)
2312 /* Process credentials */
2313 rb_define_const(rb_cSocket, "SCM_CREDS", INTEGER2NUM(SCM_CREDS));
2314 /* Process credentials */
2315 rb_define_const(rb_mSockConst, "SCM_CREDS", INTEGER2NUM(SCM_CREDS));
2316 #endif
2317 #if defined(SCM_UCRED)
2318 /* User credentials */
2319 rb_define_const(rb_cSocket, "SCM_UCRED", INTEGER2NUM(SCM_UCRED));
2320 /* User credentials */
2321 rb_define_const(rb_mSockConst, "SCM_UCRED", INTEGER2NUM(SCM_UCRED));
2322 #endif
2323 #if defined(SCM_WIFI_STATUS)
2324 /* Wifi status (Linux 3.3) */
2325 rb_define_const(rb_cSocket, "SCM_WIFI_STATUS", INTEGER2NUM(SCM_WIFI_STATUS));
2326 /* Wifi status (Linux 3.3) */
2327 rb_define_const(rb_mSockConst, "SCM_WIFI_STATUS", INTEGER2NUM(SCM_WIFI_STATUS));
2328 #endif
2329 #if defined(LOCAL_PEERCRED)
2330 /* Retrieve peer credentials */
2331 rb_define_const(rb_cSocket, "LOCAL_PEERCRED", INTEGER2NUM(LOCAL_PEERCRED));
2332 /* Retrieve peer credentials */
2333 rb_define_const(rb_mSockConst, "LOCAL_PEERCRED", INTEGER2NUM(LOCAL_PEERCRED));
2334 #endif
2335 #if defined(LOCAL_CREDS)
2336 /* Pass credentials to receiver */
2337 rb_define_const(rb_cSocket, "LOCAL_CREDS", INTEGER2NUM(LOCAL_CREDS));
2338 /* Pass credentials to receiver */
2339 rb_define_const(rb_mSockConst, "LOCAL_CREDS", INTEGER2NUM(LOCAL_CREDS));
2340 #endif
2341 #if defined(LOCAL_CONNWAIT)
2342 /* Connect blocks until accepted */
2343 rb_define_const(rb_cSocket, "LOCAL_CONNWAIT", INTEGER2NUM(LOCAL_CONNWAIT));
2344 /* Connect blocks until accepted */
2345 rb_define_const(rb_mSockConst, "LOCAL_CONNWAIT", INTEGER2NUM(LOCAL_CONNWAIT));
2346 #endif
2347 #if defined(IFF_802_1Q_VLAN)
2348 /* 802.1Q VLAN device */
2349 rb_define_const(rb_cSocket, "IFF_802_1Q_VLAN", INTEGER2NUM(IFF_802_1Q_VLAN));
2350 /* 802.1Q VLAN device */
2351 rb_define_const(rb_mSockConst, "IFF_802_1Q_VLAN", INTEGER2NUM(IFF_802_1Q_VLAN));
2352 #endif
2353 #if defined(IFF_ALLMULTI)
2354 /* receive all multicast packets */
2355 rb_define_const(rb_cSocket, "IFF_ALLMULTI", INTEGER2NUM(IFF_ALLMULTI));
2356 /* receive all multicast packets */
2357 rb_define_const(rb_mSockConst, "IFF_ALLMULTI", INTEGER2NUM(IFF_ALLMULTI));
2358 #endif
2359 #if defined(IFF_ALTPHYS)
2360 /* use alternate physical connection */
2361 rb_define_const(rb_cSocket, "IFF_ALTPHYS", INTEGER2NUM(IFF_ALTPHYS));
2362 /* use alternate physical connection */
2363 rb_define_const(rb_mSockConst, "IFF_ALTPHYS", INTEGER2NUM(IFF_ALTPHYS));
2364 #endif
2365 #if defined(IFF_AUTOMEDIA)
2366 /* auto media select active */
2367 rb_define_const(rb_cSocket, "IFF_AUTOMEDIA", INTEGER2NUM(IFF_AUTOMEDIA));
2368 /* auto media select active */
2369 rb_define_const(rb_mSockConst, "IFF_AUTOMEDIA", INTEGER2NUM(IFF_AUTOMEDIA));
2370 #endif
2371 #if defined(IFF_BONDING)
2372 /* bonding master or slave */
2373 rb_define_const(rb_cSocket, "IFF_BONDING", INTEGER2NUM(IFF_BONDING));
2374 /* bonding master or slave */
2375 rb_define_const(rb_mSockConst, "IFF_BONDING", INTEGER2NUM(IFF_BONDING));
2376 #endif
2377 #if defined(IFF_BRIDGE_PORT)
2378 /* device used as bridge port */
2379 rb_define_const(rb_cSocket, "IFF_BRIDGE_PORT", INTEGER2NUM(IFF_BRIDGE_PORT));
2380 /* device used as bridge port */
2381 rb_define_const(rb_mSockConst, "IFF_BRIDGE_PORT", INTEGER2NUM(IFF_BRIDGE_PORT));
2382 #endif
2383 #if defined(IFF_BROADCAST)
2384 /* broadcast address valid */
2385 rb_define_const(rb_cSocket, "IFF_BROADCAST", INTEGER2NUM(IFF_BROADCAST));
2386 /* broadcast address valid */
2387 rb_define_const(rb_mSockConst, "IFF_BROADCAST", INTEGER2NUM(IFF_BROADCAST));
2388 #endif
2389 #if defined(IFF_CANTCONFIG)
2390 /* unconfigurable using ioctl(2) */
2391 rb_define_const(rb_cSocket, "IFF_CANTCONFIG", INTEGER2NUM(IFF_CANTCONFIG));
2392 /* unconfigurable using ioctl(2) */
2393 rb_define_const(rb_mSockConst, "IFF_CANTCONFIG", INTEGER2NUM(IFF_CANTCONFIG));
2394 #endif
2395 #if defined(IFF_DEBUG)
2396 /* turn on debugging */
2397 rb_define_const(rb_cSocket, "IFF_DEBUG", INTEGER2NUM(IFF_DEBUG));
2398 /* turn on debugging */
2399 rb_define_const(rb_mSockConst, "IFF_DEBUG", INTEGER2NUM(IFF_DEBUG));
2400 #endif
2401 #if defined(IFF_DISABLE_NETPOLL)
2402 /* disable netpoll at run-time */
2403 rb_define_const(rb_cSocket, "IFF_DISABLE_NETPOLL", INTEGER2NUM(IFF_DISABLE_NETPOLL));
2404 /* disable netpoll at run-time */
2405 rb_define_const(rb_mSockConst, "IFF_DISABLE_NETPOLL", INTEGER2NUM(IFF_DISABLE_NETPOLL));
2406 #endif
2407 #if defined(IFF_DONT_BRIDGE)
2408 /* disallow bridging this ether dev */
2409 rb_define_const(rb_cSocket, "IFF_DONT_BRIDGE", INTEGER2NUM(IFF_DONT_BRIDGE));
2410 /* disallow bridging this ether dev */
2411 rb_define_const(rb_mSockConst, "IFF_DONT_BRIDGE", INTEGER2NUM(IFF_DONT_BRIDGE));
2412 #endif
2413 #if defined(IFF_DORMANT)
2414 /* driver signals dormant */
2415 rb_define_const(rb_cSocket, "IFF_DORMANT", INTEGER2NUM(IFF_DORMANT));
2416 /* driver signals dormant */
2417 rb_define_const(rb_mSockConst, "IFF_DORMANT", INTEGER2NUM(IFF_DORMANT));
2418 #endif
2419 #if defined(IFF_DRV_OACTIVE)
2420 /* tx hardware queue is full */
2421 rb_define_const(rb_cSocket, "IFF_DRV_OACTIVE", INTEGER2NUM(IFF_DRV_OACTIVE));
2422 /* tx hardware queue is full */
2423 rb_define_const(rb_mSockConst, "IFF_DRV_OACTIVE", INTEGER2NUM(IFF_DRV_OACTIVE));
2424 #endif
2425 #if defined(IFF_DRV_RUNNING)
2426 /* resources allocated */
2427 rb_define_const(rb_cSocket, "IFF_DRV_RUNNING", INTEGER2NUM(IFF_DRV_RUNNING));
2428 /* resources allocated */
2429 rb_define_const(rb_mSockConst, "IFF_DRV_RUNNING", INTEGER2NUM(IFF_DRV_RUNNING));
2430 #endif
2431 #if defined(IFF_DYING)
2432 /* interface is winding down */
2433 rb_define_const(rb_cSocket, "IFF_DYING", INTEGER2NUM(IFF_DYING));
2434 /* interface is winding down */
2435 rb_define_const(rb_mSockConst, "IFF_DYING", INTEGER2NUM(IFF_DYING));
2436 #endif
2437 #if defined(IFF_DYNAMIC)
2438 /* dialup device with changing addresses */
2439 rb_define_const(rb_cSocket, "IFF_DYNAMIC", INTEGER2NUM(IFF_DYNAMIC));
2440 /* dialup device with changing addresses */
2441 rb_define_const(rb_mSockConst, "IFF_DYNAMIC", INTEGER2NUM(IFF_DYNAMIC));
2442 #endif
2443 #if defined(IFF_EBRIDGE)
2444 /* ethernet bridging device */
2445 rb_define_const(rb_cSocket, "IFF_EBRIDGE", INTEGER2NUM(IFF_EBRIDGE));
2446 /* ethernet bridging device */
2447 rb_define_const(rb_mSockConst, "IFF_EBRIDGE", INTEGER2NUM(IFF_EBRIDGE));
2448 #endif
2449 #if defined(IFF_ECHO)
2450 /* echo sent packets */
2451 rb_define_const(rb_cSocket, "IFF_ECHO", INTEGER2NUM(IFF_ECHO));
2452 /* echo sent packets */
2453 rb_define_const(rb_mSockConst, "IFF_ECHO", INTEGER2NUM(IFF_ECHO));
2454 #endif
2455 #if defined(IFF_ISATAP)
2456 /* ISATAP interface (RFC4214) */
2457 rb_define_const(rb_cSocket, "IFF_ISATAP", INTEGER2NUM(IFF_ISATAP));
2458 /* ISATAP interface (RFC4214) */
2459 rb_define_const(rb_mSockConst, "IFF_ISATAP", INTEGER2NUM(IFF_ISATAP));
2460 #endif
2461 #if defined(IFF_LINK0)
2462 /* per link layer defined bit 0 */
2463 rb_define_const(rb_cSocket, "IFF_LINK0", INTEGER2NUM(IFF_LINK0));
2464 /* per link layer defined bit 0 */
2465 rb_define_const(rb_mSockConst, "IFF_LINK0", INTEGER2NUM(IFF_LINK0));
2466 #endif
2467 #if defined(IFF_LINK1)
2468 /* per link layer defined bit 1 */
2469 rb_define_const(rb_cSocket, "IFF_LINK1", INTEGER2NUM(IFF_LINK1));
2470 /* per link layer defined bit 1 */
2471 rb_define_const(rb_mSockConst, "IFF_LINK1", INTEGER2NUM(IFF_LINK1));
2472 #endif
2473 #if defined(IFF_LINK2)
2474 /* per link layer defined bit 2 */
2475 rb_define_const(rb_cSocket, "IFF_LINK2", INTEGER2NUM(IFF_LINK2));
2476 /* per link layer defined bit 2 */
2477 rb_define_const(rb_mSockConst, "IFF_LINK2", INTEGER2NUM(IFF_LINK2));
2478 #endif
2479 #if defined(IFF_LIVE_ADDR_CHANGE)
2480 /* hardware address change when it's running */
2481 rb_define_const(rb_cSocket, "IFF_LIVE_ADDR_CHANGE", INTEGER2NUM(IFF_LIVE_ADDR_CHANGE));
2482 /* hardware address change when it's running */
2483 rb_define_const(rb_mSockConst, "IFF_LIVE_ADDR_CHANGE", INTEGER2NUM(IFF_LIVE_ADDR_CHANGE));
2484 #endif
2485 #if defined(IFF_LOOPBACK)
2486 /* loopback net */
2487 rb_define_const(rb_cSocket, "IFF_LOOPBACK", INTEGER2NUM(IFF_LOOPBACK));
2488 /* loopback net */
2489 rb_define_const(rb_mSockConst, "IFF_LOOPBACK", INTEGER2NUM(IFF_LOOPBACK));
2490 #endif
2491 #if defined(IFF_LOWER_UP)
2492 /* driver signals L1 up */
2493 rb_define_const(rb_cSocket, "IFF_LOWER_UP", INTEGER2NUM(IFF_LOWER_UP));
2494 /* driver signals L1 up */
2495 rb_define_const(rb_mSockConst, "IFF_LOWER_UP", INTEGER2NUM(IFF_LOWER_UP));
2496 #endif
2497 #if defined(IFF_MACVLAN_PORT)
2498 /* device used as macvlan port */
2499 rb_define_const(rb_cSocket, "IFF_MACVLAN_PORT", INTEGER2NUM(IFF_MACVLAN_PORT));
2500 /* device used as macvlan port */
2501 rb_define_const(rb_mSockConst, "IFF_MACVLAN_PORT", INTEGER2NUM(IFF_MACVLAN_PORT));
2502 #endif
2503 #if defined(IFF_MASTER)
2504 /* master of a load balancer */
2505 rb_define_const(rb_cSocket, "IFF_MASTER", INTEGER2NUM(IFF_MASTER));
2506 /* master of a load balancer */
2507 rb_define_const(rb_mSockConst, "IFF_MASTER", INTEGER2NUM(IFF_MASTER));
2508 #endif
2509 #if defined(IFF_MASTER_8023AD)
2510 /* bonding master, 802.3ad. */
2511 rb_define_const(rb_cSocket, "IFF_MASTER_8023AD", INTEGER2NUM(IFF_MASTER_8023AD));
2512 /* bonding master, 802.3ad. */
2513 rb_define_const(rb_mSockConst, "IFF_MASTER_8023AD", INTEGER2NUM(IFF_MASTER_8023AD));
2514 #endif
2515 #if defined(IFF_MASTER_ALB)
2516 /* bonding master, balance-alb. */
2517 rb_define_const(rb_cSocket, "IFF_MASTER_ALB", INTEGER2NUM(IFF_MASTER_ALB));
2518 /* bonding master, balance-alb. */
2519 rb_define_const(rb_mSockConst, "IFF_MASTER_ALB", INTEGER2NUM(IFF_MASTER_ALB));
2520 #endif
2521 #if defined(IFF_MASTER_ARPMON)
2522 /* bonding master, ARP mon in use */
2523 rb_define_const(rb_cSocket, "IFF_MASTER_ARPMON", INTEGER2NUM(IFF_MASTER_ARPMON));
2524 /* bonding master, ARP mon in use */
2525 rb_define_const(rb_mSockConst, "IFF_MASTER_ARPMON", INTEGER2NUM(IFF_MASTER_ARPMON));
2526 #endif
2527 #if defined(IFF_MONITOR)
2528 /* user-requested monitor mode */
2529 rb_define_const(rb_cSocket, "IFF_MONITOR", INTEGER2NUM(IFF_MONITOR));
2530 /* user-requested monitor mode */
2531 rb_define_const(rb_mSockConst, "IFF_MONITOR", INTEGER2NUM(IFF_MONITOR));
2532 #endif
2533 #if defined(IFF_MULTICAST)
2534 /* supports multicast */
2535 rb_define_const(rb_cSocket, "IFF_MULTICAST", INTEGER2NUM(IFF_MULTICAST));
2536 /* supports multicast */
2537 rb_define_const(rb_mSockConst, "IFF_MULTICAST", INTEGER2NUM(IFF_MULTICAST));
2538 #endif
2539 #if defined(IFF_NOARP)
2540 /* no address resolution protocol */
2541 rb_define_const(rb_cSocket, "IFF_NOARP", INTEGER2NUM(IFF_NOARP));
2542 /* no address resolution protocol */
2543 rb_define_const(rb_mSockConst, "IFF_NOARP", INTEGER2NUM(IFF_NOARP));
2544 #endif
2545 #if defined(IFF_NOTRAILERS)
2546 /* avoid use of trailers */
2547 rb_define_const(rb_cSocket, "IFF_NOTRAILERS", INTEGER2NUM(IFF_NOTRAILERS));
2548 /* avoid use of trailers */
2549 rb_define_const(rb_mSockConst, "IFF_NOTRAILERS", INTEGER2NUM(IFF_NOTRAILERS));
2550 #endif
2551 #if defined(IFF_OACTIVE)
2552 /* transmission in progress */
2553 rb_define_const(rb_cSocket, "IFF_OACTIVE", INTEGER2NUM(IFF_OACTIVE));
2554 /* transmission in progress */
2555 rb_define_const(rb_mSockConst, "IFF_OACTIVE", INTEGER2NUM(IFF_OACTIVE));
2556 #endif
2557 #if defined(IFF_OVS_DATAPATH)
2558 /* device used as Open vSwitch datapath port */
2559 rb_define_const(rb_cSocket, "IFF_OVS_DATAPATH", INTEGER2NUM(IFF_OVS_DATAPATH));
2560 /* device used as Open vSwitch datapath port */
2561 rb_define_const(rb_mSockConst, "IFF_OVS_DATAPATH", INTEGER2NUM(IFF_OVS_DATAPATH));
2562 #endif
2563 #if defined(IFF_POINTOPOINT)
2564 /* point-to-point link */
2565 rb_define_const(rb_cSocket, "IFF_POINTOPOINT", INTEGER2NUM(IFF_POINTOPOINT));
2566 /* point-to-point link */
2567 rb_define_const(rb_mSockConst, "IFF_POINTOPOINT", INTEGER2NUM(IFF_POINTOPOINT));
2568 #endif
2569 #if defined(IFF_PORTSEL)
2570 /* can set media type */
2571 rb_define_const(rb_cSocket, "IFF_PORTSEL", INTEGER2NUM(IFF_PORTSEL));
2572 /* can set media type */
2573 rb_define_const(rb_mSockConst, "IFF_PORTSEL", INTEGER2NUM(IFF_PORTSEL));
2574 #endif
2575 #if defined(IFF_PPROMISC)
2576 /* user-requested promisc mode */
2577 rb_define_const(rb_cSocket, "IFF_PPROMISC", INTEGER2NUM(IFF_PPROMISC));
2578 /* user-requested promisc mode */
2579 rb_define_const(rb_mSockConst, "IFF_PPROMISC", INTEGER2NUM(IFF_PPROMISC));
2580 #endif
2581 #if defined(IFF_PROMISC)
2582 /* receive all packets */
2583 rb_define_const(rb_cSocket, "IFF_PROMISC", INTEGER2NUM(IFF_PROMISC));
2584 /* receive all packets */
2585 rb_define_const(rb_mSockConst, "IFF_PROMISC", INTEGER2NUM(IFF_PROMISC));
2586 #endif
2587 #if defined(IFF_RENAMING)
2588 /* interface is being renamed */
2589 rb_define_const(rb_cSocket, "IFF_RENAMING", INTEGER2NUM(IFF_RENAMING));
2590 /* interface is being renamed */
2591 rb_define_const(rb_mSockConst, "IFF_RENAMING", INTEGER2NUM(IFF_RENAMING));
2592 #endif
2593 #if defined(IFF_ROUTE)
2594 /* routing entry installed */
2595 rb_define_const(rb_cSocket, "IFF_ROUTE", INTEGER2NUM(IFF_ROUTE));
2596 /* routing entry installed */
2597 rb_define_const(rb_mSockConst, "IFF_ROUTE", INTEGER2NUM(IFF_ROUTE));
2598 #endif
2599 #if defined(IFF_RUNNING)
2600 /* resources allocated */
2601 rb_define_const(rb_cSocket, "IFF_RUNNING", INTEGER2NUM(IFF_RUNNING));
2602 /* resources allocated */
2603 rb_define_const(rb_mSockConst, "IFF_RUNNING", INTEGER2NUM(IFF_RUNNING));
2604 #endif
2605 #if defined(IFF_SIMPLEX)
2606 /* can't hear own transmissions */
2607 rb_define_const(rb_cSocket, "IFF_SIMPLEX", INTEGER2NUM(IFF_SIMPLEX));
2608 /* can't hear own transmissions */
2609 rb_define_const(rb_mSockConst, "IFF_SIMPLEX", INTEGER2NUM(IFF_SIMPLEX));
2610 #endif
2611 #if defined(IFF_SLAVE)
2612 /* slave of a load balancer */
2613 rb_define_const(rb_cSocket, "IFF_SLAVE", INTEGER2NUM(IFF_SLAVE));
2614 /* slave of a load balancer */
2615 rb_define_const(rb_mSockConst, "IFF_SLAVE", INTEGER2NUM(IFF_SLAVE));
2616 #endif
2617 #if defined(IFF_SLAVE_INACTIVE)
2618 /* bonding slave not the curr. active */
2619 rb_define_const(rb_cSocket, "IFF_SLAVE_INACTIVE", INTEGER2NUM(IFF_SLAVE_INACTIVE));
2620 /* bonding slave not the curr. active */
2621 rb_define_const(rb_mSockConst, "IFF_SLAVE_INACTIVE", INTEGER2NUM(IFF_SLAVE_INACTIVE));
2622 #endif
2623 #if defined(IFF_SLAVE_NEEDARP)
2624 /* need ARPs for validation */
2625 rb_define_const(rb_cSocket, "IFF_SLAVE_NEEDARP", INTEGER2NUM(IFF_SLAVE_NEEDARP));
2626 /* need ARPs for validation */
2627 rb_define_const(rb_mSockConst, "IFF_SLAVE_NEEDARP", INTEGER2NUM(IFF_SLAVE_NEEDARP));
2628 #endif
2629 #if defined(IFF_SMART)
2630 /* interface manages own routes */
2631 rb_define_const(rb_cSocket, "IFF_SMART", INTEGER2NUM(IFF_SMART));
2632 /* interface manages own routes */
2633 rb_define_const(rb_mSockConst, "IFF_SMART", INTEGER2NUM(IFF_SMART));
2634 #endif
2635 #if defined(IFF_STATICARP)
2636 /* static ARP */
2637 rb_define_const(rb_cSocket, "IFF_STATICARP", INTEGER2NUM(IFF_STATICARP));
2638 /* static ARP */
2639 rb_define_const(rb_mSockConst, "IFF_STATICARP", INTEGER2NUM(IFF_STATICARP));
2640 #endif
2641 #if defined(IFF_SUPP_NOFCS)
2642 /* sending custom FCS */
2643 rb_define_const(rb_cSocket, "IFF_SUPP_NOFCS", INTEGER2NUM(IFF_SUPP_NOFCS));
2644 /* sending custom FCS */
2645 rb_define_const(rb_mSockConst, "IFF_SUPP_NOFCS", INTEGER2NUM(IFF_SUPP_NOFCS));
2646 #endif
2647 #if defined(IFF_TEAM_PORT)
2648 /* used as team port */
2649 rb_define_const(rb_cSocket, "IFF_TEAM_PORT", INTEGER2NUM(IFF_TEAM_PORT));
2650 /* used as team port */
2651 rb_define_const(rb_mSockConst, "IFF_TEAM_PORT", INTEGER2NUM(IFF_TEAM_PORT));
2652 #endif
2653 #if defined(IFF_TX_SKB_SHARING)
2654 /* sharing skbs on transmit */
2655 rb_define_const(rb_cSocket, "IFF_TX_SKB_SHARING", INTEGER2NUM(IFF_TX_SKB_SHARING));
2656 /* sharing skbs on transmit */
2657 rb_define_const(rb_mSockConst, "IFF_TX_SKB_SHARING", INTEGER2NUM(IFF_TX_SKB_SHARING));
2658 #endif
2659 #if defined(IFF_UNICAST_FLT)
2660 /* unicast filtering */
2661 rb_define_const(rb_cSocket, "IFF_UNICAST_FLT", INTEGER2NUM(IFF_UNICAST_FLT));
2662 /* unicast filtering */
2663 rb_define_const(rb_mSockConst, "IFF_UNICAST_FLT", INTEGER2NUM(IFF_UNICAST_FLT));
2664 #endif
2665 #if defined(IFF_UP)
2666 /* interface is up */
2667 rb_define_const(rb_cSocket, "IFF_UP", INTEGER2NUM(IFF_UP));
2668 /* interface is up */
2669 rb_define_const(rb_mSockConst, "IFF_UP", INTEGER2NUM(IFF_UP));
2670 #endif
2671 #if defined(IFF_WAN_HDLC)
2672 /* WAN HDLC device */
2673 rb_define_const(rb_cSocket, "IFF_WAN_HDLC", INTEGER2NUM(IFF_WAN_HDLC));
2674 /* WAN HDLC device */
2675 rb_define_const(rb_mSockConst, "IFF_WAN_HDLC", INTEGER2NUM(IFF_WAN_HDLC));
2676 #endif
2677 #if defined(IFF_XMIT_DST_RELEASE)
2678 /* dev_hard_start_xmit() is allowed to release skb->dst */
2679 rb_define_const(rb_cSocket, "IFF_XMIT_DST_RELEASE", INTEGER2NUM(IFF_XMIT_DST_RELEASE));
2680 /* dev_hard_start_xmit() is allowed to release skb->dst */
2681 rb_define_const(rb_mSockConst, "IFF_XMIT_DST_RELEASE", INTEGER2NUM(IFF_XMIT_DST_RELEASE));
2682 #endif
2683 #if defined(IFF_VOLATILE)
2684 /* volatile flags */
2685 rb_define_const(rb_cSocket, "IFF_VOLATILE", INTEGER2NUM(IFF_VOLATILE));
2686 /* volatile flags */
2687 rb_define_const(rb_mSockConst, "IFF_VOLATILE", INTEGER2NUM(IFF_VOLATILE));
2688 #endif
2689 #if defined(IFF_CANTCHANGE)
2690 /* flags not changeable */
2691 rb_define_const(rb_cSocket, "IFF_CANTCHANGE", INTEGER2NUM(IFF_CANTCHANGE));
2692 /* flags not changeable */
2693 rb_define_const(rb_mSockConst, "IFF_CANTCHANGE", INTEGER2NUM(IFF_CANTCHANGE));
2694 #endif
2695
2696 rsock_intern_family_hash = st_init_numtable();
2697 #ifdef AF_E164
2698 st_insert(rsock_intern_family_hash, (st_data_t)AF_E164, (st_data_t)rb_intern2("AF_E164", 7));
2699 #endif
2700 #ifdef AF_PACKET
2701 st_insert(rsock_intern_family_hash, (st_data_t)AF_PACKET, (st_data_t)rb_intern2("AF_PACKET", 9));
2702 #endif
2703 #ifdef AF_MAX
2704 st_insert(rsock_intern_family_hash, (st_data_t)AF_MAX, (st_data_t)rb_intern2("AF_MAX", 6));
2705 #endif
2706 #ifdef AF_NETGRAPH
2707 st_insert(rsock_intern_family_hash, (st_data_t)AF_NETGRAPH, (st_data_t)rb_intern2("AF_NETGRAPH", 11));
2708 #endif
2709 #ifdef AF_ATM
2710 st_insert(rsock_intern_family_hash, (st_data_t)AF_ATM, (st_data_t)rb_intern2("AF_ATM", 6));
2711 #endif
2712 #ifdef AF_PPP
2713 st_insert(rsock_intern_family_hash, (st_data_t)AF_PPP, (st_data_t)rb_intern2("AF_PPP", 6));
2714 #endif
2715 #ifdef AF_NETBIOS
2716 st_insert(rsock_intern_family_hash, (st_data_t)AF_NETBIOS, (st_data_t)rb_intern2("AF_NETBIOS", 10));
2717 #endif
2718 #ifdef AF_SYSTEM
2719 st_insert(rsock_intern_family_hash, (st_data_t)AF_SYSTEM, (st_data_t)rb_intern2("AF_SYSTEM", 9));
2720 #endif
2721 #ifdef AF_NATM
2722 st_insert(rsock_intern_family_hash, (st_data_t)AF_NATM, (st_data_t)rb_intern2("AF_NATM", 7));
2723 #endif
2724 #ifdef AF_ISDN
2725 st_insert(rsock_intern_family_hash, (st_data_t)AF_ISDN, (st_data_t)rb_intern2("AF_ISDN", 7));
2726 #endif
2727 #ifdef AF_NDRV
2728 st_insert(rsock_intern_family_hash, (st_data_t)AF_NDRV, (st_data_t)rb_intern2("AF_NDRV", 7));
2729 #endif
2730 #ifdef AF_SIP
2731 st_insert(rsock_intern_family_hash, (st_data_t)AF_SIP, (st_data_t)rb_intern2("AF_SIP", 6));
2732 #endif
2733 #ifdef AF_CNT
2734 st_insert(rsock_intern_family_hash, (st_data_t)AF_CNT, (st_data_t)rb_intern2("AF_CNT", 6));
2735 #endif
2736 #ifdef AF_COIP
2737 st_insert(rsock_intern_family_hash, (st_data_t)AF_COIP, (st_data_t)rb_intern2("AF_COIP", 7));
2738 #endif
2739 #ifdef AF_LINK
2740 st_insert(rsock_intern_family_hash, (st_data_t)AF_LINK, (st_data_t)rb_intern2("AF_LINK", 7));
2741 #endif
2742 #ifdef AF_ROUTE
2743 st_insert(rsock_intern_family_hash, (st_data_t)AF_ROUTE, (st_data_t)rb_intern2("AF_ROUTE", 8));
2744 #endif
2745 #ifdef AF_HYLINK
2746 st_insert(rsock_intern_family_hash, (st_data_t)AF_HYLINK, (st_data_t)rb_intern2("AF_HYLINK", 9));
2747 #endif
2748 #ifdef AF_LAT
2749 st_insert(rsock_intern_family_hash, (st_data_t)AF_LAT, (st_data_t)rb_intern2("AF_LAT", 6));
2750 #endif
2751 #ifdef AF_DLI
2752 st_insert(rsock_intern_family_hash, (st_data_t)AF_DLI, (st_data_t)rb_intern2("AF_DLI", 6));
2753 #endif
2754 #ifdef AF_DEC
2755 st_insert(rsock_intern_family_hash, (st_data_t)AF_DEC, (st_data_t)rb_intern2("AF_DEC", 6));
2756 #endif
2757 #ifdef AF_SNA
2758 st_insert(rsock_intern_family_hash, (st_data_t)AF_SNA, (st_data_t)rb_intern2("AF_SNA", 6));
2759 #endif
2760 #ifdef AF_CCITT
2761 st_insert(rsock_intern_family_hash, (st_data_t)AF_CCITT, (st_data_t)rb_intern2("AF_CCITT", 8));
2762 #endif
2763 #ifdef AF_DATAKIT
2764 st_insert(rsock_intern_family_hash, (st_data_t)AF_DATAKIT, (st_data_t)rb_intern2("AF_DATAKIT", 10));
2765 #endif
2766 #ifdef AF_ECMA
2767 st_insert(rsock_intern_family_hash, (st_data_t)AF_ECMA, (st_data_t)rb_intern2("AF_ECMA", 7));
2768 #endif
2769 #ifdef AF_OSI
2770 st_insert(rsock_intern_family_hash, (st_data_t)AF_OSI, (st_data_t)rb_intern2("AF_OSI", 6));
2771 #endif
2772 #ifdef AF_ISO
2773 st_insert(rsock_intern_family_hash, (st_data_t)AF_ISO, (st_data_t)rb_intern2("AF_ISO", 6));
2774 #endif
2775 #ifdef AF_NS
2776 st_insert(rsock_intern_family_hash, (st_data_t)AF_NS, (st_data_t)rb_intern2("AF_NS", 5));
2777 #endif
2778 #ifdef AF_CHAOS
2779 st_insert(rsock_intern_family_hash, (st_data_t)AF_CHAOS, (st_data_t)rb_intern2("AF_CHAOS", 8));
2780 #endif
2781 #ifdef AF_PUP
2782 st_insert(rsock_intern_family_hash, (st_data_t)AF_PUP, (st_data_t)rb_intern2("AF_PUP", 6));
2783 #endif
2784 #ifdef AF_IMPLINK
2785 st_insert(rsock_intern_family_hash, (st_data_t)AF_IMPLINK, (st_data_t)rb_intern2("AF_IMPLINK", 10));
2786 #endif
2787 #ifdef AF_LOCAL
2788 st_insert(rsock_intern_family_hash, (st_data_t)AF_LOCAL, (st_data_t)rb_intern2("AF_LOCAL", 8));
2789 #endif
2790 #ifdef AF_APPLETALK
2791 st_insert(rsock_intern_family_hash, (st_data_t)AF_APPLETALK, (st_data_t)rb_intern2("AF_APPLETALK", 12));
2792 #endif
2793 #ifdef AF_IPX
2794 st_insert(rsock_intern_family_hash, (st_data_t)AF_IPX, (st_data_t)rb_intern2("AF_IPX", 6));
2795 #endif
2796 #ifdef AF_AX25
2797 st_insert(rsock_intern_family_hash, (st_data_t)AF_AX25, (st_data_t)rb_intern2("AF_AX25", 7));
2798 #endif
2799 #ifdef AF_UNIX
2800 st_insert(rsock_intern_family_hash, (st_data_t)AF_UNIX, (st_data_t)rb_intern2("AF_UNIX", 7));
2801 #endif
2802 #ifdef AF_INET6
2803 st_insert(rsock_intern_family_hash, (st_data_t)AF_INET6, (st_data_t)rb_intern2("AF_INET6", 8));
2804 #endif
2805 #ifdef AF_INET
2806 st_insert(rsock_intern_family_hash, (st_data_t)AF_INET, (st_data_t)rb_intern2("AF_INET", 7));
2807 #endif
2808 #ifdef AF_UNSPEC
2809 st_insert(rsock_intern_family_hash, (st_data_t)AF_UNSPEC, (st_data_t)rb_intern2("AF_UNSPEC", 9));
2810 #endif
2811
2812 rsock_intern_family_noprefix_hash = st_init_numtable();
2813 #ifdef AF_E164
2814 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_E164, (st_data_t)rb_intern2("AF_E164", 7));
2815 #endif
2816 #ifdef AF_PACKET
2817 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PACKET, (st_data_t)rb_intern2("AF_PACKET", 9));
2818 #endif
2819 #ifdef AF_MAX
2820 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_MAX, (st_data_t)rb_intern2("AF_MAX", 6));
2821 #endif
2822 #ifdef AF_NETGRAPH
2823 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NETGRAPH, (st_data_t)rb_intern2("AF_NETGRAPH", 11));
2824 #endif
2825 #ifdef AF_ATM
2826 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ATM, (st_data_t)rb_intern2("AF_ATM", 6));
2827 #endif
2828 #ifdef AF_PPP
2829 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PPP, (st_data_t)rb_intern2("AF_PPP", 6));
2830 #endif
2831 #ifdef AF_NETBIOS
2832 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NETBIOS, (st_data_t)rb_intern2("AF_NETBIOS", 10));
2833 #endif
2834 #ifdef AF_SYSTEM
2835 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SYSTEM, (st_data_t)rb_intern2("AF_SYSTEM", 9));
2836 #endif
2837 #ifdef AF_NATM
2838 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NATM, (st_data_t)rb_intern2("AF_NATM", 7));
2839 #endif
2840 #ifdef AF_ISDN
2841 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ISDN, (st_data_t)rb_intern2("AF_ISDN", 7));
2842 #endif
2843 #ifdef AF_NDRV
2844 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NDRV, (st_data_t)rb_intern2("AF_NDRV", 7));
2845 #endif
2846 #ifdef AF_SIP
2847 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SIP, (st_data_t)rb_intern2("AF_SIP", 6));
2848 #endif
2849 #ifdef AF_CNT
2850 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CNT, (st_data_t)rb_intern2("AF_CNT", 6));
2851 #endif
2852 #ifdef AF_COIP
2853 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_COIP, (st_data_t)rb_intern2("AF_COIP", 7));
2854 #endif
2855 #ifdef AF_LINK
2856 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LINK, (st_data_t)rb_intern2("AF_LINK", 7));
2857 #endif
2858 #ifdef AF_ROUTE
2859 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ROUTE, (st_data_t)rb_intern2("AF_ROUTE", 8));
2860 #endif
2861 #ifdef AF_HYLINK
2862 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_HYLINK, (st_data_t)rb_intern2("AF_HYLINK", 9));
2863 #endif
2864 #ifdef AF_LAT
2865 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LAT, (st_data_t)rb_intern2("AF_LAT", 6));
2866 #endif
2867 #ifdef AF_DLI
2868 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DLI, (st_data_t)rb_intern2("AF_DLI", 6));
2869 #endif
2870 #ifdef AF_DEC
2871 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DEC, (st_data_t)rb_intern2("AF_DEC", 6));
2872 #endif
2873 #ifdef AF_SNA
2874 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SNA, (st_data_t)rb_intern2("AF_SNA", 6));
2875 #endif
2876 #ifdef AF_CCITT
2877 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CCITT, (st_data_t)rb_intern2("AF_CCITT", 8));
2878 #endif
2879 #ifdef AF_DATAKIT
2880 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DATAKIT, (st_data_t)rb_intern2("AF_DATAKIT", 10));
2881 #endif
2882 #ifdef AF_ECMA
2883 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ECMA, (st_data_t)rb_intern2("AF_ECMA", 7));
2884 #endif
2885 #ifdef AF_OSI
2886 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_OSI, (st_data_t)rb_intern2("AF_OSI", 6));
2887 #endif
2888 #ifdef AF_ISO
2889 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ISO, (st_data_t)rb_intern2("AF_ISO", 6));
2890 #endif
2891 #ifdef AF_NS
2892 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NS, (st_data_t)rb_intern2("AF_NS", 5));
2893 #endif
2894 #ifdef AF_CHAOS
2895 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CHAOS, (st_data_t)rb_intern2("AF_CHAOS", 8));
2896 #endif
2897 #ifdef AF_PUP
2898 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PUP, (st_data_t)rb_intern2("AF_PUP", 6));
2899 #endif
2900 #ifdef AF_IMPLINK
2901 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_IMPLINK, (st_data_t)rb_intern2("AF_IMPLINK", 10));
2902 #endif
2903 #ifdef AF_LOCAL
2904 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LOCAL, (st_data_t)rb_intern2("AF_LOCAL", 8));
2905 #endif
2906 #ifdef AF_APPLETALK
2907 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_APPLETALK, (st_data_t)rb_intern2("AF_APPLETALK", 12));
2908 #endif
2909 #ifdef AF_IPX
2910 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_IPX, (st_data_t)rb_intern2("AF_IPX", 6));
2911 #endif
2912 #ifdef AF_AX25
2913 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_AX25, (st_data_t)rb_intern2("AF_AX25", 7));
2914 #endif
2915 #ifdef AF_UNIX
2916 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_UNIX, (st_data_t)rb_intern2("AF_UNIX", 7));
2917 #endif
2918 #ifdef AF_INET6
2919 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_INET6, (st_data_t)rb_intern2("AF_INET6", 8));
2920 #endif
2921 #ifdef AF_INET
2922 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_INET, (st_data_t)rb_intern2("AF_INET", 7));
2923 #endif
2924 #ifdef AF_UNSPEC
2925 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_UNSPEC, (st_data_t)rb_intern2("AF_UNSPEC", 9));
2926 #endif
2927 #ifdef AF_E164
2928 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_E164, (st_data_t)rb_intern2("E164", 4));
2929 #endif
2930 #ifdef AF_PACKET
2931 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PACKET, (st_data_t)rb_intern2("PACKET", 6));
2932 #endif
2933 #ifdef AF_MAX
2934 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_MAX, (st_data_t)rb_intern2("MAX", 3));
2935 #endif
2936 #ifdef AF_NETGRAPH
2937 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NETGRAPH, (st_data_t)rb_intern2("NETGRAPH", 8));
2938 #endif
2939 #ifdef AF_ATM
2940 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ATM, (st_data_t)rb_intern2("ATM", 3));
2941 #endif
2942 #ifdef AF_PPP
2943 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PPP, (st_data_t)rb_intern2("PPP", 3));
2944 #endif
2945 #ifdef AF_NETBIOS
2946 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NETBIOS, (st_data_t)rb_intern2("NETBIOS", 7));
2947 #endif
2948 #ifdef AF_SYSTEM
2949 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SYSTEM, (st_data_t)rb_intern2("SYSTEM", 6));
2950 #endif
2951 #ifdef AF_NATM
2952 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NATM, (st_data_t)rb_intern2("NATM", 4));
2953 #endif
2954 #ifdef AF_ISDN
2955 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ISDN, (st_data_t)rb_intern2("ISDN", 4));
2956 #endif
2957 #ifdef AF_NDRV
2958 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NDRV, (st_data_t)rb_intern2("NDRV", 4));
2959 #endif
2960 #ifdef AF_SIP
2961 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SIP, (st_data_t)rb_intern2("SIP", 3));
2962 #endif
2963 #ifdef AF_CNT
2964 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CNT, (st_data_t)rb_intern2("CNT", 3));
2965 #endif
2966 #ifdef AF_COIP
2967 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_COIP, (st_data_t)rb_intern2("COIP", 4));
2968 #endif
2969 #ifdef AF_LINK
2970 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LINK, (st_data_t)rb_intern2("LINK", 4));
2971 #endif
2972 #ifdef AF_ROUTE
2973 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ROUTE, (st_data_t)rb_intern2("ROUTE", 5));
2974 #endif
2975 #ifdef AF_HYLINK
2976 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_HYLINK, (st_data_t)rb_intern2("HYLINK", 6));
2977 #endif
2978 #ifdef AF_LAT
2979 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LAT, (st_data_t)rb_intern2("LAT", 3));
2980 #endif
2981 #ifdef AF_DLI
2982 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DLI, (st_data_t)rb_intern2("DLI", 3));
2983 #endif
2984 #ifdef AF_DEC
2985 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DEC, (st_data_t)rb_intern2("DEC", 3));
2986 #endif
2987 #ifdef AF_SNA
2988 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_SNA, (st_data_t)rb_intern2("SNA", 3));
2989 #endif
2990 #ifdef AF_CCITT
2991 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CCITT, (st_data_t)rb_intern2("CCITT", 5));
2992 #endif
2993 #ifdef AF_DATAKIT
2994 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_DATAKIT, (st_data_t)rb_intern2("DATAKIT", 7));
2995 #endif
2996 #ifdef AF_ECMA
2997 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ECMA, (st_data_t)rb_intern2("ECMA", 4));
2998 #endif
2999 #ifdef AF_OSI
3000 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_OSI, (st_data_t)rb_intern2("OSI", 3));
3001 #endif
3002 #ifdef AF_ISO
3003 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_ISO, (st_data_t)rb_intern2("ISO", 3));
3004 #endif
3005 #ifdef AF_NS
3006 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_NS, (st_data_t)rb_intern2("NS", 2));
3007 #endif
3008 #ifdef AF_CHAOS
3009 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_CHAOS, (st_data_t)rb_intern2("CHAOS", 5));
3010 #endif
3011 #ifdef AF_PUP
3012 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_PUP, (st_data_t)rb_intern2("PUP", 3));
3013 #endif
3014 #ifdef AF_IMPLINK
3015 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_IMPLINK, (st_data_t)rb_intern2("IMPLINK", 7));
3016 #endif
3017 #ifdef AF_LOCAL
3018 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_LOCAL, (st_data_t)rb_intern2("LOCAL", 5));
3019 #endif
3020 #ifdef AF_APPLETALK
3021 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_APPLETALK, (st_data_t)rb_intern2("APPLETALK", 9));
3022 #endif
3023 #ifdef AF_IPX
3024 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_IPX, (st_data_t)rb_intern2("IPX", 3));
3025 #endif
3026 #ifdef AF_AX25
3027 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_AX25, (st_data_t)rb_intern2("AX25", 4));
3028 #endif
3029 #ifdef AF_UNIX
3030 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_UNIX, (st_data_t)rb_intern2("UNIX", 4));
3031 #endif
3032 #ifdef AF_INET6
3033 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_INET6, (st_data_t)rb_intern2("INET6", 5));
3034 #endif
3035 #ifdef AF_INET
3036 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_INET, (st_data_t)rb_intern2("INET", 4));
3037 #endif
3038 #ifdef AF_UNSPEC
3039 st_insert(rsock_intern_family_noprefix_hash, (st_data_t)AF_UNSPEC, (st_data_t)rb_intern2("UNSPEC", 6));
3040 #endif
3041
3042 rsock_intern_protocol_family_hash = st_init_numtable();
3043 #ifdef PF_KEY
3044 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_KEY, (st_data_t)rb_intern2("PF_KEY", 6));
3045 #endif
3046 #ifdef PF_PIP
3047 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_PIP, (st_data_t)rb_intern2("PF_PIP", 6));
3048 #endif
3049 #ifdef PF_RTIP
3050 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_RTIP, (st_data_t)rb_intern2("PF_RTIP", 7));
3051 #endif
3052 #ifdef PF_XTP
3053 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_XTP, (st_data_t)rb_intern2("PF_XTP", 6));
3054 #endif
3055 #ifdef PF_PACKET
3056 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_PACKET, (st_data_t)rb_intern2("PF_PACKET", 9));
3057 #endif
3058 #ifdef PF_MAX
3059 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_MAX, (st_data_t)rb_intern2("PF_MAX", 6));
3060 #endif
3061 #ifdef PF_NETGRAPH
3062 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_NETGRAPH, (st_data_t)rb_intern2("PF_NETGRAPH", 11));
3063 #endif
3064 #ifdef PF_ATM
3065 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_ATM, (st_data_t)rb_intern2("PF_ATM", 6));
3066 #endif
3067 #ifdef PF_PPP
3068 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_PPP, (st_data_t)rb_intern2("PF_PPP", 6));
3069 #endif
3070 #ifdef PF_NETBIOS
3071 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_NETBIOS, (st_data_t)rb_intern2("PF_NETBIOS", 10));
3072 #endif
3073 #ifdef PF_SYSTEM
3074 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_SYSTEM, (st_data_t)rb_intern2("PF_SYSTEM", 9));
3075 #endif
3076 #ifdef PF_NATM
3077 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_NATM, (st_data_t)rb_intern2("PF_NATM", 7));
3078 #endif
3079 #ifdef PF_ISDN
3080 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_ISDN, (st_data_t)rb_intern2("PF_ISDN", 7));
3081 #endif
3082 #ifdef PF_NDRV
3083 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_NDRV, (st_data_t)rb_intern2("PF_NDRV", 7));
3084 #endif
3085 #ifdef PF_SIP
3086 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_SIP, (st_data_t)rb_intern2("PF_SIP", 6));
3087 #endif
3088 #ifdef PF_CNT
3089 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_CNT, (st_data_t)rb_intern2("PF_CNT", 6));
3090 #endif
3091 #ifdef PF_COIP
3092 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_COIP, (st_data_t)rb_intern2("PF_COIP", 7));
3093 #endif
3094 #ifdef PF_LINK
3095 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_LINK, (st_data_t)rb_intern2("PF_LINK", 7));
3096 #endif
3097 #ifdef PF_ROUTE
3098 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_ROUTE, (st_data_t)rb_intern2("PF_ROUTE", 8));
3099 #endif
3100 #ifdef PF_HYLINK
3101 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_HYLINK, (st_data_t)rb_intern2("PF_HYLINK", 9));
3102 #endif
3103 #ifdef PF_LAT
3104 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_LAT, (st_data_t)rb_intern2("PF_LAT", 6));
3105 #endif
3106 #ifdef PF_DLI
3107 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_DLI, (st_data_t)rb_intern2("PF_DLI", 6));
3108 #endif
3109 #ifdef PF_DEC
3110 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_DEC, (st_data_t)rb_intern2("PF_DEC", 6));
3111 #endif
3112 #ifdef PF_SNA
3113 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_SNA, (st_data_t)rb_intern2("PF_SNA", 6));
3114 #endif
3115 #ifdef PF_CCITT
3116 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_CCITT, (st_data_t)rb_intern2("PF_CCITT", 8));
3117 #endif
3118 #ifdef PF_DATAKIT
3119 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_DATAKIT, (st_data_t)rb_intern2("PF_DATAKIT", 10));
3120 #endif
3121 #ifdef PF_ECMA
3122 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_ECMA, (st_data_t)rb_intern2("PF_ECMA", 7));
3123 #endif
3124 #ifdef PF_OSI
3125 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_OSI, (st_data_t)rb_intern2("PF_OSI", 6));
3126 #endif
3127 #ifdef PF_ISO
3128 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_ISO, (st_data_t)rb_intern2("PF_ISO", 6));
3129 #endif
3130 #ifdef PF_NS
3131 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_NS, (st_data_t)rb_intern2("PF_NS", 5));
3132 #endif
3133 #ifdef PF_CHAOS
3134 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_CHAOS, (st_data_t)rb_intern2("PF_CHAOS", 8));
3135 #endif
3136 #ifdef PF_PUP
3137 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_PUP, (st_data_t)rb_intern2("PF_PUP", 6));
3138 #endif
3139 #ifdef PF_IMPLINK
3140 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_IMPLINK, (st_data_t)rb_intern2("PF_IMPLINK", 10));
3141 #endif
3142 #ifdef PF_LOCAL
3143 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_LOCAL, (st_data_t)rb_intern2("PF_LOCAL", 8));
3144 #endif
3145 #ifdef PF_APPLETALK
3146 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_APPLETALK, (st_data_t)rb_intern2("PF_APPLETALK", 12));
3147 #endif
3148 #ifdef PF_IPX
3149 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_IPX, (st_data_t)rb_intern2("PF_IPX", 6));
3150 #endif
3151 #ifdef PF_AX25
3152 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_AX25, (st_data_t)rb_intern2("PF_AX25", 7));
3153 #endif
3154 #ifdef PF_UNIX
3155 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_UNIX, (st_data_t)rb_intern2("PF_UNIX", 7));
3156 #endif
3157 #ifdef PF_INET6
3158 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_INET6, (st_data_t)rb_intern2("PF_INET6", 8));
3159 #endif
3160 #ifdef PF_INET
3161 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_INET, (st_data_t)rb_intern2("PF_INET", 7));
3162 #endif
3163 #ifdef PF_UNSPEC
3164 st_insert(rsock_intern_protocol_family_hash, (st_data_t)PF_UNSPEC, (st_data_t)rb_intern2("PF_UNSPEC", 9));
3165 #endif
3166
3167 rsock_intern_socktype_hash = st_init_numtable();
3168 #ifdef SOCK_PACKET
3169 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_PACKET, (st_data_t)rb_intern2("SOCK_PACKET", 11));
3170 #endif
3171 #ifdef SOCK_SEQPACKET
3172 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_SEQPACKET, (st_data_t)rb_intern2("SOCK_SEQPACKET", 14));
3173 #endif
3174 #ifdef SOCK_RDM
3175 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_RDM, (st_data_t)rb_intern2("SOCK_RDM", 8));
3176 #endif
3177 #ifdef SOCK_RAW
3178 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_RAW, (st_data_t)rb_intern2("SOCK_RAW", 8));
3179 #endif
3180 #ifdef SOCK_DGRAM
3181 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_DGRAM, (st_data_t)rb_intern2("SOCK_DGRAM", 10));
3182 #endif
3183 #ifdef SOCK_STREAM
3184 st_insert(rsock_intern_socktype_hash, (st_data_t)SOCK_STREAM, (st_data_t)rb_intern2("SOCK_STREAM", 11));
3185 #endif
3186
3187 rsock_intern_ipproto_hash = st_init_numtable();
3188 #ifdef IPPROTO_MAX
3189 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_MAX, (st_data_t)rb_intern2("IPPROTO_MAX", 11));
3190 #endif
3191 #ifdef IPPROTO_RAW
3192 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_RAW, (st_data_t)rb_intern2("IPPROTO_RAW", 11));
3193 #endif
3194 #ifdef IPPROTO_ROUTING
3195 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_ROUTING, (st_data_t)rb_intern2("IPPROTO_ROUTING", 15));
3196 #endif
3197 #ifdef IPPROTO_NONE
3198 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_NONE, (st_data_t)rb_intern2("IPPROTO_NONE", 12));
3199 #endif
3200 #ifdef IPPROTO_IPV6
3201 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_IPV6, (st_data_t)rb_intern2("IPPROTO_IPV6", 12));
3202 #endif
3203 #ifdef IPPROTO_ICMPV6
3204 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_ICMPV6, (st_data_t)rb_intern2("IPPROTO_ICMPV6", 14));
3205 #endif
3206 #ifdef IPPROTO_HOPOPTS
3207 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_HOPOPTS, (st_data_t)rb_intern2("IPPROTO_HOPOPTS", 15));
3208 #endif
3209 #ifdef IPPROTO_FRAGMENT
3210 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_FRAGMENT, (st_data_t)rb_intern2("IPPROTO_FRAGMENT", 16));
3211 #endif
3212 #ifdef IPPROTO_ESP
3213 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_ESP, (st_data_t)rb_intern2("IPPROTO_ESP", 11));
3214 #endif
3215 #ifdef IPPROTO_DSTOPTS
3216 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_DSTOPTS, (st_data_t)rb_intern2("IPPROTO_DSTOPTS", 15));
3217 #endif
3218 #ifdef IPPROTO_AH
3219 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_AH, (st_data_t)rb_intern2("IPPROTO_AH", 10));
3220 #endif
3221 #ifdef IPPROTO_BIP
3222 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_BIP, (st_data_t)rb_intern2("IPPROTO_BIP", 11));
3223 #endif
3224 #ifdef IPPROTO_EON
3225 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_EON, (st_data_t)rb_intern2("IPPROTO_EON", 11));
3226 #endif
3227 #ifdef IPPROTO_XTP
3228 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_XTP, (st_data_t)rb_intern2("IPPROTO_XTP", 11));
3229 #endif
3230 #ifdef IPPROTO_TP
3231 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_TP, (st_data_t)rb_intern2("IPPROTO_TP", 10));
3232 #endif
3233 #ifdef IPPROTO_ND
3234 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_ND, (st_data_t)rb_intern2("IPPROTO_ND", 10));
3235 #endif
3236 #ifdef IPPROTO_HELLO
3237 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_HELLO, (st_data_t)rb_intern2("IPPROTO_HELLO", 13));
3238 #endif
3239 #ifdef IPPROTO_IDP
3240 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_IDP, (st_data_t)rb_intern2("IPPROTO_IDP", 11));
3241 #endif
3242 #ifdef IPPROTO_UDP
3243 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_UDP, (st_data_t)rb_intern2("IPPROTO_UDP", 11));
3244 #endif
3245 #ifdef IPPROTO_PUP
3246 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_PUP, (st_data_t)rb_intern2("IPPROTO_PUP", 11));
3247 #endif
3248 #ifdef IPPROTO_EGP
3249 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_EGP, (st_data_t)rb_intern2("IPPROTO_EGP", 11));
3250 #endif
3251 #ifdef IPPROTO_TCP
3252 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_TCP, (st_data_t)rb_intern2("IPPROTO_TCP", 11));
3253 #endif
3254 #ifdef IPPROTO_GGP
3255 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_GGP, (st_data_t)rb_intern2("IPPROTO_GGP", 11));
3256 #endif
3257 #ifdef IPPROTO_IGMP
3258 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_IGMP, (st_data_t)rb_intern2("IPPROTO_IGMP", 12));
3259 #endif
3260 #ifdef IPPROTO_ICMP
3261 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_ICMP, (st_data_t)rb_intern2("IPPROTO_ICMP", 12));
3262 #endif
3263 #ifdef IPPROTO_IP
3264 st_insert(rsock_intern_ipproto_hash, (st_data_t)IPPROTO_IP, (st_data_t)rb_intern2("IPPROTO_IP", 10));
3265 #endif
3266
3267 rsock_intern_iplevel_hash = st_init_numtable();
3268 #ifdef IPPROTO_MAX
3269 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_MAX, (st_data_t)rb_intern2("IPPROTO_MAX", 11));
3270 #endif
3271 #ifdef IPPROTO_RAW
3272 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_RAW, (st_data_t)rb_intern2("IPPROTO_RAW", 11));
3273 #endif
3274 #ifdef IPPROTO_ROUTING
3275 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ROUTING, (st_data_t)rb_intern2("IPPROTO_ROUTING", 15));
3276 #endif
3277 #ifdef IPPROTO_NONE
3278 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_NONE, (st_data_t)rb_intern2("IPPROTO_NONE", 12));
3279 #endif
3280 #ifdef IPPROTO_IPV6
3281 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IPV6, (st_data_t)rb_intern2("IPPROTO_IPV6", 12));
3282 #endif
3283 #ifdef IPPROTO_ICMPV6
3284 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ICMPV6, (st_data_t)rb_intern2("IPPROTO_ICMPV6", 14));
3285 #endif
3286 #ifdef IPPROTO_HOPOPTS
3287 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_HOPOPTS, (st_data_t)rb_intern2("IPPROTO_HOPOPTS", 15));
3288 #endif
3289 #ifdef IPPROTO_FRAGMENT
3290 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_FRAGMENT, (st_data_t)rb_intern2("IPPROTO_FRAGMENT", 16));
3291 #endif
3292 #ifdef IPPROTO_ESP
3293 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ESP, (st_data_t)rb_intern2("IPPROTO_ESP", 11));
3294 #endif
3295 #ifdef IPPROTO_DSTOPTS
3296 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_DSTOPTS, (st_data_t)rb_intern2("IPPROTO_DSTOPTS", 15));
3297 #endif
3298 #ifdef IPPROTO_AH
3299 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_AH, (st_data_t)rb_intern2("IPPROTO_AH", 10));
3300 #endif
3301 #ifdef IPPROTO_BIP
3302 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_BIP, (st_data_t)rb_intern2("IPPROTO_BIP", 11));
3303 #endif
3304 #ifdef IPPROTO_EON
3305 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_EON, (st_data_t)rb_intern2("IPPROTO_EON", 11));
3306 #endif
3307 #ifdef IPPROTO_XTP
3308 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_XTP, (st_data_t)rb_intern2("IPPROTO_XTP", 11));
3309 #endif
3310 #ifdef IPPROTO_TP
3311 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_TP, (st_data_t)rb_intern2("IPPROTO_TP", 10));
3312 #endif
3313 #ifdef IPPROTO_ND
3314 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ND, (st_data_t)rb_intern2("IPPROTO_ND", 10));
3315 #endif
3316 #ifdef IPPROTO_HELLO
3317 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_HELLO, (st_data_t)rb_intern2("IPPROTO_HELLO", 13));
3318 #endif
3319 #ifdef IPPROTO_IDP
3320 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IDP, (st_data_t)rb_intern2("IPPROTO_IDP", 11));
3321 #endif
3322 #ifdef IPPROTO_UDP
3323 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_UDP, (st_data_t)rb_intern2("IPPROTO_UDP", 11));
3324 #endif
3325 #ifdef IPPROTO_PUP
3326 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_PUP, (st_data_t)rb_intern2("IPPROTO_PUP", 11));
3327 #endif
3328 #ifdef IPPROTO_EGP
3329 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_EGP, (st_data_t)rb_intern2("IPPROTO_EGP", 11));
3330 #endif
3331 #ifdef IPPROTO_TCP
3332 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_TCP, (st_data_t)rb_intern2("IPPROTO_TCP", 11));
3333 #endif
3334 #ifdef IPPROTO_GGP
3335 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_GGP, (st_data_t)rb_intern2("IPPROTO_GGP", 11));
3336 #endif
3337 #ifdef IPPROTO_IGMP
3338 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IGMP, (st_data_t)rb_intern2("IPPROTO_IGMP", 12));
3339 #endif
3340 #ifdef IPPROTO_ICMP
3341 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ICMP, (st_data_t)rb_intern2("IPPROTO_ICMP", 12));
3342 #endif
3343 #ifdef IPPROTO_IP
3344 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IP, (st_data_t)rb_intern2("IPPROTO_IP", 10));
3345 #endif
3346 #ifdef SOL_SOCKET
3347 st_insert(rsock_intern_iplevel_hash, (st_data_t)SOL_SOCKET, (st_data_t)rb_intern2("SOL_SOCKET", 10));
3348 #endif
3349 #ifdef IPPROTO_MAX
3350 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_MAX, (st_data_t)rb_intern2("MAX", 3));
3351 #endif
3352 #ifdef IPPROTO_RAW
3353 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_RAW, (st_data_t)rb_intern2("RAW", 3));
3354 #endif
3355 #ifdef IPPROTO_ROUTING
3356 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ROUTING, (st_data_t)rb_intern2("ROUTING", 7));
3357 #endif
3358 #ifdef IPPROTO_NONE
3359 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_NONE, (st_data_t)rb_intern2("NONE", 4));
3360 #endif
3361 #ifdef IPPROTO_IPV6
3362 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IPV6, (st_data_t)rb_intern2("IPV6", 4));
3363 #endif
3364 #ifdef IPPROTO_ICMPV6
3365 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ICMPV6, (st_data_t)rb_intern2("ICMPV6", 6));
3366 #endif
3367 #ifdef IPPROTO_HOPOPTS
3368 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_HOPOPTS, (st_data_t)rb_intern2("HOPOPTS", 7));
3369 #endif
3370 #ifdef IPPROTO_FRAGMENT
3371 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_FRAGMENT, (st_data_t)rb_intern2("FRAGMENT", 8));
3372 #endif
3373 #ifdef IPPROTO_ESP
3374 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ESP, (st_data_t)rb_intern2("ESP", 3));
3375 #endif
3376 #ifdef IPPROTO_DSTOPTS
3377 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_DSTOPTS, (st_data_t)rb_intern2("DSTOPTS", 7));
3378 #endif
3379 #ifdef IPPROTO_AH
3380 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_AH, (st_data_t)rb_intern2("AH", 2));
3381 #endif
3382 #ifdef IPPROTO_BIP
3383 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_BIP, (st_data_t)rb_intern2("BIP", 3));
3384 #endif
3385 #ifdef IPPROTO_EON
3386 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_EON, (st_data_t)rb_intern2("EON", 3));
3387 #endif
3388 #ifdef IPPROTO_XTP
3389 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_XTP, (st_data_t)rb_intern2("XTP", 3));
3390 #endif
3391 #ifdef IPPROTO_TP
3392 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_TP, (st_data_t)rb_intern2("TP", 2));
3393 #endif
3394 #ifdef IPPROTO_ND
3395 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ND, (st_data_t)rb_intern2("ND", 2));
3396 #endif
3397 #ifdef IPPROTO_HELLO
3398 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_HELLO, (st_data_t)rb_intern2("HELLO", 5));
3399 #endif
3400 #ifdef IPPROTO_IDP
3401 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IDP, (st_data_t)rb_intern2("IDP", 3));
3402 #endif
3403 #ifdef IPPROTO_UDP
3404 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_UDP, (st_data_t)rb_intern2("UDP", 3));
3405 #endif
3406 #ifdef IPPROTO_PUP
3407 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_PUP, (st_data_t)rb_intern2("PUP", 3));
3408 #endif
3409 #ifdef IPPROTO_EGP
3410 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_EGP, (st_data_t)rb_intern2("EGP", 3));
3411 #endif
3412 #ifdef IPPROTO_TCP
3413 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_TCP, (st_data_t)rb_intern2("TCP", 3));
3414 #endif
3415 #ifdef IPPROTO_GGP
3416 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_GGP, (st_data_t)rb_intern2("GGP", 3));
3417 #endif
3418 #ifdef IPPROTO_IGMP
3419 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IGMP, (st_data_t)rb_intern2("IGMP", 4));
3420 #endif
3421 #ifdef IPPROTO_ICMP
3422 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_ICMP, (st_data_t)rb_intern2("ICMP", 4));
3423 #endif
3424 #ifdef IPPROTO_IP
3425 st_insert(rsock_intern_iplevel_hash, (st_data_t)IPPROTO_IP, (st_data_t)rb_intern2("IP", 2));
3426 #endif
3427 #ifdef SOL_SOCKET
3428 st_insert(rsock_intern_iplevel_hash, (st_data_t)SOL_SOCKET, (st_data_t)rb_intern2("SOCKET", 6));
3429 #endif
3430
3431 rsock_intern_so_optname_hash = st_init_numtable();
3432 #ifdef SO_BPF_EXTENSIONS
3433 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BPF_EXTENSIONS, (st_data_t)rb_intern2("SO_BPF_EXTENSIONS", 17));
3434 #endif
3435 #ifdef SO_MAX_PACING_RATE
3436 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MAX_PACING_RATE, (st_data_t)rb_intern2("SO_MAX_PACING_RATE", 18));
3437 #endif
3438 #ifdef SO_BUSY_POLL
3439 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BUSY_POLL, (st_data_t)rb_intern2("SO_BUSY_POLL", 12));
3440 #endif
3441 #ifdef SO_SELECT_ERR_QUEUE
3442 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SELECT_ERR_QUEUE, (st_data_t)rb_intern2("SO_SELECT_ERR_QUEUE", 19));
3443 #endif
3444 #ifdef SO_LOCK_FILTER
3445 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_LOCK_FILTER, (st_data_t)rb_intern2("SO_LOCK_FILTER", 14));
3446 #endif
3447 #ifdef SO_NOFCS
3448 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NOFCS, (st_data_t)rb_intern2("SO_NOFCS", 8));
3449 #endif
3450 #ifdef SO_PEEK_OFF
3451 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEEK_OFF, (st_data_t)rb_intern2("SO_PEEK_OFF", 11));
3452 #endif
3453 #ifdef SO_WIFI_STATUS
3454 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WIFI_STATUS, (st_data_t)rb_intern2("SO_WIFI_STATUS", 14));
3455 #endif
3456 #ifdef SO_RXQ_OVFL
3457 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RXQ_OVFL, (st_data_t)rb_intern2("SO_RXQ_OVFL", 11));
3458 #endif
3459 #ifdef SO_DOMAIN
3460 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DOMAIN, (st_data_t)rb_intern2("SO_DOMAIN", 9));
3461 #endif
3462 #ifdef SO_PROTOCOL
3463 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PROTOCOL, (st_data_t)rb_intern2("SO_PROTOCOL", 11));
3464 #endif
3465 #ifdef SO_TIMESTAMPING
3466 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMPING, (st_data_t)rb_intern2("SO_TIMESTAMPING", 15));
3467 #endif
3468 #ifdef SO_MARK
3469 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MARK, (st_data_t)rb_intern2("SO_MARK", 7));
3470 #endif
3471 #ifdef SO_PASSSEC
3472 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PASSSEC, (st_data_t)rb_intern2("SO_PASSSEC", 10));
3473 #endif
3474 #ifdef SO_PEERSEC
3475 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERSEC, (st_data_t)rb_intern2("SO_PEERSEC", 10));
3476 #endif
3477 #ifdef SO_ALLZONES
3478 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ALLZONES, (st_data_t)rb_intern2("SO_ALLZONES", 11));
3479 #endif
3480 #ifdef SO_MAC_EXEMPT
3481 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MAC_EXEMPT, (st_data_t)rb_intern2("SO_MAC_EXEMPT", 13));
3482 #endif
3483 #ifdef SO_RECVUCRED
3484 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RECVUCRED, (st_data_t)rb_intern2("SO_RECVUCRED", 12));
3485 #endif
3486 #ifdef SO_BINTIME
3487 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BINTIME, (st_data_t)rb_intern2("SO_BINTIME", 10));
3488 #endif
3489 #ifdef SO_TIMESTAMPNS
3490 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMPNS, (st_data_t)rb_intern2("SO_TIMESTAMPNS", 14));
3491 #endif
3492 #ifdef SO_TIMESTAMP
3493 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMP, (st_data_t)rb_intern2("SO_TIMESTAMP", 12));
3494 #endif
3495 #ifdef SO_PEERNAME
3496 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERNAME, (st_data_t)rb_intern2("SO_PEERNAME", 11));
3497 #endif
3498 #ifdef SO_GET_FILTER
3499 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_GET_FILTER, (st_data_t)rb_intern2("SO_GET_FILTER", 13));
3500 #endif
3501 #ifdef SO_DETACH_FILTER
3502 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DETACH_FILTER, (st_data_t)rb_intern2("SO_DETACH_FILTER", 16));
3503 #endif
3504 #ifdef SO_ATTACH_FILTER
3505 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ATTACH_FILTER, (st_data_t)rb_intern2("SO_ATTACH_FILTER", 16));
3506 #endif
3507 #ifdef SO_BINDTODEVICE
3508 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BINDTODEVICE, (st_data_t)rb_intern2("SO_BINDTODEVICE", 15));
3509 #endif
3510 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
3511 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_ENCRYPTION_NETWORK, (st_data_t)rb_intern2("SO_SECURITY_ENCRYPTION_NETWORK", 30));
3512 #endif
3513 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
3514 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_ENCRYPTION_TRANSPORT, (st_data_t)rb_intern2("SO_SECURITY_ENCRYPTION_TRANSPORT", 32));
3515 #endif
3516 #ifdef SO_SECURITY_AUTHENTICATION
3517 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_AUTHENTICATION, (st_data_t)rb_intern2("SO_SECURITY_AUTHENTICATION", 26));
3518 #endif
3519 #ifdef SO_NOSIGPIPE
3520 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NOSIGPIPE, (st_data_t)rb_intern2("SO_NOSIGPIPE", 12));
3521 #endif
3522 #ifdef SO_NKE
3523 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NKE, (st_data_t)rb_intern2("SO_NKE", 6));
3524 #endif
3525 #ifdef SO_NREAD
3526 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NREAD, (st_data_t)rb_intern2("SO_NREAD", 8));
3527 #endif
3528 #ifdef SO_WANTOOBFLAG
3529 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WANTOOBFLAG, (st_data_t)rb_intern2("SO_WANTOOBFLAG", 14));
3530 #endif
3531 #ifdef SO_WANTMORE
3532 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WANTMORE, (st_data_t)rb_intern2("SO_WANTMORE", 11));
3533 #endif
3534 #ifdef SO_DONTTRUNC
3535 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DONTTRUNC, (st_data_t)rb_intern2("SO_DONTTRUNC", 12));
3536 #endif
3537 #ifdef SO_ACCEPTFILTER
3538 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ACCEPTFILTER, (st_data_t)rb_intern2("SO_ACCEPTFILTER", 15));
3539 #endif
3540 #ifdef SO_USELOOPBACK
3541 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_USELOOPBACK, (st_data_t)rb_intern2("SO_USELOOPBACK", 14));
3542 #endif
3543 #ifdef SO_ACCEPTCONN
3544 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ACCEPTCONN, (st_data_t)rb_intern2("SO_ACCEPTCONN", 13));
3545 #endif
3546 #ifdef SO_SNDTIMEO
3547 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDTIMEO, (st_data_t)rb_intern2("SO_SNDTIMEO", 11));
3548 #endif
3549 #ifdef SO_RCVTIMEO
3550 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVTIMEO, (st_data_t)rb_intern2("SO_RCVTIMEO", 11));
3551 #endif
3552 #ifdef SO_SNDLOWAT
3553 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDLOWAT, (st_data_t)rb_intern2("SO_SNDLOWAT", 11));
3554 #endif
3555 #ifdef SO_RCVLOWAT
3556 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVLOWAT, (st_data_t)rb_intern2("SO_RCVLOWAT", 11));
3557 #endif
3558 #ifdef SO_PEERCRED
3559 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERCRED, (st_data_t)rb_intern2("SO_PEERCRED", 11));
3560 #endif
3561 #ifdef SO_PASSCRED
3562 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PASSCRED, (st_data_t)rb_intern2("SO_PASSCRED", 11));
3563 #endif
3564 #ifdef SO_LINGER
3565 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_LINGER, (st_data_t)rb_intern2("SO_LINGER", 9));
3566 #endif
3567 #ifdef SO_PRIORITY
3568 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PRIORITY, (st_data_t)rb_intern2("SO_PRIORITY", 11));
3569 #endif
3570 #ifdef SO_NO_CHECK
3571 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NO_CHECK, (st_data_t)rb_intern2("SO_NO_CHECK", 11));
3572 #endif
3573 #ifdef SO_OOBINLINE
3574 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_OOBINLINE, (st_data_t)rb_intern2("SO_OOBINLINE", 12));
3575 #endif
3576 #ifdef SO_KEEPALIVE
3577 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_KEEPALIVE, (st_data_t)rb_intern2("SO_KEEPALIVE", 12));
3578 #endif
3579 #ifdef SO_RCVBUFFORCE
3580 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVBUFFORCE, (st_data_t)rb_intern2("SO_RCVBUFFORCE", 14));
3581 #endif
3582 #ifdef SO_SNDBUFFORCE
3583 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDBUFFORCE, (st_data_t)rb_intern2("SO_SNDBUFFORCE", 14));
3584 #endif
3585 #ifdef SO_RCVBUF
3586 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVBUF, (st_data_t)rb_intern2("SO_RCVBUF", 9));
3587 #endif
3588 #ifdef SO_SNDBUF
3589 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDBUF, (st_data_t)rb_intern2("SO_SNDBUF", 9));
3590 #endif
3591 #ifdef SO_BROADCAST
3592 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BROADCAST, (st_data_t)rb_intern2("SO_BROADCAST", 12));
3593 #endif
3594 #ifdef SO_DONTROUTE
3595 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DONTROUTE, (st_data_t)rb_intern2("SO_DONTROUTE", 12));
3596 #endif
3597 #ifdef SO_ERROR
3598 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ERROR, (st_data_t)rb_intern2("SO_ERROR", 8));
3599 #endif
3600 #ifdef SO_TYPE
3601 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TYPE, (st_data_t)rb_intern2("SO_TYPE", 7));
3602 #endif
3603 #ifdef SO_REUSEPORT
3604 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_REUSEPORT, (st_data_t)rb_intern2("SO_REUSEPORT", 12));
3605 #endif
3606 #ifdef SO_REUSEADDR
3607 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_REUSEADDR, (st_data_t)rb_intern2("SO_REUSEADDR", 12));
3608 #endif
3609 #ifdef SO_DEBUG
3610 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DEBUG, (st_data_t)rb_intern2("SO_DEBUG", 8));
3611 #endif
3612 #ifdef SO_BPF_EXTENSIONS
3613 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BPF_EXTENSIONS, (st_data_t)rb_intern2("BPF_EXTENSIONS", 14));
3614 #endif
3615 #ifdef SO_MAX_PACING_RATE
3616 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MAX_PACING_RATE, (st_data_t)rb_intern2("MAX_PACING_RATE", 15));
3617 #endif
3618 #ifdef SO_BUSY_POLL
3619 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BUSY_POLL, (st_data_t)rb_intern2("BUSY_POLL", 9));
3620 #endif
3621 #ifdef SO_SELECT_ERR_QUEUE
3622 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SELECT_ERR_QUEUE, (st_data_t)rb_intern2("SELECT_ERR_QUEUE", 16));
3623 #endif
3624 #ifdef SO_LOCK_FILTER
3625 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_LOCK_FILTER, (st_data_t)rb_intern2("LOCK_FILTER", 11));
3626 #endif
3627 #ifdef SO_NOFCS
3628 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NOFCS, (st_data_t)rb_intern2("NOFCS", 5));
3629 #endif
3630 #ifdef SO_PEEK_OFF
3631 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEEK_OFF, (st_data_t)rb_intern2("PEEK_OFF", 8));
3632 #endif
3633 #ifdef SO_WIFI_STATUS
3634 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WIFI_STATUS, (st_data_t)rb_intern2("WIFI_STATUS", 11));
3635 #endif
3636 #ifdef SO_RXQ_OVFL
3637 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RXQ_OVFL, (st_data_t)rb_intern2("RXQ_OVFL", 8));
3638 #endif
3639 #ifdef SO_DOMAIN
3640 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DOMAIN, (st_data_t)rb_intern2("DOMAIN", 6));
3641 #endif
3642 #ifdef SO_PROTOCOL
3643 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PROTOCOL, (st_data_t)rb_intern2("PROTOCOL", 8));
3644 #endif
3645 #ifdef SO_TIMESTAMPING
3646 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMPING, (st_data_t)rb_intern2("TIMESTAMPING", 12));
3647 #endif
3648 #ifdef SO_MARK
3649 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MARK, (st_data_t)rb_intern2("MARK", 4));
3650 #endif
3651 #ifdef SO_PASSSEC
3652 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PASSSEC, (st_data_t)rb_intern2("PASSSEC", 7));
3653 #endif
3654 #ifdef SO_PEERSEC
3655 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERSEC, (st_data_t)rb_intern2("PEERSEC", 7));
3656 #endif
3657 #ifdef SO_ALLZONES
3658 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ALLZONES, (st_data_t)rb_intern2("ALLZONES", 8));
3659 #endif
3660 #ifdef SO_MAC_EXEMPT
3661 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_MAC_EXEMPT, (st_data_t)rb_intern2("MAC_EXEMPT", 10));
3662 #endif
3663 #ifdef SO_RECVUCRED
3664 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RECVUCRED, (st_data_t)rb_intern2("RECVUCRED", 9));
3665 #endif
3666 #ifdef SO_BINTIME
3667 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BINTIME, (st_data_t)rb_intern2("BINTIME", 7));
3668 #endif
3669 #ifdef SO_TIMESTAMPNS
3670 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMPNS, (st_data_t)rb_intern2("TIMESTAMPNS", 11));
3671 #endif
3672 #ifdef SO_TIMESTAMP
3673 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TIMESTAMP, (st_data_t)rb_intern2("TIMESTAMP", 9));
3674 #endif
3675 #ifdef SO_PEERNAME
3676 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERNAME, (st_data_t)rb_intern2("PEERNAME", 8));
3677 #endif
3678 #ifdef SO_GET_FILTER
3679 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_GET_FILTER, (st_data_t)rb_intern2("GET_FILTER", 10));
3680 #endif
3681 #ifdef SO_DETACH_FILTER
3682 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DETACH_FILTER, (st_data_t)rb_intern2("DETACH_FILTER", 13));
3683 #endif
3684 #ifdef SO_ATTACH_FILTER
3685 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ATTACH_FILTER, (st_data_t)rb_intern2("ATTACH_FILTER", 13));
3686 #endif
3687 #ifdef SO_BINDTODEVICE
3688 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BINDTODEVICE, (st_data_t)rb_intern2("BINDTODEVICE", 12));
3689 #endif
3690 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
3691 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_ENCRYPTION_NETWORK, (st_data_t)rb_intern2("SECURITY_ENCRYPTION_NETWORK", 27));
3692 #endif
3693 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
3694 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_ENCRYPTION_TRANSPORT, (st_data_t)rb_intern2("SECURITY_ENCRYPTION_TRANSPORT", 29));
3695 #endif
3696 #ifdef SO_SECURITY_AUTHENTICATION
3697 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SECURITY_AUTHENTICATION, (st_data_t)rb_intern2("SECURITY_AUTHENTICATION", 23));
3698 #endif
3699 #ifdef SO_NOSIGPIPE
3700 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NOSIGPIPE, (st_data_t)rb_intern2("NOSIGPIPE", 9));
3701 #endif
3702 #ifdef SO_NKE
3703 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NKE, (st_data_t)rb_intern2("NKE", 3));
3704 #endif
3705 #ifdef SO_NREAD
3706 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NREAD, (st_data_t)rb_intern2("NREAD", 5));
3707 #endif
3708 #ifdef SO_WANTOOBFLAG
3709 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WANTOOBFLAG, (st_data_t)rb_intern2("WANTOOBFLAG", 11));
3710 #endif
3711 #ifdef SO_WANTMORE
3712 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_WANTMORE, (st_data_t)rb_intern2("WANTMORE", 8));
3713 #endif
3714 #ifdef SO_DONTTRUNC
3715 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DONTTRUNC, (st_data_t)rb_intern2("DONTTRUNC", 9));
3716 #endif
3717 #ifdef SO_ACCEPTFILTER
3718 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ACCEPTFILTER, (st_data_t)rb_intern2("ACCEPTFILTER", 12));
3719 #endif
3720 #ifdef SO_USELOOPBACK
3721 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_USELOOPBACK, (st_data_t)rb_intern2("USELOOPBACK", 11));
3722 #endif
3723 #ifdef SO_ACCEPTCONN
3724 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ACCEPTCONN, (st_data_t)rb_intern2("ACCEPTCONN", 10));
3725 #endif
3726 #ifdef SO_SNDTIMEO
3727 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDTIMEO, (st_data_t)rb_intern2("SNDTIMEO", 8));
3728 #endif
3729 #ifdef SO_RCVTIMEO
3730 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVTIMEO, (st_data_t)rb_intern2("RCVTIMEO", 8));
3731 #endif
3732 #ifdef SO_SNDLOWAT
3733 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDLOWAT, (st_data_t)rb_intern2("SNDLOWAT", 8));
3734 #endif
3735 #ifdef SO_RCVLOWAT
3736 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVLOWAT, (st_data_t)rb_intern2("RCVLOWAT", 8));
3737 #endif
3738 #ifdef SO_PEERCRED
3739 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PEERCRED, (st_data_t)rb_intern2("PEERCRED", 8));
3740 #endif
3741 #ifdef SO_PASSCRED
3742 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PASSCRED, (st_data_t)rb_intern2("PASSCRED", 8));
3743 #endif
3744 #ifdef SO_LINGER
3745 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_LINGER, (st_data_t)rb_intern2("LINGER", 6));
3746 #endif
3747 #ifdef SO_PRIORITY
3748 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_PRIORITY, (st_data_t)rb_intern2("PRIORITY", 8));
3749 #endif
3750 #ifdef SO_NO_CHECK
3751 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_NO_CHECK, (st_data_t)rb_intern2("NO_CHECK", 8));
3752 #endif
3753 #ifdef SO_OOBINLINE
3754 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_OOBINLINE, (st_data_t)rb_intern2("OOBINLINE", 9));
3755 #endif
3756 #ifdef SO_KEEPALIVE
3757 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_KEEPALIVE, (st_data_t)rb_intern2("KEEPALIVE", 9));
3758 #endif
3759 #ifdef SO_RCVBUFFORCE
3760 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVBUFFORCE, (st_data_t)rb_intern2("RCVBUFFORCE", 11));
3761 #endif
3762 #ifdef SO_SNDBUFFORCE
3763 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDBUFFORCE, (st_data_t)rb_intern2("SNDBUFFORCE", 11));
3764 #endif
3765 #ifdef SO_RCVBUF
3766 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_RCVBUF, (st_data_t)rb_intern2("RCVBUF", 6));
3767 #endif
3768 #ifdef SO_SNDBUF
3769 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_SNDBUF, (st_data_t)rb_intern2("SNDBUF", 6));
3770 #endif
3771 #ifdef SO_BROADCAST
3772 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_BROADCAST, (st_data_t)rb_intern2("BROADCAST", 9));
3773 #endif
3774 #ifdef SO_DONTROUTE
3775 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DONTROUTE, (st_data_t)rb_intern2("DONTROUTE", 9));
3776 #endif
3777 #ifdef SO_ERROR
3778 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_ERROR, (st_data_t)rb_intern2("ERROR", 5));
3779 #endif
3780 #ifdef SO_TYPE
3781 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_TYPE, (st_data_t)rb_intern2("TYPE", 4));
3782 #endif
3783 #ifdef SO_REUSEPORT
3784 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_REUSEPORT, (st_data_t)rb_intern2("REUSEPORT", 9));
3785 #endif
3786 #ifdef SO_REUSEADDR
3787 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_REUSEADDR, (st_data_t)rb_intern2("REUSEADDR", 9));
3788 #endif
3789 #ifdef SO_DEBUG
3790 st_insert(rsock_intern_so_optname_hash, (st_data_t)SO_DEBUG, (st_data_t)rb_intern2("DEBUG", 5));
3791 #endif
3792
3793 rsock_intern_ip_optname_hash = st_init_numtable();
3794 #ifdef IP_MSFILTER
3795 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MSFILTER, (st_data_t)rb_intern2("IP_MSFILTER", 11));
3796 #endif
3797 #ifdef IP_DROP_SOURCE_MEMBERSHIP
3798 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DROP_SOURCE_MEMBERSHIP, (st_data_t)rb_intern2("IP_DROP_SOURCE_MEMBERSHIP", 25));
3799 #endif
3800 #ifdef IP_ADD_SOURCE_MEMBERSHIP
3801 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ADD_SOURCE_MEMBERSHIP, (st_data_t)rb_intern2("IP_ADD_SOURCE_MEMBERSHIP", 24));
3802 #endif
3803 #ifdef IP_BLOCK_SOURCE
3804 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_BLOCK_SOURCE, (st_data_t)rb_intern2("IP_BLOCK_SOURCE", 15));
3805 #endif
3806 #ifdef IP_UNBLOCK_SOURCE
3807 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_UNBLOCK_SOURCE, (st_data_t)rb_intern2("IP_UNBLOCK_SOURCE", 17));
3808 #endif
3809 #ifdef IP_PMTUDISC_DO
3810 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_DO, (st_data_t)rb_intern2("IP_PMTUDISC_DO", 14));
3811 #endif
3812 #ifdef IP_PMTUDISC_WANT
3813 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_WANT, (st_data_t)rb_intern2("IP_PMTUDISC_WANT", 16));
3814 #endif
3815 #ifdef IP_PMTUDISC_DONT
3816 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_DONT, (st_data_t)rb_intern2("IP_PMTUDISC_DONT", 16));
3817 #endif
3818 #ifdef IP_TRANSPARENT
3819 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TRANSPARENT, (st_data_t)rb_intern2("IP_TRANSPARENT", 14));
3820 #endif
3821 #ifdef IP_PASSSEC
3822 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PASSSEC, (st_data_t)rb_intern2("IP_PASSSEC", 10));
3823 #endif
3824 #ifdef IP_XFRM_POLICY
3825 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_XFRM_POLICY, (st_data_t)rb_intern2("IP_XFRM_POLICY", 14));
3826 #endif
3827 #ifdef IP_IPSEC_POLICY
3828 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_IPSEC_POLICY, (st_data_t)rb_intern2("IP_IPSEC_POLICY", 15));
3829 #endif
3830 #ifdef IP_FREEBIND
3831 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_FREEBIND, (st_data_t)rb_intern2("IP_FREEBIND", 11));
3832 #endif
3833 #ifdef IP_MTU
3834 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MTU, (st_data_t)rb_intern2("IP_MTU", 6));
3835 #endif
3836 #ifdef IP_RECVTOS
3837 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVTOS, (st_data_t)rb_intern2("IP_RECVTOS", 10));
3838 #endif
3839 #ifdef IP_RECVERR
3840 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVERR, (st_data_t)rb_intern2("IP_RECVERR", 10));
3841 #endif
3842 #ifdef IP_MTU_DISCOVER
3843 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MTU_DISCOVER, (st_data_t)rb_intern2("IP_MTU_DISCOVER", 15));
3844 #endif
3845 #ifdef IP_PKTOPTIONS
3846 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PKTOPTIONS, (st_data_t)rb_intern2("IP_PKTOPTIONS", 13));
3847 #endif
3848 #ifdef IP_PKTINFO
3849 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PKTINFO, (st_data_t)rb_intern2("IP_PKTINFO", 10));
3850 #endif
3851 #ifdef IP_ROUTER_ALERT
3852 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ROUTER_ALERT, (st_data_t)rb_intern2("IP_ROUTER_ALERT", 15));
3853 #endif
3854 #ifdef IP_MAX_MEMBERSHIPS
3855 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MAX_MEMBERSHIPS, (st_data_t)rb_intern2("IP_MAX_MEMBERSHIPS", 18));
3856 #endif
3857 #ifdef IP_DEFAULT_MULTICAST_LOOP
3858 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DEFAULT_MULTICAST_LOOP, (st_data_t)rb_intern2("IP_DEFAULT_MULTICAST_LOOP", 25));
3859 #endif
3860 #ifdef IP_DEFAULT_MULTICAST_TTL
3861 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DEFAULT_MULTICAST_TTL, (st_data_t)rb_intern2("IP_DEFAULT_MULTICAST_TTL", 24));
3862 #endif
3863 #ifdef IP_DROP_MEMBERSHIP
3864 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DROP_MEMBERSHIP, (st_data_t)rb_intern2("IP_DROP_MEMBERSHIP", 18));
3865 #endif
3866 #ifdef IP_ADD_MEMBERSHIP
3867 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ADD_MEMBERSHIP, (st_data_t)rb_intern2("IP_ADD_MEMBERSHIP", 17));
3868 #endif
3869 #ifdef IP_MULTICAST_LOOP
3870 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_LOOP, (st_data_t)rb_intern2("IP_MULTICAST_LOOP", 17));
3871 #endif
3872 #ifdef IP_MULTICAST_TTL
3873 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_TTL, (st_data_t)rb_intern2("IP_MULTICAST_TTL", 16));
3874 #endif
3875 #ifdef IP_MULTICAST_IF
3876 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_IF, (st_data_t)rb_intern2("IP_MULTICAST_IF", 15));
3877 #endif
3878 #ifdef IP_PORTRANGE
3879 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PORTRANGE, (st_data_t)rb_intern2("IP_PORTRANGE", 12));
3880 #endif
3881 #ifdef IP_RECVSLLA
3882 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVSLLA, (st_data_t)rb_intern2("IP_RECVSLLA", 11));
3883 #endif
3884 #ifdef IP_RECVIF
3885 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVIF, (st_data_t)rb_intern2("IP_RECVIF", 9));
3886 #endif
3887 #ifdef IP_RECVTTL
3888 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVTTL, (st_data_t)rb_intern2("IP_RECVTTL", 10));
3889 #endif
3890 #ifdef IP_ONESBCAST
3891 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ONESBCAST, (st_data_t)rb_intern2("IP_ONESBCAST", 12));
3892 #endif
3893 #ifdef IP_SENDSRCADDR
3894 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_SENDSRCADDR, (st_data_t)rb_intern2("IP_SENDSRCADDR", 14));
3895 #endif
3896 #ifdef IP_DONTFRAG
3897 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DONTFRAG, (st_data_t)rb_intern2("IP_DONTFRAG", 11));
3898 #endif
3899 #ifdef IP_MINTTL
3900 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MINTTL, (st_data_t)rb_intern2("IP_MINTTL", 9));
3901 #endif
3902 #ifdef IP_RETOPTS
3903 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RETOPTS, (st_data_t)rb_intern2("IP_RETOPTS", 10));
3904 #endif
3905 #ifdef IP_RECVDSTADDR
3906 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVDSTADDR, (st_data_t)rb_intern2("IP_RECVDSTADDR", 14));
3907 #endif
3908 #ifdef IP_RECVRETOPTS
3909 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVRETOPTS, (st_data_t)rb_intern2("IP_RECVRETOPTS", 14));
3910 #endif
3911 #ifdef IP_RECVOPTS
3912 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVOPTS, (st_data_t)rb_intern2("IP_RECVOPTS", 11));
3913 #endif
3914 #ifdef IP_TTL
3915 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TTL, (st_data_t)rb_intern2("IP_TTL", 6));
3916 #endif
3917 #ifdef IP_TOS
3918 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TOS, (st_data_t)rb_intern2("IP_TOS", 6));
3919 #endif
3920 #ifdef IP_HDRINCL
3921 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_HDRINCL, (st_data_t)rb_intern2("IP_HDRINCL", 10));
3922 #endif
3923 #ifdef IP_OPTIONS
3924 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_OPTIONS, (st_data_t)rb_intern2("IP_OPTIONS", 10));
3925 #endif
3926 #ifdef IP_MSFILTER
3927 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MSFILTER, (st_data_t)rb_intern2("MSFILTER", 8));
3928 #endif
3929 #ifdef IP_DROP_SOURCE_MEMBERSHIP
3930 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DROP_SOURCE_MEMBERSHIP, (st_data_t)rb_intern2("DROP_SOURCE_MEMBERSHIP", 22));
3931 #endif
3932 #ifdef IP_ADD_SOURCE_MEMBERSHIP
3933 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ADD_SOURCE_MEMBERSHIP, (st_data_t)rb_intern2("ADD_SOURCE_MEMBERSHIP", 21));
3934 #endif
3935 #ifdef IP_BLOCK_SOURCE
3936 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_BLOCK_SOURCE, (st_data_t)rb_intern2("BLOCK_SOURCE", 12));
3937 #endif
3938 #ifdef IP_UNBLOCK_SOURCE
3939 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_UNBLOCK_SOURCE, (st_data_t)rb_intern2("UNBLOCK_SOURCE", 14));
3940 #endif
3941 #ifdef IP_PMTUDISC_DO
3942 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_DO, (st_data_t)rb_intern2("PMTUDISC_DO", 11));
3943 #endif
3944 #ifdef IP_PMTUDISC_WANT
3945 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_WANT, (st_data_t)rb_intern2("PMTUDISC_WANT", 13));
3946 #endif
3947 #ifdef IP_PMTUDISC_DONT
3948 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PMTUDISC_DONT, (st_data_t)rb_intern2("PMTUDISC_DONT", 13));
3949 #endif
3950 #ifdef IP_TRANSPARENT
3951 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TRANSPARENT, (st_data_t)rb_intern2("TRANSPARENT", 11));
3952 #endif
3953 #ifdef IP_PASSSEC
3954 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PASSSEC, (st_data_t)rb_intern2("PASSSEC", 7));
3955 #endif
3956 #ifdef IP_XFRM_POLICY
3957 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_XFRM_POLICY, (st_data_t)rb_intern2("XFRM_POLICY", 11));
3958 #endif
3959 #ifdef IP_IPSEC_POLICY
3960 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_IPSEC_POLICY, (st_data_t)rb_intern2("IPSEC_POLICY", 12));
3961 #endif
3962 #ifdef IP_FREEBIND
3963 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_FREEBIND, (st_data_t)rb_intern2("FREEBIND", 8));
3964 #endif
3965 #ifdef IP_MTU
3966 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MTU, (st_data_t)rb_intern2("MTU", 3));
3967 #endif
3968 #ifdef IP_RECVTOS
3969 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVTOS, (st_data_t)rb_intern2("RECVTOS", 7));
3970 #endif
3971 #ifdef IP_RECVERR
3972 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVERR, (st_data_t)rb_intern2("RECVERR", 7));
3973 #endif
3974 #ifdef IP_MTU_DISCOVER
3975 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MTU_DISCOVER, (st_data_t)rb_intern2("MTU_DISCOVER", 12));
3976 #endif
3977 #ifdef IP_PKTOPTIONS
3978 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PKTOPTIONS, (st_data_t)rb_intern2("PKTOPTIONS", 10));
3979 #endif
3980 #ifdef IP_PKTINFO
3981 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PKTINFO, (st_data_t)rb_intern2("PKTINFO", 7));
3982 #endif
3983 #ifdef IP_ROUTER_ALERT
3984 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ROUTER_ALERT, (st_data_t)rb_intern2("ROUTER_ALERT", 12));
3985 #endif
3986 #ifdef IP_MAX_MEMBERSHIPS
3987 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MAX_MEMBERSHIPS, (st_data_t)rb_intern2("MAX_MEMBERSHIPS", 15));
3988 #endif
3989 #ifdef IP_DEFAULT_MULTICAST_LOOP
3990 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DEFAULT_MULTICAST_LOOP, (st_data_t)rb_intern2("DEFAULT_MULTICAST_LOOP", 22));
3991 #endif
3992 #ifdef IP_DEFAULT_MULTICAST_TTL
3993 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DEFAULT_MULTICAST_TTL, (st_data_t)rb_intern2("DEFAULT_MULTICAST_TTL", 21));
3994 #endif
3995 #ifdef IP_DROP_MEMBERSHIP
3996 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DROP_MEMBERSHIP, (st_data_t)rb_intern2("DROP_MEMBERSHIP", 15));
3997 #endif
3998 #ifdef IP_ADD_MEMBERSHIP
3999 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ADD_MEMBERSHIP, (st_data_t)rb_intern2("ADD_MEMBERSHIP", 14));
4000 #endif
4001 #ifdef IP_MULTICAST_LOOP
4002 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_LOOP, (st_data_t)rb_intern2("MULTICAST_LOOP", 14));
4003 #endif
4004 #ifdef IP_MULTICAST_TTL
4005 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_TTL, (st_data_t)rb_intern2("MULTICAST_TTL", 13));
4006 #endif
4007 #ifdef IP_MULTICAST_IF
4008 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MULTICAST_IF, (st_data_t)rb_intern2("MULTICAST_IF", 12));
4009 #endif
4010 #ifdef IP_PORTRANGE
4011 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_PORTRANGE, (st_data_t)rb_intern2("PORTRANGE", 9));
4012 #endif
4013 #ifdef IP_RECVSLLA
4014 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVSLLA, (st_data_t)rb_intern2("RECVSLLA", 8));
4015 #endif
4016 #ifdef IP_RECVIF
4017 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVIF, (st_data_t)rb_intern2("RECVIF", 6));
4018 #endif
4019 #ifdef IP_RECVTTL
4020 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVTTL, (st_data_t)rb_intern2("RECVTTL", 7));
4021 #endif
4022 #ifdef IP_ONESBCAST
4023 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_ONESBCAST, (st_data_t)rb_intern2("ONESBCAST", 9));
4024 #endif
4025 #ifdef IP_SENDSRCADDR
4026 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_SENDSRCADDR, (st_data_t)rb_intern2("SENDSRCADDR", 11));
4027 #endif
4028 #ifdef IP_DONTFRAG
4029 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_DONTFRAG, (st_data_t)rb_intern2("DONTFRAG", 8));
4030 #endif
4031 #ifdef IP_MINTTL
4032 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_MINTTL, (st_data_t)rb_intern2("MINTTL", 6));
4033 #endif
4034 #ifdef IP_RETOPTS
4035 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RETOPTS, (st_data_t)rb_intern2("RETOPTS", 7));
4036 #endif
4037 #ifdef IP_RECVDSTADDR
4038 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVDSTADDR, (st_data_t)rb_intern2("RECVDSTADDR", 11));
4039 #endif
4040 #ifdef IP_RECVRETOPTS
4041 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVRETOPTS, (st_data_t)rb_intern2("RECVRETOPTS", 11));
4042 #endif
4043 #ifdef IP_RECVOPTS
4044 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_RECVOPTS, (st_data_t)rb_intern2("RECVOPTS", 8));
4045 #endif
4046 #ifdef IP_TTL
4047 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TTL, (st_data_t)rb_intern2("TTL", 3));
4048 #endif
4049 #ifdef IP_TOS
4050 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_TOS, (st_data_t)rb_intern2("TOS", 3));
4051 #endif
4052 #ifdef IP_HDRINCL
4053 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_HDRINCL, (st_data_t)rb_intern2("HDRINCL", 7));
4054 #endif
4055 #ifdef IP_OPTIONS
4056 st_insert(rsock_intern_ip_optname_hash, (st_data_t)IP_OPTIONS, (st_data_t)rb_intern2("OPTIONS", 7));
4057 #endif
4058
4059 rsock_intern_ipv6_optname_hash = st_init_numtable();
4060 #ifdef IPV6_USE_MIN_MTU
4061 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_USE_MIN_MTU, (st_data_t)rb_intern2("IPV6_USE_MIN_MTU", 16));
4062 #endif
4063 #ifdef IPV6_TCLASS
4064 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_TCLASS, (st_data_t)rb_intern2("IPV6_TCLASS", 11));
4065 #endif
4066 #ifdef IPV6_RECVPATHMTU
4067 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVPATHMTU, (st_data_t)rb_intern2("IPV6_RECVPATHMTU", 16));
4068 #endif
4069 #ifdef IPV6_RTHDR_TYPE_0
4070 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDR_TYPE_0, (st_data_t)rb_intern2("IPV6_RTHDR_TYPE_0", 17));
4071 #endif
4072 #ifdef IPV6_RTHDRDSTOPTS
4073 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDRDSTOPTS, (st_data_t)rb_intern2("IPV6_RTHDRDSTOPTS", 17));
4074 #endif
4075 #ifdef IPV6_RTHDR
4076 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDR, (st_data_t)rb_intern2("IPV6_RTHDR", 10));
4077 #endif
4078 #ifdef IPV6_RECVTCLASS
4079 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVTCLASS, (st_data_t)rb_intern2("IPV6_RECVTCLASS", 15));
4080 #endif
4081 #ifdef IPV6_RECVRTHDR
4082 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVRTHDR, (st_data_t)rb_intern2("IPV6_RECVRTHDR", 14));
4083 #endif
4084 #ifdef IPV6_RECVPKTINFO
4085 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVPKTINFO, (st_data_t)rb_intern2("IPV6_RECVPKTINFO", 16));
4086 #endif
4087 #ifdef IPV6_RECVHOPOPTS
4088 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVHOPOPTS, (st_data_t)rb_intern2("IPV6_RECVHOPOPTS", 16));
4089 #endif
4090 #ifdef IPV6_RECVHOPLIMIT
4091 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVHOPLIMIT, (st_data_t)rb_intern2("IPV6_RECVHOPLIMIT", 17));
4092 #endif
4093 #ifdef IPV6_RECVDSTOPTS
4094 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVDSTOPTS, (st_data_t)rb_intern2("IPV6_RECVDSTOPTS", 16));
4095 #endif
4096 #ifdef IPV6_PKTINFO
4097 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_PKTINFO, (st_data_t)rb_intern2("IPV6_PKTINFO", 12));
4098 #endif
4099 #ifdef IPV6_PATHMTU
4100 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_PATHMTU, (st_data_t)rb_intern2("IPV6_PATHMTU", 12));
4101 #endif
4102 #ifdef IPV6_NEXTHOP
4103 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_NEXTHOP, (st_data_t)rb_intern2("IPV6_NEXTHOP", 12));
4104 #endif
4105 #ifdef IPV6_HOPOPTS
4106 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_HOPOPTS, (st_data_t)rb_intern2("IPV6_HOPOPTS", 12));
4107 #endif
4108 #ifdef IPV6_HOPLIMIT
4109 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_HOPLIMIT, (st_data_t)rb_intern2("IPV6_HOPLIMIT", 13));
4110 #endif
4111 #ifdef IPV6_DSTOPTS
4112 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_DSTOPTS, (st_data_t)rb_intern2("IPV6_DSTOPTS", 12));
4113 #endif
4114 #ifdef IPV6_DONTFRAG
4115 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_DONTFRAG, (st_data_t)rb_intern2("IPV6_DONTFRAG", 13));
4116 #endif
4117 #ifdef IPV6_CHECKSUM
4118 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_CHECKSUM, (st_data_t)rb_intern2("IPV6_CHECKSUM", 13));
4119 #endif
4120 #ifdef IPV6_V6ONLY
4121 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_V6ONLY, (st_data_t)rb_intern2("IPV6_V6ONLY", 11));
4122 #endif
4123 #ifdef IPV6_UNICAST_HOPS
4124 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_UNICAST_HOPS, (st_data_t)rb_intern2("IPV6_UNICAST_HOPS", 17));
4125 #endif
4126 #ifdef IPV6_MULTICAST_LOOP
4127 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_LOOP, (st_data_t)rb_intern2("IPV6_MULTICAST_LOOP", 19));
4128 #endif
4129 #ifdef IPV6_MULTICAST_IF
4130 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_IF, (st_data_t)rb_intern2("IPV6_MULTICAST_IF", 17));
4131 #endif
4132 #ifdef IPV6_MULTICAST_HOPS
4133 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_HOPS, (st_data_t)rb_intern2("IPV6_MULTICAST_HOPS", 19));
4134 #endif
4135 #ifdef IPV6_LEAVE_GROUP
4136 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_LEAVE_GROUP, (st_data_t)rb_intern2("IPV6_LEAVE_GROUP", 16));
4137 #endif
4138 #ifdef IPV6_JOIN_GROUP
4139 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_JOIN_GROUP, (st_data_t)rb_intern2("IPV6_JOIN_GROUP", 15));
4140 #endif
4141 #ifdef IPV6_USE_MIN_MTU
4142 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_USE_MIN_MTU, (st_data_t)rb_intern2("USE_MIN_MTU", 11));
4143 #endif
4144 #ifdef IPV6_TCLASS
4145 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_TCLASS, (st_data_t)rb_intern2("TCLASS", 6));
4146 #endif
4147 #ifdef IPV6_RECVPATHMTU
4148 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVPATHMTU, (st_data_t)rb_intern2("RECVPATHMTU", 11));
4149 #endif
4150 #ifdef IPV6_RTHDR_TYPE_0
4151 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDR_TYPE_0, (st_data_t)rb_intern2("RTHDR_TYPE_0", 12));
4152 #endif
4153 #ifdef IPV6_RTHDRDSTOPTS
4154 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDRDSTOPTS, (st_data_t)rb_intern2("RTHDRDSTOPTS", 12));
4155 #endif
4156 #ifdef IPV6_RTHDR
4157 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RTHDR, (st_data_t)rb_intern2("RTHDR", 5));
4158 #endif
4159 #ifdef IPV6_RECVTCLASS
4160 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVTCLASS, (st_data_t)rb_intern2("RECVTCLASS", 10));
4161 #endif
4162 #ifdef IPV6_RECVRTHDR
4163 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVRTHDR, (st_data_t)rb_intern2("RECVRTHDR", 9));
4164 #endif
4165 #ifdef IPV6_RECVPKTINFO
4166 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVPKTINFO, (st_data_t)rb_intern2("RECVPKTINFO", 11));
4167 #endif
4168 #ifdef IPV6_RECVHOPOPTS
4169 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVHOPOPTS, (st_data_t)rb_intern2("RECVHOPOPTS", 11));
4170 #endif
4171 #ifdef IPV6_RECVHOPLIMIT
4172 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVHOPLIMIT, (st_data_t)rb_intern2("RECVHOPLIMIT", 12));
4173 #endif
4174 #ifdef IPV6_RECVDSTOPTS
4175 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_RECVDSTOPTS, (st_data_t)rb_intern2("RECVDSTOPTS", 11));
4176 #endif
4177 #ifdef IPV6_PKTINFO
4178 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_PKTINFO, (st_data_t)rb_intern2("PKTINFO", 7));
4179 #endif
4180 #ifdef IPV6_PATHMTU
4181 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_PATHMTU, (st_data_t)rb_intern2("PATHMTU", 7));
4182 #endif
4183 #ifdef IPV6_NEXTHOP
4184 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_NEXTHOP, (st_data_t)rb_intern2("NEXTHOP", 7));
4185 #endif
4186 #ifdef IPV6_HOPOPTS
4187 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_HOPOPTS, (st_data_t)rb_intern2("HOPOPTS", 7));
4188 #endif
4189 #ifdef IPV6_HOPLIMIT
4190 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_HOPLIMIT, (st_data_t)rb_intern2("HOPLIMIT", 8));
4191 #endif
4192 #ifdef IPV6_DSTOPTS
4193 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_DSTOPTS, (st_data_t)rb_intern2("DSTOPTS", 7));
4194 #endif
4195 #ifdef IPV6_DONTFRAG
4196 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_DONTFRAG, (st_data_t)rb_intern2("DONTFRAG", 8));
4197 #endif
4198 #ifdef IPV6_CHECKSUM
4199 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_CHECKSUM, (st_data_t)rb_intern2("CHECKSUM", 8));
4200 #endif
4201 #ifdef IPV6_V6ONLY
4202 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_V6ONLY, (st_data_t)rb_intern2("V6ONLY", 6));
4203 #endif
4204 #ifdef IPV6_UNICAST_HOPS
4205 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_UNICAST_HOPS, (st_data_t)rb_intern2("UNICAST_HOPS", 12));
4206 #endif
4207 #ifdef IPV6_MULTICAST_LOOP
4208 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_LOOP, (st_data_t)rb_intern2("MULTICAST_LOOP", 14));
4209 #endif
4210 #ifdef IPV6_MULTICAST_IF
4211 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_IF, (st_data_t)rb_intern2("MULTICAST_IF", 12));
4212 #endif
4213 #ifdef IPV6_MULTICAST_HOPS
4214 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_MULTICAST_HOPS, (st_data_t)rb_intern2("MULTICAST_HOPS", 14));
4215 #endif
4216 #ifdef IPV6_LEAVE_GROUP
4217 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_LEAVE_GROUP, (st_data_t)rb_intern2("LEAVE_GROUP", 11));
4218 #endif
4219 #ifdef IPV6_JOIN_GROUP
4220 st_insert(rsock_intern_ipv6_optname_hash, (st_data_t)IPV6_JOIN_GROUP, (st_data_t)rb_intern2("JOIN_GROUP", 10));
4221 #endif
4222
4223 rsock_intern_tcp_optname_hash = st_init_numtable();
4224 #ifdef TCP_USER_TIMEOUT
4225 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_USER_TIMEOUT, (st_data_t)rb_intern2("TCP_USER_TIMEOUT", 16));
4226 #endif
4227 #ifdef TCP_TIMESTAMP
4228 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_TIMESTAMP, (st_data_t)rb_intern2("TCP_TIMESTAMP", 13));
4229 #endif
4230 #ifdef TCP_THIN_LINEAR_TIMEOUTS
4231 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_THIN_LINEAR_TIMEOUTS, (st_data_t)rb_intern2("TCP_THIN_LINEAR_TIMEOUTS", 24));
4232 #endif
4233 #ifdef TCP_THIN_DUPACK
4234 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_THIN_DUPACK, (st_data_t)rb_intern2("TCP_THIN_DUPACK", 15));
4235 #endif
4236 #ifdef TCP_REPAIR_QUEUE
4237 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR_QUEUE, (st_data_t)rb_intern2("TCP_REPAIR_QUEUE", 16));
4238 #endif
4239 #ifdef TCP_REPAIR_OPTIONS
4240 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR_OPTIONS, (st_data_t)rb_intern2("TCP_REPAIR_OPTIONS", 18));
4241 #endif
4242 #ifdef TCP_REPAIR
4243 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR, (st_data_t)rb_intern2("TCP_REPAIR", 10));
4244 #endif
4245 #ifdef TCP_QUEUE_SEQ
4246 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_QUEUE_SEQ, (st_data_t)rb_intern2("TCP_QUEUE_SEQ", 13));
4247 #endif
4248 #ifdef TCP_COOKIE_TRANSACTIONS
4249 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_COOKIE_TRANSACTIONS, (st_data_t)rb_intern2("TCP_COOKIE_TRANSACTIONS", 23));
4250 #endif
4251 #ifdef TCP_CONGESTION
4252 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_CONGESTION, (st_data_t)rb_intern2("TCP_CONGESTION", 14));
4253 #endif
4254 #ifdef TCP_FASTOPEN
4255 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_FASTOPEN, (st_data_t)rb_intern2("TCP_FASTOPEN", 12));
4256 #endif
4257 #ifdef TCP_WINDOW_CLAMP
4258 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_WINDOW_CLAMP, (st_data_t)rb_intern2("TCP_WINDOW_CLAMP", 16));
4259 #endif
4260 #ifdef TCP_SYNCNT
4261 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_SYNCNT, (st_data_t)rb_intern2("TCP_SYNCNT", 10));
4262 #endif
4263 #ifdef TCP_QUICKACK
4264 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_QUICKACK, (st_data_t)rb_intern2("TCP_QUICKACK", 12));
4265 #endif
4266 #ifdef TCP_NOPUSH
4267 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NOPUSH, (st_data_t)rb_intern2("TCP_NOPUSH", 10));
4268 #endif
4269 #ifdef TCP_NOOPT
4270 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NOOPT, (st_data_t)rb_intern2("TCP_NOOPT", 9));
4271 #endif
4272 #ifdef TCP_MD5SIG
4273 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_MD5SIG, (st_data_t)rb_intern2("TCP_MD5SIG", 10));
4274 #endif
4275 #ifdef TCP_LINGER2
4276 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_LINGER2, (st_data_t)rb_intern2("TCP_LINGER2", 11));
4277 #endif
4278 #ifdef TCP_KEEPINTVL
4279 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPINTVL, (st_data_t)rb_intern2("TCP_KEEPINTVL", 13));
4280 #endif
4281 #ifdef TCP_KEEPIDLE
4282 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPIDLE, (st_data_t)rb_intern2("TCP_KEEPIDLE", 12));
4283 #endif
4284 #ifdef TCP_KEEPCNT
4285 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPCNT, (st_data_t)rb_intern2("TCP_KEEPCNT", 11));
4286 #endif
4287 #ifdef TCP_INFO
4288 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_INFO, (st_data_t)rb_intern2("TCP_INFO", 8));
4289 #endif
4290 #ifdef TCP_DEFER_ACCEPT
4291 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_DEFER_ACCEPT, (st_data_t)rb_intern2("TCP_DEFER_ACCEPT", 16));
4292 #endif
4293 #ifdef TCP_CORK
4294 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_CORK, (st_data_t)rb_intern2("TCP_CORK", 8));
4295 #endif
4296 #ifdef TCP_MAXSEG
4297 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_MAXSEG, (st_data_t)rb_intern2("TCP_MAXSEG", 10));
4298 #endif
4299 #ifdef TCP_NODELAY
4300 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NODELAY, (st_data_t)rb_intern2("TCP_NODELAY", 11));
4301 #endif
4302 #ifdef TCP_USER_TIMEOUT
4303 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_USER_TIMEOUT, (st_data_t)rb_intern2("USER_TIMEOUT", 12));
4304 #endif
4305 #ifdef TCP_TIMESTAMP
4306 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_TIMESTAMP, (st_data_t)rb_intern2("TIMESTAMP", 9));
4307 #endif
4308 #ifdef TCP_THIN_LINEAR_TIMEOUTS
4309 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_THIN_LINEAR_TIMEOUTS, (st_data_t)rb_intern2("THIN_LINEAR_TIMEOUTS", 20));
4310 #endif
4311 #ifdef TCP_THIN_DUPACK
4312 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_THIN_DUPACK, (st_data_t)rb_intern2("THIN_DUPACK", 11));
4313 #endif
4314 #ifdef TCP_REPAIR_QUEUE
4315 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR_QUEUE, (st_data_t)rb_intern2("REPAIR_QUEUE", 12));
4316 #endif
4317 #ifdef TCP_REPAIR_OPTIONS
4318 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR_OPTIONS, (st_data_t)rb_intern2("REPAIR_OPTIONS", 14));
4319 #endif
4320 #ifdef TCP_REPAIR
4321 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_REPAIR, (st_data_t)rb_intern2("REPAIR", 6));
4322 #endif
4323 #ifdef TCP_QUEUE_SEQ
4324 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_QUEUE_SEQ, (st_data_t)rb_intern2("QUEUE_SEQ", 9));
4325 #endif
4326 #ifdef TCP_COOKIE_TRANSACTIONS
4327 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_COOKIE_TRANSACTIONS, (st_data_t)rb_intern2("COOKIE_TRANSACTIONS", 19));
4328 #endif
4329 #ifdef TCP_CONGESTION
4330 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_CONGESTION, (st_data_t)rb_intern2("CONGESTION", 10));
4331 #endif
4332 #ifdef TCP_FASTOPEN
4333 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_FASTOPEN, (st_data_t)rb_intern2("FASTOPEN", 8));
4334 #endif
4335 #ifdef TCP_WINDOW_CLAMP
4336 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_WINDOW_CLAMP, (st_data_t)rb_intern2("WINDOW_CLAMP", 12));
4337 #endif
4338 #ifdef TCP_SYNCNT
4339 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_SYNCNT, (st_data_t)rb_intern2("SYNCNT", 6));
4340 #endif
4341 #ifdef TCP_QUICKACK
4342 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_QUICKACK, (st_data_t)rb_intern2("QUICKACK", 8));
4343 #endif
4344 #ifdef TCP_NOPUSH
4345 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NOPUSH, (st_data_t)rb_intern2("NOPUSH", 6));
4346 #endif
4347 #ifdef TCP_NOOPT
4348 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NOOPT, (st_data_t)rb_intern2("NOOPT", 5));
4349 #endif
4350 #ifdef TCP_MD5SIG
4351 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_MD5SIG, (st_data_t)rb_intern2("MD5SIG", 6));
4352 #endif
4353 #ifdef TCP_LINGER2
4354 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_LINGER2, (st_data_t)rb_intern2("LINGER2", 7));
4355 #endif
4356 #ifdef TCP_KEEPINTVL
4357 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPINTVL, (st_data_t)rb_intern2("KEEPINTVL", 9));
4358 #endif
4359 #ifdef TCP_KEEPIDLE
4360 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPIDLE, (st_data_t)rb_intern2("KEEPIDLE", 8));
4361 #endif
4362 #ifdef TCP_KEEPCNT
4363 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_KEEPCNT, (st_data_t)rb_intern2("KEEPCNT", 7));
4364 #endif
4365 #ifdef TCP_INFO
4366 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_INFO, (st_data_t)rb_intern2("INFO", 4));
4367 #endif
4368 #ifdef TCP_DEFER_ACCEPT
4369 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_DEFER_ACCEPT, (st_data_t)rb_intern2("DEFER_ACCEPT", 12));
4370 #endif
4371 #ifdef TCP_CORK
4372 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_CORK, (st_data_t)rb_intern2("CORK", 4));
4373 #endif
4374 #ifdef TCP_MAXSEG
4375 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_MAXSEG, (st_data_t)rb_intern2("MAXSEG", 6));
4376 #endif
4377 #ifdef TCP_NODELAY
4378 st_insert(rsock_intern_tcp_optname_hash, (st_data_t)TCP_NODELAY, (st_data_t)rb_intern2("NODELAY", 7));
4379 #endif
4380
4381 rsock_intern_udp_optname_hash = st_init_numtable();
4382 #ifdef UDP_CORK
4383 st_insert(rsock_intern_udp_optname_hash, (st_data_t)UDP_CORK, (st_data_t)rb_intern2("UDP_CORK", 8));
4384 #endif
4385 #ifdef UDP_CORK
4386 st_insert(rsock_intern_udp_optname_hash, (st_data_t)UDP_CORK, (st_data_t)rb_intern2("CORK", 4));
4387 #endif
4388
4389 rsock_intern_scm_optname_hash = st_init_numtable();
4390 #ifdef SCM_WIFI_STATUS
4391 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_WIFI_STATUS, (st_data_t)rb_intern2("SCM_WIFI_STATUS", 15));
4392 #endif
4393 #ifdef SCM_UCRED
4394 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_UCRED, (st_data_t)rb_intern2("SCM_UCRED", 9));
4395 #endif
4396 #ifdef SCM_CREDS
4397 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_CREDS, (st_data_t)rb_intern2("SCM_CREDS", 9));
4398 #endif
4399 #ifdef SCM_CREDENTIALS
4400 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_CREDENTIALS, (st_data_t)rb_intern2("SCM_CREDENTIALS", 15));
4401 #endif
4402 #ifdef SCM_BINTIME
4403 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_BINTIME, (st_data_t)rb_intern2("SCM_BINTIME", 11));
4404 #endif
4405 #ifdef SCM_TIMESTAMPING
4406 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMPING, (st_data_t)rb_intern2("SCM_TIMESTAMPING", 16));
4407 #endif
4408 #ifdef SCM_TIMESTAMPNS
4409 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMPNS, (st_data_t)rb_intern2("SCM_TIMESTAMPNS", 15));
4410 #endif
4411 #ifdef SCM_TIMESTAMP
4412 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMP, (st_data_t)rb_intern2("SCM_TIMESTAMP", 13));
4413 #endif
4414 #ifdef SCM_RIGHTS
4415 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_RIGHTS, (st_data_t)rb_intern2("SCM_RIGHTS", 10));
4416 #endif
4417 #ifdef SCM_WIFI_STATUS
4418 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_WIFI_STATUS, (st_data_t)rb_intern2("WIFI_STATUS", 11));
4419 #endif
4420 #ifdef SCM_UCRED
4421 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_UCRED, (st_data_t)rb_intern2("UCRED", 5));
4422 #endif
4423 #ifdef SCM_CREDS
4424 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_CREDS, (st_data_t)rb_intern2("CREDS", 5));
4425 #endif
4426 #ifdef SCM_CREDENTIALS
4427 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_CREDENTIALS, (st_data_t)rb_intern2("CREDENTIALS", 11));
4428 #endif
4429 #ifdef SCM_BINTIME
4430 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_BINTIME, (st_data_t)rb_intern2("BINTIME", 7));
4431 #endif
4432 #ifdef SCM_TIMESTAMPING
4433 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMPING, (st_data_t)rb_intern2("TIMESTAMPING", 12));
4434 #endif
4435 #ifdef SCM_TIMESTAMPNS
4436 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMPNS, (st_data_t)rb_intern2("TIMESTAMPNS", 11));
4437 #endif
4438 #ifdef SCM_TIMESTAMP
4439 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_TIMESTAMP, (st_data_t)rb_intern2("TIMESTAMP", 9));
4440 #endif
4441 #ifdef SCM_RIGHTS
4442 st_insert(rsock_intern_scm_optname_hash, (st_data_t)SCM_RIGHTS, (st_data_t)rb_intern2("RIGHTS", 6));
4443 #endif
4444
4445 rsock_intern_local_optname_hash = st_init_numtable();
4446 #ifdef LOCAL_CONNWAIT
4447 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_CONNWAIT, (st_data_t)rb_intern2("LOCAL_CONNWAIT", 14));
4448 #endif
4449 #ifdef LOCAL_CREDS
4450 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_CREDS, (st_data_t)rb_intern2("LOCAL_CREDS", 11));
4451 #endif
4452 #ifdef LOCAL_PEERCRED
4453 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_PEERCRED, (st_data_t)rb_intern2("LOCAL_PEERCRED", 14));
4454 #endif
4455 #ifdef LOCAL_CONNWAIT
4456 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_CONNWAIT, (st_data_t)rb_intern2("CONNWAIT", 8));
4457 #endif
4458 #ifdef LOCAL_CREDS
4459 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_CREDS, (st_data_t)rb_intern2("CREDS", 5));
4460 #endif
4461 #ifdef LOCAL_PEERCRED
4462 st_insert(rsock_intern_local_optname_hash, (st_data_t)LOCAL_PEERCRED, (st_data_t)rb_intern2("PEERCRED", 8));
4463 #endif
4464
4465 }
4466
4467 int
4468 rsock_family_to_int(const char *str, long len, int *valp)
4469 {
4470 switch (len) {
4471 case 2:
4472 #ifdef AF_NS
4473 if (memcmp(str, "NS", 2) == 0) { *valp = AF_NS; return 0; }
4474 #endif
4475 return -1;
4476
4477 case 3:
4478 #ifdef AF_IPX
4479 if (memcmp(str, "IPX", 3) == 0) { *valp = AF_IPX; return 0; }
4480 #endif
4481 #ifdef AF_PUP
4482 if (memcmp(str, "PUP", 3) == 0) { *valp = AF_PUP; return 0; }
4483 #endif
4484 #ifdef AF_ISO
4485 if (memcmp(str, "ISO", 3) == 0) { *valp = AF_ISO; return 0; }
4486 #endif
4487 #ifdef AF_OSI
4488 if (memcmp(str, "OSI", 3) == 0) { *valp = AF_OSI; return 0; }
4489 #endif
4490 #ifdef AF_SNA
4491 if (memcmp(str, "SNA", 3) == 0) { *valp = AF_SNA; return 0; }
4492 #endif
4493 #ifdef AF_DEC
4494 if (memcmp(str, "DEC", 3) == 0) { *valp = AF_DEC; return 0; }
4495 #endif
4496 #ifdef AF_DLI
4497 if (memcmp(str, "DLI", 3) == 0) { *valp = AF_DLI; return 0; }
4498 #endif
4499 #ifdef AF_LAT
4500 if (memcmp(str, "LAT", 3) == 0) { *valp = AF_LAT; return 0; }
4501 #endif
4502 #ifdef AF_CNT
4503 if (memcmp(str, "CNT", 3) == 0) { *valp = AF_CNT; return 0; }
4504 #endif
4505 #ifdef AF_SIP
4506 if (memcmp(str, "SIP", 3) == 0) { *valp = AF_SIP; return 0; }
4507 #endif
4508 #ifdef AF_PPP
4509 if (memcmp(str, "PPP", 3) == 0) { *valp = AF_PPP; return 0; }
4510 #endif
4511 #ifdef AF_ATM
4512 if (memcmp(str, "ATM", 3) == 0) { *valp = AF_ATM; return 0; }
4513 #endif
4514 #ifdef AF_MAX
4515 if (memcmp(str, "MAX", 3) == 0) { *valp = AF_MAX; return 0; }
4516 #endif
4517 return -1;
4518
4519 case 4:
4520 #ifdef AF_INET
4521 if (memcmp(str, "INET", 4) == 0) { *valp = AF_INET; return 0; }
4522 #endif
4523 #ifdef AF_UNIX
4524 if (memcmp(str, "UNIX", 4) == 0) { *valp = AF_UNIX; return 0; }
4525 #endif
4526 #ifdef AF_AX25
4527 if (memcmp(str, "AX25", 4) == 0) { *valp = AF_AX25; return 0; }
4528 #endif
4529 #ifdef AF_ECMA
4530 if (memcmp(str, "ECMA", 4) == 0) { *valp = AF_ECMA; return 0; }
4531 #endif
4532 #ifdef AF_LINK
4533 if (memcmp(str, "LINK", 4) == 0) { *valp = AF_LINK; return 0; }
4534 #endif
4535 #ifdef AF_COIP
4536 if (memcmp(str, "COIP", 4) == 0) { *valp = AF_COIP; return 0; }
4537 #endif
4538 #ifdef AF_NDRV
4539 if (memcmp(str, "NDRV", 4) == 0) { *valp = AF_NDRV; return 0; }
4540 #endif
4541 #ifdef AF_ISDN
4542 if (memcmp(str, "ISDN", 4) == 0) { *valp = AF_ISDN; return 0; }
4543 #endif
4544 #ifdef AF_NATM
4545 if (memcmp(str, "NATM", 4) == 0) { *valp = AF_NATM; return 0; }
4546 #endif
4547 #ifdef AF_E164
4548 if (memcmp(str, "E164", 4) == 0) { *valp = AF_E164; return 0; }
4549 #endif
4550 return -1;
4551
4552 case 5:
4553 #ifdef AF_NS
4554 if (memcmp(str, "AF_NS", 5) == 0) { *valp = AF_NS; return 0; }
4555 #endif
4556 #ifdef PF_NS
4557 if (memcmp(str, "PF_NS", 5) == 0) { *valp = PF_NS; return 0; }
4558 #endif
4559 #ifdef AF_INET6
4560 if (memcmp(str, "INET6", 5) == 0) { *valp = AF_INET6; return 0; }
4561 #endif
4562 #ifdef AF_LOCAL
4563 if (memcmp(str, "LOCAL", 5) == 0) { *valp = AF_LOCAL; return 0; }
4564 #endif
4565 #ifdef AF_CHAOS
4566 if (memcmp(str, "CHAOS", 5) == 0) { *valp = AF_CHAOS; return 0; }
4567 #endif
4568 #ifdef AF_CCITT
4569 if (memcmp(str, "CCITT", 5) == 0) { *valp = AF_CCITT; return 0; }
4570 #endif
4571 #ifdef AF_ROUTE
4572 if (memcmp(str, "ROUTE", 5) == 0) { *valp = AF_ROUTE; return 0; }
4573 #endif
4574 return -1;
4575
4576 case 6:
4577 #ifdef AF_IPX
4578 if (memcmp(str, "AF_IPX", 6) == 0) { *valp = AF_IPX; return 0; }
4579 #endif
4580 #ifdef PF_IPX
4581 if (memcmp(str, "PF_IPX", 6) == 0) { *valp = PF_IPX; return 0; }
4582 #endif
4583 #ifdef AF_PUP
4584 if (memcmp(str, "AF_PUP", 6) == 0) { *valp = AF_PUP; return 0; }
4585 #endif
4586 #ifdef PF_PUP
4587 if (memcmp(str, "PF_PUP", 6) == 0) { *valp = PF_PUP; return 0; }
4588 #endif
4589 #ifdef AF_ISO
4590 if (memcmp(str, "AF_ISO", 6) == 0) { *valp = AF_ISO; return 0; }
4591 #endif
4592 #ifdef PF_ISO
4593 if (memcmp(str, "PF_ISO", 6) == 0) { *valp = PF_ISO; return 0; }
4594 #endif
4595 #ifdef AF_OSI
4596 if (memcmp(str, "AF_OSI", 6) == 0) { *valp = AF_OSI; return 0; }
4597 #endif
4598 #ifdef PF_OSI
4599 if (memcmp(str, "PF_OSI", 6) == 0) { *valp = PF_OSI; return 0; }
4600 #endif
4601 #ifdef AF_SNA
4602 if (memcmp(str, "AF_SNA", 6) == 0) { *valp = AF_SNA; return 0; }
4603 #endif
4604 #ifdef PF_SNA
4605 if (memcmp(str, "PF_SNA", 6) == 0) { *valp = PF_SNA; return 0; }
4606 #endif
4607 #ifdef AF_DEC
4608 if (memcmp(str, "AF_DEC", 6) == 0) { *valp = AF_DEC; return 0; }
4609 #endif
4610 #ifdef PF_DEC
4611 if (memcmp(str, "PF_DEC", 6) == 0) { *valp = PF_DEC; return 0; }
4612 #endif
4613 #ifdef AF_DLI
4614 if (memcmp(str, "AF_DLI", 6) == 0) { *valp = AF_DLI; return 0; }
4615 #endif
4616 #ifdef PF_DLI
4617 if (memcmp(str, "PF_DLI", 6) == 0) { *valp = PF_DLI; return 0; }
4618 #endif
4619 #ifdef AF_LAT
4620 if (memcmp(str, "AF_LAT", 6) == 0) { *valp = AF_LAT; return 0; }
4621 #endif
4622 #ifdef PF_LAT
4623 if (memcmp(str, "PF_LAT", 6) == 0) { *valp = PF_LAT; return 0; }
4624 #endif
4625 #ifdef AF_CNT
4626 if (memcmp(str, "AF_CNT", 6) == 0) { *valp = AF_CNT; return 0; }
4627 #endif
4628 #ifdef PF_CNT
4629 if (memcmp(str, "PF_CNT", 6) == 0) { *valp = PF_CNT; return 0; }
4630 #endif
4631 #ifdef AF_SIP
4632 if (memcmp(str, "AF_SIP", 6) == 0) { *valp = AF_SIP; return 0; }
4633 #endif
4634 #ifdef PF_SIP
4635 if (memcmp(str, "PF_SIP", 6) == 0) { *valp = PF_SIP; return 0; }
4636 #endif
4637 #ifdef AF_PPP
4638 if (memcmp(str, "AF_PPP", 6) == 0) { *valp = AF_PPP; return 0; }
4639 #endif
4640 #ifdef PF_PPP
4641 if (memcmp(str, "PF_PPP", 6) == 0) { *valp = PF_PPP; return 0; }
4642 #endif
4643 #ifdef AF_ATM
4644 if (memcmp(str, "AF_ATM", 6) == 0) { *valp = AF_ATM; return 0; }
4645 #endif
4646 #ifdef PF_ATM
4647 if (memcmp(str, "PF_ATM", 6) == 0) { *valp = PF_ATM; return 0; }
4648 #endif
4649 #ifdef AF_MAX
4650 if (memcmp(str, "AF_MAX", 6) == 0) { *valp = AF_MAX; return 0; }
4651 #endif
4652 #ifdef PF_MAX
4653 if (memcmp(str, "PF_MAX", 6) == 0) { *valp = PF_MAX; return 0; }
4654 #endif
4655 #ifdef PF_XTP
4656 if (memcmp(str, "PF_XTP", 6) == 0) { *valp = PF_XTP; return 0; }
4657 #endif
4658 #ifdef PF_PIP
4659 if (memcmp(str, "PF_PIP", 6) == 0) { *valp = PF_PIP; return 0; }
4660 #endif
4661 #ifdef PF_KEY
4662 if (memcmp(str, "PF_KEY", 6) == 0) { *valp = PF_KEY; return 0; }
4663 #endif
4664 #ifdef AF_UNSPEC
4665 if (memcmp(str, "UNSPEC", 6) == 0) { *valp = AF_UNSPEC; return 0; }
4666 #endif
4667 #ifdef AF_HYLINK
4668 if (memcmp(str, "HYLINK", 6) == 0) { *valp = AF_HYLINK; return 0; }
4669 #endif
4670 #ifdef AF_SYSTEM
4671 if (memcmp(str, "SYSTEM", 6) == 0) { *valp = AF_SYSTEM; return 0; }
4672 #endif
4673 #ifdef AF_PACKET
4674 if (memcmp(str, "PACKET", 6) == 0) { *valp = AF_PACKET; return 0; }
4675 #endif
4676 return -1;
4677
4678 case 7:
4679 #ifdef AF_INET
4680 if (memcmp(str, "AF_INET", 7) == 0) { *valp = AF_INET; return 0; }
4681 #endif
4682 #ifdef PF_INET
4683 if (memcmp(str, "PF_INET", 7) == 0) { *valp = PF_INET; return 0; }
4684 #endif
4685 #ifdef AF_UNIX
4686 if (memcmp(str, "AF_UNIX", 7) == 0) { *valp = AF_UNIX; return 0; }
4687 #endif
4688 #ifdef PF_UNIX
4689 if (memcmp(str, "PF_UNIX", 7) == 0) { *valp = PF_UNIX; return 0; }
4690 #endif
4691 #ifdef AF_AX25
4692 if (memcmp(str, "AF_AX25", 7) == 0) { *valp = AF_AX25; return 0; }
4693 #endif
4694 #ifdef PF_AX25
4695 if (memcmp(str, "PF_AX25", 7) == 0) { *valp = PF_AX25; return 0; }
4696 #endif
4697 #ifdef AF_ECMA
4698 if (memcmp(str, "AF_ECMA", 7) == 0) { *valp = AF_ECMA; return 0; }
4699 #endif
4700 #ifdef PF_ECMA
4701 if (memcmp(str, "PF_ECMA", 7) == 0) { *valp = PF_ECMA; return 0; }
4702 #endif
4703 #ifdef AF_LINK
4704 if (memcmp(str, "AF_LINK", 7) == 0) { *valp = AF_LINK; return 0; }
4705 #endif
4706 #ifdef PF_LINK
4707 if (memcmp(str, "PF_LINK", 7) == 0) { *valp = PF_LINK; return 0; }
4708 #endif
4709 #ifdef AF_COIP
4710 if (memcmp(str, "AF_COIP", 7) == 0) { *valp = AF_COIP; return 0; }
4711 #endif
4712 #ifdef PF_COIP
4713 if (memcmp(str, "PF_COIP", 7) == 0) { *valp = PF_COIP; return 0; }
4714 #endif
4715 #ifdef AF_NDRV
4716 if (memcmp(str, "AF_NDRV", 7) == 0) { *valp = AF_NDRV; return 0; }
4717 #endif
4718 #ifdef PF_NDRV
4719 if (memcmp(str, "PF_NDRV", 7) == 0) { *valp = PF_NDRV; return 0; }
4720 #endif
4721 #ifdef AF_ISDN
4722 if (memcmp(str, "AF_ISDN", 7) == 0) { *valp = AF_ISDN; return 0; }
4723 #endif
4724 #ifdef PF_ISDN
4725 if (memcmp(str, "PF_ISDN", 7) == 0) { *valp = PF_ISDN; return 0; }
4726 #endif
4727 #ifdef AF_NATM
4728 if (memcmp(str, "AF_NATM", 7) == 0) { *valp = AF_NATM; return 0; }
4729 #endif
4730 #ifdef PF_NATM
4731 if (memcmp(str, "PF_NATM", 7) == 0) { *valp = PF_NATM; return 0; }
4732 #endif
4733 #ifdef AF_E164
4734 if (memcmp(str, "AF_E164", 7) == 0) { *valp = AF_E164; return 0; }
4735 #endif
4736 #ifdef PF_RTIP
4737 if (memcmp(str, "PF_RTIP", 7) == 0) { *valp = PF_RTIP; return 0; }
4738 #endif
4739 #ifdef AF_IMPLINK
4740 if (memcmp(str, "IMPLINK", 7) == 0) { *valp = AF_IMPLINK; return 0; }
4741 #endif
4742 #ifdef AF_DATAKIT
4743 if (memcmp(str, "DATAKIT", 7) == 0) { *valp = AF_DATAKIT; return 0; }
4744 #endif
4745 #ifdef AF_NETBIOS
4746 if (memcmp(str, "NETBIOS", 7) == 0) { *valp = AF_NETBIOS; return 0; }
4747 #endif
4748 return -1;
4749
4750 case 8:
4751 #ifdef AF_INET6
4752 if (memcmp(str, "AF_INET6", 8) == 0) { *valp = AF_INET6; return 0; }
4753 #endif
4754 #ifdef PF_INET6
4755 if (memcmp(str, "PF_INET6", 8) == 0) { *valp = PF_INET6; return 0; }
4756 #endif
4757 #ifdef AF_LOCAL
4758 if (memcmp(str, "AF_LOCAL", 8) == 0) { *valp = AF_LOCAL; return 0; }
4759 #endif
4760 #ifdef PF_LOCAL
4761 if (memcmp(str, "PF_LOCAL", 8) == 0) { *valp = PF_LOCAL; return 0; }
4762 #endif
4763 #ifdef AF_CHAOS
4764 if (memcmp(str, "AF_CHAOS", 8) == 0) { *valp = AF_CHAOS; return 0; }
4765 #endif
4766 #ifdef PF_CHAOS
4767 if (memcmp(str, "PF_CHAOS", 8) == 0) { *valp = PF_CHAOS; return 0; }
4768 #endif
4769 #ifdef AF_CCITT
4770 if (memcmp(str, "AF_CCITT", 8) == 0) { *valp = AF_CCITT; return 0; }
4771 #endif
4772 #ifdef PF_CCITT
4773 if (memcmp(str, "PF_CCITT", 8) == 0) { *valp = PF_CCITT; return 0; }
4774 #endif
4775 #ifdef AF_ROUTE
4776 if (memcmp(str, "AF_ROUTE", 8) == 0) { *valp = AF_ROUTE; return 0; }
4777 #endif
4778 #ifdef PF_ROUTE
4779 if (memcmp(str, "PF_ROUTE", 8) == 0) { *valp = PF_ROUTE; return 0; }
4780 #endif
4781 #ifdef AF_NETGRAPH
4782 if (memcmp(str, "NETGRAPH", 8) == 0) { *valp = AF_NETGRAPH; return 0; }
4783 #endif
4784 return -1;
4785
4786 case 9:
4787 #ifdef AF_UNSPEC
4788 if (memcmp(str, "AF_UNSPEC", 9) == 0) { *valp = AF_UNSPEC; return 0; }
4789 #endif
4790 #ifdef PF_UNSPEC
4791 if (memcmp(str, "PF_UNSPEC", 9) == 0) { *valp = PF_UNSPEC; return 0; }
4792 #endif
4793 #ifdef AF_HYLINK
4794 if (memcmp(str, "AF_HYLINK", 9) == 0) { *valp = AF_HYLINK; return 0; }
4795 #endif
4796 #ifdef PF_HYLINK
4797 if (memcmp(str, "PF_HYLINK", 9) == 0) { *valp = PF_HYLINK; return 0; }
4798 #endif
4799 #ifdef AF_SYSTEM
4800 if (memcmp(str, "AF_SYSTEM", 9) == 0) { *valp = AF_SYSTEM; return 0; }
4801 #endif
4802 #ifdef PF_SYSTEM
4803 if (memcmp(str, "PF_SYSTEM", 9) == 0) { *valp = PF_SYSTEM; return 0; }
4804 #endif
4805 #ifdef AF_PACKET
4806 if (memcmp(str, "AF_PACKET", 9) == 0) { *valp = AF_PACKET; return 0; }
4807 #endif
4808 #ifdef PF_PACKET
4809 if (memcmp(str, "PF_PACKET", 9) == 0) { *valp = PF_PACKET; return 0; }
4810 #endif
4811 #ifdef AF_APPLETALK
4812 if (memcmp(str, "APPLETALK", 9) == 0) { *valp = AF_APPLETALK; return 0; }
4813 #endif
4814 return -1;
4815
4816 case 10:
4817 #ifdef AF_IMPLINK
4818 if (memcmp(str, "AF_IMPLINK", 10) == 0) { *valp = AF_IMPLINK; return 0; }
4819 #endif
4820 #ifdef PF_IMPLINK
4821 if (memcmp(str, "PF_IMPLINK", 10) == 0) { *valp = PF_IMPLINK; return 0; }
4822 #endif
4823 #ifdef AF_DATAKIT
4824 if (memcmp(str, "AF_DATAKIT", 10) == 0) { *valp = AF_DATAKIT; return 0; }
4825 #endif
4826 #ifdef PF_DATAKIT
4827 if (memcmp(str, "PF_DATAKIT", 10) == 0) { *valp = PF_DATAKIT; return 0; }
4828 #endif
4829 #ifdef AF_NETBIOS
4830 if (memcmp(str, "AF_NETBIOS", 10) == 0) { *valp = AF_NETBIOS; return 0; }
4831 #endif
4832 #ifdef PF_NETBIOS
4833 if (memcmp(str, "PF_NETBIOS", 10) == 0) { *valp = PF_NETBIOS; return 0; }
4834 #endif
4835 return -1;
4836
4837 case 11:
4838 #ifdef AF_NETGRAPH
4839 if (memcmp(str, "AF_NETGRAPH", 11) == 0) { *valp = AF_NETGRAPH; return 0; }
4840 #endif
4841 #ifdef PF_NETGRAPH
4842 if (memcmp(str, "PF_NETGRAPH", 11) == 0) { *valp = PF_NETGRAPH; return 0; }
4843 #endif
4844 return -1;
4845
4846 case 12:
4847 #ifdef AF_APPLETALK
4848 if (memcmp(str, "AF_APPLETALK", 12) == 0) { *valp = AF_APPLETALK; return 0; }
4849 #endif
4850 #ifdef PF_APPLETALK
4851 if (memcmp(str, "PF_APPLETALK", 12) == 0) { *valp = PF_APPLETALK; return 0; }
4852 #endif
4853 return -1;
4854
4855 default:
4856 if (!str || !valp) {/* wrong argument */}
4857 return -1;
4858 }
4859 }
4860
4861
4862 int
4863 rsock_socktype_to_int(const char *str, long len, int *valp)
4864 {
4865 switch (len) {
4866 case 3:
4867 #ifdef SOCK_RAW
4868 if (memcmp(str, "RAW", 3) == 0) { *valp = SOCK_RAW; return 0; }
4869 #endif
4870 #ifdef SOCK_RDM
4871 if (memcmp(str, "RDM", 3) == 0) { *valp = SOCK_RDM; return 0; }
4872 #endif
4873 return -1;
4874
4875 case 5:
4876 #ifdef SOCK_DGRAM
4877 if (memcmp(str, "DGRAM", 5) == 0) { *valp = SOCK_DGRAM; return 0; }
4878 #endif
4879 return -1;
4880
4881 case 6:
4882 #ifdef SOCK_STREAM
4883 if (memcmp(str, "STREAM", 6) == 0) { *valp = SOCK_STREAM; return 0; }
4884 #endif
4885 #ifdef SOCK_PACKET
4886 if (memcmp(str, "PACKET", 6) == 0) { *valp = SOCK_PACKET; return 0; }
4887 #endif
4888 return -1;
4889
4890 case 8:
4891 #ifdef SOCK_RAW
4892 if (memcmp(str, "SOCK_RAW", 8) == 0) { *valp = SOCK_RAW; return 0; }
4893 #endif
4894 #ifdef SOCK_RDM
4895 if (memcmp(str, "SOCK_RDM", 8) == 0) { *valp = SOCK_RDM; return 0; }
4896 #endif
4897 return -1;
4898
4899 case 9:
4900 #ifdef SOCK_SEQPACKET
4901 if (memcmp(str, "SEQPACKET", 9) == 0) { *valp = SOCK_SEQPACKET; return 0; }
4902 #endif
4903 return -1;
4904
4905 case 10:
4906 #ifdef SOCK_DGRAM
4907 if (memcmp(str, "SOCK_DGRAM", 10) == 0) { *valp = SOCK_DGRAM; return 0; }
4908 #endif
4909 return -1;
4910
4911 case 11:
4912 #ifdef SOCK_STREAM
4913 if (memcmp(str, "SOCK_STREAM", 11) == 0) { *valp = SOCK_STREAM; return 0; }
4914 #endif
4915 #ifdef SOCK_PACKET
4916 if (memcmp(str, "SOCK_PACKET", 11) == 0) { *valp = SOCK_PACKET; return 0; }
4917 #endif
4918 return -1;
4919
4920 case 14:
4921 #ifdef SOCK_SEQPACKET
4922 if (memcmp(str, "SOCK_SEQPACKET", 14) == 0) { *valp = SOCK_SEQPACKET; return 0; }
4923 #endif
4924 return -1;
4925
4926 default:
4927 if (!str || !valp) {/* wrong argument */}
4928 return -1;
4929 }
4930 }
4931
4932
4933 int
4934 rsock_ipproto_to_int(const char *str, long len, int *valp)
4935 {
4936 switch (len) {
4937 case 2:
4938 #ifdef IPPROTO_IP
4939 if (memcmp(str, "IP", 2) == 0) { *valp = IPPROTO_IP; return 0; }
4940 #endif
4941 #ifdef IPPROTO_ND
4942 if (memcmp(str, "ND", 2) == 0) { *valp = IPPROTO_ND; return 0; }
4943 #endif
4944 #ifdef IPPROTO_TP
4945 if (memcmp(str, "TP", 2) == 0) { *valp = IPPROTO_TP; return 0; }
4946 #endif
4947 #ifdef IPPROTO_AH
4948 if (memcmp(str, "AH", 2) == 0) { *valp = IPPROTO_AH; return 0; }
4949 #endif
4950 return -1;
4951
4952 case 3:
4953 #ifdef IPPROTO_GGP
4954 if (memcmp(str, "GGP", 3) == 0) { *valp = IPPROTO_GGP; return 0; }
4955 #endif
4956 #ifdef IPPROTO_TCP
4957 if (memcmp(str, "TCP", 3) == 0) { *valp = IPPROTO_TCP; return 0; }
4958 #endif
4959 #ifdef IPPROTO_EGP
4960 if (memcmp(str, "EGP", 3) == 0) { *valp = IPPROTO_EGP; return 0; }
4961 #endif
4962 #ifdef IPPROTO_PUP
4963 if (memcmp(str, "PUP", 3) == 0) { *valp = IPPROTO_PUP; return 0; }
4964 #endif
4965 #ifdef IPPROTO_UDP
4966 if (memcmp(str, "UDP", 3) == 0) { *valp = IPPROTO_UDP; return 0; }
4967 #endif
4968 #ifdef IPPROTO_IDP
4969 if (memcmp(str, "IDP", 3) == 0) { *valp = IPPROTO_IDP; return 0; }
4970 #endif
4971 #ifdef IPPROTO_XTP
4972 if (memcmp(str, "XTP", 3) == 0) { *valp = IPPROTO_XTP; return 0; }
4973 #endif
4974 #ifdef IPPROTO_EON
4975 if (memcmp(str, "EON", 3) == 0) { *valp = IPPROTO_EON; return 0; }
4976 #endif
4977 #ifdef IPPROTO_BIP
4978 if (memcmp(str, "BIP", 3) == 0) { *valp = IPPROTO_BIP; return 0; }
4979 #endif
4980 #ifdef IPPROTO_ESP
4981 if (memcmp(str, "ESP", 3) == 0) { *valp = IPPROTO_ESP; return 0; }
4982 #endif
4983 #ifdef IPPROTO_RAW
4984 if (memcmp(str, "RAW", 3) == 0) { *valp = IPPROTO_RAW; return 0; }
4985 #endif
4986 #ifdef IPPROTO_MAX
4987 if (memcmp(str, "MAX", 3) == 0) { *valp = IPPROTO_MAX; return 0; }
4988 #endif
4989 return -1;
4990
4991 case 4:
4992 #ifdef IPPROTO_ICMP
4993 if (memcmp(str, "ICMP", 4) == 0) { *valp = IPPROTO_ICMP; return 0; }
4994 #endif
4995 #ifdef IPPROTO_IGMP
4996 if (memcmp(str, "IGMP", 4) == 0) { *valp = IPPROTO_IGMP; return 0; }
4997 #endif
4998 #ifdef IPPROTO_IPV6
4999 if (memcmp(str, "IPV6", 4) == 0) { *valp = IPPROTO_IPV6; return 0; }
5000 #endif
5001 #ifdef IPPROTO_NONE
5002 if (memcmp(str, "NONE", 4) == 0) { *valp = IPPROTO_NONE; return 0; }
5003 #endif
5004 return -1;
5005
5006 case 5:
5007 #ifdef IPPROTO_HELLO
5008 if (memcmp(str, "HELLO", 5) == 0) { *valp = IPPROTO_HELLO; return 0; }
5009 #endif
5010 return -1;
5011
5012 case 6:
5013 #ifdef IPPROTO_ICMPV6
5014 if (memcmp(str, "ICMPV6", 6) == 0) { *valp = IPPROTO_ICMPV6; return 0; }
5015 #endif
5016 return -1;
5017
5018 case 7:
5019 #ifdef IPPROTO_DSTOPTS
5020 if (memcmp(str, "DSTOPTS", 7) == 0) { *valp = IPPROTO_DSTOPTS; return 0; }
5021 #endif
5022 #ifdef IPPROTO_HOPOPTS
5023 if (memcmp(str, "HOPOPTS", 7) == 0) { *valp = IPPROTO_HOPOPTS; return 0; }
5024 #endif
5025 #ifdef IPPROTO_ROUTING
5026 if (memcmp(str, "ROUTING", 7) == 0) { *valp = IPPROTO_ROUTING; return 0; }
5027 #endif
5028 return -1;
5029
5030 case 8:
5031 #ifdef IPPROTO_FRAGMENT
5032 if (memcmp(str, "FRAGMENT", 8) == 0) { *valp = IPPROTO_FRAGMENT; return 0; }
5033 #endif
5034 return -1;
5035
5036 case 10:
5037 #ifdef IPPROTO_IP
5038 if (memcmp(str, "IPPROTO_IP", 10) == 0) { *valp = IPPROTO_IP; return 0; }
5039 #endif
5040 #ifdef IPPROTO_ND
5041 if (memcmp(str, "IPPROTO_ND", 10) == 0) { *valp = IPPROTO_ND; return 0; }
5042 #endif
5043 #ifdef IPPROTO_TP
5044 if (memcmp(str, "IPPROTO_TP", 10) == 0) { *valp = IPPROTO_TP; return 0; }
5045 #endif
5046 #ifdef IPPROTO_AH
5047 if (memcmp(str, "IPPROTO_AH", 10) == 0) { *valp = IPPROTO_AH; return 0; }
5048 #endif
5049 return -1;
5050
5051 case 11:
5052 #ifdef IPPROTO_GGP
5053 if (memcmp(str, "IPPROTO_GGP", 11) == 0) { *valp = IPPROTO_GGP; return 0; }
5054 #endif
5055 #ifdef IPPROTO_TCP
5056 if (memcmp(str, "IPPROTO_TCP", 11) == 0) { *valp = IPPROTO_TCP; return 0; }
5057 #endif
5058 #ifdef IPPROTO_EGP
5059 if (memcmp(str, "IPPROTO_EGP", 11) == 0) { *valp = IPPROTO_EGP; return 0; }
5060 #endif
5061 #ifdef IPPROTO_PUP
5062 if (memcmp(str, "IPPROTO_PUP", 11) == 0) { *valp = IPPROTO_PUP; return 0; }
5063 #endif
5064 #ifdef IPPROTO_UDP
5065 if (memcmp(str, "IPPROTO_UDP", 11) == 0) { *valp = IPPROTO_UDP; return 0; }
5066 #endif
5067 #ifdef IPPROTO_IDP
5068 if (memcmp(str, "IPPROTO_IDP", 11) == 0) { *valp = IPPROTO_IDP; return 0; }
5069 #endif
5070 #ifdef IPPROTO_XTP
5071 if (memcmp(str, "IPPROTO_XTP", 11) == 0) { *valp = IPPROTO_XTP; return 0; }
5072 #endif
5073 #ifdef IPPROTO_EON
5074 if (memcmp(str, "IPPROTO_EON", 11) == 0) { *valp = IPPROTO_EON; return 0; }
5075 #endif
5076 #ifdef IPPROTO_BIP
5077 if (memcmp(str, "IPPROTO_BIP", 11) == 0) { *valp = IPPROTO_BIP; return 0; }
5078 #endif
5079 #ifdef IPPROTO_ESP
5080 if (memcmp(str, "IPPROTO_ESP", 11) == 0) { *valp = IPPROTO_ESP; return 0; }
5081 #endif
5082 #ifdef IPPROTO_RAW
5083 if (memcmp(str, "IPPROTO_RAW", 11) == 0) { *valp = IPPROTO_RAW; return 0; }
5084 #endif
5085 #ifdef IPPROTO_MAX
5086 if (memcmp(str, "IPPROTO_MAX", 11) == 0) { *valp = IPPROTO_MAX; return 0; }
5087 #endif
5088 return -1;
5089
5090 case 12:
5091 #ifdef IPPROTO_ICMP
5092 if (memcmp(str, "IPPROTO_ICMP", 12) == 0) { *valp = IPPROTO_ICMP; return 0; }
5093 #endif
5094 #ifdef IPPROTO_IGMP
5095 if (memcmp(str, "IPPROTO_IGMP", 12) == 0) { *valp = IPPROTO_IGMP; return 0; }
5096 #endif
5097 #ifdef IPPROTO_IPV6
5098 if (memcmp(str, "IPPROTO_IPV6", 12) == 0) { *valp = IPPROTO_IPV6; return 0; }
5099 #endif
5100 #ifdef IPPROTO_NONE
5101 if (memcmp(str, "IPPROTO_NONE", 12) == 0) { *valp = IPPROTO_NONE; return 0; }
5102 #endif
5103 return -1;
5104
5105 case 13:
5106 #ifdef IPPROTO_HELLO
5107 if (memcmp(str, "IPPROTO_HELLO", 13) == 0) { *valp = IPPROTO_HELLO; return 0; }
5108 #endif
5109 return -1;
5110
5111 case 14:
5112 #ifdef IPPROTO_ICMPV6
5113 if (memcmp(str, "IPPROTO_ICMPV6", 14) == 0) { *valp = IPPROTO_ICMPV6; return 0; }
5114 #endif
5115 return -1;
5116
5117 case 15:
5118 #ifdef IPPROTO_DSTOPTS
5119 if (memcmp(str, "IPPROTO_DSTOPTS", 15) == 0) { *valp = IPPROTO_DSTOPTS; return 0; }
5120 #endif
5121 #ifdef IPPROTO_HOPOPTS
5122 if (memcmp(str, "IPPROTO_HOPOPTS", 15) == 0) { *valp = IPPROTO_HOPOPTS; return 0; }
5123 #endif
5124 #ifdef IPPROTO_ROUTING
5125 if (memcmp(str, "IPPROTO_ROUTING", 15) == 0) { *valp = IPPROTO_ROUTING; return 0; }
5126 #endif
5127 return -1;
5128
5129 case 16:
5130 #ifdef IPPROTO_FRAGMENT
5131 if (memcmp(str, "IPPROTO_FRAGMENT", 16) == 0) { *valp = IPPROTO_FRAGMENT; return 0; }
5132 #endif
5133 return -1;
5134
5135 default:
5136 if (!str || !valp) {/* wrong argument */}
5137 return -1;
5138 }
5139 }
5140
5141
5142 int
5143 rsock_unknown_level_to_int(const char *str, long len, int *valp)
5144 {
5145 switch (len) {
5146 case 6:
5147 #ifdef SOL_SOCKET
5148 if (memcmp(str, "SOCKET", 6) == 0) { *valp = SOL_SOCKET; return 0; }
5149 #endif
5150 return -1;
5151
5152 case 10:
5153 #ifdef SOL_SOCKET
5154 if (memcmp(str, "SOL_SOCKET", 10) == 0) { *valp = SOL_SOCKET; return 0; }
5155 #endif
5156 return -1;
5157
5158 default:
5159 if (!str || !valp) {/* wrong argument */}
5160 return -1;
5161 }
5162 }
5163
5164
5165 int
5166 rsock_ip_level_to_int(const char *str, long len, int *valp)
5167 {
5168 switch (len) {
5169 case 2:
5170 #ifdef IPPROTO_IP
5171 if (memcmp(str, "IP", 2) == 0) { *valp = IPPROTO_IP; return 0; }
5172 #endif
5173 #ifdef IPPROTO_ND
5174 if (memcmp(str, "ND", 2) == 0) { *valp = IPPROTO_ND; return 0; }
5175 #endif
5176 #ifdef IPPROTO_TP
5177 if (memcmp(str, "TP", 2) == 0) { *valp = IPPROTO_TP; return 0; }
5178 #endif
5179 #ifdef IPPROTO_AH
5180 if (memcmp(str, "AH", 2) == 0) { *valp = IPPROTO_AH; return 0; }
5181 #endif
5182 return -1;
5183
5184 case 3:
5185 #ifdef IPPROTO_GGP
5186 if (memcmp(str, "GGP", 3) == 0) { *valp = IPPROTO_GGP; return 0; }
5187 #endif
5188 #ifdef IPPROTO_TCP
5189 if (memcmp(str, "TCP", 3) == 0) { *valp = IPPROTO_TCP; return 0; }
5190 #endif
5191 #ifdef IPPROTO_EGP
5192 if (memcmp(str, "EGP", 3) == 0) { *valp = IPPROTO_EGP; return 0; }
5193 #endif
5194 #ifdef IPPROTO_PUP
5195 if (memcmp(str, "PUP", 3) == 0) { *valp = IPPROTO_PUP; return 0; }
5196 #endif
5197 #ifdef IPPROTO_UDP
5198 if (memcmp(str, "UDP", 3) == 0) { *valp = IPPROTO_UDP; return 0; }
5199 #endif
5200 #ifdef IPPROTO_IDP
5201 if (memcmp(str, "IDP", 3) == 0) { *valp = IPPROTO_IDP; return 0; }
5202 #endif
5203 #ifdef IPPROTO_XTP
5204 if (memcmp(str, "XTP", 3) == 0) { *valp = IPPROTO_XTP; return 0; }
5205 #endif
5206 #ifdef IPPROTO_EON
5207 if (memcmp(str, "EON", 3) == 0) { *valp = IPPROTO_EON; return 0; }
5208 #endif
5209 #ifdef IPPROTO_BIP
5210 if (memcmp(str, "BIP", 3) == 0) { *valp = IPPROTO_BIP; return 0; }
5211 #endif
5212 #ifdef IPPROTO_ESP
5213 if (memcmp(str, "ESP", 3) == 0) { *valp = IPPROTO_ESP; return 0; }
5214 #endif
5215 #ifdef IPPROTO_RAW
5216 if (memcmp(str, "RAW", 3) == 0) { *valp = IPPROTO_RAW; return 0; }
5217 #endif
5218 #ifdef IPPROTO_MAX
5219 if (memcmp(str, "MAX", 3) == 0) { *valp = IPPROTO_MAX; return 0; }
5220 #endif
5221 return -1;
5222
5223 case 4:
5224 #ifdef IPPROTO_ICMP
5225 if (memcmp(str, "ICMP", 4) == 0) { *valp = IPPROTO_ICMP; return 0; }
5226 #endif
5227 #ifdef IPPROTO_IGMP
5228 if (memcmp(str, "IGMP", 4) == 0) { *valp = IPPROTO_IGMP; return 0; }
5229 #endif
5230 #ifdef IPPROTO_IPV6
5231 if (memcmp(str, "IPV6", 4) == 0) { *valp = IPPROTO_IPV6; return 0; }
5232 #endif
5233 #ifdef IPPROTO_NONE
5234 if (memcmp(str, "NONE", 4) == 0) { *valp = IPPROTO_NONE; return 0; }
5235 #endif
5236 return -1;
5237
5238 case 5:
5239 #ifdef IPPROTO_HELLO
5240 if (memcmp(str, "HELLO", 5) == 0) { *valp = IPPROTO_HELLO; return 0; }
5241 #endif
5242 return -1;
5243
5244 case 6:
5245 #ifdef SOL_SOCKET
5246 if (memcmp(str, "SOCKET", 6) == 0) { *valp = SOL_SOCKET; return 0; }
5247 #endif
5248 #ifdef IPPROTO_ICMPV6
5249 if (memcmp(str, "ICMPV6", 6) == 0) { *valp = IPPROTO_ICMPV6; return 0; }
5250 #endif
5251 return -1;
5252
5253 case 7:
5254 #ifdef IPPROTO_DSTOPTS
5255 if (memcmp(str, "DSTOPTS", 7) == 0) { *valp = IPPROTO_DSTOPTS; return 0; }
5256 #endif
5257 #ifdef IPPROTO_HOPOPTS
5258 if (memcmp(str, "HOPOPTS", 7) == 0) { *valp = IPPROTO_HOPOPTS; return 0; }
5259 #endif
5260 #ifdef IPPROTO_ROUTING
5261 if (memcmp(str, "ROUTING", 7) == 0) { *valp = IPPROTO_ROUTING; return 0; }
5262 #endif
5263 return -1;
5264
5265 case 8:
5266 #ifdef IPPROTO_FRAGMENT
5267 if (memcmp(str, "FRAGMENT", 8) == 0) { *valp = IPPROTO_FRAGMENT; return 0; }
5268 #endif
5269 return -1;
5270
5271 case 10:
5272 #ifdef SOL_SOCKET
5273 if (memcmp(str, "SOL_SOCKET", 10) == 0) { *valp = SOL_SOCKET; return 0; }
5274 #endif
5275 #ifdef IPPROTO_IP
5276 if (memcmp(str, "IPPROTO_IP", 10) == 0) { *valp = IPPROTO_IP; return 0; }
5277 #endif
5278 #ifdef IPPROTO_ND
5279 if (memcmp(str, "IPPROTO_ND", 10) == 0) { *valp = IPPROTO_ND; return 0; }
5280 #endif
5281 #ifdef IPPROTO_TP
5282 if (memcmp(str, "IPPROTO_TP", 10) == 0) { *valp = IPPROTO_TP; return 0; }
5283 #endif
5284 #ifdef IPPROTO_AH
5285 if (memcmp(str, "IPPROTO_AH", 10) == 0) { *valp = IPPROTO_AH; return 0; }
5286 #endif
5287 return -1;
5288
5289 case 11:
5290 #ifdef IPPROTO_GGP
5291 if (memcmp(str, "IPPROTO_GGP", 11) == 0) { *valp = IPPROTO_GGP; return 0; }
5292 #endif
5293 #ifdef IPPROTO_TCP
5294 if (memcmp(str, "IPPROTO_TCP", 11) == 0) { *valp = IPPROTO_TCP; return 0; }
5295 #endif
5296 #ifdef IPPROTO_EGP
5297 if (memcmp(str, "IPPROTO_EGP", 11) == 0) { *valp = IPPROTO_EGP; return 0; }
5298 #endif
5299 #ifdef IPPROTO_PUP
5300 if (memcmp(str, "IPPROTO_PUP", 11) == 0) { *valp = IPPROTO_PUP; return 0; }
5301 #endif
5302 #ifdef IPPROTO_UDP
5303 if (memcmp(str, "IPPROTO_UDP", 11) == 0) { *valp = IPPROTO_UDP; return 0; }
5304 #endif
5305 #ifdef IPPROTO_IDP
5306 if (memcmp(str, "IPPROTO_IDP", 11) == 0) { *valp = IPPROTO_IDP; return 0; }
5307 #endif
5308 #ifdef IPPROTO_XTP
5309 if (memcmp(str, "IPPROTO_XTP", 11) == 0) { *valp = IPPROTO_XTP; return 0; }
5310 #endif
5311 #ifdef IPPROTO_EON
5312 if (memcmp(str, "IPPROTO_EON", 11) == 0) { *valp = IPPROTO_EON; return 0; }
5313 #endif
5314 #ifdef IPPROTO_BIP
5315 if (memcmp(str, "IPPROTO_BIP", 11) == 0) { *valp = IPPROTO_BIP; return 0; }
5316 #endif
5317 #ifdef IPPROTO_ESP
5318 if (memcmp(str, "IPPROTO_ESP", 11) == 0) { *valp = IPPROTO_ESP; return 0; }
5319 #endif
5320 #ifdef IPPROTO_RAW
5321 if (memcmp(str, "IPPROTO_RAW", 11) == 0) { *valp = IPPROTO_RAW; return 0; }
5322 #endif
5323 #ifdef IPPROTO_MAX
5324 if (memcmp(str, "IPPROTO_MAX", 11) == 0) { *valp = IPPROTO_MAX; return 0; }
5325 #endif
5326 return -1;
5327
5328 case 12:
5329 #ifdef IPPROTO_ICMP
5330 if (memcmp(str, "IPPROTO_ICMP", 12) == 0) { *valp = IPPROTO_ICMP; return 0; }
5331 #endif
5332 #ifdef IPPROTO_IGMP
5333 if (memcmp(str, "IPPROTO_IGMP", 12) == 0) { *valp = IPPROTO_IGMP; return 0; }
5334 #endif
5335 #ifdef IPPROTO_IPV6
5336 if (memcmp(str, "IPPROTO_IPV6", 12) == 0) { *valp = IPPROTO_IPV6; return 0; }
5337 #endif
5338 #ifdef IPPROTO_NONE
5339 if (memcmp(str, "IPPROTO_NONE", 12) == 0) { *valp = IPPROTO_NONE; return 0; }
5340 #endif
5341 return -1;
5342
5343 case 13:
5344 #ifdef IPPROTO_HELLO
5345 if (memcmp(str, "IPPROTO_HELLO", 13) == 0) { *valp = IPPROTO_HELLO; return 0; }
5346 #endif
5347 return -1;
5348
5349 case 14:
5350 #ifdef IPPROTO_ICMPV6
5351 if (memcmp(str, "IPPROTO_ICMPV6", 14) == 0) { *valp = IPPROTO_ICMPV6; return 0; }
5352 #endif
5353 return -1;
5354
5355 case 15:
5356 #ifdef IPPROTO_DSTOPTS
5357 if (memcmp(str, "IPPROTO_DSTOPTS", 15) == 0) { *valp = IPPROTO_DSTOPTS; return 0; }
5358 #endif
5359 #ifdef IPPROTO_HOPOPTS
5360 if (memcmp(str, "IPPROTO_HOPOPTS", 15) == 0) { *valp = IPPROTO_HOPOPTS; return 0; }
5361 #endif
5362 #ifdef IPPROTO_ROUTING
5363 if (memcmp(str, "IPPROTO_ROUTING", 15) == 0) { *valp = IPPROTO_ROUTING; return 0; }
5364 #endif
5365 return -1;
5366
5367 case 16:
5368 #ifdef IPPROTO_FRAGMENT
5369 if (memcmp(str, "IPPROTO_FRAGMENT", 16) == 0) { *valp = IPPROTO_FRAGMENT; return 0; }
5370 #endif
5371 return -1;
5372
5373 default:
5374 if (!str || !valp) {/* wrong argument */}
5375 return -1;
5376 }
5377 }
5378
5379
5380 int
5381 rsock_so_optname_to_int(const char *str, long len, int *valp)
5382 {
5383 switch (len) {
5384 case 3:
5385 #ifdef SO_NKE
5386 if (memcmp(str, "NKE", 3) == 0) { *valp = SO_NKE; return 0; }
5387 #endif
5388 return -1;
5389
5390 case 4:
5391 #ifdef SO_TYPE
5392 if (memcmp(str, "TYPE", 4) == 0) { *valp = SO_TYPE; return 0; }
5393 #endif
5394 #ifdef SO_MARK
5395 if (memcmp(str, "MARK", 4) == 0) { *valp = SO_MARK; return 0; }
5396 #endif
5397 return -1;
5398
5399 case 5:
5400 #ifdef SO_DEBUG
5401 if (memcmp(str, "DEBUG", 5) == 0) { *valp = SO_DEBUG; return 0; }
5402 #endif
5403 #ifdef SO_ERROR
5404 if (memcmp(str, "ERROR", 5) == 0) { *valp = SO_ERROR; return 0; }
5405 #endif
5406 #ifdef SO_NREAD
5407 if (memcmp(str, "NREAD", 5) == 0) { *valp = SO_NREAD; return 0; }
5408 #endif
5409 #ifdef SO_NOFCS
5410 if (memcmp(str, "NOFCS", 5) == 0) { *valp = SO_NOFCS; return 0; }
5411 #endif
5412 return -1;
5413
5414 case 6:
5415 #ifdef SO_NKE
5416 if (memcmp(str, "SO_NKE", 6) == 0) { *valp = SO_NKE; return 0; }
5417 #endif
5418 #ifdef SO_SNDBUF
5419 if (memcmp(str, "SNDBUF", 6) == 0) { *valp = SO_SNDBUF; return 0; }
5420 #endif
5421 #ifdef SO_RCVBUF
5422 if (memcmp(str, "RCVBUF", 6) == 0) { *valp = SO_RCVBUF; return 0; }
5423 #endif
5424 #ifdef SO_LINGER
5425 if (memcmp(str, "LINGER", 6) == 0) { *valp = SO_LINGER; return 0; }
5426 #endif
5427 #ifdef SO_DOMAIN
5428 if (memcmp(str, "DOMAIN", 6) == 0) { *valp = SO_DOMAIN; return 0; }
5429 #endif
5430 return -1;
5431
5432 case 7:
5433 #ifdef SO_TYPE
5434 if (memcmp(str, "SO_TYPE", 7) == 0) { *valp = SO_TYPE; return 0; }
5435 #endif
5436 #ifdef SO_MARK
5437 if (memcmp(str, "SO_MARK", 7) == 0) { *valp = SO_MARK; return 0; }
5438 #endif
5439 #ifdef SO_BINTIME
5440 if (memcmp(str, "BINTIME", 7) == 0) { *valp = SO_BINTIME; return 0; }
5441 #endif
5442 #ifdef SO_PEERSEC
5443 if (memcmp(str, "PEERSEC", 7) == 0) { *valp = SO_PEERSEC; return 0; }
5444 #endif
5445 #ifdef SO_PASSSEC
5446 if (memcmp(str, "PASSSEC", 7) == 0) { *valp = SO_PASSSEC; return 0; }
5447 #endif
5448 return -1;
5449
5450 case 8:
5451 #ifdef SO_DEBUG
5452 if (memcmp(str, "SO_DEBUG", 8) == 0) { *valp = SO_DEBUG; return 0; }
5453 #endif
5454 #ifdef SO_ERROR
5455 if (memcmp(str, "SO_ERROR", 8) == 0) { *valp = SO_ERROR; return 0; }
5456 #endif
5457 #ifdef SO_NREAD
5458 if (memcmp(str, "SO_NREAD", 8) == 0) { *valp = SO_NREAD; return 0; }
5459 #endif
5460 #ifdef SO_NOFCS
5461 if (memcmp(str, "SO_NOFCS", 8) == 0) { *valp = SO_NOFCS; return 0; }
5462 #endif
5463 #ifdef SO_NO_CHECK
5464 if (memcmp(str, "NO_CHECK", 8) == 0) { *valp = SO_NO_CHECK; return 0; }
5465 #endif
5466 #ifdef SO_PRIORITY
5467 if (memcmp(str, "PRIORITY", 8) == 0) { *valp = SO_PRIORITY; return 0; }
5468 #endif
5469 #ifdef SO_PASSCRED
5470 if (memcmp(str, "PASSCRED", 8) == 0) { *valp = SO_PASSCRED; return 0; }
5471 #endif
5472 #ifdef SO_PEERCRED
5473 if (memcmp(str, "PEERCRED", 8) == 0) { *valp = SO_PEERCRED; return 0; }
5474 #endif
5475 #ifdef SO_RCVLOWAT
5476 if (memcmp(str, "RCVLOWAT", 8) == 0) { *valp = SO_RCVLOWAT; return 0; }
5477 #endif
5478 #ifdef SO_SNDLOWAT
5479 if (memcmp(str, "SNDLOWAT", 8) == 0) { *valp = SO_SNDLOWAT; return 0; }
5480 #endif
5481 #ifdef SO_RCVTIMEO
5482 if (memcmp(str, "RCVTIMEO", 8) == 0) { *valp = SO_RCVTIMEO; return 0; }
5483 #endif
5484 #ifdef SO_SNDTIMEO
5485 if (memcmp(str, "SNDTIMEO", 8) == 0) { *valp = SO_SNDTIMEO; return 0; }
5486 #endif
5487 #ifdef SO_WANTMORE
5488 if (memcmp(str, "WANTMORE", 8) == 0) { *valp = SO_WANTMORE; return 0; }
5489 #endif
5490 #ifdef SO_PEERNAME
5491 if (memcmp(str, "PEERNAME", 8) == 0) { *valp = SO_PEERNAME; return 0; }
5492 #endif
5493 #ifdef SO_ALLZONES
5494 if (memcmp(str, "ALLZONES", 8) == 0) { *valp = SO_ALLZONES; return 0; }
5495 #endif
5496 #ifdef SO_PROTOCOL
5497 if (memcmp(str, "PROTOCOL", 8) == 0) { *valp = SO_PROTOCOL; return 0; }
5498 #endif
5499 #ifdef SO_RXQ_OVFL
5500 if (memcmp(str, "RXQ_OVFL", 8) == 0) { *valp = SO_RXQ_OVFL; return 0; }
5501 #endif
5502 #ifdef SO_PEEK_OFF
5503 if (memcmp(str, "PEEK_OFF", 8) == 0) { *valp = SO_PEEK_OFF; return 0; }
5504 #endif
5505 return -1;
5506
5507 case 9:
5508 #ifdef SO_SNDBUF
5509 if (memcmp(str, "SO_SNDBUF", 9) == 0) { *valp = SO_SNDBUF; return 0; }
5510 #endif
5511 #ifdef SO_RCVBUF
5512 if (memcmp(str, "SO_RCVBUF", 9) == 0) { *valp = SO_RCVBUF; return 0; }
5513 #endif
5514 #ifdef SO_LINGER
5515 if (memcmp(str, "SO_LINGER", 9) == 0) { *valp = SO_LINGER; return 0; }
5516 #endif
5517 #ifdef SO_DOMAIN
5518 if (memcmp(str, "SO_DOMAIN", 9) == 0) { *valp = SO_DOMAIN; return 0; }
5519 #endif
5520 #ifdef SO_REUSEADDR
5521 if (memcmp(str, "REUSEADDR", 9) == 0) { *valp = SO_REUSEADDR; return 0; }
5522 #endif
5523 #ifdef SO_REUSEPORT
5524 if (memcmp(str, "REUSEPORT", 9) == 0) { *valp = SO_REUSEPORT; return 0; }
5525 #endif
5526 #ifdef SO_DONTROUTE
5527 if (memcmp(str, "DONTROUTE", 9) == 0) { *valp = SO_DONTROUTE; return 0; }
5528 #endif
5529 #ifdef SO_BROADCAST
5530 if (memcmp(str, "BROADCAST", 9) == 0) { *valp = SO_BROADCAST; return 0; }
5531 #endif
5532 #ifdef SO_KEEPALIVE
5533 if (memcmp(str, "KEEPALIVE", 9) == 0) { *valp = SO_KEEPALIVE; return 0; }
5534 #endif
5535 #ifdef SO_OOBINLINE
5536 if (memcmp(str, "OOBINLINE", 9) == 0) { *valp = SO_OOBINLINE; return 0; }
5537 #endif
5538 #ifdef SO_DONTTRUNC
5539 if (memcmp(str, "DONTTRUNC", 9) == 0) { *valp = SO_DONTTRUNC; return 0; }
5540 #endif
5541 #ifdef SO_NOSIGPIPE
5542 if (memcmp(str, "NOSIGPIPE", 9) == 0) { *valp = SO_NOSIGPIPE; return 0; }
5543 #endif
5544 #ifdef SO_TIMESTAMP
5545 if (memcmp(str, "TIMESTAMP", 9) == 0) { *valp = SO_TIMESTAMP; return 0; }
5546 #endif
5547 #ifdef SO_RECVUCRED
5548 if (memcmp(str, "RECVUCRED", 9) == 0) { *valp = SO_RECVUCRED; return 0; }
5549 #endif
5550 #ifdef SO_BUSY_POLL
5551 if (memcmp(str, "BUSY_POLL", 9) == 0) { *valp = SO_BUSY_POLL; return 0; }
5552 #endif
5553 return -1;
5554
5555 case 10:
5556 #ifdef SO_BINTIME
5557 if (memcmp(str, "SO_BINTIME", 10) == 0) { *valp = SO_BINTIME; return 0; }
5558 #endif
5559 #ifdef SO_PEERSEC
5560 if (memcmp(str, "SO_PEERSEC", 10) == 0) { *valp = SO_PEERSEC; return 0; }
5561 #endif
5562 #ifdef SO_PASSSEC
5563 if (memcmp(str, "SO_PASSSEC", 10) == 0) { *valp = SO_PASSSEC; return 0; }
5564 #endif
5565 #ifdef SO_ACCEPTCONN
5566 if (memcmp(str, "ACCEPTCONN", 10) == 0) { *valp = SO_ACCEPTCONN; return 0; }
5567 #endif
5568 #ifdef SO_GET_FILTER
5569 if (memcmp(str, "GET_FILTER", 10) == 0) { *valp = SO_GET_FILTER; return 0; }
5570 #endif
5571 #ifdef SO_MAC_EXEMPT
5572 if (memcmp(str, "MAC_EXEMPT", 10) == 0) { *valp = SO_MAC_EXEMPT; return 0; }
5573 #endif
5574 return -1;
5575
5576 case 11:
5577 #ifdef SO_NO_CHECK
5578 if (memcmp(str, "SO_NO_CHECK", 11) == 0) { *valp = SO_NO_CHECK; return 0; }
5579 #endif
5580 #ifdef SO_PRIORITY
5581 if (memcmp(str, "SO_PRIORITY", 11) == 0) { *valp = SO_PRIORITY; return 0; }
5582 #endif
5583 #ifdef SO_PASSCRED
5584 if (memcmp(str, "SO_PASSCRED", 11) == 0) { *valp = SO_PASSCRED; return 0; }
5585 #endif
5586 #ifdef SO_PEERCRED
5587 if (memcmp(str, "SO_PEERCRED", 11) == 0) { *valp = SO_PEERCRED; return 0; }
5588 #endif
5589 #ifdef SO_RCVLOWAT
5590 if (memcmp(str, "SO_RCVLOWAT", 11) == 0) { *valp = SO_RCVLOWAT; return 0; }
5591 #endif
5592 #ifdef SO_SNDLOWAT
5593 if (memcmp(str, "SO_SNDLOWAT", 11) == 0) { *valp = SO_SNDLOWAT; return 0; }
5594 #endif
5595 #ifdef SO_RCVTIMEO
5596 if (memcmp(str, "SO_RCVTIMEO", 11) == 0) { *valp = SO_RCVTIMEO; return 0; }
5597 #endif
5598 #ifdef SO_SNDTIMEO
5599 if (memcmp(str, "SO_SNDTIMEO", 11) == 0) { *valp = SO_SNDTIMEO; return 0; }
5600 #endif
5601 #ifdef SO_WANTMORE
5602 if (memcmp(str, "SO_WANTMORE", 11) == 0) { *valp = SO_WANTMORE; return 0; }
5603 #endif
5604 #ifdef SO_PEERNAME
5605 if (memcmp(str, "SO_PEERNAME", 11) == 0) { *valp = SO_PEERNAME; return 0; }
5606 #endif
5607 #ifdef SO_ALLZONES
5608 if (memcmp(str, "SO_ALLZONES", 11) == 0) { *valp = SO_ALLZONES; return 0; }
5609 #endif
5610 #ifdef SO_PROTOCOL
5611 if (memcmp(str, "SO_PROTOCOL", 11) == 0) { *valp = SO_PROTOCOL; return 0; }
5612 #endif
5613 #ifdef SO_RXQ_OVFL
5614 if (memcmp(str, "SO_RXQ_OVFL", 11) == 0) { *valp = SO_RXQ_OVFL; return 0; }
5615 #endif
5616 #ifdef SO_PEEK_OFF
5617 if (memcmp(str, "SO_PEEK_OFF", 11) == 0) { *valp = SO_PEEK_OFF; return 0; }
5618 #endif
5619 #ifdef SO_SNDBUFFORCE
5620 if (memcmp(str, "SNDBUFFORCE", 11) == 0) { *valp = SO_SNDBUFFORCE; return 0; }
5621 #endif
5622 #ifdef SO_RCVBUFFORCE
5623 if (memcmp(str, "RCVBUFFORCE", 11) == 0) { *valp = SO_RCVBUFFORCE; return 0; }
5624 #endif
5625 #ifdef SO_USELOOPBACK
5626 if (memcmp(str, "USELOOPBACK", 11) == 0) { *valp = SO_USELOOPBACK; return 0; }
5627 #endif
5628 #ifdef SO_WANTOOBFLAG
5629 if (memcmp(str, "WANTOOBFLAG", 11) == 0) { *valp = SO_WANTOOBFLAG; return 0; }
5630 #endif
5631 #ifdef SO_TIMESTAMPNS
5632 if (memcmp(str, "TIMESTAMPNS", 11) == 0) { *valp = SO_TIMESTAMPNS; return 0; }
5633 #endif
5634 #ifdef SO_WIFI_STATUS
5635 if (memcmp(str, "WIFI_STATUS", 11) == 0) { *valp = SO_WIFI_STATUS; return 0; }
5636 #endif
5637 #ifdef SO_LOCK_FILTER
5638 if (memcmp(str, "LOCK_FILTER", 11) == 0) { *valp = SO_LOCK_FILTER; return 0; }
5639 #endif
5640 return -1;
5641
5642 case 12:
5643 #ifdef SO_REUSEADDR
5644 if (memcmp(str, "SO_REUSEADDR", 12) == 0) { *valp = SO_REUSEADDR; return 0; }
5645 #endif
5646 #ifdef SO_REUSEPORT
5647 if (memcmp(str, "SO_REUSEPORT", 12) == 0) { *valp = SO_REUSEPORT; return 0; }
5648 #endif
5649 #ifdef SO_DONTROUTE
5650 if (memcmp(str, "SO_DONTROUTE", 12) == 0) { *valp = SO_DONTROUTE; return 0; }
5651 #endif
5652 #ifdef SO_BROADCAST
5653 if (memcmp(str, "SO_BROADCAST", 12) == 0) { *valp = SO_BROADCAST; return 0; }
5654 #endif
5655 #ifdef SO_KEEPALIVE
5656 if (memcmp(str, "SO_KEEPALIVE", 12) == 0) { *valp = SO_KEEPALIVE; return 0; }
5657 #endif
5658 #ifdef SO_OOBINLINE
5659 if (memcmp(str, "SO_OOBINLINE", 12) == 0) { *valp = SO_OOBINLINE; return 0; }
5660 #endif
5661 #ifdef SO_DONTTRUNC
5662 if (memcmp(str, "SO_DONTTRUNC", 12) == 0) { *valp = SO_DONTTRUNC; return 0; }
5663 #endif
5664 #ifdef SO_NOSIGPIPE
5665 if (memcmp(str, "SO_NOSIGPIPE", 12) == 0) { *valp = SO_NOSIGPIPE; return 0; }
5666 #endif
5667 #ifdef SO_TIMESTAMP
5668 if (memcmp(str, "SO_TIMESTAMP", 12) == 0) { *valp = SO_TIMESTAMP; return 0; }
5669 #endif
5670 #ifdef SO_RECVUCRED
5671 if (memcmp(str, "SO_RECVUCRED", 12) == 0) { *valp = SO_RECVUCRED; return 0; }
5672 #endif
5673 #ifdef SO_BUSY_POLL
5674 if (memcmp(str, "SO_BUSY_POLL", 12) == 0) { *valp = SO_BUSY_POLL; return 0; }
5675 #endif
5676 #ifdef SO_ACCEPTFILTER
5677 if (memcmp(str, "ACCEPTFILTER", 12) == 0) { *valp = SO_ACCEPTFILTER; return 0; }
5678 #endif
5679 #ifdef SO_BINDTODEVICE
5680 if (memcmp(str, "BINDTODEVICE", 12) == 0) { *valp = SO_BINDTODEVICE; return 0; }
5681 #endif
5682 #ifdef SO_TIMESTAMPING
5683 if (memcmp(str, "TIMESTAMPING", 12) == 0) { *valp = SO_TIMESTAMPING; return 0; }
5684 #endif
5685 return -1;
5686
5687 case 13:
5688 #ifdef SO_ACCEPTCONN
5689 if (memcmp(str, "SO_ACCEPTCONN", 13) == 0) { *valp = SO_ACCEPTCONN; return 0; }
5690 #endif
5691 #ifdef SO_GET_FILTER
5692 if (memcmp(str, "SO_GET_FILTER", 13) == 0) { *valp = SO_GET_FILTER; return 0; }
5693 #endif
5694 #ifdef SO_MAC_EXEMPT
5695 if (memcmp(str, "SO_MAC_EXEMPT", 13) == 0) { *valp = SO_MAC_EXEMPT; return 0; }
5696 #endif
5697 #ifdef SO_ATTACH_FILTER
5698 if (memcmp(str, "ATTACH_FILTER", 13) == 0) { *valp = SO_ATTACH_FILTER; return 0; }
5699 #endif
5700 #ifdef SO_DETACH_FILTER
5701 if (memcmp(str, "DETACH_FILTER", 13) == 0) { *valp = SO_DETACH_FILTER; return 0; }
5702 #endif
5703 return -1;
5704
5705 case 14:
5706 #ifdef SO_SNDBUFFORCE
5707 if (memcmp(str, "SO_SNDBUFFORCE", 14) == 0) { *valp = SO_SNDBUFFORCE; return 0; }
5708 #endif
5709 #ifdef SO_RCVBUFFORCE
5710 if (memcmp(str, "SO_RCVBUFFORCE", 14) == 0) { *valp = SO_RCVBUFFORCE; return 0; }
5711 #endif
5712 #ifdef SO_USELOOPBACK
5713 if (memcmp(str, "SO_USELOOPBACK", 14) == 0) { *valp = SO_USELOOPBACK; return 0; }
5714 #endif
5715 #ifdef SO_WANTOOBFLAG
5716 if (memcmp(str, "SO_WANTOOBFLAG", 14) == 0) { *valp = SO_WANTOOBFLAG; return 0; }
5717 #endif
5718 #ifdef SO_TIMESTAMPNS
5719 if (memcmp(str, "SO_TIMESTAMPNS", 14) == 0) { *valp = SO_TIMESTAMPNS; return 0; }
5720 #endif
5721 #ifdef SO_WIFI_STATUS
5722 if (memcmp(str, "SO_WIFI_STATUS", 14) == 0) { *valp = SO_WIFI_STATUS; return 0; }
5723 #endif
5724 #ifdef SO_LOCK_FILTER
5725 if (memcmp(str, "SO_LOCK_FILTER", 14) == 0) { *valp = SO_LOCK_FILTER; return 0; }
5726 #endif
5727 #ifdef SO_BPF_EXTENSIONS
5728 if (memcmp(str, "BPF_EXTENSIONS", 14) == 0) { *valp = SO_BPF_EXTENSIONS; return 0; }
5729 #endif
5730 return -1;
5731
5732 case 15:
5733 #ifdef SO_ACCEPTFILTER
5734 if (memcmp(str, "SO_ACCEPTFILTER", 15) == 0) { *valp = SO_ACCEPTFILTER; return 0; }
5735 #endif
5736 #ifdef SO_BINDTODEVICE
5737 if (memcmp(str, "SO_BINDTODEVICE", 15) == 0) { *valp = SO_BINDTODEVICE; return 0; }
5738 #endif
5739 #ifdef SO_TIMESTAMPING
5740 if (memcmp(str, "SO_TIMESTAMPING", 15) == 0) { *valp = SO_TIMESTAMPING; return 0; }
5741 #endif
5742 #ifdef SO_MAX_PACING_RATE
5743 if (memcmp(str, "MAX_PACING_RATE", 15) == 0) { *valp = SO_MAX_PACING_RATE; return 0; }
5744 #endif
5745 return -1;
5746
5747 case 16:
5748 #ifdef SO_ATTACH_FILTER
5749 if (memcmp(str, "SO_ATTACH_FILTER", 16) == 0) { *valp = SO_ATTACH_FILTER; return 0; }
5750 #endif
5751 #ifdef SO_DETACH_FILTER
5752 if (memcmp(str, "SO_DETACH_FILTER", 16) == 0) { *valp = SO_DETACH_FILTER; return 0; }
5753 #endif
5754 #ifdef SO_SELECT_ERR_QUEUE
5755 if (memcmp(str, "SELECT_ERR_QUEUE", 16) == 0) { *valp = SO_SELECT_ERR_QUEUE; return 0; }
5756 #endif
5757 return -1;
5758
5759 case 17:
5760 #ifdef SO_BPF_EXTENSIONS
5761 if (memcmp(str, "SO_BPF_EXTENSIONS", 17) == 0) { *valp = SO_BPF_EXTENSIONS; return 0; }
5762 #endif
5763 return -1;
5764
5765 case 18:
5766 #ifdef SO_MAX_PACING_RATE
5767 if (memcmp(str, "SO_MAX_PACING_RATE", 18) == 0) { *valp = SO_MAX_PACING_RATE; return 0; }
5768 #endif
5769 return -1;
5770
5771 case 19:
5772 #ifdef SO_SELECT_ERR_QUEUE
5773 if (memcmp(str, "SO_SELECT_ERR_QUEUE", 19) == 0) { *valp = SO_SELECT_ERR_QUEUE; return 0; }
5774 #endif
5775 return -1;
5776
5777 case 23:
5778 #ifdef SO_SECURITY_AUTHENTICATION
5779 if (memcmp(str, "SECURITY_AUTHENTICATION", 23) == 0) { *valp = SO_SECURITY_AUTHENTICATION; return 0; }
5780 #endif
5781 return -1;
5782
5783 case 26:
5784 #ifdef SO_SECURITY_AUTHENTICATION
5785 if (memcmp(str, "SO_SECURITY_AUTHENTICATION", 26) == 0) { *valp = SO_SECURITY_AUTHENTICATION; return 0; }
5786 #endif
5787 return -1;
5788
5789 case 27:
5790 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
5791 if (memcmp(str, "SECURITY_ENCRYPTION_NETWORK", 27) == 0) { *valp = SO_SECURITY_ENCRYPTION_NETWORK; return 0; }
5792 #endif
5793 return -1;
5794
5795 case 29:
5796 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
5797 if (memcmp(str, "SECURITY_ENCRYPTION_TRANSPORT", 29) == 0) { *valp = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0; }
5798 #endif
5799 return -1;
5800
5801 case 30:
5802 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
5803 if (memcmp(str, "SO_SECURITY_ENCRYPTION_NETWORK", 30) == 0) { *valp = SO_SECURITY_ENCRYPTION_NETWORK; return 0; }
5804 #endif
5805 return -1;
5806
5807 case 32:
5808 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
5809 if (memcmp(str, "SO_SECURITY_ENCRYPTION_TRANSPORT", 32) == 0) { *valp = SO_SECURITY_ENCRYPTION_TRANSPORT; return 0; }
5810 #endif
5811 return -1;
5812
5813 default:
5814 if (!str || !valp) {/* wrong argument */}
5815 return -1;
5816 }
5817 }
5818
5819
5820 int
5821 rsock_ip_optname_to_int(const char *str, long len, int *valp)
5822 {
5823 switch (len) {
5824 case 3:
5825 #ifdef IP_TOS
5826 if (memcmp(str, "TOS", 3) == 0) { *valp = IP_TOS; return 0; }
5827 #endif
5828 #ifdef IP_TTL
5829 if (memcmp(str, "TTL", 3) == 0) { *valp = IP_TTL; return 0; }
5830 #endif
5831 #ifdef IP_MTU
5832 if (memcmp(str, "MTU", 3) == 0) { *valp = IP_MTU; return 0; }
5833 #endif
5834 return -1;
5835
5836 case 6:
5837 #ifdef IP_TOS
5838 if (memcmp(str, "IP_TOS", 6) == 0) { *valp = IP_TOS; return 0; }
5839 #endif
5840 #ifdef IP_TTL
5841 if (memcmp(str, "IP_TTL", 6) == 0) { *valp = IP_TTL; return 0; }
5842 #endif
5843 #ifdef IP_MTU
5844 if (memcmp(str, "IP_MTU", 6) == 0) { *valp = IP_MTU; return 0; }
5845 #endif
5846 #ifdef IP_MINTTL
5847 if (memcmp(str, "MINTTL", 6) == 0) { *valp = IP_MINTTL; return 0; }
5848 #endif
5849 #ifdef IP_RECVIF
5850 if (memcmp(str, "RECVIF", 6) == 0) { *valp = IP_RECVIF; return 0; }
5851 #endif
5852 return -1;
5853
5854 case 7:
5855 #ifdef IP_OPTIONS
5856 if (memcmp(str, "OPTIONS", 7) == 0) { *valp = IP_OPTIONS; return 0; }
5857 #endif
5858 #ifdef IP_HDRINCL
5859 if (memcmp(str, "HDRINCL", 7) == 0) { *valp = IP_HDRINCL; return 0; }
5860 #endif
5861 #ifdef IP_RETOPTS
5862 if (memcmp(str, "RETOPTS", 7) == 0) { *valp = IP_RETOPTS; return 0; }
5863 #endif
5864 #ifdef IP_RECVTTL
5865 if (memcmp(str, "RECVTTL", 7) == 0) { *valp = IP_RECVTTL; return 0; }
5866 #endif
5867 #ifdef IP_PKTINFO
5868 if (memcmp(str, "PKTINFO", 7) == 0) { *valp = IP_PKTINFO; return 0; }
5869 #endif
5870 #ifdef IP_RECVERR
5871 if (memcmp(str, "RECVERR", 7) == 0) { *valp = IP_RECVERR; return 0; }
5872 #endif
5873 #ifdef IP_RECVTOS
5874 if (memcmp(str, "RECVTOS", 7) == 0) { *valp = IP_RECVTOS; return 0; }
5875 #endif
5876 #ifdef IP_PASSSEC
5877 if (memcmp(str, "PASSSEC", 7) == 0) { *valp = IP_PASSSEC; return 0; }
5878 #endif
5879 return -1;
5880
5881 case 8:
5882 #ifdef IP_RECVOPTS
5883 if (memcmp(str, "RECVOPTS", 8) == 0) { *valp = IP_RECVOPTS; return 0; }
5884 #endif
5885 #ifdef IP_DONTFRAG
5886 if (memcmp(str, "DONTFRAG", 8) == 0) { *valp = IP_DONTFRAG; return 0; }
5887 #endif
5888 #ifdef IP_RECVSLLA
5889 if (memcmp(str, "RECVSLLA", 8) == 0) { *valp = IP_RECVSLLA; return 0; }
5890 #endif
5891 #ifdef IP_FREEBIND
5892 if (memcmp(str, "FREEBIND", 8) == 0) { *valp = IP_FREEBIND; return 0; }
5893 #endif
5894 #ifdef IP_MSFILTER
5895 if (memcmp(str, "MSFILTER", 8) == 0) { *valp = IP_MSFILTER; return 0; }
5896 #endif
5897 return -1;
5898
5899 case 9:
5900 #ifdef IP_MINTTL
5901 if (memcmp(str, "IP_MINTTL", 9) == 0) { *valp = IP_MINTTL; return 0; }
5902 #endif
5903 #ifdef IP_RECVIF
5904 if (memcmp(str, "IP_RECVIF", 9) == 0) { *valp = IP_RECVIF; return 0; }
5905 #endif
5906 #ifdef IP_ONESBCAST
5907 if (memcmp(str, "ONESBCAST", 9) == 0) { *valp = IP_ONESBCAST; return 0; }
5908 #endif
5909 #ifdef IP_PORTRANGE
5910 if (memcmp(str, "PORTRANGE", 9) == 0) { *valp = IP_PORTRANGE; return 0; }
5911 #endif
5912 return -1;
5913
5914 case 10:
5915 #ifdef IP_OPTIONS
5916 if (memcmp(str, "IP_OPTIONS", 10) == 0) { *valp = IP_OPTIONS; return 0; }
5917 #endif
5918 #ifdef IP_HDRINCL
5919 if (memcmp(str, "IP_HDRINCL", 10) == 0) { *valp = IP_HDRINCL; return 0; }
5920 #endif
5921 #ifdef IP_RETOPTS
5922 if (memcmp(str, "IP_RETOPTS", 10) == 0) { *valp = IP_RETOPTS; return 0; }
5923 #endif
5924 #ifdef IP_RECVTTL
5925 if (memcmp(str, "IP_RECVTTL", 10) == 0) { *valp = IP_RECVTTL; return 0; }
5926 #endif
5927 #ifdef IP_PKTINFO
5928 if (memcmp(str, "IP_PKTINFO", 10) == 0) { *valp = IP_PKTINFO; return 0; }
5929 #endif
5930 #ifdef IP_RECVERR
5931 if (memcmp(str, "IP_RECVERR", 10) == 0) { *valp = IP_RECVERR; return 0; }
5932 #endif
5933 #ifdef IP_RECVTOS
5934 if (memcmp(str, "IP_RECVTOS", 10) == 0) { *valp = IP_RECVTOS; return 0; }
5935 #endif
5936 #ifdef IP_PASSSEC
5937 if (memcmp(str, "IP_PASSSEC", 10) == 0) { *valp = IP_PASSSEC; return 0; }
5938 #endif
5939 #ifdef IP_PKTOPTIONS
5940 if (memcmp(str, "PKTOPTIONS", 10) == 0) { *valp = IP_PKTOPTIONS; return 0; }
5941 #endif
5942 return -1;
5943
5944 case 11:
5945 #ifdef IP_RECVOPTS
5946 if (memcmp(str, "IP_RECVOPTS", 11) == 0) { *valp = IP_RECVOPTS; return 0; }
5947 #endif
5948 #ifdef IP_DONTFRAG
5949 if (memcmp(str, "IP_DONTFRAG", 11) == 0) { *valp = IP_DONTFRAG; return 0; }
5950 #endif
5951 #ifdef IP_RECVSLLA
5952 if (memcmp(str, "IP_RECVSLLA", 11) == 0) { *valp = IP_RECVSLLA; return 0; }
5953 #endif
5954 #ifdef IP_FREEBIND
5955 if (memcmp(str, "IP_FREEBIND", 11) == 0) { *valp = IP_FREEBIND; return 0; }
5956 #endif
5957 #ifdef IP_MSFILTER
5958 if (memcmp(str, "IP_MSFILTER", 11) == 0) { *valp = IP_MSFILTER; return 0; }
5959 #endif
5960 #ifdef IP_RECVRETOPTS
5961 if (memcmp(str, "RECVRETOPTS", 11) == 0) { *valp = IP_RECVRETOPTS; return 0; }
5962 #endif
5963 #ifdef IP_RECVDSTADDR
5964 if (memcmp(str, "RECVDSTADDR", 11) == 0) { *valp = IP_RECVDSTADDR; return 0; }
5965 #endif
5966 #ifdef IP_SENDSRCADDR
5967 if (memcmp(str, "SENDSRCADDR", 11) == 0) { *valp = IP_SENDSRCADDR; return 0; }
5968 #endif
5969 #ifdef IP_XFRM_POLICY
5970 if (memcmp(str, "XFRM_POLICY", 11) == 0) { *valp = IP_XFRM_POLICY; return 0; }
5971 #endif
5972 #ifdef IP_TRANSPARENT
5973 if (memcmp(str, "TRANSPARENT", 11) == 0) { *valp = IP_TRANSPARENT; return 0; }
5974 #endif
5975 #ifdef IP_PMTUDISC_DO
5976 if (memcmp(str, "PMTUDISC_DO", 11) == 0) { *valp = IP_PMTUDISC_DO; return 0; }
5977 #endif
5978 return -1;
5979
5980 case 12:
5981 #ifdef IP_ONESBCAST
5982 if (memcmp(str, "IP_ONESBCAST", 12) == 0) { *valp = IP_ONESBCAST; return 0; }
5983 #endif
5984 #ifdef IP_PORTRANGE
5985 if (memcmp(str, "IP_PORTRANGE", 12) == 0) { *valp = IP_PORTRANGE; return 0; }
5986 #endif
5987 #ifdef IP_MULTICAST_IF
5988 if (memcmp(str, "MULTICAST_IF", 12) == 0) { *valp = IP_MULTICAST_IF; return 0; }
5989 #endif
5990 #ifdef IP_ROUTER_ALERT
5991 if (memcmp(str, "ROUTER_ALERT", 12) == 0) { *valp = IP_ROUTER_ALERT; return 0; }
5992 #endif
5993 #ifdef IP_MTU_DISCOVER
5994 if (memcmp(str, "MTU_DISCOVER", 12) == 0) { *valp = IP_MTU_DISCOVER; return 0; }
5995 #endif
5996 #ifdef IP_IPSEC_POLICY
5997 if (memcmp(str, "IPSEC_POLICY", 12) == 0) { *valp = IP_IPSEC_POLICY; return 0; }
5998 #endif
5999 #ifdef IP_BLOCK_SOURCE
6000 if (memcmp(str, "BLOCK_SOURCE", 12) == 0) { *valp = IP_BLOCK_SOURCE; return 0; }
6001 #endif
6002 return -1;
6003
6004 case 13:
6005 #ifdef IP_PKTOPTIONS
6006 if (memcmp(str, "IP_PKTOPTIONS", 13) == 0) { *valp = IP_PKTOPTIONS; return 0; }
6007 #endif
6008 #ifdef IP_MULTICAST_TTL
6009 if (memcmp(str, "MULTICAST_TTL", 13) == 0) { *valp = IP_MULTICAST_TTL; return 0; }
6010 #endif
6011 #ifdef IP_PMTUDISC_DONT
6012 if (memcmp(str, "PMTUDISC_DONT", 13) == 0) { *valp = IP_PMTUDISC_DONT; return 0; }
6013 #endif
6014 #ifdef IP_PMTUDISC_WANT
6015 if (memcmp(str, "PMTUDISC_WANT", 13) == 0) { *valp = IP_PMTUDISC_WANT; return 0; }
6016 #endif
6017 return -1;
6018
6019 case 14:
6020 #ifdef IP_RECVRETOPTS
6021 if (memcmp(str, "IP_RECVRETOPTS", 14) == 0) { *valp = IP_RECVRETOPTS; return 0; }
6022 #endif
6023 #ifdef IP_RECVDSTADDR
6024 if (memcmp(str, "IP_RECVDSTADDR", 14) == 0) { *valp = IP_RECVDSTADDR; return 0; }
6025 #endif
6026 #ifdef IP_SENDSRCADDR
6027 if (memcmp(str, "IP_SENDSRCADDR", 14) == 0) { *valp = IP_SENDSRCADDR; return 0; }
6028 #endif
6029 #ifdef IP_XFRM_POLICY
6030 if (memcmp(str, "IP_XFRM_POLICY", 14) == 0) { *valp = IP_XFRM_POLICY; return 0; }
6031 #endif
6032 #ifdef IP_TRANSPARENT
6033 if (memcmp(str, "IP_TRANSPARENT", 14) == 0) { *valp = IP_TRANSPARENT; return 0; }
6034 #endif
6035 #ifdef IP_PMTUDISC_DO
6036 if (memcmp(str, "IP_PMTUDISC_DO", 14) == 0) { *valp = IP_PMTUDISC_DO; return 0; }
6037 #endif
6038 #ifdef IP_MULTICAST_LOOP
6039 if (memcmp(str, "MULTICAST_LOOP", 14) == 0) { *valp = IP_MULTICAST_LOOP; return 0; }
6040 #endif
6041 #ifdef IP_ADD_MEMBERSHIP
6042 if (memcmp(str, "ADD_MEMBERSHIP", 14) == 0) { *valp = IP_ADD_MEMBERSHIP; return 0; }
6043 #endif
6044 #ifdef IP_UNBLOCK_SOURCE
6045 if (memcmp(str, "UNBLOCK_SOURCE", 14) == 0) { *valp = IP_UNBLOCK_SOURCE; return 0; }
6046 #endif
6047 return -1;
6048
6049 case 15:
6050 #ifdef IP_MULTICAST_IF
6051 if (memcmp(str, "IP_MULTICAST_IF", 15) == 0) { *valp = IP_MULTICAST_IF; return 0; }
6052 #endif
6053 #ifdef IP_ROUTER_ALERT
6054 if (memcmp(str, "IP_ROUTER_ALERT", 15) == 0) { *valp = IP_ROUTER_ALERT; return 0; }
6055 #endif
6056 #ifdef IP_MTU_DISCOVER
6057 if (memcmp(str, "IP_MTU_DISCOVER", 15) == 0) { *valp = IP_MTU_DISCOVER; return 0; }
6058 #endif
6059 #ifdef IP_IPSEC_POLICY
6060 if (memcmp(str, "IP_IPSEC_POLICY", 15) == 0) { *valp = IP_IPSEC_POLICY; return 0; }
6061 #endif
6062 #ifdef IP_BLOCK_SOURCE
6063 if (memcmp(str, "IP_BLOCK_SOURCE", 15) == 0) { *valp = IP_BLOCK_SOURCE; return 0; }
6064 #endif
6065 #ifdef IP_DROP_MEMBERSHIP
6066 if (memcmp(str, "DROP_MEMBERSHIP", 15) == 0) { *valp = IP_DROP_MEMBERSHIP; return 0; }
6067 #endif
6068 #ifdef IP_MAX_MEMBERSHIPS
6069 if (memcmp(str, "MAX_MEMBERSHIPS", 15) == 0) { *valp = IP_MAX_MEMBERSHIPS; return 0; }
6070 #endif
6071 return -1;
6072
6073 case 16:
6074 #ifdef IP_MULTICAST_TTL
6075 if (memcmp(str, "IP_MULTICAST_TTL", 16) == 0) { *valp = IP_MULTICAST_TTL; return 0; }
6076 #endif
6077 #ifdef IP_PMTUDISC_DONT
6078 if (memcmp(str, "IP_PMTUDISC_DONT", 16) == 0) { *valp = IP_PMTUDISC_DONT; return 0; }
6079 #endif
6080 #ifdef IP_PMTUDISC_WANT
6081 if (memcmp(str, "IP_PMTUDISC_WANT", 16) == 0) { *valp = IP_PMTUDISC_WANT; return 0; }
6082 #endif
6083 return -1;
6084
6085 case 17:
6086 #ifdef IP_MULTICAST_LOOP
6087 if (memcmp(str, "IP_MULTICAST_LOOP", 17) == 0) { *valp = IP_MULTICAST_LOOP; return 0; }
6088 #endif
6089 #ifdef IP_ADD_MEMBERSHIP
6090 if (memcmp(str, "IP_ADD_MEMBERSHIP", 17) == 0) { *valp = IP_ADD_MEMBERSHIP; return 0; }
6091 #endif
6092 #ifdef IP_UNBLOCK_SOURCE
6093 if (memcmp(str, "IP_UNBLOCK_SOURCE", 17) == 0) { *valp = IP_UNBLOCK_SOURCE; return 0; }
6094 #endif
6095 return -1;
6096
6097 case 18:
6098 #ifdef IP_DROP_MEMBERSHIP
6099 if (memcmp(str, "IP_DROP_MEMBERSHIP", 18) == 0) { *valp = IP_DROP_MEMBERSHIP; return 0; }
6100 #endif
6101 #ifdef IP_MAX_MEMBERSHIPS
6102 if (memcmp(str, "IP_MAX_MEMBERSHIPS", 18) == 0) { *valp = IP_MAX_MEMBERSHIPS; return 0; }
6103 #endif
6104 return -1;
6105
6106 case 21:
6107 #ifdef IP_DEFAULT_MULTICAST_TTL
6108 if (memcmp(str, "DEFAULT_MULTICAST_TTL", 21) == 0) { *valp = IP_DEFAULT_MULTICAST_TTL; return 0; }
6109 #endif
6110 #ifdef IP_ADD_SOURCE_MEMBERSHIP
6111 if (memcmp(str, "ADD_SOURCE_MEMBERSHIP", 21) == 0) { *valp = IP_ADD_SOURCE_MEMBERSHIP; return 0; }
6112 #endif
6113 return -1;
6114
6115 case 22:
6116 #ifdef IP_DEFAULT_MULTICAST_LOOP
6117 if (memcmp(str, "DEFAULT_MULTICAST_LOOP", 22) == 0) { *valp = IP_DEFAULT_MULTICAST_LOOP; return 0; }
6118 #endif
6119 #ifdef IP_DROP_SOURCE_MEMBERSHIP
6120 if (memcmp(str, "DROP_SOURCE_MEMBERSHIP", 22) == 0) { *valp = IP_DROP_SOURCE_MEMBERSHIP; return 0; }
6121 #endif
6122 return -1;
6123
6124 case 24:
6125 #ifdef IP_DEFAULT_MULTICAST_TTL
6126 if (memcmp(str, "IP_DEFAULT_MULTICAST_TTL", 24) == 0) { *valp = IP_DEFAULT_MULTICAST_TTL; return 0; }
6127 #endif
6128 #ifdef IP_ADD_SOURCE_MEMBERSHIP
6129 if (memcmp(str, "IP_ADD_SOURCE_MEMBERSHIP", 24) == 0) { *valp = IP_ADD_SOURCE_MEMBERSHIP; return 0; }
6130 #endif
6131 return -1;
6132
6133 case 25:
6134 #ifdef IP_DEFAULT_MULTICAST_LOOP
6135 if (memcmp(str, "IP_DEFAULT_MULTICAST_LOOP", 25) == 0) { *valp = IP_DEFAULT_MULTICAST_LOOP; return 0; }
6136 #endif
6137 #ifdef IP_DROP_SOURCE_MEMBERSHIP
6138 if (memcmp(str, "IP_DROP_SOURCE_MEMBERSHIP", 25) == 0) { *valp = IP_DROP_SOURCE_MEMBERSHIP; return 0; }
6139 #endif
6140 return -1;
6141
6142 default:
6143 if (!str || !valp) {/* wrong argument */}
6144 return -1;
6145 }
6146 }
6147
6148
6149 #ifdef IPPROTO_IPV6
6150 int
6151 rsock_ipv6_optname_to_int(const char *str, long len, int *valp)
6152 {
6153 switch (len) {
6154 case 5:
6155 #ifdef IPV6_RTHDR
6156 if (memcmp(str, "RTHDR", 5) == 0) { *valp = IPV6_RTHDR; return 0; }
6157 #endif
6158 return -1;
6159
6160 case 6:
6161 #ifdef IPV6_V6ONLY
6162 if (memcmp(str, "V6ONLY", 6) == 0) { *valp = IPV6_V6ONLY; return 0; }
6163 #endif
6164 #ifdef IPV6_TCLASS
6165 if (memcmp(str, "TCLASS", 6) == 0) { *valp = IPV6_TCLASS; return 0; }
6166 #endif
6167 return -1;
6168
6169 case 7:
6170 #ifdef IPV6_DSTOPTS
6171 if (memcmp(str, "DSTOPTS", 7) == 0) { *valp = IPV6_DSTOPTS; return 0; }
6172 #endif
6173 #ifdef IPV6_HOPOPTS
6174 if (memcmp(str, "HOPOPTS", 7) == 0) { *valp = IPV6_HOPOPTS; return 0; }
6175 #endif
6176 #ifdef IPV6_NEXTHOP
6177 if (memcmp(str, "NEXTHOP", 7) == 0) { *valp = IPV6_NEXTHOP; return 0; }
6178 #endif
6179 #ifdef IPV6_PATHMTU
6180 if (memcmp(str, "PATHMTU", 7) == 0) { *valp = IPV6_PATHMTU; return 0; }
6181 #endif
6182 #ifdef IPV6_PKTINFO
6183 if (memcmp(str, "PKTINFO", 7) == 0) { *valp = IPV6_PKTINFO; return 0; }
6184 #endif
6185 return -1;
6186
6187 case 8:
6188 #ifdef IPV6_CHECKSUM
6189 if (memcmp(str, "CHECKSUM", 8) == 0) { *valp = IPV6_CHECKSUM; return 0; }
6190 #endif
6191 #ifdef IPV6_DONTFRAG
6192 if (memcmp(str, "DONTFRAG", 8) == 0) { *valp = IPV6_DONTFRAG; return 0; }
6193 #endif
6194 #ifdef IPV6_HOPLIMIT
6195 if (memcmp(str, "HOPLIMIT", 8) == 0) { *valp = IPV6_HOPLIMIT; return 0; }
6196 #endif
6197 return -1;
6198
6199 case 9:
6200 #ifdef IPV6_RECVRTHDR
6201 if (memcmp(str, "RECVRTHDR", 9) == 0) { *valp = IPV6_RECVRTHDR; return 0; }
6202 #endif
6203 return -1;
6204
6205 case 10:
6206 #ifdef IPV6_RTHDR
6207 if (memcmp(str, "IPV6_RTHDR", 10) == 0) { *valp = IPV6_RTHDR; return 0; }
6208 #endif
6209 #ifdef IPV6_JOIN_GROUP
6210 if (memcmp(str, "JOIN_GROUP", 10) == 0) { *valp = IPV6_JOIN_GROUP; return 0; }
6211 #endif
6212 #ifdef IPV6_RECVTCLASS
6213 if (memcmp(str, "RECVTCLASS", 10) == 0) { *valp = IPV6_RECVTCLASS; return 0; }
6214 #endif
6215 return -1;
6216
6217 case 11:
6218 #ifdef IPV6_V6ONLY
6219 if (memcmp(str, "IPV6_V6ONLY", 11) == 0) { *valp = IPV6_V6ONLY; return 0; }
6220 #endif
6221 #ifdef IPV6_TCLASS
6222 if (memcmp(str, "IPV6_TCLASS", 11) == 0) { *valp = IPV6_TCLASS; return 0; }
6223 #endif
6224 #ifdef IPV6_LEAVE_GROUP
6225 if (memcmp(str, "LEAVE_GROUP", 11) == 0) { *valp = IPV6_LEAVE_GROUP; return 0; }
6226 #endif
6227 #ifdef IPV6_RECVDSTOPTS
6228 if (memcmp(str, "RECVDSTOPTS", 11) == 0) { *valp = IPV6_RECVDSTOPTS; return 0; }
6229 #endif
6230 #ifdef IPV6_RECVHOPOPTS
6231 if (memcmp(str, "RECVHOPOPTS", 11) == 0) { *valp = IPV6_RECVHOPOPTS; return 0; }
6232 #endif
6233 #ifdef IPV6_RECVPKTINFO
6234 if (memcmp(str, "RECVPKTINFO", 11) == 0) { *valp = IPV6_RECVPKTINFO; return 0; }
6235 #endif
6236 #ifdef IPV6_RECVPATHMTU
6237 if (memcmp(str, "RECVPATHMTU", 11) == 0) { *valp = IPV6_RECVPATHMTU; return 0; }
6238 #endif
6239 #ifdef IPV6_USE_MIN_MTU
6240 if (memcmp(str, "USE_MIN_MTU", 11) == 0) { *valp = IPV6_USE_MIN_MTU; return 0; }
6241 #endif
6242 return -1;
6243
6244 case 12:
6245 #ifdef IPV6_DSTOPTS
6246 if (memcmp(str, "IPV6_DSTOPTS", 12) == 0) { *valp = IPV6_DSTOPTS; return 0; }
6247 #endif
6248 #ifdef IPV6_HOPOPTS
6249 if (memcmp(str, "IPV6_HOPOPTS", 12) == 0) { *valp = IPV6_HOPOPTS; return 0; }
6250 #endif
6251 #ifdef IPV6_NEXTHOP
6252 if (memcmp(str, "IPV6_NEXTHOP", 12) == 0) { *valp = IPV6_NEXTHOP; return 0; }
6253 #endif
6254 #ifdef IPV6_PATHMTU
6255 if (memcmp(str, "IPV6_PATHMTU", 12) == 0) { *valp = IPV6_PATHMTU; return 0; }
6256 #endif
6257 #ifdef IPV6_PKTINFO
6258 if (memcmp(str, "IPV6_PKTINFO", 12) == 0) { *valp = IPV6_PKTINFO; return 0; }
6259 #endif
6260 #ifdef IPV6_MULTICAST_IF
6261 if (memcmp(str, "MULTICAST_IF", 12) == 0) { *valp = IPV6_MULTICAST_IF; return 0; }
6262 #endif
6263 #ifdef IPV6_UNICAST_HOPS
6264 if (memcmp(str, "UNICAST_HOPS", 12) == 0) { *valp = IPV6_UNICAST_HOPS; return 0; }
6265 #endif
6266 #ifdef IPV6_RECVHOPLIMIT
6267 if (memcmp(str, "RECVHOPLIMIT", 12) == 0) { *valp = IPV6_RECVHOPLIMIT; return 0; }
6268 #endif
6269 #ifdef IPV6_RTHDRDSTOPTS
6270 if (memcmp(str, "RTHDRDSTOPTS", 12) == 0) { *valp = IPV6_RTHDRDSTOPTS; return 0; }
6271 #endif
6272 #ifdef IPV6_RTHDR_TYPE_0
6273 if (memcmp(str, "RTHDR_TYPE_0", 12) == 0) { *valp = IPV6_RTHDR_TYPE_0; return 0; }
6274 #endif
6275 return -1;
6276
6277 case 13:
6278 #ifdef IPV6_CHECKSUM
6279 if (memcmp(str, "IPV6_CHECKSUM", 13) == 0) { *valp = IPV6_CHECKSUM; return 0; }
6280 #endif
6281 #ifdef IPV6_DONTFRAG
6282 if (memcmp(str, "IPV6_DONTFRAG", 13) == 0) { *valp = IPV6_DONTFRAG; return 0; }
6283 #endif
6284 #ifdef IPV6_HOPLIMIT
6285 if (memcmp(str, "IPV6_HOPLIMIT", 13) == 0) { *valp = IPV6_HOPLIMIT; return 0; }
6286 #endif
6287 return -1;
6288
6289 case 14:
6290 #ifdef IPV6_RECVRTHDR
6291 if (memcmp(str, "IPV6_RECVRTHDR", 14) == 0) { *valp = IPV6_RECVRTHDR; return 0; }
6292 #endif
6293 #ifdef IPV6_MULTICAST_HOPS
6294 if (memcmp(str, "MULTICAST_HOPS", 14) == 0) { *valp = IPV6_MULTICAST_HOPS; return 0; }
6295 #endif
6296 #ifdef IPV6_MULTICAST_LOOP
6297 if (memcmp(str, "MULTICAST_LOOP", 14) == 0) { *valp = IPV6_MULTICAST_LOOP; return 0; }
6298 #endif
6299 return -1;
6300
6301 case 15:
6302 #ifdef IPV6_JOIN_GROUP
6303 if (memcmp(str, "IPV6_JOIN_GROUP", 15) == 0) { *valp = IPV6_JOIN_GROUP; return 0; }
6304 #endif
6305 #ifdef IPV6_RECVTCLASS
6306 if (memcmp(str, "IPV6_RECVTCLASS", 15) == 0) { *valp = IPV6_RECVTCLASS; return 0; }
6307 #endif
6308 return -1;
6309
6310 case 16:
6311 #ifdef IPV6_LEAVE_GROUP
6312 if (memcmp(str, "IPV6_LEAVE_GROUP", 16) == 0) { *valp = IPV6_LEAVE_GROUP; return 0; }
6313 #endif
6314 #ifdef IPV6_RECVDSTOPTS
6315 if (memcmp(str, "IPV6_RECVDSTOPTS", 16) == 0) { *valp = IPV6_RECVDSTOPTS; return 0; }
6316 #endif
6317 #ifdef IPV6_RECVHOPOPTS
6318 if (memcmp(str, "IPV6_RECVHOPOPTS", 16) == 0) { *valp = IPV6_RECVHOPOPTS; return 0; }
6319 #endif
6320 #ifdef IPV6_RECVPKTINFO
6321 if (memcmp(str, "IPV6_RECVPKTINFO", 16) == 0) { *valp = IPV6_RECVPKTINFO; return 0; }
6322 #endif
6323 #ifdef IPV6_RECVPATHMTU
6324 if (memcmp(str, "IPV6_RECVPATHMTU", 16) == 0) { *valp = IPV6_RECVPATHMTU; return 0; }
6325 #endif
6326 #ifdef IPV6_USE_MIN_MTU
6327 if (memcmp(str, "IPV6_USE_MIN_MTU", 16) == 0) { *valp = IPV6_USE_MIN_MTU; return 0; }
6328 #endif
6329 return -1;
6330
6331 case 17:
6332 #ifdef IPV6_MULTICAST_IF
6333 if (memcmp(str, "IPV6_MULTICAST_IF", 17) == 0) { *valp = IPV6_MULTICAST_IF; return 0; }
6334 #endif
6335 #ifdef IPV6_UNICAST_HOPS
6336 if (memcmp(str, "IPV6_UNICAST_HOPS", 17) == 0) { *valp = IPV6_UNICAST_HOPS; return 0; }
6337 #endif
6338 #ifdef IPV6_RECVHOPLIMIT
6339 if (memcmp(str, "IPV6_RECVHOPLIMIT", 17) == 0) { *valp = IPV6_RECVHOPLIMIT; return 0; }
6340 #endif
6341 #ifdef IPV6_RTHDRDSTOPTS
6342 if (memcmp(str, "IPV6_RTHDRDSTOPTS", 17) == 0) { *valp = IPV6_RTHDRDSTOPTS; return 0; }
6343 #endif
6344 #ifdef IPV6_RTHDR_TYPE_0
6345 if (memcmp(str, "IPV6_RTHDR_TYPE_0", 17) == 0) { *valp = IPV6_RTHDR_TYPE_0; return 0; }
6346 #endif
6347 return -1;
6348
6349 case 19:
6350 #ifdef IPV6_MULTICAST_HOPS
6351 if (memcmp(str, "IPV6_MULTICAST_HOPS", 19) == 0) { *valp = IPV6_MULTICAST_HOPS; return 0; }
6352 #endif
6353 #ifdef IPV6_MULTICAST_LOOP
6354 if (memcmp(str, "IPV6_MULTICAST_LOOP", 19) == 0) { *valp = IPV6_MULTICAST_LOOP; return 0; }
6355 #endif
6356 return -1;
6357
6358 default:
6359 if (!str || !valp) {/* wrong argument */}
6360 return -1;
6361 }
6362 }
6363
6364 #endif
6365
6366 int
6367 rsock_tcp_optname_to_int(const char *str, long len, int *valp)
6368 {
6369 switch (len) {
6370 case 4:
6371 #ifdef TCP_CORK
6372 if (memcmp(str, "CORK", 4) == 0) { *valp = TCP_CORK; return 0; }
6373 #endif
6374 #ifdef TCP_INFO
6375 if (memcmp(str, "INFO", 4) == 0) { *valp = TCP_INFO; return 0; }
6376 #endif
6377 return -1;
6378
6379 case 5:
6380 #ifdef TCP_NOOPT
6381 if (memcmp(str, "NOOPT", 5) == 0) { *valp = TCP_NOOPT; return 0; }
6382 #endif
6383 return -1;
6384
6385 case 6:
6386 #ifdef TCP_MAXSEG
6387 if (memcmp(str, "MAXSEG", 6) == 0) { *valp = TCP_MAXSEG; return 0; }
6388 #endif
6389 #ifdef TCP_MD5SIG
6390 if (memcmp(str, "MD5SIG", 6) == 0) { *valp = TCP_MD5SIG; return 0; }
6391 #endif
6392 #ifdef TCP_NOPUSH
6393 if (memcmp(str, "NOPUSH", 6) == 0) { *valp = TCP_NOPUSH; return 0; }
6394 #endif
6395 #ifdef TCP_SYNCNT
6396 if (memcmp(str, "SYNCNT", 6) == 0) { *valp = TCP_SYNCNT; return 0; }
6397 #endif
6398 #ifdef TCP_REPAIR
6399 if (memcmp(str, "REPAIR", 6) == 0) { *valp = TCP_REPAIR; return 0; }
6400 #endif
6401 return -1;
6402
6403 case 7:
6404 #ifdef TCP_NODELAY
6405 if (memcmp(str, "NODELAY", 7) == 0) { *valp = TCP_NODELAY; return 0; }
6406 #endif
6407 #ifdef TCP_KEEPCNT
6408 if (memcmp(str, "KEEPCNT", 7) == 0) { *valp = TCP_KEEPCNT; return 0; }
6409 #endif
6410 #ifdef TCP_LINGER2
6411 if (memcmp(str, "LINGER2", 7) == 0) { *valp = TCP_LINGER2; return 0; }
6412 #endif
6413 return -1;
6414
6415 case 8:
6416 #ifdef TCP_CORK
6417 if (memcmp(str, "TCP_CORK", 8) == 0) { *valp = TCP_CORK; return 0; }
6418 #endif
6419 #ifdef TCP_INFO
6420 if (memcmp(str, "TCP_INFO", 8) == 0) { *valp = TCP_INFO; return 0; }
6421 #endif
6422 #ifdef TCP_KEEPIDLE
6423 if (memcmp(str, "KEEPIDLE", 8) == 0) { *valp = TCP_KEEPIDLE; return 0; }
6424 #endif
6425 #ifdef TCP_QUICKACK
6426 if (memcmp(str, "QUICKACK", 8) == 0) { *valp = TCP_QUICKACK; return 0; }
6427 #endif
6428 #ifdef TCP_FASTOPEN
6429 if (memcmp(str, "FASTOPEN", 8) == 0) { *valp = TCP_FASTOPEN; return 0; }
6430 #endif
6431 return -1;
6432
6433 case 9:
6434 #ifdef TCP_NOOPT
6435 if (memcmp(str, "TCP_NOOPT", 9) == 0) { *valp = TCP_NOOPT; return 0; }
6436 #endif
6437 #ifdef TCP_KEEPINTVL
6438 if (memcmp(str, "KEEPINTVL", 9) == 0) { *valp = TCP_KEEPINTVL; return 0; }
6439 #endif
6440 #ifdef TCP_QUEUE_SEQ
6441 if (memcmp(str, "QUEUE_SEQ", 9) == 0) { *valp = TCP_QUEUE_SEQ; return 0; }
6442 #endif
6443 #ifdef TCP_TIMESTAMP
6444 if (memcmp(str, "TIMESTAMP", 9) == 0) { *valp = TCP_TIMESTAMP; return 0; }
6445 #endif
6446 return -1;
6447
6448 case 10:
6449 #ifdef TCP_MAXSEG
6450 if (memcmp(str, "TCP_MAXSEG", 10) == 0) { *valp = TCP_MAXSEG; return 0; }
6451 #endif
6452 #ifdef TCP_MD5SIG
6453 if (memcmp(str, "TCP_MD5SIG", 10) == 0) { *valp = TCP_MD5SIG; return 0; }
6454 #endif
6455 #ifdef TCP_NOPUSH
6456 if (memcmp(str, "TCP_NOPUSH", 10) == 0) { *valp = TCP_NOPUSH; return 0; }
6457 #endif
6458 #ifdef TCP_SYNCNT
6459 if (memcmp(str, "TCP_SYNCNT", 10) == 0) { *valp = TCP_SYNCNT; return 0; }
6460 #endif
6461 #ifdef TCP_REPAIR
6462 if (memcmp(str, "TCP_REPAIR", 10) == 0) { *valp = TCP_REPAIR; return 0; }
6463 #endif
6464 #ifdef TCP_CONGESTION
6465 if (memcmp(str, "CONGESTION", 10) == 0) { *valp = TCP_CONGESTION; return 0; }
6466 #endif
6467 return -1;
6468
6469 case 11:
6470 #ifdef TCP_NODELAY
6471 if (memcmp(str, "TCP_NODELAY", 11) == 0) { *valp = TCP_NODELAY; return 0; }
6472 #endif
6473 #ifdef TCP_KEEPCNT
6474 if (memcmp(str, "TCP_KEEPCNT", 11) == 0) { *valp = TCP_KEEPCNT; return 0; }
6475 #endif
6476 #ifdef TCP_LINGER2
6477 if (memcmp(str, "TCP_LINGER2", 11) == 0) { *valp = TCP_LINGER2; return 0; }
6478 #endif
6479 #ifdef TCP_THIN_DUPACK
6480 if (memcmp(str, "THIN_DUPACK", 11) == 0) { *valp = TCP_THIN_DUPACK; return 0; }
6481 #endif
6482 return -1;
6483
6484 case 12:
6485 #ifdef TCP_KEEPIDLE
6486 if (memcmp(str, "TCP_KEEPIDLE", 12) == 0) { *valp = TCP_KEEPIDLE; return 0; }
6487 #endif
6488 #ifdef TCP_QUICKACK
6489 if (memcmp(str, "TCP_QUICKACK", 12) == 0) { *valp = TCP_QUICKACK; return 0; }
6490 #endif
6491 #ifdef TCP_FASTOPEN
6492 if (memcmp(str, "TCP_FASTOPEN", 12) == 0) { *valp = TCP_FASTOPEN; return 0; }
6493 #endif
6494 #ifdef TCP_DEFER_ACCEPT
6495 if (memcmp(str, "DEFER_ACCEPT", 12) == 0) { *valp = TCP_DEFER_ACCEPT; return 0; }
6496 #endif
6497 #ifdef TCP_WINDOW_CLAMP
6498 if (memcmp(str, "WINDOW_CLAMP", 12) == 0) { *valp = TCP_WINDOW_CLAMP; return 0; }
6499 #endif
6500 #ifdef TCP_REPAIR_QUEUE
6501 if (memcmp(str, "REPAIR_QUEUE", 12) == 0) { *valp = TCP_REPAIR_QUEUE; return 0; }
6502 #endif
6503 #ifdef TCP_USER_TIMEOUT
6504 if (memcmp(str, "USER_TIMEOUT", 12) == 0) { *valp = TCP_USER_TIMEOUT; return 0; }
6505 #endif
6506 return -1;
6507
6508 case 13:
6509 #ifdef TCP_KEEPINTVL
6510 if (memcmp(str, "TCP_KEEPINTVL", 13) == 0) { *valp = TCP_KEEPINTVL; return 0; }
6511 #endif
6512 #ifdef TCP_QUEUE_SEQ
6513 if (memcmp(str, "TCP_QUEUE_SEQ", 13) == 0) { *valp = TCP_QUEUE_SEQ; return 0; }
6514 #endif
6515 #ifdef TCP_TIMESTAMP
6516 if (memcmp(str, "TCP_TIMESTAMP", 13) == 0) { *valp = TCP_TIMESTAMP; return 0; }
6517 #endif
6518 return -1;
6519
6520 case 14:
6521 #ifdef TCP_CONGESTION
6522 if (memcmp(str, "TCP_CONGESTION", 14) == 0) { *valp = TCP_CONGESTION; return 0; }
6523 #endif
6524 #ifdef TCP_REPAIR_OPTIONS
6525 if (memcmp(str, "REPAIR_OPTIONS", 14) == 0) { *valp = TCP_REPAIR_OPTIONS; return 0; }
6526 #endif
6527 return -1;
6528
6529 case 15:
6530 #ifdef TCP_THIN_DUPACK
6531 if (memcmp(str, "TCP_THIN_DUPACK", 15) == 0) { *valp = TCP_THIN_DUPACK; return 0; }
6532 #endif
6533 return -1;
6534
6535 case 16:
6536 #ifdef TCP_DEFER_ACCEPT
6537 if (memcmp(str, "TCP_DEFER_ACCEPT", 16) == 0) { *valp = TCP_DEFER_ACCEPT; return 0; }
6538 #endif
6539 #ifdef TCP_WINDOW_CLAMP
6540 if (memcmp(str, "TCP_WINDOW_CLAMP", 16) == 0) { *valp = TCP_WINDOW_CLAMP; return 0; }
6541 #endif
6542 #ifdef TCP_REPAIR_QUEUE
6543 if (memcmp(str, "TCP_REPAIR_QUEUE", 16) == 0) { *valp = TCP_REPAIR_QUEUE; return 0; }
6544 #endif
6545 #ifdef TCP_USER_TIMEOUT
6546 if (memcmp(str, "TCP_USER_TIMEOUT", 16) == 0) { *valp = TCP_USER_TIMEOUT; return 0; }
6547 #endif
6548 return -1;
6549
6550 case 18:
6551 #ifdef TCP_REPAIR_OPTIONS
6552 if (memcmp(str, "TCP_REPAIR_OPTIONS", 18) == 0) { *valp = TCP_REPAIR_OPTIONS; return 0; }
6553 #endif
6554 return -1;
6555
6556 case 19:
6557 #ifdef TCP_COOKIE_TRANSACTIONS
6558 if (memcmp(str, "COOKIE_TRANSACTIONS", 19) == 0) { *valp = TCP_COOKIE_TRANSACTIONS; return 0; }
6559 #endif
6560 return -1;
6561
6562 case 20:
6563 #ifdef TCP_THIN_LINEAR_TIMEOUTS
6564 if (memcmp(str, "THIN_LINEAR_TIMEOUTS", 20) == 0) { *valp = TCP_THIN_LINEAR_TIMEOUTS; return 0; }
6565 #endif
6566 return -1;
6567
6568 case 23:
6569 #ifdef TCP_COOKIE_TRANSACTIONS
6570 if (memcmp(str, "TCP_COOKIE_TRANSACTIONS", 23) == 0) { *valp = TCP_COOKIE_TRANSACTIONS; return 0; }
6571 #endif
6572 return -1;
6573
6574 case 24:
6575 #ifdef TCP_THIN_LINEAR_TIMEOUTS
6576 if (memcmp(str, "TCP_THIN_LINEAR_TIMEOUTS", 24) == 0) { *valp = TCP_THIN_LINEAR_TIMEOUTS; return 0; }
6577 #endif
6578 return -1;
6579
6580 default:
6581 if (!str || !valp) {/* wrong argument */}
6582 return -1;
6583 }
6584 }
6585
6586
6587 int
6588 rsock_udp_optname_to_int(const char *str, long len, int *valp)
6589 {
6590 switch (len) {
6591 case 4:
6592 #ifdef UDP_CORK
6593 if (memcmp(str, "CORK", 4) == 0) { *valp = UDP_CORK; return 0; }
6594 #endif
6595 return -1;
6596
6597 case 8:
6598 #ifdef UDP_CORK
6599 if (memcmp(str, "UDP_CORK", 8) == 0) { *valp = UDP_CORK; return 0; }
6600 #endif
6601 return -1;
6602
6603 default:
6604 if (!str || !valp) {/* wrong argument */}
6605 return -1;
6606 }
6607 }
6608
6609
6610 int
6611 rsock_shutdown_how_to_int(const char *str, long len, int *valp)
6612 {
6613 switch (len) {
6614 case 2:
6615 #ifdef SHUT_RD
6616 if (memcmp(str, "RD", 2) == 0) { *valp = SHUT_RD; return 0; }
6617 #endif
6618 #ifdef SHUT_WR
6619 if (memcmp(str, "WR", 2) == 0) { *valp = SHUT_WR; return 0; }
6620 #endif
6621 return -1;
6622
6623 case 4:
6624 #ifdef SHUT_RDWR
6625 if (memcmp(str, "RDWR", 4) == 0) { *valp = SHUT_RDWR; return 0; }
6626 #endif
6627 return -1;
6628
6629 case 7:
6630 #ifdef SHUT_RD
6631 if (memcmp(str, "SHUT_RD", 7) == 0) { *valp = SHUT_RD; return 0; }
6632 #endif
6633 #ifdef SHUT_WR
6634 if (memcmp(str, "SHUT_WR", 7) == 0) { *valp = SHUT_WR; return 0; }
6635 #endif
6636 return -1;
6637
6638 case 9:
6639 #ifdef SHUT_RDWR
6640 if (memcmp(str, "SHUT_RDWR", 9) == 0) { *valp = SHUT_RDWR; return 0; }
6641 #endif
6642 return -1;
6643
6644 default:
6645 if (!str || !valp) {/* wrong argument */}
6646 return -1;
6647 }
6648 }
6649
6650
6651 int
6652 rsock_scm_optname_to_int(const char *str, long len, int *valp)
6653 {
6654 switch (len) {
6655 case 5:
6656 #ifdef SCM_CREDS
6657 if (memcmp(str, "CREDS", 5) == 0) { *valp = SCM_CREDS; return 0; }
6658 #endif
6659 #ifdef SCM_UCRED
6660 if (memcmp(str, "UCRED", 5) == 0) { *valp = SCM_UCRED; return 0; }
6661 #endif
6662 return -1;
6663
6664 case 6:
6665 #ifdef SCM_RIGHTS
6666 if (memcmp(str, "RIGHTS", 6) == 0) { *valp = SCM_RIGHTS; return 0; }
6667 #endif
6668 return -1;
6669
6670 case 7:
6671 #ifdef SCM_BINTIME
6672 if (memcmp(str, "BINTIME", 7) == 0) { *valp = SCM_BINTIME; return 0; }
6673 #endif
6674 return -1;
6675
6676 case 9:
6677 #ifdef SCM_CREDS
6678 if (memcmp(str, "SCM_CREDS", 9) == 0) { *valp = SCM_CREDS; return 0; }
6679 #endif
6680 #ifdef SCM_UCRED
6681 if (memcmp(str, "SCM_UCRED", 9) == 0) { *valp = SCM_UCRED; return 0; }
6682 #endif
6683 #ifdef SCM_TIMESTAMP
6684 if (memcmp(str, "TIMESTAMP", 9) == 0) { *valp = SCM_TIMESTAMP; return 0; }
6685 #endif
6686 return -1;
6687
6688 case 10:
6689 #ifdef SCM_RIGHTS
6690 if (memcmp(str, "SCM_RIGHTS", 10) == 0) { *valp = SCM_RIGHTS; return 0; }
6691 #endif
6692 return -1;
6693
6694 case 11:
6695 #ifdef SCM_BINTIME
6696 if (memcmp(str, "SCM_BINTIME", 11) == 0) { *valp = SCM_BINTIME; return 0; }
6697 #endif
6698 #ifdef SCM_TIMESTAMPNS
6699 if (memcmp(str, "TIMESTAMPNS", 11) == 0) { *valp = SCM_TIMESTAMPNS; return 0; }
6700 #endif
6701 #ifdef SCM_CREDENTIALS
6702 if (memcmp(str, "CREDENTIALS", 11) == 0) { *valp = SCM_CREDENTIALS; return 0; }
6703 #endif
6704 #ifdef SCM_WIFI_STATUS
6705 if (memcmp(str, "WIFI_STATUS", 11) == 0) { *valp = SCM_WIFI_STATUS; return 0; }
6706 #endif
6707 return -1;
6708
6709 case 12:
6710 #ifdef SCM_TIMESTAMPING
6711 if (memcmp(str, "TIMESTAMPING", 12) == 0) { *valp = SCM_TIMESTAMPING; return 0; }
6712 #endif
6713 return -1;
6714
6715 case 13:
6716 #ifdef SCM_TIMESTAMP
6717 if (memcmp(str, "SCM_TIMESTAMP", 13) == 0) { *valp = SCM_TIMESTAMP; return 0; }
6718 #endif
6719 return -1;
6720
6721 case 15:
6722 #ifdef SCM_TIMESTAMPNS
6723 if (memcmp(str, "SCM_TIMESTAMPNS", 15) == 0) { *valp = SCM_TIMESTAMPNS; return 0; }
6724 #endif
6725 #ifdef SCM_CREDENTIALS
6726 if (memcmp(str, "SCM_CREDENTIALS", 15) == 0) { *valp = SCM_CREDENTIALS; return 0; }
6727 #endif
6728 #ifdef SCM_WIFI_STATUS
6729 if (memcmp(str, "SCM_WIFI_STATUS", 15) == 0) { *valp = SCM_WIFI_STATUS; return 0; }
6730 #endif
6731 return -1;
6732
6733 case 16:
6734 #ifdef SCM_TIMESTAMPING
6735 if (memcmp(str, "SCM_TIMESTAMPING", 16) == 0) { *valp = SCM_TIMESTAMPING; return 0; }
6736 #endif
6737 return -1;
6738
6739 default:
6740 if (!str || !valp) {/* wrong argument */}
6741 return -1;
6742 }
6743 }
6744
6745
6746
6747 ID
6748 rsock_intern_family(int val)
6749 {
6750 st_data_t name;
6751 if (st_lookup(rsock_intern_family_hash, (st_data_t)val, &name))
6752 return (ID)name;
6753 return 0;
6754 }
6755
6756 ID
6757 rsock_intern_family_noprefix(int val)
6758 {
6759 st_data_t name;
6760 if (st_lookup(rsock_intern_family_noprefix_hash, (st_data_t)val, &name))
6761 return (ID)name;
6762 return 0;
6763 }
6764
6765 ID
6766 rsock_intern_protocol_family(int val)
6767 {
6768 st_data_t name;
6769 if (st_lookup(rsock_intern_protocol_family_hash, (st_data_t)val, &name))
6770 return (ID)name;
6771 return 0;
6772 }
6773
6774 ID
6775 rsock_intern_socktype(int val)
6776 {
6777 st_data_t name;
6778 if (st_lookup(rsock_intern_socktype_hash, (st_data_t)val, &name))
6779 return (ID)name;
6780 return 0;
6781 }
6782
6783 ID
6784 rsock_intern_ipproto(int val)
6785 {
6786 st_data_t name;
6787 if (st_lookup(rsock_intern_ipproto_hash, (st_data_t)val, &name))
6788 return (ID)name;
6789 return 0;
6790 }
6791
6792 ID
6793 rsock_intern_iplevel(int val)
6794 {
6795 st_data_t name;
6796 if (st_lookup(rsock_intern_iplevel_hash, (st_data_t)val, &name))
6797 return (ID)name;
6798 return 0;
6799 }
6800
6801 ID
6802 rsock_intern_so_optname(int val)
6803 {
6804 st_data_t name;
6805 if (st_lookup(rsock_intern_so_optname_hash, (st_data_t)val, &name))
6806 return (ID)name;
6807 return 0;
6808 }
6809
6810 ID
6811 rsock_intern_ip_optname(int val)
6812 {
6813 st_data_t name;
6814 if (st_lookup(rsock_intern_ip_optname_hash, (st_data_t)val, &name))
6815 return (ID)name;
6816 return 0;
6817 }
6818
6819 ID
6820 rsock_intern_ipv6_optname(int val)
6821 {
6822 st_data_t name;
6823 if (st_lookup(rsock_intern_ipv6_optname_hash, (st_data_t)val, &name))
6824 return (ID)name;
6825 return 0;
6826 }
6827
6828 ID
6829 rsock_intern_tcp_optname(int val)
6830 {
6831 st_data_t name;
6832 if (st_lookup(rsock_intern_tcp_optname_hash, (st_data_t)val, &name))
6833 return (ID)name;
6834 return 0;
6835 }
6836
6837 ID
6838 rsock_intern_udp_optname(int val)
6839 {
6840 st_data_t name;
6841 if (st_lookup(rsock_intern_udp_optname_hash, (st_data_t)val, &name))
6842 return (ID)name;
6843 return 0;
6844 }
6845
6846 ID
6847 rsock_intern_scm_optname(int val)
6848 {
6849 st_data_t name;
6850 if (st_lookup(rsock_intern_scm_optname_hash, (st_data_t)val, &name))
6851 return (ID)name;
6852 return 0;
6853 }
6854
6855 ID
6856 rsock_intern_local_optname(int val)
6857 {
6858 st_data_t name;
6859 if (st_lookup(rsock_intern_local_optname_hash, (st_data_t)val, &name))
6860 return (ID)name;
6861 return 0;
6862 }
6863
6864
AF_UNSPEC
#define AF_UNSPEC
Definition: sockport.h:101
ID
unsigned long ID
Definition: ruby.h:103
AI_PASSIVE
#define AI_PASSIVE
Definition: addrinfo.h:96
rsock_tcp_optname_to_int
int rsock_tcp_optname_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:6367
NI_NAMEREQD
#define NI_NAMEREQD
Definition: addrinfo.h:126
AI_CANONNAME
#define AI_CANONNAME
Definition: addrinfo.h:97
rb_define_module_under
VALUE rb_define_module_under(VALUE outer, const char *name)
Definition: class.c:797
IPPROTO_UDP
#define IPPROTO_UDP
Definition: constdefs.h:627
INET_ADDRSTRLEN
#define INET_ADDRSTRLEN
Definition: constdefs.h:1825
INADDR_ALLHOSTS_GROUP
#define INADDR_ALLHOSTS_GROUP
Definition: constdefs.h:768
IPPROTO_TCP
#define IPPROTO_TCP
Definition: constdefs.h:610
rsock_intern_tcp_optname
ID rsock_intern_tcp_optname(int val)
Definition: constdefs.c:6829
SHUT_RDWR
#define SHUT_RDWR
Definition: constdefs.h:1683
rsock_intern_udp_optname
ID rsock_intern_udp_optname(int val)
Definition: constdefs.c:6838
NI_NOFQDN
#define NI_NOFQDN
Definition: addrinfo.h:124
INADDR_LOOPBACK
#define INADDR_LOOPBACK
Definition: constdefs.h:754
st_init_numtable
st_table * st_init_numtable(void)
Definition: st.c:653
NI_MAXSERV
#define NI_MAXSERV
Definition: addrinfo.h:118
INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN
Definition: constdefs.h:1832
rsock_intern_scm_optname
ID rsock_intern_scm_optname(int val)
Definition: constdefs.c:6847
INADDR_ANY
#define INADDR_ANY
Definition: constdefs.h:740
rsock_intern_ipv6_optname
ID rsock_intern_ipv6_optname(int val)
Definition: constdefs.c:6820
IPPROTO_IP
#define IPPROTO_IP
Definition: constdefs.h:586
rsock_socktype_to_int
int rsock_socktype_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:4863
AI_MASK
#define AI_MASK
Definition: addrinfo.h:103
AI_NUMERICHOST
#define AI_NUMERICHOST
Definition: addrinfo.h:98
rsock_intern_local_optname
ID rsock_intern_local_optname(int val)
Definition: constdefs.c:6856
st_insert
int st_insert(st_table *tab, st_data_t key, st_data_t value)
Definition: st.c:1171
SHUT_RD
#define SHUT_RD
Definition: constdefs.h:1669
EAI_SOCKTYPE
#define EAI_SOCKTYPE
Definition: addrinfo.h:87
AI_DEFAULT
#define AI_DEFAULT
Definition: addrinfo.h:111
rsock_ip_optname_to_int
int rsock_ip_optname_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:5821
INADDR_NONE
#define INADDR_NONE
Definition: constdefs.h:782
IPPROTO_ICMP
#define IPPROTO_ICMP
Definition: constdefs.h:593
EAI_SYSTEM
#define EAI_SYSTEM
Definition: addrinfo.h:88
rsock_intern_family_noprefix
ID rsock_intern_family_noprefix(int val)
Definition: constdefs.c:6757
rb_cSocket
VALUE rb_cSocket
Definition: init.c:26
rsock_family_to_int
int rsock_family_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:4468
EAI_AGAIN
#define EAI_AGAIN
Definition: addrinfo.h:79
SOMAXCONN
#define SOMAXCONN
Definition: constdefs.h:1849
NI_NUMERICHOST
#define NI_NUMERICHOST
Definition: addrinfo.h:125
INTEGER2NUM
#define INTEGER2NUM(n)
Definition: constdefs.c:23
AI_V4MAPPED
#define AI_V4MAPPED
Definition: addrinfo.h:109
INADDR_MAX_LOCAL_GROUP
#define INADDR_MAX_LOCAL_GROUP
Definition: constdefs.h:775
EAI_NODATA
#define EAI_NODATA
Definition: addrinfo.h:84
SHUT_WR
#define SHUT_WR
Definition: constdefs.h:1676
rsock_ipproto_to_int
int rsock_ipproto_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:4934
IFNAMSIZ
#define IFNAMSIZ
rsock_intern_socktype
ID rsock_intern_socktype(int val)
Definition: constdefs.c:6775
AI_NUMERICSERV
#define AI_NUMERICSERV
Definition: addrinfo.h:99
NI_MAXHOST
#define NI_MAXHOST
Definition: addrinfo.h:117
PF_INET
#define PF_INET
Definition: sockport.h:109
memcmp
int memcmp(const void *s1, const void *s2, size_t len)
Definition: memcmp.c:7
rsock_udp_optname_to_int
int rsock_udp_optname_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:6588
NI_NUMERICSERV
#define NI_NUMERICSERV
Definition: addrinfo.h:127
PF_UNSPEC
#define PF_UNSPEC
Definition: sockport.h:105
EAI_MEMORY
#define EAI_MEMORY
Definition: addrinfo.h:83
IPPORT_USERRESERVED
#define IPPORT_USERRESERVED
Definition: constdefs.h:733
EAI_PROTOCOL
#define EAI_PROTOCOL
Definition: addrinfo.h:90
EAI_MAX
#define EAI_MAX
Definition: addrinfo.h:91
AI_ADDRCONFIG
#define AI_ADDRCONFIG
Definition: addrinfo.h:108
rb_intern2
ID rb_intern2(const char *, long)
Definition: symbol.c:653
rsock_intern_ipproto
ID rsock_intern_ipproto(int val)
Definition: constdefs.c:6784
st_data_t
unsigned long st_data_t
Definition: rb_mjit_min_header-2.7.0.h:5363
AI_ALL
#define AI_ALL
Definition: addrinfo.h:106
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
rsock_intern_family
ID rsock_intern_family(int val)
Definition: constdefs.c:6748
rsock_scm_optname_to_int
int rsock_scm_optname_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:6652
EAI_SERVICE
#define EAI_SERVICE
Definition: addrinfo.h:86
rsock_so_optname_to_int
int rsock_so_optname_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:5381
EAI_FAMILY
#define EAI_FAMILY
Definition: addrinfo.h:82
INADDR_BROADCAST
#define INADDR_BROADCAST
Definition: constdefs.h:747
EAI_ADDRFAMILY
#define EAI_ADDRFAMILY
Definition: addrinfo.h:78
rb_define_const
void rb_define_const(VALUE, const char *, VALUE)
Definition: variable.c:2880
AI_V4MAPPED_CFG
#define AI_V4MAPPED_CFG
Definition: addrinfo.h:107
rsock_unknown_level_to_int
int rsock_unknown_level_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:5143
len
uint8_t len
Definition: escape.c:17
EAI_BADFLAGS
#define EAI_BADFLAGS
Definition: addrinfo.h:80
EAI_NONAME
#define EAI_NONAME
Definition: addrinfo.h:85
rsock_intern_ip_optname
ID rsock_intern_ip_optname(int val)
Definition: constdefs.c:6811
IPPORT_RESERVED
#define IPPORT_RESERVED
Definition: constdefs.h:726
NI_DGRAM
#define NI_DGRAM
Definition: addrinfo.h:128
INADDR_UNSPEC_GROUP
#define INADDR_UNSPEC_GROUP
Definition: constdefs.h:761
EAI_BADHINTS
#define EAI_BADHINTS
Definition: addrinfo.h:89
rsock_ip_level_to_int
int rsock_ip_level_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:5166
rsock_intern_iplevel
ID rsock_intern_iplevel(int val)
Definition: constdefs.c:6793
rsock_intern_so_optname
ID rsock_intern_so_optname(int val)
Definition: constdefs.c:6802
st_lookup
int st_lookup(st_table *tab, st_data_t key, st_data_t *value)
Definition: st.c:1101
st_table
Definition: st.h:79
IPPROTO_RAW
#define IPPROTO_RAW
Definition: constdefs.h:714
EAI_FAIL
#define EAI_FAIL
Definition: addrinfo.h:81
rsock_shutdown_how_to_int
int rsock_shutdown_how_to_int(const char *str, long len, int *valp)
Definition: constdefs.c:6611
rsock_intern_protocol_family
ID rsock_intern_protocol_family(int val)
Definition: constdefs.c:6766
name
const char * name
Definition: nkf.c:208