1.\" Copyright (c) 1985, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)idp.4 8.1 (Berkeley) 06/05/93 7.\" 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 29normally used with the 30.Xr sendto 31and 32.Xr recvfrom 33calls, though the 34.Xr connect 2 35call may also be used to fix the destination for future 36packets (in which case the 37.Xr recv 2 38or 39.Xr read 2 40and 41.Xr send 2 42or 43.Xr write 2 44system calls may be used). 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 65options enabled below). 66In addition broadcast packets may be sent 67(assuming the underlying network supports 68this) by using a reserved 69.Dq broadcast address ; 70this address 71is network interface dependent. 72.Sh DIAGNOSTICS 73A socket operation may fail with one of the following errors returned: 74.Bl -tag -width [EADDRNOTAVAIL] 75.It Bq Er EISCONN 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; 79.It Bq Er ENOTCONN 80when trying to send a datagram, but 81no destination address is specified, and the socket hasn't been 82connected; 83.It Bq Er ENOBUFS 84when the system runs out of memory for 85an internal data structure; 86.It Bq Er EADDRINUSE 87when an attempt 88is made to create a socket with a port which has already been 89allocated; 90.It Bq Er EADDRNOTAVAIL 91when an attempt is made to create a 92socket with a network address for which no network interface 93exists. 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 111When set, the first 30 bytes of any data returned from a read 112or recv from will be the initial 30 bytes of the 113.Tn IDP 114packet, 115as described by 116.Bd -literal -offset indent 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}; 125.Ed 126.Pp 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, 131.Pf ( Dv NSP_RAWIN 132or 0). 133.It Bq Dv SO_HEADERS_ON_OUTPUT 134When set, the first 30 bytes of any data sent 135will be the initial 30 bytes of the 136.Tn IDP 137packet. 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. 143.Pf ( Dv NSP_RAWOUT 144or 0). 145.It Bq Dv SO_SEQNO 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. 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 . 160