MirBSD manpage: inet(4)

INET(4)                    BSD Programmer's Manual                     INET(4)


     inet - Internet protocol family


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


     The Internet protocol family is a collection of protocols layered atop
     the Internet Protocol (IP) transport layer, and utilizing the Internet
     address format. The Internet family provides protocol support for the
     SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW socket types; the SOCK_RAW inter-
     face provides access to the IP protocol.


     Internet addresses are four byte quantities, stored in network standard
     format (on the VAX these are word and byte reversed). The include file
     <netinet/in.h> defines this address as a discriminated union.

     Sockets bound to the Internet protocol family utilize the following ad-
     dressing structure,

           struct sockaddr_in {
                   u_int8_t        sin_len;
                   sa_family_t     sin_family;
                   in_port_t       sin_port;
                   struct          in_addr sin_addr;
                   int8_t          sin_zero[8];

     Sockets may be created with the local address INADDR_ANY to effect
     "wildcard" matching on incoming messages. The address in a connect(2) or
     sendto(2) call may be given as INADDR_ANY to mean "this host". The dis-
     tinguished address INADDR_BROADCAST is allowed as a shorthand for the
     broadcast address on the primary network if the first network configured
     supports broadcast.


     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
     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 ad-
     dresses, 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 Internet may choose to use a single network
     number for the cluster; this is done by using subnet addressing. The lo-
     cal (host) portion of the address is further subdivided into subnet and
     host parts. Within a subnet, each subnet appears to be an individual net-
     work; externally, the entire cluster appears to be a single, uniform net-
     work 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 sub-
                     nets are in use.

     SIOCGIFNETMASK  Get interface network mask.


     ioctl(2), socket(2), icmp(4), ip(4), netintro(4), tcp(4), udp(4)

     "An Introductory 4.3 BSD Interprocess Communication Tutorial", PS1, 7.

     "An Advanced 4.3 BSD Interprocess Communication Tutorial", PS1, 8.


     The inet protocol interface appeared in 4.2BSD.


     The Internet protocol support is subject to change as the Internet proto-
     cols develop. Users should not depend on details of the current implemen-
     tation, but rather the services exported.

MirBSD #10-current               June 5, 1993                                1

Generated on 2021-12-07 11:07:08 by $MirOS: src/scripts/roff2htm,v 1.103 2021/01/23 20:24:35 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2021 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.