XNSBuf.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, October 14, 1986 5:22:42 pm PDT
Packet format for XNS Level 1 protocol (IDP) per XSIS 028112, December 1981.
DIRECTORY
Basics USING [bytesPerWord],
CommBuffer USING [Overhead],
Endian USING [BYTE, bytesPerFWord, bytesPerHWord, FWORD, HWORD],
XNS USING [Address];
XNSBuf: CEDAR DEFINITIONS
~ BEGIN
BYTE: TYPE ~ Endian.BYTE;
HWORD: TYPE ~ Endian.HWORD;
FWORD: TYPE ~ Endian.FWORD;
Maximum Packet Size
maxBytes: CARDINAL ~ 576;
XSIS 028112 says 576 here, but the code may be compiled with maxBytes anything up to actual comm buffer size; the remaining XNSxxxBuf types should adjust themselves accordingly.
Header
TransportCtl: TYPE ~ MACHINE DEPENDENT RECORD [
trace: BOOL,
filler: [0..7H],
hopCount: [0 .. 0fH]];
Type: TYPE ~ MACHINE DEPENDENT {
private(0),
routing(1),
echo(2),
error(3),
exchange(4),
spp(5),
(LAST[BYTE]) };
noChecksum: HWORD ~ 0FFFFH; -- distinguished value of checksum field of Hdr
Hdr: TYPE ~ MACHINE DEPENDENT RECORD [
checksum: HWORD,
length: HWORD,
transportCtl: TransportCtl,
type: Type,
dest: XNS.Address,
source: XNS.Address];
hdrBytes: CARDINAL ~ SIZE[Hdr] * Basics.bytesPerWord; -- Should be BYTES[Hdr]?
Body
Body: TYPE ~ MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
bytes => [bytes: PACKED ARRAY [0..maxBodyBytes) OF BYTE],
chars => [chars: PACKED ARRAY [0..maxBodyChars) OF CHAR],
hWords => [hWords: PACKED ARRAY [0..maxBodyHWords) OF HWORD],
fWords => [fWords: PACKED ARRAY [0..maxBodyFWords) OF FWORD]
ENDCASE
];
maxBodyBytes: CARDINAL ~ maxBytes - hdrBytes;
maxBodyChars: CARDINAL ~ maxBodyBytes;
maxBodyHWords: CARDINAL ~ maxBodyBytes/Endian.bytesPerHWord;
maxBodyFWords: CARDINAL ~ maxBodyBytes/Endian.bytesPerFWord;
Packet
Packet: TYPE ~ REF PacketObject;
PacketObject: TYPE ~ MACHINE DEPENDENT RECORD [
hdr: Hdr,
body: Body];
Buffer
All buffers start out as Driver.Buffer's. Clients may SmashType between Driver.Buffer and XNSBuf.Buffer, so the "right" module gets to do finalization. This is VERY delicate.
Buffer: TYPE ~ REF BufferObject;
BufferObject: TYPE ~ MACHINE DEPENDENT RECORD [
ovh: CommBuffer.Overhead,
hdr1: Hdr,
body: Body];
END.