add PASS8: pass all 8 bits of input
[unix-history] / usr / src / share / man / man4 / spp.4
CommitLineData
6c73177c
KS
1.\" Copyright (c) 1985 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)spp.4 1.1 (Berkeley) %G%
6.\"
7.TH SPP 4P "July 30, 1985"
8.UC 6
9.SH NAME
10spp \- Xerox Sequenced Packet Protocol
11.SH SYNOPSIS
12.B #include <sys/socket.h>
13.br
14.B #include <netns/ns.h>
15.br
16.B s = socket(AF_NS, SOCK_STREAM, 0);
17.PP
18.B #include <netns/sp.h>
19.br
20.B s = socket(AF_NS, SOCK_SEQPACKET, 0);
21.SH DESCRIPTION
22The SPP protocol provides reliable, flow-controlled, two-way
23transmission of data. It is a byte-stream protocol used to
24support the SOCK_STREAM abstraction. SPP uses the standard
25NS(tm) address formats.
26.PP
27Sockets utilizing the SPP protocol are either \*(lqactive\*(rq or
28\*(lqpassive\*(rq. Active sockets initiate connections to passive
29sockets. By default SPP sockets are created active; to create a
30passive socket the
31.IR listen (2)
32system call must be used
33after binding the socket with the
34.IR bind (2)
35system call. Only
36passive sockets may use the
37.IR accept (2)
38call to accept incoming connections. Only active sockets may
39use the
40.IR connect (2)
41call to initiate connections.
42.PP
43Passive sockets may \*(lqunderspecify\*(rq their location to match
44incoming connection requests from multiple networks. This
45technique, termed \*(lqwildcard addressing\*(rq, allows a single
46server to provide service to clients on multiple networks.
47To create a socket which listens on all networks, the NS
48address of all zeroes must be bound.
49The SPP port may still be specified
50at this time; if the port is not specified the system will assign one.
51Once a connection has been established the socket's address is
52fixed by the peer entity's location. The address assigned the
53socket is the address associated with the network interface
54through which packets are being transmitted and received. Normally
55this address corresponds to the peer entity's network.
56.LP
57If the SOCK_SEQPACKET socket type is specified,
58each packet received has the actual 12 byte sequenced packet header
59left for the user to inspect:
60.nf
61struct sphdr {
62 u_char sp_cc; /* \fIconnection control\fP */
63#define SP_EM 0x10 /* \fIend of message\fP */
64 u_char sp_dt; /* \fIdatastream type\fP */
65 u_short sp_sid;
66 u_short sp_did;
67 u_short sp_seq;
68 u_short sp_ack;
69 u_short sp_alo;
70};
71.fi
72This facilitates the implementation of higher level Xerox protocols
73which make use of the data stream type field and the end of message bit.
74Conversely, the user is required to supply a 12 byte header,
75the only part of which inspected is the data stream type and end of message
76fields.
77.LP
78For either socket type,
79packets received with the Attention bit sent are interpreted as
80out of band data. Data sent with send(..., ..., ..., MSG_OOB)
81cause the attention bit to be set.
82.SH DIAGNOSTICS
83A socket operation may fail with one of the following errors returned:
84.TP 20
85[EISCONN]
86when trying to establish a connection on a socket which
87already has one;
88.TP 20
89[ENOBUFS]
90when the system runs out of memory for
91an internal data structure;
92.TP 20
93[ETIMEDOUT]
94when a connection was dropped
95due to excessive retransmissions;
96.TP 20
97[ECONNRESET]
98when the remote peer
99forces the connection to be closed;
100.TP 20
101[ECONNREFUSED]
102when the remote
103peer actively refuses connection establishment (usually because
104no process is listening to the port);
105.TP 20
106[EADDRINUSE]
107when an attempt
108is made to create a socket with a port which has already been
109allocated;
110.TP 20
111[EADDRNOTAVAIL]
112when an attempt is made to create a
113socket with a network address for which no network interface
114exists.
115.SH SOCKET OPTIONS
116.TP 20
117SO_DEFAULT_HEADERS
118when set, this determines the data stream type and whether
119the end of message bit is to be set on every ensuing packet.
120.SH SEE ALSO
121intro(4N), ns(4F)
122.SH BUGS
123There should be a socket option to increase the nominal
124maximum SPP packet size.
125There should be some way to reflect record boundaries in
126a stream.
127For stream mode, there should be an option to get the data stream type of
128the record the user process is about to receive.