Convert an Internet network number from CIDR format to network format
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int inet_net_pton( int af, const char * src, void * dst, size_t size );
The inet_net_pton() function converts an Internet network number from presentation format—a printable form as held in a character string, such as Internet standard dot notation or Classless Internet Domain Routing (CIDR)—to network format (usually a struct in_addr or some other internal binary representation, in network byte order).
For more information on Internet addresses, see inet_net_ntop().
The number of bits that specify the network number (computed based on the class, or specified with /CIDR), or -1 if an error occurred (errno is set).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |