Sequence Packet Protocol (SPP) is the primary transport-layer protocol in the Xerox Network Systems (XNS). It provides reliable, flow-controlled, two-way transmission of data for an application program. It is a byte-stream protocol used to support the SOCK_STREAM abstraction. The SPP protocol uses the standard Network Systems (NS) address formats.
The SPP layer presents a byte-stream interface to an application or user process. As a byte-stream protocol, SPP is used to support the SOCK_STREAM mechanism for interprocess communication.
The following example illustrates how SPP uses the SOCK_STREAM mechanism:
#include <sys/socket.h> #include <netns/ns.h> ... s = socket (AF_NS, SOCK_STREAM, 0);
The next example illustrates how SPP uses the SOCK_SEQPACKET mechanism:
#include <sys/socket.h> #include <netns.sp.h> s = socket (AF_NS, SOCK_SEQPACKET, 0);
Sockets using the SPP protocol are either active or passive. By default, SPP sockets are created active. The following conventions apply to using active and passive sockets.
If the socket is defined using the SOCK_SEQPACKET socket type, each SPP packet received has the actual 12-byte sequenced packet header left for the user to inspect. The following example data structure illustrates the format of a packet header.
u_char sp_cc; /*connection control*/ #define SP_EM 0x10 /*end of message*/ u_char sp_dt; /*datastream type*/ u_short sp_sid; u_short sp_did; u_short sp_seq; u_short sp_ack; u_short sp_alo; };
Providing the sequenced packet header facilitates the implementation of higher level Xerox protocols, which make use of the data-stream type field and the end-of-message bit. The user is required to supply a 12-byte header, of which the data-stream type and the end-of-message fields are inspected.
For either the SOCK_STREAM or SOCK_SEQPACKET socket type, packets received with the attention bit set are interpreted as out-of-band data. Data sent with send (..., ..., ..., MSG_OOB) causes the attention bit to be set.
SO_DEFAULT_HEADERS | Determines the data-stream type and whether the end-of-message bit is to be set on every ensuing packet. |
SO_MTU | Specifies the maximum amount of user data in a single packet. The default is 576 bytes minus the size of the packet header. This quantity affects windowing. Increasing the mtu parameter without increasing the amount of buffering in the socket, lowers the number of accepted unread packets. Anything larger than the default is not forwarded by a genuine XEROX-product internetwork router. The data argument for the setsockopt subroutine must be an unsigned short. |
SPP fails if one or more of the following are true: