XNSExchangeBuf.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, December 19, 1986 8:39:37 pm PST
Packet format for XNS Level 2 Packet Exchange Protocol per XSIS 028112, December 1981.
DIRECTORY
Basics USING [bytesPerFWord, bytesPerHWord, FWORD, HWORD],
CommBuffer USING [Overhead],
XNSBuf USING[Hdr, maxBodyBytes],
XNSExchangeTypes USING [ExchangeID, ExchangeType];
XNSExchangeBuf: CEDAR DEFINITIONS
~
BEGIN
HWORD: TYPE ~ Basics.HWORD;
FWORD: TYPE ~ Basics.FWORD;
maxBytes: CARDINAL ~ XNSBuf.maxBodyBytes;
Header
Hdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
id: XNSExchangeTypes.ExchangeID,
type: XNSExchangeTypes.ExchangeType];
hdrBytes: CARDINAL ~ BITS[Hdr]/BITS[BYTE];
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/Basics.bytesPerHWord;
maxBodyFWords: CARDINAL ~ maxBodyBytes/Basics.bytesPerFWord;
Packet
Packet: TYPE ~ REF PacketObject;
PacketObject:
TYPE ~
MACHINE
DEPENDENT
RECORD [
hdr: Hdr,
body: Body];
Buffer
All buffers are actually Driver.Buffer's that have been SmashType'd to XNSBuf.Buffer's. Clients may LOOPHOLE between XNSBuf.Buffer and XNSExchangeBuf.Buffer, but should never NEW one of these and should NARROW one only to XNSBuf.Buffer.
Buffer: TYPE ~ REF BufferObject;
BufferObject:
TYPE ~
MACHINE
DEPENDENT
RECORD [
ovh: CommBuffer.Overhead,
hdr1: XNSBuf.Hdr,
hdr2: Hdr,
body: Body];
END.