Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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