CIDR*cidr_addr_broadcast(constCIDR*cidr)
Return a CIDR structure describing the broadcast address of the network represented by cidr.
CIDR*cidr_addr_hostmax(constCIDR*cidr)
Return a CIDR structure describing the "highest" host in the subnet represented by cidr.
CIDR*cidr_addr_hostmin(constCIDR*cidr)
Return a CIDR structure describing the "lowest" host in the subnet represented by cidr.
CIDR*cidr_addr_network(constCIDR*cidr)
Return a CIDR structure describing the network address of the network represented by cidr.
CIDR*cidr_alloc(void)
Allocate and initialize a CIDR structure.
intcidr_contains(constCIDR*big,constCIDR*little)
Determine whether little is a CIDR block entirely contained within the block described by big.
Return 0 if so, else non-zero.
CIDR*cidr_dup(constCIDR*cidr)
Return a duplicate of cidr.
intcidr_equals(constCIDR*first,constCIDR*second)
Determine whether first and second describe the same CIDR block. Return 0 if they do, else non-
zero.
voidcidr_free(CIDR*cidr)
Free the memory used by a CIDR*.
CIDR*cidr_from_inaddr(conststructin_addr*in)
Generate a CIDR* based on a structin_addr.
CIDR*cidr_from_in6addr(conststructin6_addr*in)
Generate a CIDR* based on a structin6_addr.
CIDR*cidr_from_str(constchar*str)
Parse str and return a CIDR* representing it.
uint8_t*cidr_get_addr(constCIDR*cidr)
Return the address in an array of binary octets.
uint8_t*cidr_get_mask(constCIDR*cidr)
Return the netmask in an array of binary octets.
intcidr_get_pflen(constCIDR*cidr)
Return the length of the netmask prefix of cidr.
intcidr_get_proto(constCIDR*cidr)
Return the protocol of an address.
intcidr_is_v4mapped(constCIDR*addr)
Checks if an IPv6 address is in the IPv4-mapped range.
CIDR**cidr_net_subnets(constCIDR*cidr)
Return a 2-element array of CIDR*'s representing the two immediate subnets of the network
described by cidr. That is to say, the two networks, within cidr, which have a netmask 1 bit
longer.
CIDR*cidr_net_supernet(constCIDR*cidr)
Return a CIDR* describing the "parent" network of cidr. That is, the network with a netmask 1 bit
shorter, which wholly contains cidr.
constchar*cidr_numaddr(constCIDR*cidr)
Return a pointer to a static string giving the number of total addresses available in the network
described by cidr. Do not attempt to alter or free(3) this string.
constchar*cidr_numaddr_pflen(intpflen)
Return a pointer to a static string giving the number of total addresses available in a network
having a prefix length of pflen. Do not attempt to alter or free(3) this string. You probably
don't want to call this function manually often.
constchar*cidr_numhost(constCIDR*cidr)
Return a pointer to a static string giving the number of addresses available for hosts available in
the network described by cidr. Do not attempt to alter or free(3) this string.
constchar*cidr_numhost_pflen(intpflen)
Return a pointer to a static string giving the number of addresses available for hosts in a network
having a prefix length of pflen. Do not attempt to alter or free(3) this string. You probably
don't want to call this function manually often.
structin_addr*cidr_to_inaddr(constCIDR*cidr,structin_addr*in)
Fill in a structin_addr with the address given in cidr. A user-supplied structin_addr is used if
passed in; if a null pointer is passed, a new one will be allocated, filled in, and returned.
structin6_addr*cidr_to_in6addr(constCIDR*cidr,structin6_addr*in)
Fill in a structin6_addr with the address given in cidr. A user-supplied structin6_addr is used
if passed in; if a null pointer is passed, a new one will be allocated, filled in, and returned.
char*cidr_to_str(constCIDR*cidr,intflags)
Return a string version of the passed-in cidr, as described by flags. By default, it will print in
the standard address form for whatever address family cidr represents, followed by a slash, and
then the prefix length of the netmask.
constchar*cidr_version(void)
Return a static string containing version information.