PupDefs.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Andrew Birrell May 20, 1983 2:11 pm
Levin, June 24, 1983 5:18 pm
DIRECTORY
BufferDefs USING [PupBuffer, Queue, QueueObject],
PupStream USING [NameLookupErrorCode, Tocks, veryLongWait, veryShortWait],
PupTypes USING [maxDataWordsPerGatewayPup, Pair, PupType, PupAddress, PupErrorCode, PupHostID, PupNetID, PupSocketID],
Rope USING [ROPE];
PupDefs: DEFINITIONS = BEGIN
Byte: TYPE = [0..377B];
TYPEs Copied from BufferDefs
PupBuffer: TYPE = BufferDefs.PupBuffer;
Queue: TYPE = BufferDefs.Queue;
QueueObject: TYPE = BufferDefs.QueueObject;
TYPEs Copied things from PupTypes
PupAddress: TYPE = PupTypes.PupAddress;
PupNetID: TYPE = PupTypes.PupNetID;
PupHostID: TYPE = PupTypes.PupHostID;
PupSocketID: TYPE = PupTypes.PupSocketID;
Pair: TYPE = PupTypes.Pair;
Buffer/Queue procedures
EnqueuePup: PROCEDURE [Queue, PupBuffer];
DequeuePup: PROCEDURE [Queue] RETURNS [PupBuffer];
GetFreePupBuffer: PROCEDURE RETURNS [PupBuffer];
ReturnFreePupBuffer: PROCEDURE [PupBuffer];
GetClumpOfPupBuffers: PROCEDURE [q: Queue, n: CARDINAL, wait: BOOLEAN];
ExtractPupFromQueue: PROCEDURE [Queue, PupBuffer] RETURNS [PupBuffer];
Pup Routing
InspectStrayPups: SAFE PROCEDURE [
on: BOOLEAN, seeBroadcast: BOOLEAN,
proc: PROCEDURE [PupBuffer] RETURNS [error: BOOLEAN]];
PupRouterBroadcastThis: PROCEDURE [PupBuffer];
PupRouterSendThis: PROCEDURE [PupBuffer];
Start of things like this
GetHopsToNetwork: SAFE PROCEDURE [PupNetID] RETURNS [CARDINAL];
returns a big number if can't get there
FastPath: SAFE PROCEDURE [PupAddress] RETURNS [BOOLEAN];
default parameters collected here
defaultNumberOfNetworks: CARDINAL = 126; -- two pages from the heap
defaultDataWordsPerPup: CARDINAL = PupTypes.maxDataWordsPerGatewayPup;
defaultPupsToAllocate: CARDINAL = 5; -- allocates for PktStreams
Misc utilities
GetLocalPupAddress: SAFE PROCEDURE [
local: PupSocketID, remote: PupAddress] RETURNS [PupAddress];
AnyLocalPupAddress: SAFE PROCEDURE [local: PupSocketID] RETURNS [PupAddress];
UniqueLocalPupSocketID: SAFE PROCEDURE RETURNS [PupSocketID];
UniqueLocalPupAddress: SAFE PROCEDURE [PupAddress] RETURNS [PupAddress];
SwapPupSourceAndDest: PROCEDURE [PupBuffer]; -- fixes up broadcast too
SendPup: PROCEDURE [b: PupBuffer, type: PupTypes.PupType, bytes: CARDINAL];
ReturnPup: PROCEDURE [b: PupBuffer, type: PupTypes.PupType, bytes: CARDINAL];
Timeout things
Tocks: TYPE = PupStream.Tocks;
veryLongWait: Tocks = PupStream.veryLongWait;
veryShortWait: Tocks = PupStream.veryShortWait;
SecondsToTocks: SAFE PROCEDURE [CARDINAL] RETURNS [Tocks];
MsToTocks: SAFE PROCEDURE [CARDINAL] RETURNS [Tocks];
PupBuffer level utilities
GetPupContentsBytes: PROCEDURE [PupBuffer] RETURNS [CARDINAL];
SetPupContentsBytes: PROCEDURE [PupBuffer, CARDINAL];
SetPupContentsWords: PROCEDURE [PupBuffer, CARDINAL];
DataWordsPerPupBuffer: SAFE PROCEDURE RETURNS [CARDINAL];
Socket Interface
PupSocketMake: SAFE PROCEDURE [
local: PupSocketID, remote: PupAddress, ticks: Tocks, id: Pair ← [0, 0]]
RETURNS [PupSocket];
PupSocketMakeFull: SAFE PROCEDURE [local, remote: PupAddress, ticks: Tocks]
RETURNS [PupSocket];
PupSocketKick: SAFE PROCEDURE [PupSocket];
PupSocketDestroy: SAFE PROCEDURE [PupSocket];
PupSocket: TYPE = REF PupSocketObject;
PupSocketObject: TYPE = RECORD[
put: UNSAFE PROCEDURE [PupBuffer],
get: PROCEDURE RETURNS [PupBuffer], -- if none, wait, then return NIL
setRemoteAddress: PROCEDURE [PupAddress],
getLocalAddress: PROCEDURE RETURNS [PupAddress]];
Start and Stop
AdjustBufferParms: SAFE PROCEDURE [bufferPoolSize, bufferSize: CARDINAL];
GetBufferParms: SAFE PROCEDURE RETURNS [bufferPoolSize, bufferSize: CARDINAL];
PupPackageMake: SAFE PROCEDURE;
PupPackageDestroy: SAFE PROCEDURE;
GetPupPackageUseCount: SAFE PROCEDURE RETURNS [CARDINAL];
UseNullChecksumMicrocode: PROCEDURE;
UseSoftwareChecksumMicrocode: PROCEDURE;
UseAltoChecksumMicrocode: PROCEDURE;
UsePrincOpsChecksumMicrocode: PROCEDURE;
SmashMyHostNumber: PROCEDURE [CARDINAL];
NameConversion and ROPE diddling
GetPupAddress: SAFE PROC [PupSocketID, Rope.ROPE] RETURNS[ PupAddress ];--Parse or NameLookup
PupNameLookup: SAFE PROC [PupSocketID, Rope.ROPE] RETURNS[ PupAddress ];--NameLookup only
NameLookupErrorCode: TYPE = PupStream.NameLookupErrorCode;
ParsePupAddressConstant: SAFE PROC [PupSocketID, Rope.ROPE] RETURNS [BOOLEAN, PupAddress];
EnumeratePupAddresses: SAFE PROC [
name: Rope.ROPE, filter: PROCEDURE [PupAddress] RETURNS [BOOLEAN]]
RETURNS [hit: BOOLEAN];
PupAddressLookup: SAFE PROCEDURE [PupAddress] RETURNS [Rope.ROPE];-- via NLS
PupAddressToRope: SAFE PROCEDURE [PupAddress] RETURNS [Rope.ROPE];-- e.g. 3#14#1234
GetHostName: SAFE PROCEDURE [PupAddress] RETURNS [Rope.ROPE];
GetMyName: SAFE PROCEDURE RETURNS [Rope.ROPE];
MoveRopeToPupBuffer: PROCEDURE [PupBuffer, Rope.ROPE];
AppendRopeToPupBuffer: PROCEDURE [PupBuffer, Rope.ROPE];
Does SwapPupSourceAndDest and such, then PupRouterSendThis
SendErrorPup: PROCEDURE [PupBuffer, PupTypes.PupErrorCode, Rope.ROPE];
ERRORs
PupNameTrouble: ERROR [e: Rope.ROPE, code: NameLookupErrorCode];
TockConversionTroubles: ERROR;
Debugging
SetLocalOnly: PROCEDURE [BOOLEAN];
SetPupCheckit: PROCEDURE [x: BOOLEAN] = INLINE
BEGIN
IF x THEN UseSoftwareChecksumMicrocode[] ELSE UseNullChecksumMicrocode[];
END;
SetPupStormy: PROCEDURE [BOOLEAN]; -- lightning in Router
SetErrorSuppression: PROCEDURE [dontSendErrors: BOOLEAN];
SetBufferFullSuppression: PROCEDURE [dontSend: BOOLEAN];
GetDoStats: PROCEDURE RETURNS [BOOLEAN];
CaptureErrors: PROCEDURE [PROCEDURE [ERROR]];
InspectIncomingPups: PROCEDURE [BOOLEAN, PROCEDURE [CARDINAL, PupBuffer]];
InspectOutgoingPups: PROCEDURE [BOOLEAN, PROCEDURE [CARDINAL, PupBuffer]];
ShowPupBuffer: PROCEDURE [POINTER, CARDINAL, PupBuffer]; -- in PupShow.bcd
incomingPup: CARDINAL = 100; -- code numbers for Show
outgoingPup: CARDINAL = 101;
zappedIncomingPup: CARDINAL = 102;
zappedOutgoingPup: CARDINAL = 103;
END.