4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / share / man / man4 / idp.4
CommitLineData
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
22is a simple, unreliable datagram protocol which is used
23to support the
24.Dv SOCK_DGRAM
25abstraction for the Internet
26protocol family.
27.Tn IDP
28sockets are connectionless, and are
c239fd3a 29normally used with the
9903e566 30.Xr sendto
c239fd3a 31and
9903e566 32.Xr recvfrom
c239fd3a 33calls, though the
9903e566 34.Xr connect 2
c239fd3a
KS
35call may also be used to fix the destination for future
36packets (in which case the
9903e566 37.Xr recv 2
c239fd3a 38or
9903e566 39.Xr read 2
c239fd3a 40and
9903e566 41.Xr send 2
c239fd3a 42or
9903e566 43.Xr write 2
c239fd3a 44system calls may be used).
9903e566
CL
45.Pp
46Xerox protocols are built vertically on top of
47.Tn IDP .
48Thus,
49.Tn IDP
50address formats are identical to those used by
51.Tn SPP .
52Note that the
53.Tn IDP
54port
55space is the same as the
56.Tn SPP
57port space (i.e. a
58.Tn IDP
59port
60may be
61.Dq connected
62to a
63.Tn SPP
64port, with certain
c239fd3a
KS
65options enabled below).
66In addition broadcast packets may be sent
67(assuming the underlying network supports
9903e566
CL
68this) by using a reserved
69.Dq broadcast address ;
70this address
c239fd3a 71is network interface dependent.
9903e566 72.Sh DIAGNOSTICS
c239fd3a 73A 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
76when trying to establish a connection on a socket which
77already has one, or when trying to send a datagram with the destination
78address specified and the socket is already connected;
9903e566 79.It Bq Er ENOTCONN
c239fd3a
KS
80when trying to send a datagram, but
81no destination address is specified, and the socket hasn't been
82connected;
9903e566 83.It Bq Er ENOBUFS
c239fd3a
KS
84when the system runs out of memory for
85an internal data structure;
9903e566 86.It Bq Er EADDRINUSE
c239fd3a
KS
87when an attempt
88is made to create a socket with a port which has already been
89allocated;
9903e566 90.It Bq Er EADDRNOTAVAIL
c239fd3a
KS
91when an attempt is made to create a
92socket with a network address for which no network interface
93exists.
9903e566
CL
94.El
95.Sh SOCKET OPTIONS
96.Bl -tag -width [SO_HEADERS_ON_OUTPUT]
97.It Bq Dv SO_ALL_PACKETS
98When set, this option defeats automatic processing of Error packets,
99and Sequence Protocol packets.
100.It Bq Dv SO_DEFAULT_HEADERS
101The user provides the kernel an
102.Tn IDP
103header, from which
104it gleans the Packet Type.
105When requested, the kernel will provide an
106.Tn IDP
107header, showing
108the default packet type, and local and foreign addresses, if
109connected.
110.It Bq Dv SO_HEADERS_ON_INPUT
c239fd3a 111When set, the first 30 bytes of any data returned from a read
9903e566
CL
112or recv from will be the initial 30 bytes of the
113.Tn IDP
114packet,
c239fd3a 115as described by
9903e566 116.Bd -literal -offset indent
c239fd3a
KS
117struct 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
127This allows the user to determine the packet type, and whether
128the packet was a multi-cast packet or directed specifically at
129the local host.
130When requested, gives the current state of the option,
9903e566
CL
131.Pf ( Dv NSP_RAWIN
132or 0).
133.It Bq Dv SO_HEADERS_ON_OUTPUT
c239fd3a 134When set, the first 30 bytes of any data sent
9903e566
CL
135will be the initial 30 bytes of the
136.Tn IDP
137packet.
c239fd3a
KS
138This allows the user to determine the packet type, and whether
139the packet should be multi-cast packet or directed specifically at
140the local host.
141You can also misrepresent the sender of the packet.
142When requested, gives the current state of the option.
9903e566
CL
143.Pf ( Dv NSP_RAWOUT
144or 0).
145.It Bq Dv SO_SEQNO
c239fd3a
KS
146When requested, this returns a sequence number which is not likely
147to be repeated until the machine crashes or a very long time has passed.
148It 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
156The
157.Nm
158protocol appeared in
159.Bx 4.3 .