Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 8
Convert an Internet network number to CIDR format
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
char * inet_net_ntop( int af,
const void * src,
int bits,
char * dst,
size_t size );
- af
- The address family.
Currently, only AF_INET is supported.
- src
- A pointer to the Internet network number that you want to convert.
The format of the address is interpreted according to af.
- bits
- The number of bits that specify the network number (src).
- dst
- a pointer to the buffer where the function can store the converted
address.
- size
- The size of the buffer that dst points to, in bytes.
libsocket
Use the -l socket option to
qcc
to link against this library.
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 (Classless Internet Domain Routing) presentation format that's suitable for external display purposes.
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.
You can specify Internet addresses in the “dotted quad” notation, or Internet network numbers,
using one of the following forms:
- a.b.c.d/bits or
a.b.c.d
- When you specify a four-part address,
each part is interpreted as a byte of data and is assigned,
from left to right, to the four bytes of an Internet network number (or Internet address).
When an Internet network number is viewed as a 32-bit integer quantity
on a system that uses little-endian byte order (i.e. right to left),
such as the Intel 386, 486 and Pentium processors,
the bytes referred to above appear as “d.c.b.a”.
- a.b.c
- When you specify a three-part address,
the last part is interpreted as a 16-bit quantity and is
placed in the rightmost two bytes of the Internet network number (or network address).
This makes the three-part address format convenient for specifying Class B network addresses as
net.net.host.
- a.b
- When you specify a two-part address,
the last part is interpreted as a 24-bit quantity and is
placed in the rightmost three bytes of the Internet network number (or network address).
This makes the two-part number format convenient for specifying Class A network numbers as
net.host.
- a
- When you specify a one-part address,
the value is stored directly in the Internet network number (network address) without any byte rearrangement.
All numbers supplied as “parts” in a dot notation
may be decimal, octal, or hexadecimal, as specified in the C language.
That is, a number is interpreted as decimal unless it has a leading 0 (octal),
or a leading 0x or 0X (hex).
A pointer to the destination string (dst),
or NULL if a system error occurs
(errno
is set).
- ENOENT
- Invalid argument af.
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
inet_aton(),
inet_net_ntop()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 223
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/inet_net_ntop.html on line 223