inet_net_pton()

convert Internet network number from presentation format to network format 

Function


SYNOPSIS

#include <arpa/inet.h>

char *inet_net_pton(int af, const char *src, void *dst, size_t size);


DESCRIPTION

The inet_net_pton() function converts an Internet network number from presentation format (either Internet standard dot notation, or Classless Internet Domain Routing (CIDR) format) to network format (usually a struct in_addr or some other binary form, in network byte order).

With CIDR, a single IP address can be used to designate many unique IP addresses. A CIDR IP address looks like a normal IP address except that it ends with a slash followed by a number, called the IP prefix. For example:

172.200.0.0/16

The IP prefix specifies how many addresses are covered by the CIDR address, with lower numbers covering more addresses. An IP prefix of /12, for example, can be used to address 4,096 former Class C addresses.


PARAMETERS

af 

Specifies the address family. Currently, only AF_INET is supported.

src 

Points to the presentation-format address. The format of the address is interpreted according to af.

dst 

Points to the buffer where the converted address is stored.

size 

Is the size of dst, in bytes.


RETURN VALUES

On success, the inet_net_pton() function returns the number of bits that specify the network number. Otherwise, it returns -1, and sets errno to one of the following:

EAFNOSUPPORT 

The address family specified in af is not supported by this function.

EMSGSIZE 

The buffer specified by dst and size is not large enough to contain the converted address.

ENOENT 

The address could not be parsed.


CONFORMANCE

PTC MKS Toolkit UNIX APIs extension.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The implementation of this function is taken from the Bind resolver implementation from the Internet Software Consortium.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
inet_addr(), inet_aton(), inet_lnaof(), inet_makeaddr(), inet_net_ntop(), inet_neta(), inet_netof(), inet_network(), inet_ntoa(), inet_ntop(), inet_pton()


PTC MKS Toolkit 10.3 Documentation Build 39.