13 #if defined(INET6) && (defined(LOOKUP_ORDER_HACK_INET) || defined(LOOKUP_ORDER_HACK_INET6))
14 #define LOOKUP_ORDERS (sizeof(lookup_order_table) / sizeof(lookup_order_table[0]))
15 static const int lookup_order_table[] = {
16 #if defined(LOOKUP_ORDER_HACK_INET)
18 #elif defined(LOOKUP_ORDER_HACK_INET6)
26 ruby_getaddrinfo(
const char *nodename,
const char *servname,
36 for (i = 0; i < LOOKUP_ORDERS; i++) {
37 af = lookup_order_table[
i];
39 tmp_hints.ai_family = af;
40 error =
getaddrinfo(nodename, servname, &tmp_hints, res);
53 #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
58 ruby_getaddrinfo__aix(
const char *nodename,
const char *servname,
61 int error =
getaddrinfo(nodename, servname, hints, res);
74 #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
76 ruby_getnameinfo__aix(
const struct sockaddr *sa,
size_t salen,
77 char *host,
size_t hostlen,
78 char *serv,
size_t servlen,
int flags)
80 struct sockaddr_in6 *sa6;
83 if (sa->sa_family == AF_INET6) {
84 sa6 = (
struct sockaddr_in6 *)sa;
85 a6 = sa6->sin6_addr.u6_addr.u6_addr32;
87 if (a6[0] == 0 && a6[1] == 0 && a6[2] == 0 && a6[3] == 0) {
88 strncpy(host,
"::", hostlen);
89 snprintf(serv, servlen,
"%d", sa6->sin6_port);
93 return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
96 #define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) \
97 ruby_getnameinfo__aix((sa), (salen), (host), (hostlen), (serv), (servlen), (flags))
102 #if defined(__APPLE__)
104 ruby_getaddrinfo__darwin(
const char *nodename,
const char *servname,
108 const char *tmp_servname;
112 tmp_servname = servname;
114 if (nodename && servname) {
117 #ifdef AI_NUMERICSERV
123 error =
getaddrinfo(nodename, tmp_servname, &tmp_hints, res);
145 #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__darwin((node),(serv),(hints),(res))
148 #ifndef GETADDRINFO_EMU
170 return (
void *)(
VALUE)ret;
179 #ifdef GETADDRINFO_EMU
194 #ifndef GETADDRINFO_EMU
197 const struct sockaddr *
sa;
219 char *host,
size_t hostlen,
220 char *serv,
size_t servlen,
int flags)
222 #ifdef GETADDRINFO_EMU
223 return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
262 struct sockaddr_in sin;
264 MEMZERO(&sin,
struct sockaddr_in, 1);
265 sin.sin_family = AF_INET;
267 sin.sin_addr.s_addr = host;
276 if (!p || *p ==
'\0')
280 if (ep && *ep ==
'\0')
304 if (!name || *name == 0 || (name[0] ==
'<' && strcmp(name,
"<any>") == 0)) {
308 else if (name[0] ==
'<' && strcmp(name,
"<broadcast>") == 0) {
312 else if (
strlen(name) >= len) {
331 #ifdef AI_NUMERICSERV
341 if (
strlen(serv) >= len) {
357 int additional_flags = 0;
359 hostp =
host_str(host, hbuf,
sizeof(hbuf), &additional_flags);
360 portp =
port_str(port, pbuf,
sizeof(pbuf), &additional_flags);
365 hints->
ai_flags |= additional_flags;
369 if (hostp && hostp[
strlen(hostp)-1] ==
'\n') {
393 VALUE family, port, addr1, addr2;
396 char hbuf[1024], pbuf[1024];
399 id = rsock_intern_family(sockaddr->sa_family);
404 sprintf(pbuf,
"unknown:%d", sockaddr->sa_family);
433 rsock_unixpath_str(
struct sockaddr_un *sockaddr, socklen_t len)
436 s = sockaddr->sun_path;
437 e = (
char *)sockaddr + len;
438 while (s < e && *(e-1) ==
'\0')
447 rsock_unixaddr(
struct sockaddr_un *sockaddr, socklen_t len)
450 rsock_unixpath_str(sockaddr, len));
454 rsock_unix_sockaddr_len(
VALUE path)
459 return (socklen_t)
sizeof(sa_family_t);
463 return (socklen_t)
offsetof(
struct sockaddr_un, sun_path) +
468 return (socklen_t)
sizeof(
struct sockaddr_un);
486 VALUE (*ipaddr)(
struct sockaddr*, size_t) = arg->
ipaddr;
506 if (h->h_aliases !=
NULL) {
507 for (pch = h->h_aliases; *pch; pch++) {
517 for (ai = addr; ai; ai = ai->
ai_next) {
518 rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
563 #define addrinfo_free RUBY_TYPED_DEFAULT_FREE
582 #define IS_ADDRINFO(obj) rb_typeddata_is_kind_of((obj), &addrinfo_type)
613 int pfamily,
int socktype,
int protocol,
616 if ((socklen_t)
sizeof(rai->
addr) < len)
618 memcpy((
void *)&rai->
addr, (
void *)sa, len);
630 int family,
int socktype,
int protocol,
638 init_addrinfo(rai, addr, len, family, socktype, protocol, canonname, inspectname);
652 if (!
NIL_P(socktype)) {
655 if (!
NIL_P(protocol)) {
687 canonname, inspectname);
702 sizeof(hbuf), pbuf,
sizeof(pbuf),
718 if (
NIL_P(inspectname))
725 if (
NIL_P(inspectname))
730 if (!
NIL_P(inspectname)) {
757 canonname, inspectname);
775 for (r = res; r; r = r->
ai_next) {
786 canonname, inspectname);
800 struct sockaddr_un un;
805 if (
sizeof(un.sun_path) < (
size_t)
RSTRING_LEN(path))
807 "too long unix socket path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)",
810 MEMZERO(&un,
struct sockaddr_un, 1);
812 un.sun_family = AF_UNIX;
815 len = rsock_unix_sockaddr_len(path);
871 VALUE sockaddr_arg, sockaddr_ary, pfamily, socktype, protocol;
872 int i_pfamily, i_socktype, i_protocol;
873 struct sockaddr *sockaddr_ptr;
874 socklen_t sockaddr_len;
881 rb_scan_args(argc, argv,
"13", &sockaddr_arg, &pfamily, &socktype, &protocol);
888 if (!
NIL_P(sockaddr_ary)) {
906 if (!
NIL_P(nodename))
910 #ifdef AI_NUMERICSERV
926 init_unix_addrinfo(rai, path, SOCK_STREAM);
937 sockaddr_ptr = (
struct sockaddr *)
RSTRING_PTR(sockaddr_arg);
940 i_pfamily, i_socktype, i_protocol,
941 canonname, inspectname);
950 if ((socklen_t)((
char*)&addr->sa_family +
sizeof(addr->sa_family) - (
char*)addr) <= len)
951 return addr->sa_family;
976 struct sockaddr_in *addr;
978 if (rai->
sockaddr_len < (socklen_t)
sizeof(
struct sockaddr_in)) {
982 addr = (
struct sockaddr_in *)&rai->
addr;
984 ((
unsigned char*)&addr->sin_addr)[0],
985 ((
unsigned char*)&addr->sin_addr)[1],
986 ((
unsigned char*)&addr->sin_addr)[2],
987 ((
unsigned char*)&addr->sin_addr)[3]);
988 port = ntohs(addr->sin_port);
991 if ((socklen_t)
sizeof(
struct sockaddr_in) < rai->
sockaddr_len)
1000 struct sockaddr_in6 *addr;
1004 if (rai->
sockaddr_len < (socklen_t)
sizeof(
struct sockaddr_in6)) {
1008 addr = (
struct sockaddr_in6 *)&rai->
addr;
1014 hbuf, (socklen_t)
sizeof(hbuf),
NULL, 0,
1019 if (addr->sin6_port == 0) {
1023 port = ntohs(addr->sin6_port);
1026 if ((socklen_t)
sizeof(
struct sockaddr_in6) < rai->
sockaddr_len)
1033 #ifdef HAVE_SYS_UN_H
1036 struct sockaddr_un *addr = (
struct sockaddr_un *)&rai->
addr;
1040 while (s < e && *(e-1) ==
'\0')
1047 int printable_only = 1;
1053 if (printable_only) {
1063 if (addr->sun_path +
sizeof(addr->sun_path) < (
char*)&rai->
addr + rai->
sockaddr_len)
1065 (
int)(rai->
sockaddr_len - (addr->sun_path +
sizeof(addr->sun_path) - (
char*)&rai->
addr)));
1108 ID id = rsock_intern_protocol_family(rai->
pfamily);
1117 internet_p = internet_p || rai->
pfamily == PF_INET6;
1119 if (internet_p && rai->
socktype == SOCK_STREAM &&
1123 else if (internet_p && rai->
socktype == SOCK_DGRAM &&
1129 ID id = rsock_intern_socktype(rai->
socktype);
1142 goto unknown_protocol;
1187 VALUE sockaddr, afamily, pfamily, socktype, protocol, canonname, inspectname;
1191 id = rsock_intern_protocol_family(rai->
pfamily);
1199 id = rsock_intern_socktype(rai->
socktype);
1208 id = rsock_intern_ipproto(rai->
protocol);
1221 id = rsock_intern_family(afamily_int);
1226 switch(afamily_int) {
1227 #ifdef HAVE_SYS_UN_H
1230 struct sockaddr_un *su = (
struct sockaddr_un *)&rai->
addr;
1234 while (s < e && *(e-1) ==
'\0')
1246 hbuf, (socklen_t)
sizeof(hbuf), pbuf, (socklen_t)
sizeof(pbuf),
1256 return rb_ary_new3(7, afamily, sockaddr, pfamily, socktype, protocol, canonname, inspectname);
1264 VALUE canonname, inspectname;
1265 int afamily, pfamily, socktype, protocol;
1326 #ifdef HAVE_SYS_UN_H
1329 struct sockaddr_un uaddr;
1330 MEMZERO(&uaddr,
struct sockaddr_un, 1);
1331 uaddr.sun_family = AF_UNIX;
1334 if (
sizeof(uaddr.sun_path) < (
size_t)
RSTRING_LEN(v))
1336 "too long AF_UNIX path (%"PRIuSIZE
" bytes given but %"PRIuSIZE
" bytes max)",
1339 len = (socklen_t)
sizeof(uaddr);
1340 memcpy(&ss, &uaddr, len);
1350 #ifdef AI_NUMERICSERV
1365 pfamily, socktype, protocol,
1366 canonname, inspectname);
1582 char hbuf[1024], pbuf[1024];
1593 hbuf, (socklen_t)
sizeof(hbuf), pbuf, (socklen_t)
sizeof(pbuf),
1683 port = ntohs(((
struct sockaddr_in *)&rai->
addr)->sin_port);
1690 port = ntohs(((
struct sockaddr_in6 *)&rai->
addr)->sin6_port);
1706 if (family != AF_INET)
return 0;
1707 *addrp = ntohl(((
struct sockaddr_in *)&rai->
addr)->sin_addr.s_addr);
1720 if ((a & 0xff000000) == 0x0a000000 ||
1721 (a & 0xfff00000) == 0xac100000 ||
1722 (a & 0xffff0000) == 0xc0a80000)
1736 if ((a & 0xff000000) == 0x7f000000)
1750 if ((a & 0xf0000000) == 0xe0000000)
1757 static struct in6_addr *
1758 extract_in6_addr(
VALUE self)
1762 if (family != AF_INET6)
return NULL;
1763 return &((
struct sockaddr_in6 *)&rai->
addr)->sin6_addr;
1771 addrinfo_ipv6_unspecified_p(
VALUE self)
1773 struct in6_addr *addr = extract_in6_addr(
self);
1774 if (addr && IN6_IS_ADDR_UNSPECIFIED(addr))
return Qtrue;
1783 addrinfo_ipv6_loopback_p(
VALUE self)
1785 struct in6_addr *addr = extract_in6_addr(
self);
1786 if (addr && IN6_IS_ADDR_LOOPBACK(addr))
return Qtrue;
1795 addrinfo_ipv6_multicast_p(
VALUE self)
1797 struct in6_addr *addr = extract_in6_addr(
self);
1798 if (addr && IN6_IS_ADDR_MULTICAST(addr))
return Qtrue;
1807 addrinfo_ipv6_linklocal_p(
VALUE self)
1809 struct in6_addr *addr = extract_in6_addr(
self);
1810 if (addr && IN6_IS_ADDR_LINKLOCAL(addr))
return Qtrue;
1819 addrinfo_ipv6_sitelocal_p(
VALUE self)
1821 struct in6_addr *addr = extract_in6_addr(
self);
1822 if (addr && IN6_IS_ADDR_SITELOCAL(addr))
return Qtrue;
1831 addrinfo_ipv6_unique_local_p(
VALUE self)
1833 struct in6_addr *addr = extract_in6_addr(
self);
1843 addrinfo_ipv6_v4mapped_p(
VALUE self)
1845 struct in6_addr *addr = extract_in6_addr(
self);
1846 if (addr && IN6_IS_ADDR_V4MAPPED(addr))
return Qtrue;
1855 addrinfo_ipv6_v4compat_p(
VALUE self)
1857 struct in6_addr *addr = extract_in6_addr(
self);
1858 if (addr && IN6_IS_ADDR_V4COMPAT(addr))
return Qtrue;
1867 addrinfo_ipv6_mc_nodelocal_p(
VALUE self)
1869 struct in6_addr *addr = extract_in6_addr(
self);
1870 if (addr && IN6_IS_ADDR_MC_NODELOCAL(addr))
return Qtrue;
1879 addrinfo_ipv6_mc_linklocal_p(
VALUE self)
1881 struct in6_addr *addr = extract_in6_addr(
self);
1882 if (addr && IN6_IS_ADDR_MC_LINKLOCAL(addr))
return Qtrue;
1891 addrinfo_ipv6_mc_sitelocal_p(
VALUE self)
1893 struct in6_addr *addr = extract_in6_addr(
self);
1894 if (addr && IN6_IS_ADDR_MC_SITELOCAL(addr))
return Qtrue;
1903 addrinfo_ipv6_mc_orglocal_p(
VALUE self)
1905 struct in6_addr *addr = extract_in6_addr(
self);
1906 if (addr && IN6_IS_ADDR_MC_ORGLOCAL(addr))
return Qtrue;
1915 addrinfo_ipv6_mc_global_p(
VALUE self)
1917 struct in6_addr *addr = extract_in6_addr(
self);
1918 if (addr && IN6_IS_ADDR_MC_GLOBAL(addr))
return Qtrue;
1933 addrinfo_ipv6_to_ipv4(
VALUE self)
1936 struct in6_addr *addr;
1938 if (family != AF_INET6)
return Qnil;
1939 addr = &((
struct sockaddr_in6 *)&rai->
addr)->sin6_addr;
1940 if (IN6_IS_ADDR_V4MAPPED(addr) || IN6_IS_ADDR_V4COMPAT(addr)) {
1941 struct sockaddr_in sin4;
1942 MEMZERO(&sin4,
struct sockaddr_in, 1);
1943 sin4.sin_family = AF_INET;
1945 memcpy(&sin4.sin_addr, (
char*)addr +
sizeof(*addr) -
sizeof(sin4.sin_addr),
sizeof(sin4.sin_addr));
1957 #ifdef HAVE_SYS_UN_H
1967 addrinfo_unix_path(
VALUE self)
1971 struct sockaddr_un *addr;
1974 if (family != AF_UNIX)
1977 addr = (
struct sockaddr_un *)&rai->
addr;
1982 rb_raise(
rb_eSocket,
"too short AF_UNIX address: %"PRIuSIZE
" bytes given for minimum %"PRIuSIZE
" bytes.",
1983 (
size_t)rai->
sockaddr_len, (
size_t)(s - (
char *)addr));
1984 if (addr->sun_path +
sizeof(addr->sun_path) < e)
1986 "too long AF_UNIX path (%"PRIuSIZE
" bytes given but %"PRIuSIZE
" bytes max)",
1987 (
size_t)(e - addr->sun_path),
sizeof(addr->sun_path));
1988 while (s < e && *(e-1) ==
'\0')
2040 VALUE node, service, family, socktype, protocol, flags;
2042 rb_scan_args(argc, argv,
"24", &node, &service, &family, &socktype, &protocol, &flags);
2100 #ifdef HAVE_SYS_UN_H
2117 VALUE path, vsocktype, addr;
2123 if (
NIL_P(vsocktype))
2124 socktype = SOCK_STREAM;
2130 init_unix_addrinfo(rai, path, socktype);
2169 socklen_t optlen = (socklen_t)
sizeof(socktype);
2174 ret = getsockopt(fd, SOL_SOCKET, SO_TYPE, (
void*)&socktype, &optlen);
2224 #ifdef HAVE_SYS_UN_H
2265 #ifdef HAVE_SYS_UN_H
#define RB_TYPE_P(obj, type)
struct addrinfo * rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
static void make_ipaddr0(struct sockaddr *addr, char *buf, size_t len)
VALUE rb_ary_entry(VALUE ary, long offset)
static int str_is_number(const char *)
size_t strlen(const char *)
const char * rb_obj_classname(VALUE)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
static rb_addrinfo_t * check_addrinfo(VALUE self)
static struct addrinfo * call_getaddrinfo(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE protocol, VALUE flags, int socktype_hack)
struct sockaddr_storage addr
static VALUE addrinfo_ipv6_p(VALUE self)
#define SET_SIN_LEN(si, len)
int rsock_socktype_arg(VALUE type)
static VALUE addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE protocol, VALUE flags)
VALUE rb_str_new_cstr(const char *)
VALUE rsock_ipaddr(struct sockaddr *sockaddr, int norevlookup)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
const struct sockaddr * sa
VALUE rb_ary_push(VALUE ary, VALUE item)
static void * nogvl_getaddrinfo(void *arg)
VALUE rb_str_buf_cat2(VALUE, const char *)
static VALUE addrinfo_ipv4_loopback_p(VALUE self)
void rb_raise(VALUE exc, const char *fmt,...)
#define IN6_IS_ADDR_UNIQUE_LOCAL(a)
static VALUE addrinfo_protocol(VALUE self)
#define SafeStringValue(v)
VALUE rb_check_sockaddr_string_type(VALUE val)
VALUE rb_ary_new3(long n,...)
static VALUE addrinfo_ipv4_p(VALUE self)
static size_t addrinfo_memsize(const void *ptr)
const struct addrinfo * hints
#define STRTOUL(str, endptr, base)
#define GetOpenFile(obj, fp)
void rsock_init_addrinfo(void)
static char * host_str(VALUE host, char *hbuf, size_t len, int *flags_ptr)
VALUE rsock_make_ipaddr(struct sockaddr *addr)
VALUE rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len)
VALUE rb_str_equal(VALUE str1, VALUE str2)
static VALUE addrinfo_ipv4_multicast_p(VALUE self)
static VALUE addrinfo_inspect_sockaddr(VALUE self)
VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE(*ipaddr)(struct sockaddr *, size_t))
static VALUE addrinfo_to_sockaddr(VALUE self)
#define MEMZERO(p, type, n)
VALUE rsock_addrinfo_new(struct sockaddr *addr, socklen_t len, int family, int socktype, int protocol, VALUE canonname, VALUE inspectname)
int rsock_family_arg(VALUE domain)
static int ai_get_afamily(rb_addrinfo_t *rai)
#define StringValueCStr(v)
static VALUE addrinfo_initialize(int argc, VALUE *argv, VALUE self)
static VALUE addrinfo_ip_unpack(VALUE self)
VALUE rb_str_cat2(VALUE, const char *)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
static VALUE addrinfo_getnameinfo(int argc, VALUE *argv, VALUE self)
void rb_ary_store(VALUE ary, long idx, VALUE val)
#define offsetof(p_type, field)
static const rb_data_type_t addrinfo_type
int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
static char * port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
#define TypedData_Wrap_Struct(klass, data_type, sval)
static VALUE addrinfo_s_udp(VALUE self, VALUE host, VALUE port)
void * rb_thread_call_without_gvl(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2)
static int get_afamily(struct sockaddr *addr, socklen_t len)
static VALUE addrinfo_unix_p(VALUE self)
VALUE rb_tainted_str_new_cstr(const char *)
static void init_addrinfo_getaddrinfo(rb_addrinfo_t *rai, VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE protocol, VALUE flags, VALUE inspectnode, VALUE inspectservice)
RUBY_EXTERN VALUE rb_cInteger
char * rsock_sockaddr_string_value_ptr(volatile VALUE *v)
VALUE rb_sprintf(const char *format,...)
static void * nogvl_getnameinfo(void *arg)
VALUE rsock_freeaddrinfo(struct addrinfo *addr)
static VALUE addrinfo_firstonly_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE protocol, VALUE flags)
static VALUE addrinfo_s_getaddrinfo(int argc, VALUE *argv, VALUE self)
void freeaddrinfo(struct addrinfo *ai)
static rb_addrinfo_t * alloc_addrinfo()
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
static VALUE addrinfo_mload(VALUE self, VALUE ary)
unsigned char buf[MIME_BUF_SIZE]
VALUE rb_assoc_new(VALUE car, VALUE cdr)
static VALUE addrinfo_pfamily(VALUE self)
static VALUE addrinfo_ip_address(VALUE self)
static VALUE addrinfo_s_ip(VALUE self, VALUE host)
VALUE rb_ensure(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*e_proc)(ANYARGS), VALUE data2)
static VALUE addrinfo_ip_p(VALUE self)
void rb_sys_fail(const char *mesg)
static VALUE addrinfo_s_allocate(VALUE klass)
static void init_addrinfo(rb_addrinfo_t *rai, struct sockaddr *sa, socklen_t len, int pfamily, int socktype, int protocol, VALUE canonname, VALUE inspectname)
static void make_inetaddr(unsigned int host, char *buf, size_t len)
static VALUE make_hostent_internal(struct hostent_arg *arg)
#define MEMCPY(p1, p2, type, n)
static VALUE addrinfo_afamily(VALUE self)
int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
VALUE rb_str_cat(VALUE, const char *, long)
static VALUE inspect_sockaddr(VALUE addrinfo, VALUE ret)
static VALUE addrinfo_canonname(VALUE self)
static VALUE addrinfo_ipv4_private_p(VALUE self)
void * rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
VALUE rb_check_array_type(VALUE ary)
void rsock_raise_socket_error(const char *reason, int error)
VALUE rb_str_catf(VALUE str, const char *format,...)
static VALUE addrinfo_s_tcp(VALUE self, VALUE host, VALUE port)
struct addrinfo * rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
struct addrinfo * ai_next
#define RSTRING_LENINT(str)
static VALUE addrinfo_socktype(VALUE self)
VALUE rb_ary_new2(long capa)
VALUE rb_str_new(const char *, long)
const char * rb_id2name(ID id)
static void addrinfo_mark(void *ptr)
VALUE(* ipaddr)(struct sockaddr *, size_t)
static VALUE make_inspectname(VALUE node, VALUE service, struct addrinfo *res)
static VALUE addrinfo_ip_port(VALUE self)
RUBY_EXTERN VALUE rb_cData
VALUE rb_check_string_type(VALUE)
int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
static VALUE addrinfo_mdump(VALUE self)
static rb_addrinfo_t * get_addrinfo(VALUE self)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static VALUE addrinfo_inspect(VALUE self)
struct sockaddr * ai_addr
VALUE rb_convert_type(VALUE, int, const char *, const char *)
static int extract_in_addr(VALUE self, uint32_t *addrp)
VALUE rsock_sockaddr_string_value(volatile VALUE *v)