SYNTAX

       #include "ip.h"

       unsigned int ip4_fmt(char *s,char ip[4]);
       unsigned int ip4_scan(const char *s,char ip[4]);
       unsigned int ip_scan(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);


DESCRIPTION

       ip4_fmt reads the char[4] IPv4 address and returns a dotted-decimal
       IPv4 address string 1.2.3.4.

       ip4_scan reads an IPv4 address string 1.2.3.4 and converts it to the
       char[4] IPv4 address.

       ip_scan calls ip4_san in compatibility mode with the first argument als
       input and the second as output. Upon detecting an IPvr6 address it call
       ip6_scan and otherwise ip4_scan.

       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
       the 'bytestring' representation 1001001....  up to the given prefix
       length plen.


RETURN CODES

       The ip(4)* programs return the number of bytes processed.
       ip4_bytestring returns negative numbers on failure.


SEE ALSO

       ip6(3), socket_if(3)



                                                                  qlibs:(ipv4)

Man(1) output converted with man2html