libbind_inet_cidr

Langue: en

Version: 158321 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)


BSD mandoc
BSD 4

NAME

inet_cidr_ntop inet_cidr_pton - network translation routines

SYNOPSIS

Fd #include <sys/types.h> Fd #include <sys/socket.h> Fd #include <netinet/in.h> Fd #include <arpa/inet.h> Fn inet_cidr_ntop int af const void *src int bits char *dst size_t size Fn inet_cidr_pton int af const char *src void *dst int *bits

DESCRIPTION

These routines are used for converting addresses to and from network and presentation forms with CIDR (Classless Inter-Domain Routing) representation, embedded net mask.
                 130.155.16.1/20
 

Fn inet_cidr_ntop converts an address from network to presentation format.

Ft af describes the type of address that is being passed in Ft src . Currently only AF_INET is supported.

Ft src is an address in network byte order, its length is determined from Ft af .

Ft bits specifies the number of bits in the netmask unless it is -1 in which case the CIDR representation is omitted.

Ft dst is a caller supplied buffer of at least Ft size bytes.

Fn inet_cidr_ntop returns Ft dst on success or NULL. Check errno for reason.

Fn inet_cidr_pton converts and address from presentation format, with optional CIDR reperesentation, to network format. The resulting address is zero filled if there were insufficint bits in Ft src .

Ft af describes the type of address that is being passed in via Ft src and determines the size of Ft dst .

Ft src is an address in presentation format.

Ft bits returns the number of bits in the netmask or -1 if a CIDR representation was not supplied.

Fn inet_cidr_pton returns 0 on succces or -1 on error. Check errno for reason. ENOENT indicates an invalid netmask.

SEE ALSO

intro(2)