xref: /csrg-svn/share/man/man4/idp.4 (revision 47675)
1*47675Scael.\" Copyright (c) 1985, 1991 The Regents of the University of California.
236752Sbostic.\" All rights reserved.
324104Ssklower.\"
443581Strent.\" %sccs.include.redist.man%
524104Ssklower.\"
6*47675Scael.\"     @(#)idp.4	1.4 (Berkeley) 03/28/91
736752Sbostic.\"
8*47675Scael.Dd
9*47675Scael.Dt IDP 4
10*47675Scael.Os BSD 4.3
11*47675Scael.Sh NAME
12*47675Scael.Nm idp
13*47675Scael.Nd Xerox Internet Datagram Protocol
14*47675Scael.Sh SYNOPSIS
15*47675Scael.Fd #include <sys/socket.h>
16*47675Scael.Fd #include <netns/ns.h>
17*47675Scael.Fd #include <netns/idp.h>
18*47675Scael.Ft int
19*47675Scael.Fn socket AF_NS SOCK_DGRAM 0
20*47675Scael.Sh DESCRIPTION
21*47675Scael.Tn IDP
22*47675Scaelis a simple, unreliable datagram protocol which is used
23*47675Scaelto support the
24*47675Scael.Dv SOCK_DGRAM
25*47675Scaelabstraction for the Internet
26*47675Scaelprotocol family.
27*47675Scael.Tn IDP
28*47675Scaelsockets are connectionless, and are
2924104Ssklowernormally used with the
30*47675Scael.Xr sendto
3124104Ssklowerand
32*47675Scael.Xr recvfrom
3324104Ssklowercalls, though the
34*47675Scael.Xr connect 2
3524104Ssklowercall may also be used to fix the destination for future
3624104Ssklowerpackets (in which case the
37*47675Scael.Xr recv 2
3824104Sskloweror
39*47675Scael.Xr read 2
4024104Ssklowerand
41*47675Scael.Xr send 2
4224104Sskloweror
43*47675Scael.Xr write 2
4424104Ssklowersystem calls may be used).
45*47675Scael.Pp
46*47675ScaelXerox protocols are built vertically on top of
47*47675Scael.Tn IDP .
48*47675ScaelThus,
49*47675Scael.Tn IDP
50*47675Scaeladdress formats are identical to those used by
51*47675Scael.Tn SPP .
52*47675ScaelNote that the
53*47675Scael.Tn IDP
54*47675Scaelport
55*47675Scaelspace is the same as the
56*47675Scael.Tn SPP
57*47675Scaelport space (i.e. a
58*47675Scael.Tn IDP
59*47675Scaelport
60*47675Scaelmay be
61*47675Scael.Dq connected
62*47675Scaelto a
63*47675Scael.Tn SPP
64*47675Scaelport, with certain
6524104Sskloweroptions enabled below).
6624104SsklowerIn addition broadcast packets may be sent
6724104Ssklower(assuming the underlying network supports
68*47675Scaelthis) by using a reserved
69*47675Scael.Dq broadcast address ;
70*47675Scaelthis address
7124104Sskloweris network interface dependent.
72*47675Scael.Sh DIAGNOSTICS
7324104SsklowerA socket operation may fail with one of the following errors returned:
74*47675Scael.Bl -tag -width [EADDRNOTAVAIL]
75*47675Scael.It Bq Er EISCONN
7624104Ssklowerwhen trying to establish a connection on a socket which
7724104Sskloweralready has one, or when trying to send a datagram with the destination
7824104Sskloweraddress specified and the socket is already connected;
79*47675Scael.It Bq Er ENOTCONN
8024104Ssklowerwhen trying to send a datagram, but
8124104Ssklowerno destination address is specified, and the socket hasn't been
8224104Ssklowerconnected;
83*47675Scael.It Bq Er ENOBUFS
8424104Ssklowerwhen the system runs out of memory for
8524104Sskloweran internal data structure;
86*47675Scael.It Bq Er EADDRINUSE
8724104Ssklowerwhen an attempt
8824104Sskloweris made to create a socket with a port which has already been
8924104Ssklowerallocated;
90*47675Scael.It Bq Er EADDRNOTAVAIL
9124104Ssklowerwhen an attempt is made to create a
9224104Ssklowersocket with a network address for which no network interface
9324104Ssklowerexists.
94*47675Scael.El
95*47675Scael.Sh SOCKET OPTIONS
96*47675Scael.Bl -tag -width [SO_HEADERS_ON_OUTPUT]
97*47675Scael.It Bq Dv SO_ALL_PACKETS
98*47675ScaelWhen set, this option defeats automatic processing of Error packets,
99*47675Scaeland Sequence Protocol packets.
100*47675Scael.It Bq Dv SO_DEFAULT_HEADERS
101*47675ScaelThe user provides the kernel an
102*47675Scael.Tn IDP
103*47675Scaelheader, from which
104*47675Scaelit gleans the Packet Type.
105*47675ScaelWhen requested, the kernel will provide an
106*47675Scael.Tn IDP
107*47675Scaelheader, showing
108*47675Scaelthe default packet type, and local and foreign addresses, if
109*47675Scaelconnected.
110*47675Scael.It Bq Dv SO_HEADERS_ON_INPUT
11124104SsklowerWhen set, the first 30 bytes of any data returned from a read
112*47675Scaelor recv from will be the initial 30 bytes of the
113*47675Scael.Tn IDP
114*47675Scaelpacket,
11524104Sskloweras described by
116*47675Scael.Bd -literal -offset indent
11724104Ssklowerstruct idp {
11824104Ssklower	u_short		idp_sum;
11924104Ssklower	u_short		idp_len;
12024104Ssklower	u_char		idp_tc;
12124104Ssklower	u_char		idp_pt;
12224104Ssklower	struct ns_addr	idp_dna;
12324104Ssklower	struct ns_addr	idp_sna;
12424104Ssklower};
125*47675Scael.Ed
126*47675Scael.Pp
12724104SsklowerThis allows the user to determine the packet type, and whether
12824104Ssklowerthe packet was a multi-cast packet or directed specifically at
12924104Ssklowerthe local host.
13024104SsklowerWhen requested, gives the current state of the option,
131*47675Scael.Pf ( Dv NSP_RAWIN
132*47675Scaelor 0).
133*47675Scael.It Bq Dv SO_HEADERS_ON_OUTPUT
13424104SsklowerWhen set, the first 30 bytes of any data sent
135*47675Scaelwill be the initial 30 bytes of the
136*47675Scael.Tn IDP
137*47675Scaelpacket.
13824104SsklowerThis allows the user to determine the packet type, and whether
13924104Ssklowerthe packet should be multi-cast packet or directed specifically at
14024104Ssklowerthe local host.
14124104SsklowerYou can also misrepresent the sender of the packet.
14224104SsklowerWhen requested, gives the current state of the option.
143*47675Scael.Pf ( Dv NSP_RAWOUT
144*47675Scaelor 0).
145*47675Scael.It Bq Dv SO_SEQNO
14624104SsklowerWhen requested, this returns a sequence number which is not likely
14724104Ssklowerto be repeated until the machine crashes or a very long time has passed.
14824104SsklowerIt is useful in constructing Packet Exchange Protocol packets.
149*47675Scael.El
150*47675Scael.Sh SEE ALSO
151*47675Scael.Xr send 2 ,
152*47675Scael.Xr recv 2 ,
153*47675Scael.Xr intro 4 ,
154*47675Scael.Xr ns 4
155*47675Scael.Sh HISTORY
156*47675ScaelThe
157*47675Scael.Nm
158*47675Scaelprotocol appeared in
159*47675Scael.Bx 4.3 .
160