unsigned int ip4_fmt(char *s,char ip[4]);
unsigned int ip4_scan(const char *s,char ip[4]);
unsigned int ip4_scanbracket(char *s,char ip[4]);
unsigned int ip_scanbracket(char *ip_str,char *s);
unsigned int ip4_cidr(char *s,char ip[4],unsigned long *plen);
unsigned int ip4_bytestring(stralloc *ip4string,char ip[4],int plen);
ip4_scan reads an IPv4 address string 1.2.3.4 and converts it to the char[4] IPv4 address.
ip4_scanbracket reads an IPv4 address string enclosed in brackets [1.2.3.4] removes the brackets and calls ip4_scan on the result.
ip_scanbracket reads an IP address string enclosed in brackets [1.2.3.4] or [fe80::1], removes the brackets and calls ip4_scan or ip6_scan upon detecting an IPv6 address on the result.
ip4_cidr reads the CIDR IPv4 address string 1.2.3.4/15 determines the prefix as integer plen and calls ip4_scan. If no prefix is identified, it returns 32.
ip4_bytestring reads the IPv4 address given as char[4] while returning a 0-terminated 'bytestring' representation 1001001.... up to the given prefix length plen.