Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ inet(7) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctl(2)

bind(3N)

byteorder(3N)

connect(3N)

getsockopt(3N)

gethostent(3N)

getnetent(3N)

getprotoent(3N)

getservent(3N)

send(3N)

socket(3N)

arp(7)

icmp(7)

if(7)

ip(7)

tcp(7)

udp(7)

inet(7)                                                             inet(7)

NAME
     inet - Internet protocol family

SYNOPSIS
     #include <sys/types.h>
     #include <netinet/in.h>

DESCRIPTION
     The Internet protocol family implements a collection of protocols
     which are centered around the Internet Protocol (IP) and which share a
     common address format. The Internet family protocols can be accessed
     via the socket interface, where they support the SOCKSTREAM,
     SOCKDGRAM, and SOCKRAW socket types, or the Transport Level Inter-
     face (TLI), where they support the connectionless (TCLTS) and connec-
     tion oriented (TCOTSORD) service types.

PROTOCOLS
     The Internet protocol family comprises the Internet Protocol (IP), the
     Address Resolution Protocol (ARP), the Internet Control Message Proto-
     col (ICMP), the Transmission Control Protocol (TCP), and the User
     Datagram Protocol (UDP).

     IP    Is the internetwork datagram delivery protocol that is central
           to the Internet protocol family; see ip(7).

     TCP   Supports the socket interface's SOCKSTREAM abstraction and
           TLI's TCOTSORD service type; see udp(7).

     UDP   Supports the SOCKDGRAM socket abstraction and the TLI TCLTS
           service type; see tcp(7). A direct interface to IP is available
           via both TLI and the socket interface; see ip(7).

     ICMP  Is used by the kernel to handle and report errors in protocol
           processing. It is also accessible to user programs; see icmp(7).

     ARP   Is used to translate 32-bit IP addresses into 48-bit Ethernet
           addresses; see arp(7).


















Page 1                       Reliant UNIX 5.44                Printed 11/98

inet(7)                                                             inet(7)

     The 32-bit IP address is divided into network number and host number
     parts. It is frequency-encoded; The most-significant bit is zero in
     Class A addresses, in which the high-order 8 bits represent the net-
     work number. Class B addresses have their high order two bits set to
     10 and use the high-order 16 bits as the network number field. Class C
     addresses have a 24-bit network number part of which the high order
     three bits are 110. Sites with a cluster of IP networks may chose to
     use a single network number for the cluster; this is done by using
     subnet addressing. The host number portion of the address is further
     subdivided into subnet number and host number 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; they have the same form as the SIOC-
     SIFADDR command [see if(7)].

     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.

ADDRESSING
     IP addresses are four byte quantities, stored in network byte order.
     IP addresses should be manipulated using the byte order conversion
     routines [see byteorder(3N)].

     Addresses in the Internet protocol family use the following structure:

          struct sockaddrin {
               short    sinfamily;
               ushort  sinport;
               struct   inaddr sinaddr;
               char     sinzero[8];
          };

     Library routines are provided to manipulate structures of this form;
     see inet(3N).

     The sinaddr field of the sockaddrin structure specifies a local or
     remote IP address. Each network interface has its own unique IP
     address. The special value INADDRANY may be used in this field to
     effect "wildcard" matching. Given in a bind(3N) call, this value
     leaves the local IP address of the socket unspecified, so that the
     socket will receive connections or messages directed at any of the
     valid IP addresses of the system. This can prove useful when a process
     neither knows nor cares what the local IP address is or when a process
     wishes to receive requests using all of its network interfaces. The
     sockaddrin structure given in the bind(3N) call must specify an
     inaddr value of either INADDRANY or one of the system's valid IP
     addresses. Requests to bind any other address will elicit the error


Page 2                       Reliant UNIX 5.44                Printed 11/98

inet(7)                                                             inet(7)

     EADDRNOTAVAI. When a connect(3N) call is made for a socket that has a
     wildcard local address, the system sets the sinaddr field of the
     socket to the IP address of the network interface that the packets for
     that connection are routed via.

     The sinport field of the sockaddrin structure specifies a port
     number used by TCP or UDP. The local port address specified in a
     bind(3N) call is restricted to be greater than IPPORTRESERVED
     (defined in <netinet/in.h>) unless the creating process is running as
     the superuser, providing a space of protected port numbers. In addi-
     tion, the local port address must not be in use by any socket of same
     address family and type. Requests to bind sockets to port numbers
     being used by other sockets return the error EADDRINUSE. If the local
     port address is specified as 0, then the system picks a unique port
     address greater than IPPORTRESERVED. A unique local port address is
     also picked when a socket which is not bound is used in a connect(3N)
     or sendto [see send(3N)] call. This allows programs which do not care
     which local port number is used to set up TCP connections by simply
     calling socket(3N) and then connect(3N), and to send UDP datagrams
     with a socket(3N) call followed by a sendto(3N) call.

     Although this implementation restricts sockets to unique local port
     numbers, TCP allows multiple simultaneous connections involving the
     same local port number so long as the remote IP addresses or port
     numbers are different for each connection. Programs may explicitly
     override the socket restriction by setting the SOREUSEADDR socket
     option with setsockopt [see getsockopt(3N)].

     TLI applies somewhat different semantics to the binding of local port
     numbers. These semantics apply when Internet family protocols are used
     via the TLI.

NOTES
     The Internet protocol support is subject to change as the Internet
     protocols develop. Users should not depend on details of the current
     implementation, but rather the services exported.

SEE ALSO
     ioctl(2), bind(3N), byteorder(3N), connect(3N), getsockopt(3N),
     gethostent(3N), getnetent(3N), getprotoent(3N), getservent(3N),
     send(3N), socket(3N), arp(7), icmp(7), if(7), ip(7), tcp(7), udp(7).

     Network Information Center, DDN Protocol Handbook (3 vols.), Network
     Information Center, SRI International, Menlo Park, Calif., 1985.










Page 3                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026