Lines Matching refs:addr
114 /* returns true is string addr is an ip6 specced address */
193 struct sockaddr_storage* addr, socklen_t addrlen)
198 int af = (int)((struct sockaddr_in*)addr)->sin_family;
199 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
205 sinaddr = &((struct sockaddr_in6*)addr)->sin6_addr;
219 port = ntohs(((struct sockaddr_in*)addr)->sin_port);
227 extstrtoaddr(const char* str, struct sockaddr_storage* addr,
243 return ipstrtoaddr(buf, port, addr, addrlen);
245 return ipstrtoaddr(str, port, addr, addrlen);
250 ipstrtoaddr(const char* ip, int port, struct sockaddr_storage* addr,
259 struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
276 struct sockaddr_in* sa = (struct sockaddr_in*)addr;
288 int netblockstrtoaddr(const char* str, int port, struct sockaddr_storage* addr,
309 if(!ipstrtoaddr(s?s:str, port, addr, addrlen)) {
314 addr_mask(addr, *addrlen, *net);
321 struct sockaddr_storage* addr, socklen_t* addrlen, int* af)
344 struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
350 struct sockaddr_in* sa = (struct sockaddr_in*)addr;
400 struct sockaddr_storage* addr, socklen_t* addrlen, int* net, int* af)
419 if(!ipdnametoaddr(dname, dnamelen-1-nlablen, addr, addrlen, af))
426 int authextstrtoaddr(char* str, struct sockaddr_storage* addr,
452 return ipstrtoaddr(buf, port, addr, addrlen);
464 return ipstrtoaddr(buf, port, addr, addrlen);
467 return ipstrtoaddr(str, port, addr, addrlen);
472 sockaddr_store_port(struct sockaddr_storage* addr, socklen_t addrlen, int port)
474 if(addr_is_ip6(addr, addrlen)) {
475 struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
478 struct sockaddr_in* sa = (struct sockaddr_in*)addr;
547 struct sockaddr_storage* addr, socklen_t addrlen)
553 int af = (int)((struct sockaddr_in*)addr)->sin_family;
554 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
560 sinaddr = &((struct sockaddr_in6*)addr)->sin6_addr;
569 port = ntohs(((struct sockaddr_in*)addr)->sin_port);
579 struct sockaddr_storage* addr, socklen_t addrlen)
583 int af = (int)((struct sockaddr_in*)addr)->sin_family;
584 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
586 sinaddr = &((struct sockaddr_in6*)addr)->sin6_addr;
591 port = ntohs(((struct sockaddr_in*)addr)->sin_port);
671 addr_is_ip6(struct sockaddr_storage* addr, socklen_t len)
674 ((struct sockaddr_in6*)addr)->sin6_family == AF_INET6)
680 addr_mask(struct sockaddr_storage* addr, socklen_t len, int net)
685 if(addr_is_ip6(addr, len)) {
686 s = (uint8_t*)&((struct sockaddr_in6*)addr)->sin6_addr;
689 s = (uint8_t*)&((struct sockaddr_in*)addr)->sin_addr;
736 addr_to_str(struct sockaddr_storage* addr, socklen_t addrlen,
739 int af = (int)((struct sockaddr_in*)addr)->sin_family;
740 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
741 if(addr_is_ip6(addr, addrlen))
742 sinaddr = &((struct sockaddr_in6*)addr)->sin6_addr;
749 addr_is_ip4mapped(struct sockaddr_storage* addr, socklen_t addrlen)
755 if(!addr_is_ip6(addr, addrlen))
758 s = (uint8_t*)&((struct sockaddr_in6*)addr)->sin6_addr;
762 int addr_is_broadcast(struct sockaddr_storage* addr, socklen_t addrlen)
764 int af = (int)((struct sockaddr_in*)addr)->sin_family;
765 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
770 int addr_is_any(struct sockaddr_storage* addr, socklen_t addrlen)
772 int af = (int)((struct sockaddr_in*)addr)->sin_family;
773 void* sinaddr = &((struct sockaddr_in*)addr)->sin_addr;
774 void* sin6addr = &((struct sockaddr_in6*)addr)->sin6_addr;
785 void sock_list_insert(struct sock_list** list, struct sockaddr_storage* addr,
789 sizeof(*add) - sizeof(add->addr) + (size_t)len);
798 if(len) memmove(&add->addr, addr, len);
812 int sock_list_find(struct sock_list* list, struct sockaddr_storage* addr,
817 if(len == 0 || sockaddr_cmp_addr(addr, len,
818 &list->addr, list->len) == 0)
831 if(!sock_list_find(*list, &p->addr, p->len))
832 sock_list_insert(list, &p->addr, p->len, region);