XNSEchoBuf.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, June 5, 1986 10:16:24 pm PDT
Packet format for XNS Level 2 Echo Protocol per XSIS 028112, December 1981.
DIRECTORY
Basics USING [bytesPerWord],
CommBuffer USING [Overhead],
Endian USING [BYTE, bytesPerFWord, bytesPerHWord, FWORD, HWORD],
XNSBuf USING[Hdr, maxBodyBytes];
XNSEchoBuf: CEDAR DEFINITIONS
~
BEGIN
BYTE: TYPE ~ Endian.BYTE;
HWORD: TYPE ~ Endian.HWORD;
FWORD: TYPE ~ Endian.FWORD;
maxBytes: CARDINAL ~ XNSBuf.maxBodyBytes;
Header
Type:
TYPE ~
MACHINE
DEPENDENT {
request(1),
reply(2),
(LAST[BYTE]) };
Hdr:
TYPE ~
MACHINE
DEPENDENT
RECORD [
filler: BYTE,
type: Type];
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 are actually Driver.Buffer's that have been SmashType'd to XNSBuf.Buffer's. Clients may LOOPHOLE between XNSBuf.Buffer and XNSEchoBuf.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.