NAME
inet_makeaddr
,
inet_netof
, inet_lnaof
— routines for manipulating
classful Internet Protocol version 4 (IPv4) addresses
SYNOPSIS
#include
<arpa/inet.h>
struct in_addr
inet_makeaddr
(in_addr_t
net, in_addr_t
lna);
in_addr_t
inet_netof
(struct
in_addr in);
in_addr_t
inet_lnaof
(struct
in_addr in);
DESCRIPTION
As originally designed, IP version 4 split each address into a network part and local network address part, encoding that split into the address itself. It is frequency-encoded; the most-significant bit is clear in Class A addresses, in which the high-order 8 bits are the network number. Class B addresses use the high-order 16 bits as the network field, and Class C addresses have a 24-bit network part.
The routine
inet_makeaddr
()
takes an Internet network number and a local network address and constructs
an Internet address from it.
The routines
inet_netof
()
and
inet_lnaof
()
break apart Internet host addresses, returning the network number and local
network address part, respectively.
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 format integer values.
SEE ALSO
HISTORY
The inet_makeaddr
,
inet_lnaof
, and inet_netof
functions appeared in 4.2BSD.