Lines Matching refs:addr
579 unsigned char in4_addr_netmask_to_prefixlen(const struct in_addr *addr) { in in4_addr_netmask_to_prefixlen() argument
580 assert(addr); in in4_addr_netmask_to_prefixlen()
582 return 32U - u32ctz(be32toh(addr->s_addr)); in in4_addr_netmask_to_prefixlen()
585 struct in_addr* in4_addr_prefixlen_to_netmask(struct in_addr *addr, unsigned char prefixlen) { in in4_addr_prefixlen_to_netmask() argument
586 assert(addr); in in4_addr_prefixlen_to_netmask()
591 addr->s_addr = 0; in in4_addr_prefixlen_to_netmask()
593 addr->s_addr = htobe32((0xffffffff << (32 - prefixlen)) & 0xffffffff); in in4_addr_prefixlen_to_netmask()
595 return addr; in in4_addr_prefixlen_to_netmask()
598 int in4_addr_default_prefixlen(const struct in_addr *addr, unsigned char *prefixlen) { in in4_addr_default_prefixlen() argument
599 uint8_t msb_octet = *(uint8_t*) addr; in in4_addr_default_prefixlen()
603 assert(addr); in in4_addr_default_prefixlen()
622 int in4_addr_default_subnet_mask(const struct in_addr *addr, struct in_addr *mask) { in in4_addr_default_subnet_mask() argument
626 assert(addr); in in4_addr_default_subnet_mask()
629 r = in4_addr_default_prefixlen(addr, &prefixlen); in in4_addr_default_subnet_mask()
637 int in4_addr_mask(struct in_addr *addr, unsigned char prefixlen) { in in4_addr_mask() argument
640 assert(addr); in in4_addr_mask()
645 addr->s_addr &= mask.s_addr; in in4_addr_mask()
649 int in6_addr_mask(struct in6_addr *addr, unsigned char prefixlen) { in in6_addr_mask() argument
666 addr->s6_addr[i] &= mask; in in6_addr_mask()
672 int in_addr_mask(int family, union in_addr_union *addr, unsigned char prefixlen) { in in_addr_mask() argument
673 assert(addr); in in_addr_mask()
677 return in4_addr_mask(&addr->in, prefixlen); in in_addr_mask()
679 return in6_addr_mask(&addr->in6, prefixlen); in in_addr_mask()
902 void in6_addr_hash_func(const struct in6_addr *addr, struct siphash *state) { in in6_addr_hash_func() argument
903 assert(addr); in in6_addr_hash_func()
906 siphash24_compress(addr, sizeof(*addr), state); in in6_addr_hash_func()