xref: /csrg-svn/share/man/man4/idp.4 (revision 61597)
1*61597Sbostic.\" Copyright (c) 1985, 1991, 1993
2*61597Sbostic.\"	The Regents of the University of California.  All rights reserved.
324104Ssklower.\"
443581Strent.\" %sccs.include.redist.man%
524104Ssklower.\"
6*61597Sbostic.\"     @(#)idp.4	8.1 (Berkeley) 06/05/93
736752Sbostic.\"
847675Scael.Dd
947675Scael.Dt IDP 4
1047675Scael.Os BSD 4.3
1147675Scael.Sh NAME
1247675Scael.Nm idp
1347675Scael.Nd Xerox Internet Datagram Protocol
1447675Scael.Sh SYNOPSIS
1547675Scael.Fd #include <sys/socket.h>
1647675Scael.Fd #include <netns/ns.h>
1747675Scael.Fd #include <netns/idp.h>
1847675Scael.Ft int
1947675Scael.Fn socket AF_NS SOCK_DGRAM 0
2047675Scael.Sh DESCRIPTION
2147675Scael.Tn IDP
2247675Scaelis a simple, unreliable datagram protocol which is used
2347675Scaelto support the
2447675Scael.Dv SOCK_DGRAM
2547675Scaelabstraction for the Internet
2647675Scaelprotocol family.
2747675Scael.Tn IDP
2847675Scaelsockets are connectionless, and are
2924104Ssklowernormally used with the
3047675Scael.Xr sendto
3124104Ssklowerand
3247675Scael.Xr recvfrom
3324104Ssklowercalls, though the
3447675Scael.Xr connect 2
3524104Ssklowercall may also be used to fix the destination for future
3624104Ssklowerpackets (in which case the
3747675Scael.Xr recv 2
3824104Sskloweror
3947675Scael.Xr read 2
4024104Ssklowerand
4147675Scael.Xr send 2
4224104Sskloweror
4347675Scael.Xr write 2
4424104Ssklowersystem calls may be used).
4547675Scael.Pp
4647675ScaelXerox protocols are built vertically on top of
4747675Scael.Tn IDP .
4847675ScaelThus,
4947675Scael.Tn IDP
5047675Scaeladdress formats are identical to those used by
5147675Scael.Tn SPP .
5247675ScaelNote that the
5347675Scael.Tn IDP
5447675Scaelport
5547675Scaelspace is the same as the
5647675Scael.Tn SPP
5747675Scaelport space (i.e. a
5847675Scael.Tn IDP
5947675Scaelport
6047675Scaelmay be
6147675Scael.Dq connected
6247675Scaelto a
6347675Scael.Tn SPP
6447675Scaelport, with certain
6524104Sskloweroptions enabled below).
6624104SsklowerIn addition broadcast packets may be sent
6724104Ssklower(assuming the underlying network supports
6847675Scaelthis) by using a reserved
6947675Scael.Dq broadcast address ;
7047675Scaelthis address
7124104Sskloweris network interface dependent.
7247675Scael.Sh DIAGNOSTICS
7324104SsklowerA socket operation may fail with one of the following errors returned:
7447675Scael.Bl -tag -width [EADDRNOTAVAIL]
7547675Scael.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;
7947675Scael.It Bq Er ENOTCONN
8024104Ssklowerwhen trying to send a datagram, but
8124104Ssklowerno destination address is specified, and the socket hasn't been
8224104Ssklowerconnected;
8347675Scael.It Bq Er ENOBUFS
8424104Ssklowerwhen the system runs out of memory for
8524104Sskloweran internal data structure;
8647675Scael.It Bq Er EADDRINUSE
8724104Ssklowerwhen an attempt
8824104Sskloweris made to create a socket with a port which has already been
8924104Ssklowerallocated;
9047675Scael.It Bq Er EADDRNOTAVAIL
9124104Ssklowerwhen an attempt is made to create a
9224104Ssklowersocket with a network address for which no network interface
9324104Ssklowerexists.
9447675Scael.El
9547675Scael.Sh SOCKET OPTIONS
9647675Scael.Bl -tag -width [SO_HEADERS_ON_OUTPUT]
9747675Scael.It Bq Dv SO_ALL_PACKETS
9847675ScaelWhen set, this option defeats automatic processing of Error packets,
9947675Scaeland Sequence Protocol packets.
10047675Scael.It Bq Dv SO_DEFAULT_HEADERS
10147675ScaelThe user provides the kernel an
10247675Scael.Tn IDP
10347675Scaelheader, from which
10447675Scaelit gleans the Packet Type.
10547675ScaelWhen requested, the kernel will provide an
10647675Scael.Tn IDP
10747675Scaelheader, showing
10847675Scaelthe default packet type, and local and foreign addresses, if
10947675Scaelconnected.
11047675Scael.It Bq Dv SO_HEADERS_ON_INPUT
11124104SsklowerWhen set, the first 30 bytes of any data returned from a read
11247675Scaelor recv from will be the initial 30 bytes of the
11347675Scael.Tn IDP
11447675Scaelpacket,
11524104Sskloweras described by
11647675Scael.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};
12547675Scael.Ed
12647675Scael.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,
13147675Scael.Pf ( Dv NSP_RAWIN
13247675Scaelor 0).
13347675Scael.It Bq Dv SO_HEADERS_ON_OUTPUT
13424104SsklowerWhen set, the first 30 bytes of any data sent
13547675Scaelwill be the initial 30 bytes of the
13647675Scael.Tn IDP
13747675Scaelpacket.
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.
14347675Scael.Pf ( Dv NSP_RAWOUT
14447675Scaelor 0).
14547675Scael.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.
14947675Scael.El
15047675Scael.Sh SEE ALSO
15147675Scael.Xr send 2 ,
15247675Scael.Xr recv 2 ,
15347675Scael.Xr intro 4 ,
15447675Scael.Xr ns 4
15547675Scael.Sh HISTORY
15647675ScaelThe
15747675Scael.Nm
15847675Scaelprotocol appeared in
15947675Scael.Bx 4.3 .
160