The Internet protocol family comprises the IP transport protocol, Internet Control Message Protocol (ICMP), Transmission Control Protocol (TCP), and User Datagram Protocol (UDP). TCP is used to support the
SOCK_STREAM abstraction while UDP is used to support the
SOCK_DGRAM abstraction. A raw interface to IP is available by creating an Internet socket of type
SOCK_RAW. The ICMP message protocol is accessible from a raw socket.
The 32-bit Internet address contains both network and host parts. 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. Sites with a cluster of local networks and a connection to the Internet may chose to use a single network number for the cluster; this is done by using subnet addressing. The local (host) portion of the address is further subdivided into subnet and host parts. Within a subnet, each subnet appears to be an individual network; externally, the entire cluster appears to be a single, uniform network requiring only a single routing entry. Subnet addressing is enabled and examined by the following
ioctl(2) commands on a datagram socket in the Internet domain; they have the same form as the
SIOCIFADDR command (see
netintro(4)).
SIOCSIFNETMASK
Set interface network mask. The network mask defines the network part of the address; if it contains more of the address than the address type would indicate, then subnets are in use.
SIOCGIFNETMASK
Get interface network mask.