Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

ifaddr.c
Go to the documentation of this file.
1 #include "rubysocket.h"
2
3 #ifdef HAVE_GETIFADDRS
4
5 /*
6 * ifa_flags is usually unsigned int.
7 * However it is uint64_t on SunOS 5.11 (OpenIndiana).
8 */
9 #ifdef HAVE_LONG_LONG
10 typedef unsigned LONG_LONG ifa_flags_t;
11 #define PRIxIFAFLAGS PRI_LL_PREFIX"x"
12 #define IFAFLAGS2NUM(flags) ULL2NUM(flags)
13 #else
14 typedef unsigned int ifa_flags_t;
15 #define PRIxIFAFLAGS "x"
16 #define IFAFLAGS2NUM(flags) UINT2NUM(flags)
17 #endif
18
19 VALUE rb_cSockIfaddr;
20
21 typedef struct rb_ifaddr_tag rb_ifaddr_t;
22 typedef struct rb_ifaddr_root_tag rb_ifaddr_root_t;
23
24 struct rb_ifaddr_tag {
25 int ord;
26 struct ifaddrs *ifaddr;
27 };
28
29 struct rb_ifaddr_root_tag {
30 int refcount;
31 int numifaddrs;
32 rb_ifaddr_t ary[1];
33 };
34
35 static rb_ifaddr_root_t *
36 get_root(const rb_ifaddr_t *ifaddr)
37 {
38 return (rb_ifaddr_root_t *)((char *)&ifaddr[-ifaddr->ord] -
39 offsetof(rb_ifaddr_root_t, ary));
40 }
41
42 static void
43 ifaddr_free(void *ptr)
44 {
45 rb_ifaddr_t *ifaddr = ptr;
46 rb_ifaddr_root_t *root = get_root(ifaddr);
47 root->refcount--;
48 if (root->refcount == 0) {
49 freeifaddrs(root->ary[0].ifaddr);
50 xfree(root);
51 }
52 }
53
54 static size_t
55 ifaddr_memsize(const void *ptr)
56 {
57 size_t size = offsetof(rb_ifaddr_root_t, ary);
58 const rb_ifaddr_t *ifaddr;
59 ifaddr = ptr;
60 if (ifaddr->ord == 0) size = sizeof(rb_ifaddr_root_t);
61 size += sizeof(struct ifaddrs);
62 return size;
63 }
64
65 static const rb_data_type_t ifaddr_type = {
66 "socket/ifaddr",
67 {0, ifaddr_free, ifaddr_memsize,},
68 };
69
70 static inline rb_ifaddr_t *
71 check_ifaddr(VALUE self)
72 {
73 return rb_check_typeddata(self, &ifaddr_type);
74 }
75
76 static rb_ifaddr_t *
77 get_ifaddr(VALUE self)
78 {
79 rb_ifaddr_t *rifaddr = check_ifaddr(self);
80
81 if (!rifaddr) {
82 rb_raise(rb_eTypeError, "uninitialized ifaddr");
83 }
84 return rifaddr;
85 }
86
87 static struct ifaddrs *
88 get_ifaddrs(VALUE self)
89 {
90 return get_ifaddr(self)->ifaddr;
91 }
92
93 static VALUE
94 rsock_getifaddrs(void)
95 {
96 int ret;
97 int numifaddrs, i;
98 struct ifaddrs *ifaddrs, *ifa;
99 rb_ifaddr_root_t *root;
100 VALUE result, addr;
101
102 ret = getifaddrs(&ifaddrs);
103 if (ret == -1)
104 rb_sys_fail("getifaddrs");
105
106 if (!ifaddrs) {
107 return rb_ary_new();
108 }
109
110 numifaddrs = 0;
111 for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next)
112 numifaddrs++;
113
114 addr = TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, 0);
115 root = xmalloc(offsetof(rb_ifaddr_root_t, ary) + numifaddrs * sizeof(rb_ifaddr_t));
116 root->refcount = 0;
117 root->numifaddrs = numifaddrs;
118
119 ifa = ifaddrs;
120 for (i = 0; i < numifaddrs; i++) {
121 root->ary[i].ord = i;
122 root->ary[i].ifaddr = ifa;
123 ifa = ifa->ifa_next;
124 }
125 RTYPEDDATA_DATA(addr) = &root->ary[0];
126 root->refcount++;
127
128 result = rb_ary_new2(numifaddrs);
129 rb_ary_push(result, addr);
130 for (i = 1; i < numifaddrs; i++) {
131 addr = TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, &root->ary[i]);
132 root->refcount++;
133 rb_ary_push(result, addr);
134 }
135
136 return result;
137 }
138
139 /*
140 * call-seq:
141 * ifaddr.name => string
142 *
143 * Returns the interface name of _ifaddr_.
144 */
145
146 static VALUE
147 ifaddr_name(VALUE self)
148 {
149 struct ifaddrs *ifa = get_ifaddrs(self);
150 return rb_str_new_cstr(ifa->ifa_name);
151 }
152
153 #ifdef HAVE_IF_NAMETOINDEX
154 /*
155 * call-seq:
156 * ifaddr.ifindex => integer
157 *
158 * Returns the interface index of _ifaddr_.
159 */
160
161 static VALUE
162 ifaddr_ifindex(VALUE self)
163 {
164 struct ifaddrs *ifa = get_ifaddrs(self);
165 unsigned int ifindex = if_nametoindex(ifa->ifa_name);
166 if (ifindex == 0) {
167 rb_raise(rb_eArgError, "invalid interface name: %s", ifa->ifa_name);
168 }
169 return UINT2NUM(ifindex);
170 }
171 #else
172 #define ifaddr_ifindex rb_f_notimplement
173 #endif
174
175 /*
176 * call-seq:
177 * ifaddr.flags => integer
178 *
179 * Returns the flags of _ifaddr_.
180 */
181
182 static VALUE
183 ifaddr_flags(VALUE self)
184 {
185 struct ifaddrs *ifa = get_ifaddrs(self);
186 return IFAFLAGS2NUM(ifa->ifa_flags);
187 }
188
189 /*
190 * call-seq:
191 * ifaddr.addr => addrinfo
192 *
193 * Returns the address of _ifaddr_.
194 * nil is returned if address is not available in _ifaddr_.
195 */
196
197 static VALUE
198 ifaddr_addr(VALUE self)
199 {
200 struct ifaddrs *ifa = get_ifaddrs(self);
201 if (ifa->ifa_addr)
202 return rsock_sockaddr_obj(ifa->ifa_addr, rsock_sockaddr_len(ifa->ifa_addr));
203 return Qnil;
204 }
205
206 /*
207 * call-seq:
208 * ifaddr.netmask => addrinfo
209 *
210 * Returns the netmask address of _ifaddr_.
211 * nil is returned if netmask is not available in _ifaddr_.
212 */
213
214 static VALUE
215 ifaddr_netmask(VALUE self)
216 {
217 struct ifaddrs *ifa = get_ifaddrs(self);
218 if (ifa->ifa_netmask)
219 return rsock_sockaddr_obj(ifa->ifa_netmask, rsock_sockaddr_len(ifa->ifa_netmask));
220 return Qnil;
221 }
222
223 /*
224 * call-seq:
225 * ifaddr.broadaddr => addrinfo
226 *
227 * Returns the broadcast address of _ifaddr_.
228 * nil is returned if the flags doesn't have IFF_BROADCAST.
229 */
230
231 static VALUE
232 ifaddr_broadaddr(VALUE self)
233 {
234 struct ifaddrs *ifa = get_ifaddrs(self);
235 if ((ifa->ifa_flags & IFF_BROADCAST) && ifa->ifa_broadaddr)
236 return rsock_sockaddr_obj(ifa->ifa_broadaddr, rsock_sockaddr_len(ifa->ifa_broadaddr));
237 return Qnil;
238 }
239
240 /*
241 * call-seq:
242 * ifaddr.dstaddr => addrinfo
243 *
244 * Returns the destination address of _ifaddr_.
245 * nil is returned if the flags doesn't have IFF_POINTOPOINT.
246 */
247
248 static VALUE
249 ifaddr_dstaddr(VALUE self)
250 {
251 struct ifaddrs *ifa = get_ifaddrs(self);
252 if ((ifa->ifa_flags & IFF_POINTOPOINT) && ifa->ifa_dstaddr)
253 return rsock_sockaddr_obj(ifa->ifa_dstaddr, rsock_sockaddr_len(ifa->ifa_dstaddr));
254 return Qnil;
255 }
256
257 #ifdef HAVE_STRUCT_IF_DATA_IFI_VHID
258 /*
259 * call-seq:
260 * ifaddr.vhid => Integer
261 *
262 * Returns the vhid address of _ifaddr_.
263 * nil is returned if there is no vhid.
264 */
265
266 static VALUE
267 ifaddr_vhid(VALUE self)
268 {
269 struct ifaddrs *ifa = get_ifaddrs(self);
270 if (ifa->ifa_data)
271 return (INT2FIX(((struct if_data*)ifa->ifa_data)->ifi_vhid));
272 else
273 return Qnil;
274 }
275 #endif
276
277 static void
278 ifaddr_inspect_flags(ifa_flags_t flags, VALUE result)
279 {
280 const char *sep = " ";
281 #define INSPECT_BIT(bit, name) \
282 if (flags & (bit)) { rb_str_catf(result, "%s" name, sep); flags &= ~(ifa_flags_t)(bit); sep = ","; }
283 #ifdef IFF_UP
284 INSPECT_BIT(IFF_UP, "UP")
285 #endif
286 #ifdef IFF_BROADCAST
287 INSPECT_BIT(IFF_BROADCAST, "BROADCAST")
288 #endif
289 #ifdef IFF_DEBUG
290 INSPECT_BIT(IFF_DEBUG, "DEBUG")
291 #endif
292 #ifdef IFF_LOOPBACK
293 INSPECT_BIT(IFF_LOOPBACK, "LOOPBACK")
294 #endif
295 #ifdef IFF_POINTOPOINT
296 INSPECT_BIT(IFF_POINTOPOINT, "POINTOPOINT")
297 #endif
298 #ifdef IFF_RUNNING
299 INSPECT_BIT(IFF_RUNNING, "RUNNING")
300 #endif
301 #ifdef IFF_NOARP
302 INSPECT_BIT(IFF_NOARP, "NOARP")
303 #endif
304 #ifdef IFF_PROMISC
305 INSPECT_BIT(IFF_PROMISC, "PROMISC")
306 #endif
307 #ifdef IFF_NOTRAILERS
308 INSPECT_BIT(IFF_NOTRAILERS, "NOTRAILERS")
309 #endif
310 #ifdef IFF_ALLMULTI
311 INSPECT_BIT(IFF_ALLMULTI, "ALLMULTI")
312 #endif
313 #ifdef IFF_SIMPLEX
314 INSPECT_BIT(IFF_SIMPLEX, "SIMPLEX")
315 #endif
316 #ifdef IFF_MASTER
317 INSPECT_BIT(IFF_MASTER, "MASTER")
318 #endif
319 #ifdef IFF_SLAVE
320 INSPECT_BIT(IFF_SLAVE, "SLAVE")
321 #endif
322 #ifdef IFF_MULTICAST
323 INSPECT_BIT(IFF_MULTICAST, "MULTICAST")
324 #endif
325 #ifdef IFF_PORTSEL
326 INSPECT_BIT(IFF_PORTSEL, "PORTSEL")
327 #endif
328 #ifdef IFF_AUTOMEDIA
329 INSPECT_BIT(IFF_AUTOMEDIA, "AUTOMEDIA")
330 #endif
331 #ifdef IFF_DYNAMIC
332 INSPECT_BIT(IFF_DYNAMIC, "DYNAMIC")
333 #endif
334 #ifdef IFF_LOWER_UP
335 INSPECT_BIT(IFF_LOWER_UP, "LOWER_UP")
336 #endif
337 #ifdef IFF_DORMANT
338 INSPECT_BIT(IFF_DORMANT, "DORMANT")
339 #endif
340 #ifdef IFF_ECHO
341 INSPECT_BIT(IFF_ECHO, "ECHO")
342 #endif
343 #undef INSPECT_BIT
344 if (flags) {
345 rb_str_catf(result, "%s%#"PRIxIFAFLAGS, sep, flags);
346 }
347 }
348
349 /*
350 * call-seq:
351 * ifaddr.inspect => string
352 *
353 * Returns a string to show contents of _ifaddr_.
354 */
355
356 static VALUE
357 ifaddr_inspect(VALUE self)
358 {
359 struct ifaddrs *ifa = get_ifaddrs(self);
360 VALUE result;
361
362 result = rb_str_new_cstr("#<");
363
364 rb_str_append(result, rb_class_name(CLASS_OF(self)));
365 rb_str_cat2(result, " ");
366 rb_str_cat2(result, ifa->ifa_name);
367
368 if (ifa->ifa_flags)
369 ifaddr_inspect_flags(ifa->ifa_flags, result);
370
371 if (ifa->ifa_addr) {
372 rb_str_cat2(result, " ");
373 rsock_inspect_sockaddr(ifa->ifa_addr,
374 rsock_sockaddr_len(ifa->ifa_addr),
375 result);
376 }
377 if (ifa->ifa_netmask) {
378 rb_str_cat2(result, " netmask=");
379 rsock_inspect_sockaddr(ifa->ifa_netmask,
380 rsock_sockaddr_len(ifa->ifa_netmask),
381 result);
382 }
383
384 if ((ifa->ifa_flags & IFF_BROADCAST) && ifa->ifa_broadaddr) {
385 rb_str_cat2(result, " broadcast=");
386 rsock_inspect_sockaddr(ifa->ifa_broadaddr,
387 rsock_sockaddr_len(ifa->ifa_broadaddr),
388 result);
389 }
390
391 if ((ifa->ifa_flags & IFF_POINTOPOINT) && ifa->ifa_dstaddr) {
392 rb_str_cat2(result, " dstaddr=");
393 rsock_inspect_sockaddr(ifa->ifa_dstaddr,
394 rsock_sockaddr_len(ifa->ifa_dstaddr),
395 result);
396 }
397
398 rb_str_cat2(result, ">");
399 return result;
400 }
401 #endif
402
403 #ifdef HAVE_GETIFADDRS
404 /*
405 * call-seq:
406 * Socket.getifaddrs => [ifaddr1, ...]
407 *
408 * Returns an array of interface addresses.
409 * An element of the array is an instance of Socket::Ifaddr.
410 *
411 * This method can be used to find multicast-enabled interfaces:
412 *
413 * pp Socket.getifaddrs.reject {|ifaddr|
414 * !ifaddr.addr.ip? || (ifaddr.flags & Socket::IFF_MULTICAST == 0)
415 * }.map {|ifaddr| [ifaddr.name, ifaddr.ifindex, ifaddr.addr] }
416 * #=> [["eth0", 2, #<Addrinfo: 221.186.184.67>],
417 * # ["eth0", 2, #<Addrinfo: fe80::216:3eff:fe95:88bb%eth0>]]
418 *
419 * Example result on GNU/Linux:
420 * pp Socket.getifaddrs
421 * #=> [#<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 PACKET[protocol=0 lo hatype=772 HOST hwaddr=00:00:00:00:00:00]>,
422 * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=00:16:3e:95:88:bb] broadcast=PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=ff:ff:ff:ff:ff:ff]>,
423 * # #<Socket::Ifaddr sit0 NOARP PACKET[protocol=0 sit0 hatype=776 HOST hwaddr=00:00:00:00]>,
424 * # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 127.0.0.1 netmask=255.0.0.0>,
425 * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 221.186.184.67 netmask=255.255.255.240 broadcast=221.186.184.79>,
426 * # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
427 * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 fe80::216:3eff:fe95:88bb%eth0 netmask=ffff:ffff:ffff:ffff::>]
428 *
429 * Example result on FreeBSD:
430 * pp Socket.getifaddrs
431 * #=> [#<Socket::Ifaddr usbus0 UP,0x10000 LINK[usbus0]>,
432 * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 LINK[re0 3a:d0:40:9a:fe:e8]>,
433 * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 10.250.10.18 netmask=255.255.255.? (7 bytes for 16 bytes sockaddr_in) broadcast=10.250.10.255>,
434 * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 fe80:2::38d0:40ff:fe9a:fee8 netmask=ffff:ffff:ffff:ffff::>,
435 * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 2001:2e8:408:10::12 netmask=UNSPEC>,
436 * # #<Socket::Ifaddr plip0 POINTOPOINT,MULTICAST,0x800 LINK[plip0]>,
437 * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST LINK[lo0]>,
438 * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
439 * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST fe80:4::1 netmask=ffff:ffff:ffff:ffff::>,
440 * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST 127.0.0.1 netmask=255.?.?.? (5 bytes for 16 bytes sockaddr_in)>]
441 *
442 */
443
444 static VALUE
445 socket_s_getifaddrs(VALUE self)
446 {
447 return rsock_getifaddrs();
448 }
449 #else
450 #define socket_s_getifaddrs rb_f_notimplement
451 #endif
452
453 void
454 rsock_init_sockifaddr(void)
455 {
456 #ifdef HAVE_GETIFADDRS
457 /*
458 * Document-class: Socket::Ifaddr
459 *
460 * Socket::Ifaddr represents a result of getifaddrs() function.
461 */
462 rb_cSockIfaddr = rb_define_class_under(rb_cSocket, "Ifaddr", rb_cData);
463 rb_define_method(rb_cSockIfaddr, "inspect", ifaddr_inspect, 0);
464 rb_define_method(rb_cSockIfaddr, "name", ifaddr_name, 0);
465 rb_define_method(rb_cSockIfaddr, "ifindex", ifaddr_ifindex, 0);
466 rb_define_method(rb_cSockIfaddr, "flags", ifaddr_flags, 0);
467 rb_define_method(rb_cSockIfaddr, "addr", ifaddr_addr, 0);
468 rb_define_method(rb_cSockIfaddr, "netmask", ifaddr_netmask, 0);
469 rb_define_method(rb_cSockIfaddr, "broadaddr", ifaddr_broadaddr, 0);
470 rb_define_method(rb_cSockIfaddr, "dstaddr", ifaddr_dstaddr, 0);
471 #ifdef HAVE_STRUCT_IF_DATA_IFI_VHID
472 rb_define_method(rb_cSockIfaddr, "vhid", ifaddr_vhid, 0);
473 #endif
474 #endif
475
476 rb_define_singleton_method(rb_cSocket, "getifaddrs", socket_s_getifaddrs, 0);
477 }
getifaddrs
int getifaddrs(struct ifaddrs **)
Definition: win32.c:4089
socket_s_getifaddrs
#define socket_s_getifaddrs
Definition: ifaddr.c:450
ifaddrs::ifa_broadaddr
struct sockaddr * ifa_broadaddr
Definition: win32.h:246
rb_cData
RUBY_EXTERN VALUE rb_cData
Definition: ruby.h:2018
INT2FIX
#define INT2FIX(i)
Definition: ruby.h:263
LONG_LONG
#define LONG_LONG
Definition: rb_mjit_min_header-2.7.0.h:3939
VALUE
unsigned long VALUE
Definition: ruby.h:102
rb_eArgError
VALUE rb_eArgError
Definition: error.c:923
offsetof
#define offsetof(p_type, field)
Definition: addrinfo.h:186
UINT2NUM
#define UINT2NUM(x)
Definition: ruby.h:1610
rb_str_cat2
#define rb_str_cat2
Definition: intern.h:912
rb_define_singleton_method
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
Definition: class.c:1755
rb_define_method
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
Definition: class.c:1551
ptr
struct RIMemo * ptr
Definition: debug.c:74
NULL
#define NULL
Definition: _sdbm.c:101
rsock_inspect_sockaddr
VALUE rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE ret)
Definition: raddrinfo.c:1266
rb_cSocket
VALUE rb_cSocket
Definition: init.c:26
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:2669
ifaddrs::ifa_netmask
struct sockaddr * ifa_netmask
Definition: win32.h:245
ifaddrs::ifa_addr
struct sockaddr * ifa_addr
Definition: win32.h:244
ifaddrs::ifa_name
char * ifa_name
Definition: win32.h:242
i
uint32_t i
Definition: rb_mjit_min_header-2.7.0.h:5464
rsock_sockaddr_len
socklen_t rsock_sockaddr_len(struct sockaddr *addr)
rb_ary_push
VALUE rb_ary_push(VALUE ary, VALUE item)
Definition: array.c:1195
TypedData_Wrap_Struct
#define TypedData_Wrap_Struct(klass, data_type, sval)
Definition: ruby.h:1231
rb_sys_fail
void rb_sys_fail(const char *mesg)
Definition: error.c:2793
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:922
RTYPEDDATA_DATA
#define RTYPEDDATA_DATA(v)
Definition: ruby.h:1179
size
int size
Definition: encoding.c:58
rb_str_new_cstr
#define rb_str_new_cstr(str)
Definition: rb_mjit_min_header-2.7.0.h:6117
ifaddrs::ifa_flags
u_int ifa_flags
Definition: win32.h:243
freeifaddrs
void freeifaddrs(struct ifaddrs *)
Definition: win32.c:4176
CLASS_OF
#define CLASS_OF(v)
Definition: ruby.h:484
rb_ary_new2
#define rb_ary_new2
Definition: intern.h:103
rb_str_append
VALUE rb_str_append(VALUE, VALUE)
Definition: string.c:2965
ifaddrs::ifa_dstaddr
struct sockaddr * ifa_dstaddr
Definition: win32.h:247
xmalloc
#define xmalloc
Definition: defines.h:211
rb_data_type_struct
Definition: ruby.h:1148
xfree
#define xfree
Definition: defines.h:216
rb_check_typeddata
void * rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
Definition: error.c:889
ifaddrs
Definition: win32.h:240
rb_str_catf
VALUE rb_str_catf(VALUE str, const char *format,...)
Definition: sprintf.c:1237
rb_class_name
VALUE rb_class_name(VALUE)
Definition: variable.c:274
rubysocket.h
ifaddrs::ifa_next
struct ifaddrs * ifa_next
Definition: win32.h:241
rb_define_class_under
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
Definition: class.c:698
rsock_init_sockifaddr
void rsock_init_sockifaddr(void)
Definition: ifaddr.c:454
rb_ary_new
VALUE rb_ary_new(void)
Definition: array.c:723
Qnil
#define Qnil
Definition: ruby.h:469
rsock_sockaddr_obj
VALUE rsock_sockaddr_obj(struct sockaddr *addr, socklen_t len)
ifaddrs::ifa_data
void * ifa_data
Definition: win32.h:248