Manual Page Search Parameters

INET_LNAOF(3) Library Functions Manual INET_LNAOF(3)


inet_makeaddr, inet_netof, inet_lnaofroutines for manipulating classful Internet Protocol version 4 (IPv4) addresses


#include <arpa/inet.h>
struct in_addr
inet_makeaddr(in_addr_t net, in_addr_t lna);
inet_netof(struct in_addr in);
inet_lnaof(struct in_addr in);


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.


getnetent(3), inet_addr(3), inet_net(3), hosts(5), networks(5)


The inet_makeaddr, inet_lnaof, and inet_netof functions appeared in 4.2BSD.
April 19, 2014 OpenBSD-current