date and time created 87/11/21 14:33:27 by karels
[unix-history] / usr / src / share / man / man4 / inet.4
CommitLineData
97ee408e
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
31c711c1 5.\" @(#)inet.4 6.3 (Berkeley) %G%
97ee408e 6.\"
5d512b67 7.TH INET 4F ""
97ee408e
KM
8.UC 5
9.SH NAME
10inet \- Internet protocol family
11.SH SYNOPSIS
12.B #include <sys/types.h>
13.br
14.B #include <netinet/in.h>
15.SH DESCRIPTION
16.de _d
17.if t .ta .6i 2.1i 2.6i
18.\" 2.94 went to 2.6, 3.64 to 3.30
19.if n .ta .84i 2.6i 3.30i
20..
21.de _f
22.if t .ta .5i 1.25i 2.5i
23.\" 3.5i went to 3.8i
24.if n .ta .7i 1.75i 3.8i
25..
26The Internet protocol family is a collection of protocols
27layered atop the
28.I Internet Protocol
29(IP) transport layer, and utilizing the Internet address format.
30The Internet family provides protocol support for the
31SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW socket types; the
32SOCK_RAW interface provides access to the IP protocol.
33.SH ADDRESSING
34Internet addresses are four byte quantities, stored in
35network standard format (on the VAX these are word and byte
36reversed). The include file
37.RI < netinet/in.h >
38defines this address
39as a discriminated union.
40.PP
41Sockets bound to the Internet protocol family utilize
42the following addressing structure,
43.sp 1
44.nf
45._f
46struct sockaddr_in {
47 short sin_family;
48 u_short sin_port;
49 struct in_addr sin_addr;
50 char sin_zero[8];
51};
52.sp 1
53.fi
8c7f03f8 54Sockets may be created with the local address INADDR_ANY
97ee408e 55to effect \*(lqwildcard\*(rq matching on incoming messages.
8c7f03f8
MK
56The address in a
57.IR connect (2)
58or
59.IR sendto (2)
60call may be given as INADDR_ANY to mean ``this host.''
61The distinguished address INADDR_BROADCAST
62is allowed as a shorthand for the broadcast address on the primary
63network if the first network configured supports broadcast.
97ee408e
KM
64.SH PROTOCOLS
65The Internet protocol family is comprised of
66the IP transport protocol, Internet Control
67Message Protocol (ICMP), Transmission Control
68Protocol (TCP), and User Datagram Protocol (UDP).
69TCP is used to support the SOCK_STREAM
70abstraction while UDP is used to support the SOCK_DGRAM
71abstraction. A raw interface to IP is available
72by creating an Internet socket of type SOCK_RAW.
8c7f03f8
MK
73The ICMP message protocol is accessible from a raw socket.
74.PP
75The 32-bit Internet address contains both network and host parts.
76It is frequency-encoded; the most-significant bit is clear
77in Class A addresses, in which the high-order 8 bits are the network
78number.
79Class B addresses use the high-order 16 bits as the network field,
80and Class C addresses have a 24-bit network part.
81Sites with a cluster of local networks and a connection to the DARPA
82Internet may chose to use a single network number for the cluster;
83this is done by using subnet addressing.
84The local (host) portion of the address is further subdivided
85into subnet and host parts.
86Within a subnet, each subnet appears to be an individual network;
87externally, the entire cluster appears to be a single, uniform
88network requiring only a single routing entry.
89Subnet addressing is enabled and examined by the following
90.IR ioctl (2)
91commands on a datagram socket in the Internet domain;
92they have the same form as the
93SIOCIFADDR command (see
94.IR intro (4N)).
95.PP
96.TP 20
97SIOCSIFNETMASK
98Set interface network mask.
99The network mask defines the network part of the address;
100if it contains more of the address than the address type would indicate,
101then subnets are in use.
102.TP 20
103SIOCGIFNETMASK
104Get interface network mask.
97ee408e 105.SH SEE ALSO
8c7f03f8 106ioctl(2), socket(2), intro(4N), tcp(4P), udp(4P), ip(4P), icmp(4P)
31c711c1
MS
107.PP
108An Introductory 4.3BSD Interprocess Communication Tutorial (PS1:7).
109.PP
110An Advanced 4.3BSD Interprocess Communication Tutorial (PS1:8).
97ee408e
KM
111.SH CAVEAT
112The Internet protocol support is subject to change as
113the Internet protocols develop. Users should not depend
114on details of the current implementation, but rather
115the services exported.