|
NAMEinet_aton , inet_addr ,
inet_network , inet_ntoa ,
inet_ntoa_r , inet_ntop ,
inet_pton , inet_makeaddr ,
inet_lnaof , inet_netof
—
Internet address manipulation routines
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int
in_addr_t
in_addr_t
char *
char *
const char *
int
struct in_addr
in_addr_t
in_addr_t
DESCRIPTIONThe routinesinet_aton (),
inet_addr () and inet_network ()
interpret character strings representing numbers expressed in the Internet
standard ‘. ’ notation.
The The The function The routine All Internet addresses are returned in network order (bytes ordered from left to right). All network numbers and local address parts are returned as machine byte order integer values. INTERNET ADDRESSESValues specified using the ‘. ’ notation
take one of the following forms:
a.b.c.d a.b.c a.b a When four parts are specified, each is interpreted as a byte of
data and assigned, from left to right, to the four bytes of an Internet
address. Note that when an Internet address is viewed as a 32-bit integer
quantity on the VAX the bytes referred to above appear as
“ When a three part address is specified, the last part is interpreted as a 16-bit quantity and placed in the least significant two bytes of the network address. When a two part address is supplied, the last part is interpreted as a 24-bit quantity and placed in the least significant three bytes of the network address. When only one part is given, the value is stored directly in the network address without any byte rearrangement. All numbers supplied as “parts” in a
‘ DIAGNOSTICSThe constantINADDR_NONE is returned by
inet_addr () and inet_network ()
for malformed requests.
ERRORSTheinet_ntop () call fails if:
SEE ALSObyteorder(3), getaddrinfo(3), gethostbyname(3), getnameinfo(3), getnetent(3), inet_net(3), hosts(5), networks(5)IP Version 6 Addressing Architecture, RFC, 2373, July 1998. STANDARDSTheinet_ntop () and inet_pton ()
functions conform to X/Open Networking Services
Issue 5.2 (“XNS5.2”). Note that
inet_pton () does not accept 1-, 2-, or 3-part dotted
addresses; all four parts must be specified and are interpreted only as
decimal values. This is a narrower input set than that accepted by
inet_aton ().
HISTORYThese functions appeared in 4.2BSD.BUGSThe valueINADDR_NONE (0xffffffff) is a valid broadcast
address, but inet_addr () cannot return that value
without indicating failure. The newer inet_aton ()
function does not share this problem. The problem of host byte ordering versus
network byte ordering is confusing. The string returned by
inet_ntoa () resides in a static memory area.
The
Visit the GSP FreeBSD Man Page Interface. |