Commit | Line | Data |
---|---|---|
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 | |
10 | inet \- 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 | .. | |
26 | The Internet protocol family is a collection of protocols | |
27 | layered atop the | |
28 | .I Internet Protocol | |
29 | (IP) transport layer, and utilizing the Internet address format. | |
30 | The Internet family provides protocol support for the | |
31 | SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW socket types; the | |
32 | SOCK_RAW interface provides access to the IP protocol. | |
33 | .SH ADDRESSING | |
34 | Internet addresses are four byte quantities, stored in | |
35 | network standard format (on the VAX these are word and byte | |
36 | reversed). The include file | |
37 | .RI < netinet/in.h > | |
38 | defines this address | |
39 | as a discriminated union. | |
40 | .PP | |
41 | Sockets bound to the Internet protocol family utilize | |
42 | the following addressing structure, | |
43 | .sp 1 | |
44 | .nf | |
45 | ._f | |
46 | struct 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 | 54 | Sockets may be created with the local address INADDR_ANY |
97ee408e | 55 | to effect \*(lqwildcard\*(rq matching on incoming messages. |
8c7f03f8 MK |
56 | The address in a |
57 | .IR connect (2) | |
58 | or | |
59 | .IR sendto (2) | |
60 | call may be given as INADDR_ANY to mean ``this host.'' | |
61 | The distinguished address INADDR_BROADCAST | |
62 | is allowed as a shorthand for the broadcast address on the primary | |
63 | network if the first network configured supports broadcast. | |
97ee408e KM |
64 | .SH PROTOCOLS |
65 | The Internet protocol family is comprised of | |
66 | the IP transport protocol, Internet Control | |
67 | Message Protocol (ICMP), Transmission Control | |
68 | Protocol (TCP), and User Datagram Protocol (UDP). | |
69 | TCP is used to support the SOCK_STREAM | |
70 | abstraction while UDP is used to support the SOCK_DGRAM | |
71 | abstraction. A raw interface to IP is available | |
72 | by creating an Internet socket of type SOCK_RAW. | |
8c7f03f8 MK |
73 | The ICMP message protocol is accessible from a raw socket. |
74 | .PP | |
75 | The 32-bit Internet address contains both network and host parts. | |
76 | It is frequency-encoded; the most-significant bit is clear | |
77 | in Class A addresses, in which the high-order 8 bits are the network | |
78 | number. | |
79 | Class B addresses use the high-order 16 bits as the network field, | |
80 | and Class C addresses have a 24-bit network part. | |
81 | Sites with a cluster of local networks and a connection to the DARPA | |
82 | Internet may chose to use a single network number for the cluster; | |
83 | this is done by using subnet addressing. | |
84 | The local (host) portion of the address is further subdivided | |
85 | into subnet and host parts. | |
86 | Within a subnet, each subnet appears to be an individual network; | |
87 | externally, the entire cluster appears to be a single, uniform | |
88 | network requiring only a single routing entry. | |
89 | Subnet addressing is enabled and examined by the following | |
90 | .IR ioctl (2) | |
91 | commands on a datagram socket in the Internet domain; | |
92 | they have the same form as the | |
93 | SIOCIFADDR command (see | |
94 | .IR intro (4N)). | |
95 | .PP | |
96 | .TP 20 | |
97 | SIOCSIFNETMASK | |
98 | Set interface network mask. | |
99 | The network mask defines the network part of the address; | |
100 | if it contains more of the address than the address type would indicate, | |
101 | then subnets are in use. | |
102 | .TP 20 | |
103 | SIOCGIFNETMASK | |
104 | Get interface network mask. | |
97ee408e | 105 | .SH SEE ALSO |
8c7f03f8 | 106 | ioctl(2), socket(2), intro(4N), tcp(4P), udp(4P), ip(4P), icmp(4P) |
31c711c1 MS |
107 | .PP |
108 | An Introductory 4.3BSD Interprocess Communication Tutorial (PS1:7). | |
109 | .PP | |
110 | An Advanced 4.3BSD Interprocess Communication Tutorial (PS1:8). | |
97ee408e KM |
111 | .SH CAVEAT |
112 | The Internet protocol support is subject to change as | |
113 | the Internet protocols develop. Users should not depend | |
114 | on details of the current implementation, but rather | |
115 | the services exported. |