xref: /386bsd/usr/share/man/cat4/ip.0 (revision a2142627)
1IP(4)                     386BSD Programmer's Manual                     IP(4)
2
3NNAAMMEE
4     iipp - Internet Protocol
5
6SSYYNNOOPPSSIISS
7     MMaakkeeffiillee::
8     $$((NNOONNSSTTDDIINNCC)) ++== $$((IINNCCNNEETT))
9     CC::
10     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
11     ##iinncclluuddee ""iinn..hh""
12
13     _i_n_t
14     ssoocckkeett(_A_F__I_N_E_T, _S_O_C_K__R_A_W, _p_r_o_t_o)
15
16DDEESSCCRRIIPPTTIIOONN
17     IP is the transport layer protocol used by the Internet protocol family.
18     Options may be set at the IP level when using higher-level protocols that
19     are based on IP (such as TCP and UDP). It may also be accessed through a
20     ``raw socket'' when developing new protocols, or special purpose
21     applications.
22
23     A single generic option is supported at the IP level, IP_OPTIONS, that
24     may be used to provide IP options to be transmitted in the IP header of
25     each outgoing packet.  Options are set with setsockopt(2) and examined
26     with getsockopt(2).  The format of IP options to be sent is that
27     specified by the IP protocol specification, with one exception: the list
28     of addresses for Source Route options must include the first-hop gateway
29     at the beginning of the list of gateways.  The first-hop gateway address
30     will be extracted from the option list and the size adjusted accordingly
31     before use.  IP options may be used with any socket type in the Internet
32     family.
33
34     Raw IP sockets are connectionless, and are normally used with the sendto
35     and recvfrom calls, though the connect(2) call may also be used to fix
36     the destination for future packets (in which case the read(2) or recv(2)
37     and write(2) or send(2) system calls may be used).
38
39     If _p_r_o_t_o is 0, the default protocol IPPROTO_RAW is used for outgoing
40     packets, and only incoming packets destined for that protocol are
41     received.  If _p_r_o_t_o is non-zero, that protocol number will be used on
42     outgoing packets and to filter incoming packets.
43
44     Outgoing packets automatically have an IP header prepended to them (based
45     on the destination address and the protocol number the socket is created
46     with).  Incoming packets are received with IP header and options intact.
47
48DDIIAAGGNNOOSSTTIICCSS
49     A socket operation may fail with one of the following errors returned:
50
51     [EISCONN]        when trying to establish a connection on a socket which
52                      already has one, or when trying to send a datagram with
53                      the destination address specified and the socket is
54                      already connected;
55
56     [ENOTCONN]       when trying to send a datagram, but no destination
57                      address is specified, and the socket hasn't been
58                      connected;
59
60     [ENOBUFS]        when the system runs out of memory for an internal data
61                      structure;
62
63     [EADDRNOTAVAIL]  when an attempt is made to create a socket with a
64                      network address for which no network interface exists.
65
66
67     The following errors specific to IP may occur when setting or getting IP
68     options:
69
70     [EINVAL]         An unknown socket option name was given.
71
72     [EINVAL]         The IP option field was improperly formed; an option
73                      field was shorter than the minimum value or longer than
74                      the option buffer provided.
75
76SSEEEE AALLSSOO
77     getsockopt(2),  send(2),  recv(2),  intro(4),  icmp(4),  inet(4)
78
79HHIISSTTOORRYY
80     The iipp protocol appeared in 4.2BSD.
81
824.2 Berkeley Distribution       March 28, 1991                               2
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133