Commit | Line | Data |
---|---|---|
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 | .\" | |
7e5db945 | 5 | .\" @(#)spp.4 1.2 (Berkeley) %G% |
6c73177c KS |
6 | .\" |
7 | .TH SPP 4P "July 30, 1985" | |
8 | .UC 6 | |
9 | .SH NAME | |
10 | spp \- 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 | |
22 | The SPP protocol provides reliable, flow-controlled, two-way | |
23 | transmission of data. It is a byte-stream protocol used to | |
24 | support the SOCK_STREAM abstraction. SPP uses the standard | |
25 | NS(tm) address formats. | |
26 | .PP | |
27 | Sockets utilizing the SPP protocol are either \*(lqactive\*(rq or | |
28 | \*(lqpassive\*(rq. Active sockets initiate connections to passive | |
29 | sockets. By default SPP sockets are created active; to create a | |
30 | passive socket the | |
31 | .IR listen (2) | |
32 | system call must be used | |
33 | after binding the socket with the | |
34 | .IR bind (2) | |
35 | system call. Only | |
36 | passive sockets may use the | |
37 | .IR accept (2) | |
38 | call to accept incoming connections. Only active sockets may | |
39 | use the | |
40 | .IR connect (2) | |
41 | call to initiate connections. | |
42 | .PP | |
43 | Passive sockets may \*(lqunderspecify\*(rq their location to match | |
44 | incoming connection requests from multiple networks. This | |
45 | technique, termed \*(lqwildcard addressing\*(rq, allows a single | |
46 | server to provide service to clients on multiple networks. | |
47 | To create a socket which listens on all networks, the NS | |
48 | address of all zeroes must be bound. | |
49 | The SPP port may still be specified | |
50 | at this time; if the port is not specified the system will assign one. | |
51 | Once a connection has been established the socket's address is | |
52 | fixed by the peer entity's location. The address assigned the | |
53 | socket is the address associated with the network interface | |
54 | through which packets are being transmitted and received. Normally | |
55 | this address corresponds to the peer entity's network. | |
56 | .LP | |
57 | If the SOCK_SEQPACKET socket type is specified, | |
58 | each packet received has the actual 12 byte sequenced packet header | |
59 | left for the user to inspect: | |
60 | .nf | |
61 | struct 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 | |
72 | This facilitates the implementation of higher level Xerox protocols | |
73 | which make use of the data stream type field and the end of message bit. | |
74 | Conversely, the user is required to supply a 12 byte header, | |
75 | the only part of which inspected is the data stream type and end of message | |
76 | fields. | |
77 | .LP | |
78 | For either socket type, | |
79 | packets received with the Attention bit sent are interpreted as | |
80 | out of band data. Data sent with send(..., ..., ..., MSG_OOB) | |
81 | cause the attention bit to be set. | |
82 | .SH DIAGNOSTICS | |
83 | A socket operation may fail with one of the following errors returned: | |
84 | .TP 20 | |
85 | [EISCONN] | |
86 | when trying to establish a connection on a socket which | |
87 | already has one; | |
88 | .TP 20 | |
89 | [ENOBUFS] | |
90 | when the system runs out of memory for | |
91 | an internal data structure; | |
92 | .TP 20 | |
93 | [ETIMEDOUT] | |
94 | when a connection was dropped | |
95 | due to excessive retransmissions; | |
96 | .TP 20 | |
97 | [ECONNRESET] | |
98 | when the remote peer | |
99 | forces the connection to be closed; | |
100 | .TP 20 | |
101 | [ECONNREFUSED] | |
102 | when the remote | |
103 | peer actively refuses connection establishment (usually because | |
104 | no process is listening to the port); | |
105 | .TP 20 | |
106 | [EADDRINUSE] | |
107 | when an attempt | |
108 | is made to create a socket with a port which has already been | |
109 | allocated; | |
110 | .TP 20 | |
111 | [EADDRNOTAVAIL] | |
112 | when an attempt is made to create a | |
113 | socket with a network address for which no network interface | |
114 | exists. | |
115 | .SH SOCKET OPTIONS | |
116 | .TP 20 | |
117 | SO_DEFAULT_HEADERS | |
118 | when set, this determines the data stream type and whether | |
119 | the end of message bit is to be set on every ensuing packet. | |
7e5db945 KS |
120 | .TP 20 |
121 | SO_MTU | |
122 | This specifies the maximum ammount of user data in a single packet. | |
123 | The default is 576 bytes - sizeof(struct spidp). This quantity | |
124 | affects windowing -- increasing it without increasing the amount | |
125 | of buffering in the socket will lower the number of unread packets | |
126 | accepted. Anything larger than the default will not be forwarded | |
127 | by a bona fide XEROX product internetwork router. | |
128 | The data argument for the setsockopt call must be | |
129 | an unsigned short. | |
6c73177c KS |
130 | .SH SEE ALSO |
131 | intro(4N), ns(4F) | |
132 | .SH BUGS | |
6c73177c KS |
133 | There should be some way to reflect record boundaries in |
134 | a stream. | |
135 | For stream mode, there should be an option to get the data stream type of | |
136 | the record the user process is about to receive. |