ArpaICMPBuf.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Demers, August 26, 1987 2:09:27 pm PDT
Format for Arpa ICMP packets.
DIRECTORY
Arpa USING [Address],
ArpaBuf USING [Hdr, maxBodyBytes],
Basics USING [FWORD, HWORD],
CommBuffer USING [Overhead];
ArpaICMPBuf: CEDAR DEFINITIONS ~ {
HWORD: TYPE ~ Basics.HWORD;
FWORD: TYPE ~ Basics.FWORD;
maxBytes: CARDINAL ~ ArpaBuf.maxBodyBytes;
Header
ICMPType: TYPE ~ MACHINE DEPENDENT {
echoReply(0),
destUnreachable(3),
sourceQuench(4),
redirect(5),
echo(8),
timeExceeded(11),
parameterProblem(12),
timestamp(13),
timestampReply(14),
infoRequest(15),
infoReply(16),
last(0FFH)
};
ICMPCode: TYPE ~ BYTE;
Must be 0 except for the type-specific codes defined below ...
DestUnreachableCode: TYPE ~ MACHINE DEPENDENT {
netUnreachable(0),
hostUnreachable(1),
protocolUnreachable(2),
portUnreachable(3),
mustFragment(4),
sourceRouteFailure(5),
last(0FFH)
};
RedirectCode: TYPE ~ MACHINE DEPENDENT {
network(0),
host(1),
networkAndService(2),
hostAndService(3),
last(0FFH)
};
TimeExceededCode: TYPE ~ MACHINE DEPENDENT {
timeToLive(0),
fragmentReassembly(1),
last(0FFH)
};
Hdr: TYPE ~ MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
any => [icmpType: ICMPType,
icmpCode: ICMPCode,
checksum: HWORD],
destUnreachable => [destUnreachableType: ICMPType,
destUnreachableCode: DestUnreachableCode],
redirect => [redirectType: ICMPType,
redirectCode: RedirectCode],
timeExceeded => [timeExceededType: ICMPType,
timeExceededCode: TimeExceededCode],
ENDCASE
];
hdrBytes: CARDINAL ~ 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],
echoReply => [echoReply: EchoRequestOrReplyBody],
destUnreachable => [destUnreachable: ReturnedDataBody],
sourceQuench => [sourceQuench: ReturnedDataBody],
redirect => [redirect: ReturnedDataAndAddressBody],
echo => [echo: EchoRequestOrReplyBody],
timeExceeded => [timeExceeded: ReturnedDataBody],
parameterProblem => [parameterProblem: ReturnedDataAndPointerBody],
timestamp => [timestamp: TimesBody],
timestampReply => [timestampReply: TimesBody],
infoRequest => [infoRequest: InfoRequestOrReplyBody],
infoReply => [infoReply: InfoRequestOrReplyBody]
ENDCASE
];
maxBodyBytes: CARDINAL ~ maxBytes - hdrBytes;
maxBodyChars: CARDINAL ~ maxBodyBytes;
maxBodyHWords: CARDINAL ~ maxBodyBytes/BYTES[HWORD];
maxBodyFWords: CARDINAL ~ maxBodyBytes/BYTES[FWORD];
EchoRequestOrReplyBody: TYPE ~ MACHINE DEPENDENT RECORD [
identifier: HWORD,
sequenceNum: HWORD,
data: PACKED ARRAY [0..maxEchoDataBytes) OF BYTE
];
maxEchoDataBytes: CARDINAL ~ maxBytes - hdrBytes - 2*BYTES[HWORD];
ReturnedDataBody: TYPE ~ MACHINE DEPENDENT RECORD [
unused: FWORD,
origHdr: ArpaBuf.Hdr,
origBody: PACKED ARRAY [0..8) OF BYTE
];
ReturnedDataAndAddressBody: TYPE ~ MACHINE DEPENDENT RECORD [
address: Arpa.Address,
origHdr: ArpaBuf.Hdr,
origBody: PACKED ARRAY [0..8) OF BYTE
];
ReturnedDataAndPointerBody: TYPE ~ MACHINE DEPENDENT RECORD [
pointer: BYTE,
unused1, unused2, unused3: BYTE,
origHdr: ArpaBuf.Hdr,
origBody: PACKED ARRAY [0..8) OF BYTE
];
TimesBody: TYPE ~ MACHINE DEPENDENT RECORD [
identifier: HWORD,
sequenceNum: HWORD,
originateTimestamp: Timestamp,
receiveTimestamp: Timestamp,
transmitTimestamp: Timestamp
];
Timestamp: TYPE ~ FWORD; -- milliseconds since midnight UT.
InfoRequestOrReplyBody: TYPE ~ MACHINE DEPENDENT RECORD [
identifier: HWORD,
sequenceNum: HWORD
];
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 ArpaBuf.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: ArpaBuf.Hdr,
hdr2: Hdr,
body: Body];
}.