inet(ADMP) 19 June 1992 inet(ADMP) Name inet - Internet protocol family Syntax #include <sys/types.h> #include <netinet/in.h> Description The Internet protocol family is a set of protocols using the Internet Protocol (IP) network layer and the Internet address format. The Inter- net family provides protocol support for the SOCKSTREAM, SOCKDGRAM, and SOCKRAW socket types; the SOCKRAW interface provides access to the IP protocol. Addressing Internet addresses are four-byte quantities, stored in network standard format. The include file <sys/in.h> defines this address as a discrim- inated union. Sockets bound to the Internet protocol family use the following addressing structure: struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; When using sockets, the sinfamily field is specified in host order, and the sinport and sinaddr fields are specified in network order. Sockets may be created with the local address INADDRANY to affect ``wildcard'' matching on incoming messages. The address in a connect(SSC) or sendto (see send(SSC)) call may be given as INADDRANY to mean this ``host''. The distinguished address INADDRBROADCAST is allowed as a shorthand for the broadcast address on the primary network if the first network configured supports broadcast. When using the Transport Layer Interface (TLI), transport providers such as tcp(ADMP) support addresses whose length varies from eight to sixteen bytes. The eight byte form is the same as a sockaddrin without the sinzero field. The sixteen byte form is identical to sockaddrin. Additionally, when using TLI, the sinfamily field is accepted in either host or network order. For communicating with other implementations via RFS, the preferred form is eight bytes with sinfamily in network order. Protocols The Internet protocol family is comprised of the IP transport protocol, Internet Control Message Protocol (ICMP), Transmission Control Protocol (TCP), and User Datagram Protocol UDP), TCP is used to support the SOCKSTREAM abstraction; UDP is used to support the SOCKDGRAM abstrac- tion. A raw interface to IP is available by creating an Internet socket of type SOCKRAW. 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 net- works and a connection to the DARPA 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(S) commands on a datagram socket in the Internet ``communications domain''; they have the same form as the SIOCIFADDR command (see Intro(ADMP)). 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. Notes The Internet protocol support is subject to change as the Internet proto- cols develop. Users should not depend on details of the current imple- mentation, but rather the services exported. See also icmp(ADMP), Intro(ADMP), Intro(S), ioctl(S), ip(ADMP), socket(SSC), tcp(ADMP), udp(ADMP)