*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: inet_net_ntop | Section: 3 | Source: OpenBSD | File: inet_net_ntop.3
INET_NET_NTOP(3) FreeBSD Library Functions Manual INET_NET_NTOP(3) NAME inet_net_ntop, inet_net_pton - Internet network number manipulation routines SYNOPSIS #include <sys/socket.h> #include <arpa/inet.h> char * inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size); int inet_net_pton(int af, const char *src, void *dst, size_t size); DESCRIPTION The inet_net_ntop() function converts an Internet network number from network format (usually a struct in_addr or some other binary form, in network byte order) to CIDR presentation format (suitable for external display purposes). bits is the number of bits in src that are the network number. It returns NULL if a system error occurs (in which case, errno will have been set), or it returns a pointer to the destination string. The inet_net_pton() function converts a presentation format Internet network number (that is, printable form as held in a character string) to network format (usually a struct in_addr or some other internal binary representation, in network byte order). It returns the number of bits (either computed based on the class, or specified with /CIDR), or -1 if a failure occurred (in which case errno will have been set. It will be set to ENOENT if the Internet network number was not valid). Caution: The dst field should be zeroed before calling inet_net_pton() as the function will only fill the number of bytes necessary to encode the network number in network byte order. The only values for af currently supported are AF_INET and AF_INET6. size is the size of the result buffer dst. NETWORK NUMBERS (IP VERSION 4) The external representation of Internet network numbers may be specified in one of the following forms: a a.b a.b.c a.b.c.d Any of the above four forms may have "/bits" appended where "bits" is in the range 0-32 and is used to explicitly specify the number of bits in the network address. When "/bits" is not specified, the number of bits in the network address is calculated as the larger of the number of bits in the class to which the address belongs and the number of bits provided rounded up modulo 8. Examples: 10 an 8-bit network number (class A), value 10.0.0.0. 192 a 24-bit network number (class C), value 192.0.0.0. 10.10 a 16-bit network number, value 10.10.0.0. 10.1.2 a 24-bit network number, value 10.1.2.0. 10.1.2.3 a 32-bit network number, value 10.1.2.3. 10.1.2.3/24 a 24-bit network number (explicit), value 10.1.2.3. Note that when the number of bits is specified using "/bits" notation, the value of the address still includes all bits supplied in the external representation, even those bits which are the host part of an Internet address. Also, unlike inet_pton(3) where the external representation is assumed to be a host address, the external representation for inet_net_pton() is assumed to be a network address. Thus "10.1" is assumed to be "10.1.0.0" not "10.0.0.1" All numbers supplied as "parts" in a `.' notation may be decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal). NETWORK NUMBERS (IP VERSION 6) See inet_pton(3) for valid external representations of IP version 6 addresses. A valid external representation may have "/bits" appended where "bits" is in the range 0-128 and is used to explicitly specify the number of bits in the network address. When "/bits" is not specified, 128 is used. Note that when the number of bits is specified using "/bits" notation, the value of the address still includes all bits supplied in the external representation, even those bits which are the host part of an Internet address. SEE ALSO htonl(3), inet_pton(3), inet(4), hosts(5) HISTORY The inet_net_ntop and inet_net_pton functions first appeared in BIND 4.9.4. FreeBSD 14.1-RELEASE-p8 September 11, 2022 FreeBSD 14.1-RELEASE-p8

Navigation Options