Remove unnecessary references to the ``U word''. AF_UNIX is still there,
[unix-history] / share / man / man4 / spp.4
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1985, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)spp.4 1.5 (Berkeley) 3/28/91
33.\"
34.Dd March 28, 1991
35.Dt SPP 4
36.Os BSD 4.3
37.Sh NAME
38.Nm spp
39.Nd Xerox Sequenced Packet Protocol
40.Sh SYNOPSIS
41.Fd #include <sys/socket.h>
42.Fd #include <netns/ns.h>
43.Fd #include <netns/sp.h>
44.Ft int
45.Fn socket AF_NS SOCK_STREAM 0
46.Ft int
47.Fn socket AF_NS SOCK_SEQPACKET 0
48.Sh DESCRIPTION
49The
50.Tn SPP
51protocol provides reliable, flow-controlled, two-way
52transmission of data. It is a byte-stream protocol used to
53support the
54.Dv SOCK_STREAM
55abstraction.
56.Tn SPP
57uses the standard
58.Tn NS Ns (tm)
59address formats.
60.Pp
61Sockets utilizing the
62.Tn SPP
63protocol are either
64.Dq active
65or
66.Dq passive .
67Active sockets initiate connections to passive
68sockets. By default
69.Tn SPP
70sockets are created active; to create a
71passive socket the
72.Xr listen 2
73system call must be used
74after binding the socket with the
75.Xr bind 2
76system call. Only
77passive sockets may use the
78.Xr accept 2
79call to accept incoming connections. Only active sockets may
80use the
81.Xr connect 2
82call to initiate connections.
83.Pp
84Passive sockets may
85.Dq underspecify
86their location to match
87incoming connection requests from multiple networks. This
88technique, termed
89.Dq wildcard addressing ,
90allows a single
91server to provide service to clients on multiple networks.
92To create a socket which listens on all networks, the
93.Tn NS
94address of all zeroes must be bound.
95The
96.Tn SPP
97port may still be specified
98at this time; if the port is not specified the system will assign one.
99Once a connection has been established the socket's address is
100fixed by the peer entity's location. The address assigned the
101socket is the address associated with the network interface
102through which packets are being transmitted and received. Normally
103this address corresponds to the peer entity's network.
104.Pp
105If the
106.Dv SOCK_SEQPACKET
107socket type is specified,
108each packet received has the actual 12 byte sequenced packet header
109left for the user to inspect:
110.Bd -literal -offset indent
111struct sphdr {
112 u_char sp_cc; /* connection control */
113#define SP_EM 0x10 /* end of message */
114 u_char sp_dt; /* datastream type */
115 u_short sp_sid;
116 u_short sp_did;
117 u_short sp_seq;
118 u_short sp_ack;
119 u_short sp_alo;
120};
121.Ed
122.Pp
123This facilitates the implementation of higher level Xerox protocols
124which make use of the data stream type field and the end of message bit.
125Conversely, the user is required to supply a 12 byte header,
126the only part of which inspected is the data stream type and end of message
127fields.
128.Pp
129For either socket type,
130packets received with the Attention bit sent are interpreted as
131out of band data. Data sent with
132.Dq send(..., ..., ..., Dv MSG_OOB )
133cause the attention bit to be set.
134.Sh DIAGNOSTICS
135A socket operation may fail with one of the following errors returned:
136.Bl -tag -width [EADDRNOTAVAIL]
137.It Bq Er EISCONN
138when trying to establish a connection on a socket which
139already has one;
140.It Bq Er ENOBUFS
141when the system runs out of memory for
142an internal data structure;
143.It Bq Er ETIMEDOUT
144when a connection was dropped
145due to excessive retransmissions;
146.It Bq Er ECONNRESET
147when the remote peer
148forces the connection to be closed;
149.It Bq Er ECONNREFUSED
150when the remote
151peer actively refuses connection establishment (usually because
152no process is listening to the port);
153.It Bq Er EADDRINUSE
154when an attempt
155is made to create a socket with a port which has already been
156allocated;
157.It Bq Er EADDRNOTAVAIL
158when an attempt is made to create a
159socket with a network address for which no network interface
160exists.
161.El
162.Sh SOCKET OPTIONS
163.Bl -tag -width SO_DEFAULT_HEADERS
164.It Dv SO_DEFAULT_HEADERS
165when set, this determines the data stream type and whether
166the end of message bit is to be set on every ensuing packet.
167.It Dv SO_MTU
168This specifies the maximum ammount of user data in a single packet.
169The default is 576 bytes - sizeof(struct spidp). This quantity
170affects windowing \- increasing it without increasing the amount
171of buffering in the socket will lower the number of unread packets
172accepted. Anything larger than the default will not be forwarded
173by a bona fide
174.Tn XEROX
175product internetwork router.
176The data argument for the setsockopt call must be
177an unsigned short.
178.El
179.Sh SEE ALSO
180.Xr intro 4 ,
181.Xr ns 4
182.Sh HISTORY
183The
184.Nm
185protocol appeared in
186.Bx 4.3 .
187.Sh BUGS
188There should be some way to reflect record boundaries in
189a stream.
190For stream mode, there should be an option to get the data stream type of
191the record the user process is about to receive.