Lines Matching refs:addr
38 httpAddrAny(const http_addr_t *addr) /* I - Address to check */ in httpAddrAny() argument
40 if (!addr) in httpAddrAny()
44 if (addr->addr.sa_family == AF_INET6 && in httpAddrAny()
45 IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr))) in httpAddrAny()
49 if (addr->addr.sa_family == AF_INET && in httpAddrAny()
50 ntohl(addr->ipv4.sin_addr.s_addr) == 0x00000000) in httpAddrAny()
69 httpAddrClose(http_addr_t *addr, /* I - Listen address or @code NULL@ */ in httpAddrClose() argument
80 if (addr && addr->addr.sa_family == AF_LOCAL) in httpAddrClose()
81 return (unlink(addr->un.sun_path)); in httpAddrClose()
104 if (addr1->addr.sa_family != addr2->addr.sa_family) in httpAddrEqual()
108 if (addr1->addr.sa_family == AF_LOCAL) in httpAddrEqual()
113 if (addr1->addr.sa_family == AF_INET6) in httpAddrEqual()
128 httpAddrLength(const http_addr_t *addr) /* I - Address */ in httpAddrLength() argument
130 if (!addr) in httpAddrLength()
134 if (addr->addr.sa_family == AF_INET6) in httpAddrLength()
135 return (sizeof(addr->ipv6)); in httpAddrLength()
139 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLength()
140 return ((int)(offsetof(struct sockaddr_un, sun_path) + strlen(addr->un.sun_path) + 1)); in httpAddrLength()
143 if (addr->addr.sa_family == AF_INET) in httpAddrLength()
144 return (sizeof(addr->ipv4)); in httpAddrLength()
159 httpAddrListen(http_addr_t *addr, /* I - Address to bind to */ in httpAddrListen() argument
171 if (!addr || port < 0) in httpAddrListen()
178 if ((fd = socket(addr->addr.sa_family, SOCK_STREAM, 0)) < 0) in httpAddrListen()
188 if (addr->addr.sa_family == AF_INET6) in httpAddrListen()
197 if (addr->addr.sa_family == AF_LOCAL) in httpAddrListen()
205 unlink(addr->un.sun_path); in httpAddrListen()
218 status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr)); in httpAddrListen()
225 chmod(addr->un.sun_path, 0140777); in httpAddrListen()
230 _httpAddrSetPort(addr, port); in httpAddrListen()
232 status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr)); in httpAddrListen()
286 const http_addr_t *addr) /* I - Address to check */ in httpAddrLocalhost() argument
288 if (!addr) in httpAddrLocalhost()
292 if (addr->addr.sa_family == AF_INET6 && in httpAddrLocalhost()
293 IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr))) in httpAddrLocalhost()
298 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLocalhost()
302 if (addr->addr.sa_family == AF_INET && in httpAddrLocalhost()
303 (ntohl(addr->ipv4.sin_addr.s_addr) & 0xff000000) == 0x7f000000) in httpAddrLocalhost()
318 const http_addr_t *addr, /* I - Address to lookup */ in httpAddrLookup() argument
326 …DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", (void *)addr, (void *)name, namelen)… in httpAddrLookup()
332 if (!addr || !name || namelen <= 2) in httpAddrLookup()
341 if (addr->addr.sa_family == AF_LOCAL) in httpAddrLookup()
343 strlcpy(name, addr->un.sun_path, (size_t)namelen); in httpAddrLookup()
352 if (httpAddrLocalhost(addr)) in httpAddrLookup()
389 …int error = getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), name, (socklen_t)namelen, NU… in httpAddrLookup()
396 return (httpAddrString(addr, name, namelen)); in httpAddrLookup()
405 if (addr->addr.sa_family == AF_INET6) in httpAddrLookup()
406 host = gethostbyaddr((char *)&(addr->ipv6.sin6_addr), in httpAddrLookup()
410 host = gethostbyaddr((char *)&(addr->ipv4.sin_addr), in httpAddrLookup()
422 return (httpAddrString(addr, name, namelen)); in httpAddrLookup()
440 httpAddrFamily(http_addr_t *addr) /* I - Address */ in httpAddrFamily() argument
442 if (addr) in httpAddrFamily()
443 return (addr->addr.sa_family); in httpAddrFamily()
456 httpAddrPort(http_addr_t *addr) /* I - Address */ in httpAddrPort() argument
458 if (!addr) in httpAddrPort()
461 else if (addr->addr.sa_family == AF_INET6) in httpAddrPort()
462 return (ntohs(addr->ipv6.sin6_port)); in httpAddrPort()
464 else if (addr->addr.sa_family == AF_INET) in httpAddrPort()
465 return (ntohs(addr->ipv4.sin_port)); in httpAddrPort()
476 _httpAddrSetPort(http_addr_t *addr, /* I - Address */ in _httpAddrSetPort() argument
479 if (!addr || port <= 0) in _httpAddrSetPort()
483 if (addr->addr.sa_family == AF_INET6) in _httpAddrSetPort()
484 addr->ipv6.sin6_port = htons(port); in _httpAddrSetPort()
487 if (addr->addr.sa_family == AF_INET) in _httpAddrSetPort()
488 addr->ipv4.sin_port = htons(port); in _httpAddrSetPort()
499 httpAddrString(const http_addr_t *addr, /* I - Address to convert */ in httpAddrString() argument
503 DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", (void *)addr, (void *)s, slen)); in httpAddrString()
509 if (!addr || !s || slen <= 2) in httpAddrString()
518 if (addr->addr.sa_family == AF_LOCAL) in httpAddrString()
520 if (addr->un.sun_path[0] == '/') in httpAddrString()
521 strlcpy(s, addr->un.sun_path, (size_t)slen); in httpAddrString()
527 if (addr->addr.sa_family == AF_INET) in httpAddrString()
531 temp = ntohl(addr->ipv4.sin_addr.s_addr); in httpAddrString()
537 else if (addr->addr.sa_family == AF_INET6) in httpAddrString()
543 …if (getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), temps, sizeof(temps), NULL, 0, NI_NU… in httpAddrString()
570 for (sptr = temps, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++) in httpAddrString()
572 temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]); in httpAddrString()
580 if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1]) in httpAddrString()
589 while (i < 4 && !addr->ipv6.sin6_addr.s6_addr32[i]) in httpAddrString()
600 temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]); in httpAddrString()
603 (i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1])) in httpAddrString()