connectFree/lev — pull request #38 by hnakamur (2012-09-10 16:09:47+00:00)
Title: Implement dns.getaddrinfo()

Constants values on Linux are different from those on OSX.

> lev=require'lev'
> p(lev.process.platform)
"darwin"
> p(lev.dns)
{
NI_NOFQDN = 1,
EAI_OVERFLOW = 14,
EAI_FAMILY = 5,
EAI_PROTOCOL = 13,
AI_NUMERICHOST = 4,
getaddrinfo = function: 0x0e94b380,
EAI_SYSTEM = 11,
EAI_BADHINTS = 12,
EAI_MEMORY = 6,
SOCK_DGRAM = 2,
SOCK_STREAM = 1,
EAI_SERVICE = 9,
PF_INET = 2,
IPPROTO_UDP = 17,
AI_CANONNAME = 2,
NI_NUMERICSERV = 8,
NI_DGRAM = 16,
AI_PASSIVE = 1,
EAI_NONAME = 8,
SOCK_RAW = 3,
PF_UNSPEC = 0,
EAI_NODATA = 7,
EAI_SOCKTYPE = 10,
EAI_BADFLAGS = 3,
IPPROTO_TCP = 6,
NI_NUMERICHOST = 2,
PF_INET6 = 30,
EAI_AGAIN = 2,
EAI_ADDRFAMILY = 1,
EAI_FAIL = 4,
NI_NAMEREQD = 4
}

> lev=require'lev'
> p(lev.process.platform)
"linux"
> p(lev.dns)
{
NI_NOFQDN = 4,
EAI_FAMILY = -6,
AI_NUMERICHOST = 4,
getaddrinfo = function: 0x41294380,
EAI_SYSTEM = -11,
EAI_OVERFLOW = -12,
EAI_MEMORY = -10,
SOCK_DGRAM = 2,
SOCK_STREAM = 1,
EAI_SERVICE = -8,
PF_INET = 2,
IPPROTO_UDP = 17,
AI_CANONNAME = 2,
NI_NUMERICSERV = 2,
NI_DGRAM = 16,
AI_PASSIVE = 1,
EAI_NONAME = -2,
SOCK_RAW = 3,
PF_UNSPEC = 0,
EAI_NODATA = -5,
EAI_SOCKTYPE = -7,
EAI_BADFLAGS = -1,
IPPROTO_TCP = 6,
NI_NUMERICHOST = 1,
PF_INET6 = 10,
EAI_AGAIN = -3,
EAI_ADDRFAMILY = -9,
EAI_FAIL = -4,
NI_NAMEREQD = 8
}