Lines Matching refs:addr
36 httpAddrAny(const http_addr_t *addr) /* I - Address to check */ in httpAddrAny() argument
38 if (!addr) in httpAddrAny()
42 if (addr->addr.sa_family == AF_INET6 && in httpAddrAny()
43 IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr))) in httpAddrAny()
47 if (addr->addr.sa_family == AF_INET && in httpAddrAny()
48 ntohl(addr->ipv4.sin_addr.s_addr) == 0x00000000) in httpAddrAny()
67 httpAddrClose(http_addr_t *addr, /* I - Listen address or @code NULL@ */ in httpAddrClose() argument
78 if (addr && addr->addr.sa_family == AF_LOCAL) in httpAddrClose()
79 return (unlink(addr->un.sun_path)); in httpAddrClose()
102 if (addr1->addr.sa_family != addr2->addr.sa_family) in httpAddrEqual()
106 if (addr1->addr.sa_family == AF_LOCAL) in httpAddrEqual()
111 if (addr1->addr.sa_family == AF_INET6) in httpAddrEqual()
126 httpAddrLength(const http_addr_t *addr) /* I - Address */ in httpAddrLength() argument
128 if (!addr) in httpAddrLength()
132 if (addr->addr.sa_family == AF_INET6) in httpAddrLength()
133 return (sizeof(addr->ipv6)); in httpAddrLength()
137 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLength()
138 return ((int)(offsetof(struct sockaddr_un, sun_path) + strlen(addr->un.sun_path) + 1)); in httpAddrLength()
141 if (addr->addr.sa_family == AF_INET) in httpAddrLength()
142 return (sizeof(addr->ipv4)); in httpAddrLength()
157 httpAddrListen(http_addr_t *addr, /* I - Address to bind to */ in httpAddrListen() argument
169 if (!addr || port < 0) in httpAddrListen()
176 if ((fd = socket(addr->addr.sa_family, SOCK_STREAM, 0)) < 0) in httpAddrListen()
186 if (addr->addr.sa_family == AF_INET6) in httpAddrListen()
195 if (addr->addr.sa_family == AF_LOCAL) in httpAddrListen()
203 unlink(addr->un.sun_path); in httpAddrListen()
216 status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr)); in httpAddrListen()
223 chmod(addr->un.sun_path, 0140777); in httpAddrListen()
228 _httpAddrSetPort(addr, port); in httpAddrListen()
230 status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr)); in httpAddrListen()
284 const http_addr_t *addr) /* I - Address to check */ in httpAddrLocalhost() argument
286 if (!addr) in httpAddrLocalhost()
290 if (addr->addr.sa_family == AF_INET6 && in httpAddrLocalhost()
291 IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr))) in httpAddrLocalhost()
296 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLocalhost()
300 if (addr->addr.sa_family == AF_INET && in httpAddrLocalhost()
301 (ntohl(addr->ipv4.sin_addr.s_addr) & 0xff000000) == 0x7f000000) in httpAddrLocalhost()
316 const http_addr_t *addr, /* I - Address to lookup */ in httpAddrLookup() argument
324 …DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", (void *)addr, (void *)name, namelen)… in httpAddrLookup()
330 if (!addr || !name || namelen <= 2) in httpAddrLookup()
339 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLookup()
341 strlcpy(name, addr->un.sun_path, (size_t)namelen); in httpAddrLookup()
350 if (httpAddrLocalhost(addr)) in httpAddrLookup()
387 …int error = getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), name, (socklen_t)namelen, NU… in httpAddrLookup()
394 return (httpAddrString(addr, name, namelen)); in httpAddrLookup()
403 if (addr->addr.sa_family == AF_INET6) in httpAddrLookup()
404 host = gethostbyaddr((char *)&(addr->ipv6.sin6_addr), in httpAddrLookup()
408 host = gethostbyaddr((char *)&(addr->ipv4.sin_addr), in httpAddrLookup()
420 return (httpAddrString(addr, name, namelen)); in httpAddrLookup()
438 httpAddrFamily(http_addr_t *addr) /* I - Address */ in httpAddrFamily() argument
440 if (addr) in httpAddrFamily()
441 return (addr->addr.sa_family); in httpAddrFamily()
454 httpAddrPort(http_addr_t *addr) /* I - Address */ in httpAddrPort() argument
456 if (!addr) in httpAddrPort()
459 else if (addr->addr.sa_family == AF_INET6) in httpAddrPort()
460 return (ntohs(addr->ipv6.sin6_port)); in httpAddrPort()
462 else if (addr->addr.sa_family == AF_INET) in httpAddrPort()
463 return (ntohs(addr->ipv4.sin_port)); in httpAddrPort()
474 _httpAddrSetPort(http_addr_t *addr, /* I - Address */ in _httpAddrSetPort() argument
477 if (!addr || port <= 0) in _httpAddrSetPort()
481 if (addr->addr.sa_family == AF_INET6) in _httpAddrSetPort()
482 addr->ipv6.sin6_port = htons(port); in _httpAddrSetPort()
485 if (addr->addr.sa_family == AF_INET) in _httpAddrSetPort()
486 addr->ipv4.sin_port = htons(port); in _httpAddrSetPort()
497 httpAddrString(const http_addr_t *addr, /* I - Address to convert */ in httpAddrString() argument
501 DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", (void *)addr, (void *)s, slen)); in httpAddrString()
507 if (!addr || !s || slen <= 2) in httpAddrString()
516 if (addr->addr.sa_family == AF_LOCAL) in httpAddrString()
518 if (addr->un.sun_path[0] == '/') in httpAddrString()
519 strlcpy(s, addr->un.sun_path, (size_t)slen); in httpAddrString()
525 if (addr->addr.sa_family == AF_INET) in httpAddrString()
529 temp = ntohl(addr->ipv4.sin_addr.s_addr); in httpAddrString()
535 else if (addr->addr.sa_family == AF_INET6) in httpAddrString()
541 …if (getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), temps, sizeof(temps), NULL, 0, NI_NU… in httpAddrString()
568 for (sptr = temps, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++) in httpAddrString()
570 temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]); in httpAddrString()
578 if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1]) in httpAddrString()
587 while (i < 4 && !addr->ipv6.sin6_addr.s6_addr32[i]) in httpAddrString()
598 temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]); in httpAddrString()
601 (i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1])) in httpAddrString()