Commit | Line | Data |
---|---|---|
5ebe7d4b KB |
1 | .\" Copyright (c) 1985, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
c239fd3a | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
c239fd3a | 5 | .\" |
5ebe7d4b | 6 | .\" @(#)idp.4 8.1 (Berkeley) %G% |
1324d254 | 7 | .\" |
9903e566 CL |
8 | .Dd |
9 | .Dt IDP 4 | |
10 | .Os BSD 4.3 | |
11 | .Sh NAME | |
12 | .Nm idp | |
13 | .Nd Xerox Internet Datagram Protocol | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/socket.h> | |
16 | .Fd #include <netns/ns.h> | |
17 | .Fd #include <netns/idp.h> | |
18 | .Ft int | |
19 | .Fn socket AF_NS SOCK_DGRAM 0 | |
20 | .Sh DESCRIPTION | |
21 | .Tn IDP | |
22 | is a simple, unreliable datagram protocol which is used | |
23 | to support the | |
24 | .Dv SOCK_DGRAM | |
25 | abstraction for the Internet | |
26 | protocol family. | |
27 | .Tn IDP | |
28 | sockets are connectionless, and are | |
c239fd3a | 29 | normally used with the |
9903e566 | 30 | .Xr sendto |
c239fd3a | 31 | and |
9903e566 | 32 | .Xr recvfrom |
c239fd3a | 33 | calls, though the |
9903e566 | 34 | .Xr connect 2 |
c239fd3a KS |
35 | call may also be used to fix the destination for future |
36 | packets (in which case the | |
9903e566 | 37 | .Xr recv 2 |
c239fd3a | 38 | or |
9903e566 | 39 | .Xr read 2 |
c239fd3a | 40 | and |
9903e566 | 41 | .Xr send 2 |
c239fd3a | 42 | or |
9903e566 | 43 | .Xr write 2 |
c239fd3a | 44 | system calls may be used). |
9903e566 CL |
45 | .Pp |
46 | Xerox protocols are built vertically on top of | |
47 | .Tn IDP . | |
48 | Thus, | |
49 | .Tn IDP | |
50 | address formats are identical to those used by | |
51 | .Tn SPP . | |
52 | Note that the | |
53 | .Tn IDP | |
54 | port | |
55 | space is the same as the | |
56 | .Tn SPP | |
57 | port space (i.e. a | |
58 | .Tn IDP | |
59 | port | |
60 | may be | |
61 | .Dq connected | |
62 | to a | |
63 | .Tn SPP | |
64 | port, with certain | |
c239fd3a KS |
65 | options enabled below). |
66 | In addition broadcast packets may be sent | |
67 | (assuming the underlying network supports | |
9903e566 CL |
68 | this) by using a reserved |
69 | .Dq broadcast address ; | |
70 | this address | |
c239fd3a | 71 | is network interface dependent. |
9903e566 | 72 | .Sh DIAGNOSTICS |
c239fd3a | 73 | A socket operation may fail with one of the following errors returned: |
9903e566 CL |
74 | .Bl -tag -width [EADDRNOTAVAIL] |
75 | .It Bq Er EISCONN | |
c239fd3a KS |
76 | when trying to establish a connection on a socket which |
77 | already has one, or when trying to send a datagram with the destination | |
78 | address specified and the socket is already connected; | |
9903e566 | 79 | .It Bq Er ENOTCONN |
c239fd3a KS |
80 | when trying to send a datagram, but |
81 | no destination address is specified, and the socket hasn't been | |
82 | connected; | |
9903e566 | 83 | .It Bq Er ENOBUFS |
c239fd3a KS |
84 | when the system runs out of memory for |
85 | an internal data structure; | |
9903e566 | 86 | .It Bq Er EADDRINUSE |
c239fd3a KS |
87 | when an attempt |
88 | is made to create a socket with a port which has already been | |
89 | allocated; | |
9903e566 | 90 | .It Bq Er EADDRNOTAVAIL |
c239fd3a KS |
91 | when an attempt is made to create a |
92 | socket with a network address for which no network interface | |
93 | exists. | |
9903e566 CL |
94 | .El |
95 | .Sh SOCKET OPTIONS | |
96 | .Bl -tag -width [SO_HEADERS_ON_OUTPUT] | |
97 | .It Bq Dv SO_ALL_PACKETS | |
98 | When set, this option defeats automatic processing of Error packets, | |
99 | and Sequence Protocol packets. | |
100 | .It Bq Dv SO_DEFAULT_HEADERS | |
101 | The user provides the kernel an | |
102 | .Tn IDP | |
103 | header, from which | |
104 | it gleans the Packet Type. | |
105 | When requested, the kernel will provide an | |
106 | .Tn IDP | |
107 | header, showing | |
108 | the default packet type, and local and foreign addresses, if | |
109 | connected. | |
110 | .It Bq Dv SO_HEADERS_ON_INPUT | |
c239fd3a | 111 | When set, the first 30 bytes of any data returned from a read |
9903e566 CL |
112 | or recv from will be the initial 30 bytes of the |
113 | .Tn IDP | |
114 | packet, | |
c239fd3a | 115 | as described by |
9903e566 | 116 | .Bd -literal -offset indent |
c239fd3a KS |
117 | struct idp { |
118 | u_short idp_sum; | |
119 | u_short idp_len; | |
120 | u_char idp_tc; | |
121 | u_char idp_pt; | |
122 | struct ns_addr idp_dna; | |
123 | struct ns_addr idp_sna; | |
124 | }; | |
9903e566 CL |
125 | .Ed |
126 | .Pp | |
c239fd3a KS |
127 | This allows the user to determine the packet type, and whether |
128 | the packet was a multi-cast packet or directed specifically at | |
129 | the local host. | |
130 | When requested, gives the current state of the option, | |
9903e566 CL |
131 | .Pf ( Dv NSP_RAWIN |
132 | or 0). | |
133 | .It Bq Dv SO_HEADERS_ON_OUTPUT | |
c239fd3a | 134 | When set, the first 30 bytes of any data sent |
9903e566 CL |
135 | will be the initial 30 bytes of the |
136 | .Tn IDP | |
137 | packet. | |
c239fd3a KS |
138 | This allows the user to determine the packet type, and whether |
139 | the packet should be multi-cast packet or directed specifically at | |
140 | the local host. | |
141 | You can also misrepresent the sender of the packet. | |
142 | When requested, gives the current state of the option. | |
9903e566 CL |
143 | .Pf ( Dv NSP_RAWOUT |
144 | or 0). | |
145 | .It Bq Dv SO_SEQNO | |
c239fd3a KS |
146 | When requested, this returns a sequence number which is not likely |
147 | to be repeated until the machine crashes or a very long time has passed. | |
148 | It is useful in constructing Packet Exchange Protocol packets. | |
9903e566 CL |
149 | .El |
150 | .Sh SEE ALSO | |
151 | .Xr send 2 , | |
152 | .Xr recv 2 , | |
153 | .Xr intro 4 , | |
154 | .Xr ns 4 | |
155 | .Sh HISTORY | |
156 | The | |
157 | .Nm | |
158 | protocol appeared in | |
159 | .Bx 4.3 . |