XNSRoutingBuf.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, June 5, 1986 10:21:12 pm PDT
Packet format for XNS Level 2 Routing Information Protocol per XSIS 028112, December 1981.
DIRECTORY
Basics USING [bytesPerWord],
CommBuffer USING [Overhead],
Endian USING [BYTE, HWORD],
XNS USING [Net],
XNSBuf USING [Hdr, maxBodyBytes];
XNSRoutingBuf: CEDAR DEFINITIONS
~ BEGIN
BYTE: TYPE ~ Endian.BYTE;
HWORD: TYPE ~ Endian.HWORD;
maxBytes: CARDINAL ~ XNSBuf.maxBodyBytes;
Header
Type: TYPE ~ MACHINE DEPENDENT {
request(1),
response(2),
(LAST[BYTE]) };
Hdr: TYPE ~ MACHINE DEPENDENT RECORD [
filler: BYTE,
type: Type];
hdrBytes: CARDINAL ~ SIZE[Hdr] * Basics.bytesPerWord; -- Should be BYTES[Hdr]?
Body
Tuple: TYPE ~ MACHINE DEPENDENT RECORD [
net: XNS.Net,
delay: HWORD];
Body: TYPE ~ MACHINE DEPENDENT RECORD [
tuples: PACKED ARRAY [0..maxTuples) OF Tuple];
maxBodyBytes: CARDINAL ~ maxBytes - hdrBytes;
tupleBytes: CARDINAL ~ SIZE[Tuple] * Basics.bytesPerWord; -- Should be BYTES[Tuple]?
maxTuples: CARDINAL ~ (maxBodyBytes)/tupleBytes;
NumTuplesFromUserBytes: PROC [bytes: CARDINAL] RETURNS [CARDINAL] ~ INLINE {
RETURN [ (bytes - hdrBytes) / tupleBytes ] };
UserBytesFromNumTuples: PROC [numTuples: CARDINAL] RETURNS [CARDINAL] ~ INLINE {
RETURN [ hdrBytes + numTuples*tupleBytes ] };
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 XNSRoutingBuf.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.