OISCPTypes:
DEFINITIONS =
BEGIN
TYPEs and definitions
Nibble: TYPE = [0..17B];
Byte: TYPE = [0..377B];
WaitTime: TYPE = LONG CARDINAL; -- in milliseconds
ConnectionID: TYPE = RECORD [WORD];
ExchangeClientType:
TYPE =
MACHINE
DEPENDENT {
unspecified(0), timeService(1), clearinghouseService(2), (LAST[CARDINAL])};
ExchangeID: TYPE = MACHINE DEPENDENT RECORD [a, b: CARDINAL];
PacketType:
TYPE =
MACHINE
DEPENDENT {
-- eight bits!!
private(0), routingInformation(1), echo(2), error(3), packetExchange(4), sequencedPacket(5), pupAddrTransPacket(6), (LAST[Byte])};
RoutingInfoType:
TYPE =
MACHINE
DEPENDENT {
private(0), routingInfoRequest(1), routingInfoResponse(2), (LAST[CARDINAL])};
EchoType:
TYPE =
MACHINE
DEPENDENT {
private(0), echoRequest(1), echoResponse(2), (LAST[CARDINAL])};
OISErrorCode:
TYPE =
MACHINE
DEPENDENT{
packet got to the destination machine, but wasn't processed
unspecifiedOisErrorCode(0B), badChecksumOisErrorCode(1B),
noSocketOisErrorCode(2B), resourceLimitsOisErrorCode(3B),
Pup didn't get to the destination machine
unspecifiedInRouteOisErrorCode(1000B), inconsistentOisErrorCode(1001B),
cantGetThereOisErrorCode(1002B), excessHopsOisErrorCode(1003B),
tooBigOisErrorCode(1004B),
used by ForwardBuffer for various hacks
noErrorOisErrorCode(10000), connectionLimitOisErrorCode(10001),
filler(LAST[WORD])};
TransPortControl:
TYPE =
MACHINE
DEPENDENT
RECORD [
trace: BOOLEAN,
filler: [0 .. 7],
hopCount: [0 .. 17B]];
the TransportControl is included here so that we can obtain the address of the
WORD containing the transport control.
TransControlAndPacketType:
TYPE =
MACHINE
DEPENDENT
RECORD [
transportControl: TransPortControl, -- eight bits!!
packetType: PacketType];
RoutingInfoTuple:
TYPE =
MACHINE
DEPENDENT
RECORD [
objectNetID: NSAddress.NetworkNumber, interrouterDelay: CARDINAL];
BufferBody:
TYPE =
MACHINE
DEPENDENT
RECORD [
checksum: CARDINAL,
pktLength: CARDINAL, -- in bytes, includes header
transCntlAndPktTp: TransControlAndPacketType,
destination, source: NSAddress.NetworkAddress,
oisBody:
SELECT
OVERLAID *
FROM
oisWords => [oisWords: ARRAY [0..0) OF WORD],
oisBytes => [oisBytes: PACKED ARRAY [0..0) OF Byte],
oisChars => [oisChars: PACKED ARRAY [0..0) OF CHARACTER],
routingInformation => [
routingType: RoutingInfoType,
routingTuple: ARRAY [0..0) OF RoutingInfoTuple],
error => [
errorType: OISErrorCode,
errorParameter: CARDINAL,
errorBody: ARRAY [0..0) OF WORD],
echo => [
echoType: EchoType,
echoBody:
SELECT
OVERLAID *
FROM
echoWords => [echoWords: ARRAY [0..0) OF WORD],
echoBytes => [echoBytes: PACKED ARRAY [0..0) OF Byte],
ENDCASE],
spp => [
first word of level 2 Sequenced Protocol
systemPacket: BOOLEAN,
sendAck: BOOLEAN,
attention: BOOLEAN,
endOfMessage: BOOLEAN,
unusedType: [0B..17B],
subtype: Byte,
sourceConnectionID: ConnectionID,
destinationConnectionID: ConnectionID,
sequenceNumber: CARDINAL,
acknowledgeNumber: CARDINAL,
allocationNumber: CARDINAL,
sppBody:
SELECT
OVERLAID *
FROM
sppWords => [sppWords: ARRAY [0..0) OF WORD],
sppBytes => [sppBytes: PACKED ARRAY [0..0) OF Byte],
sppChars => [sppChars: PACKED ARRAY [0..0) OF CHARACTER],
sppString => [sppString: StringBody],
ENDCASE],
packetExchange => [
exchangeID: ExchangeID,
exchangeType: ExchangeClientType,
exchangeBody:
SELECT
OVERLAID *
FROM
exchangeWords => [exchangeWords: ARRAY [0..0) OF WORD],
exchangeBytes => [exchangeBytes: PACKED ARRAY [0..0) OF Byte],
exchangeChars => [exchangeChars: PACKED ARRAY [0..0) OF CHARACTER],
exchangeString => [exchangeString: StringBody],
ENDCASE],
ENDCASE];
Magic numbers for the OIS communication (transport) protocols.
OIS packet header lengths.
zz: PRIVATE POINTER TO BufferBody = NIL; -- zz is declared so we can do arithmetic
maxBytesPerPkt: CARDINAL = 576;
wordPerPktHeader:
CARDINAL =
LOOPHOLE[@zz.oisBody, CARDINAL] - LOOPHOLE[zz, CARDINAL];
bytesPerPktHeader: CARDINAL = wordPerPktHeader*2;
bytesPerPktText: CARDINAL = maxBytesPerPkt - bytesPerPktHeader;
wordsPerLevel2SppHeader:
CARDINAL =
LOOPHOLE[@zz.sppBody, CARDINAL] - LOOPHOLE[@zz.oisBody, CARDINAL];
bytesPerLevel2SppHeader: CARDINAL = wordsPerLevel2SppHeader*2;
maxDataWordsPerSpp: CARDINAL = (bytesPerPktText - bytesPerLevel2SppHeader)/2;
wordsPerExchangeHeader:
CARDINAL =
LOOPHOLE[@zz.exchangeBody, CARDINAL] - LOOPHOLE[@zz.oisBody, CARDINAL];
bytesPerExchangeHeader: CARDINAL = wordsPerExchangeHeader*2;
maxDataBytePerExchange: CARDINAL = bytesPerPktText - bytesPerExchangeHeader;