-- File: PupDefs.Mesa, Last Edit:
-- HGM June 29, 1980 8:47 PM
-- MAS August 27, 1980 4:09 PM
-- Copyright Xerox Corporation 1979, 1980
DIRECTORY
BufferDefs USING [PupBuffer, Queue, QueueObject, RppBuffer],
PupTypes USING [
maxDataWordsPerGatewayPup, Pair, PupType,
PupAddress, PupErrorCode, PupHostID, PupNetID, PupSocketID];
PupDefs: DEFINITIONS = BEGIN
Byte: TYPE = [0..377B];
-- TYPEs Copied from BufferDefs
PupBuffer: TYPE = BufferDefs.PupBuffer;
RppBuffer: TYPE = BufferDefs.RppBuffer;
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];
EnqueueRpp: PROCEDURE [Queue, RppBuffer];
DequeueRpp: PROCEDURE [Queue] RETURNS [RppBuffer];
GetFreeRppBuffer: PROCEDURE RETURNS [RppBuffer];
ReturnFreeRppBuffer: PROCEDURE [RppBuffer];
GetClumpOfPupBuffers: PROCEDURE [q: Queue, n: CARDINAL, wait: BOOLEAN];
GetClumpOfRppBuffers: PROCEDURE [q: Queue, n: CARDINAL, wait: BOOLEAN];
ExtractPupFromQueue: PROCEDURE [Queue, PupBuffer] RETURNS [PupBuffer];
ExtractRppFromQueue: PROCEDURE [Queue, RppBuffer] RETURNS [RppBuffer];
-- Pup Routing
InspectStrayPups: PROCEDURE [
on: BOOLEAN, seeBroadcast: BOOLEAN,
proc: PROCEDURE [PupBuffer] RETURNS [error: BOOLEAN] ];
PupRouterBroadcastThis: PROCEDURE [PupBuffer];
PupRouterSendThis: PROCEDURE [PupBuffer];
-- Start of things like this
GetHopsToNetwork: PROCEDURE [PupNetID] RETURNS [CARDINAL]; -- returns a big number if can’t get there
-- default parameters collected here
defaultNumberOfNetworks: CARDINAL = 84; -- as many as fit in a page
defaultDataWordsPerPup: CARDINAL = PupTypes.maxDataWordsPerGatewayPup;
defaultPupsToAllocate: CARDINAL = 5; -- allocates for PktStreams
-- Misc utilities
GetLocalPupAddress: PROCEDURE [local: PupSocketID, remote: POINTER TO PupAddress] RETURNS [PupAddress];
UniqueLocalPupSocketID: PROCEDURE RETURNS [PupSocketID];
UniqueLocalPupAddress: PROCEDURE [POINTER TO 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 = RECORD[CARDINAL];
veryLongWait: Tocks = [LAST[CARDINAL]];
veryShortWait: Tocks = [0];
SecondsToTocks: PROCEDURE [CARDINAL] RETURNS [Tocks];
MsToTocks: PROCEDURE [CARDINAL] RETURNS [Tocks];
-- PupBuffer level utilities
GetPupContentsBytes: PROCEDURE [PupBuffer] RETURNS [CARDINAL];
SetPupContentsBytes: PROCEDURE [PupBuffer, CARDINAL];
SetPupContentsWords: PROCEDURE [ PupBuffer, CARDINAL ];
DataWordsPerPupBuffer: PROCEDURE RETURNS [CARDINAL];
-- Socket Interface
PupSocketMake: PROCEDURE [
local: PupSocketID, remote: PupAddress, ticks: Tocks, id: Pair ← [0,0]]
RETURNS [PupSocket];
PupSocketKick: PROCEDURE [PupSocket];
PupSocketDestroy: PROCEDURE [PupSocket];
PupSocket: TYPE = POINTER TO PupSocketObject;
PupSocketObject: TYPE = RECORD [
put: PROCEDURE [PupBuffer],
get: PROCEDURE RETURNS [PupBuffer], -- if none, wait, then return NIL
setRemoteAddress: PROCEDURE [PupAddress],
getLocalAddress: PROCEDURE RETURNS [PupAddress] ];
-- Start and Stop
AdjustBufferParms: PROCEDURE [bufferPoolSize, bufferSize: CARDINAL];
GetBufferParms: PROCEDURE RETURNS [bufferPoolSize, bufferSize: CARDINAL];
PupPackageMake: PROCEDURE;
PupPackageReady: PROCEDURE;
PupPackageDestroy: PROCEDURE;
GetPupPackageUseCount: PROCEDURE RETURNS [CARDINAL];
UseAltoChecksumMicrocode: PROCEDURE;
-- NameConversion and STRING diddling
GetPupAddress: PROCEDURE [POINTER TO PupAddress, STRING];
PupNameLookup: PROCEDURE [POINTER TO PupAddress, STRING];
NameLookupErrorCode: TYPE = {noRoute, noResponse, errorFromServer}; -- if error
ParsePupAddressConstant: PROCEDURE [POINTER TO PupAddress, STRING] RETURNS [BOOLEAN];
EnumeratePupAddresses: PROCEDURE [
s: STRING, filter: PROCEDURE [PupAddress] RETURNS [BOOLEAN] ]
RETURNS [hit: BOOLEAN];
PupAddressLookup: PROCEDURE [STRING, PupAddress];
AppendPupAddress: PROCEDURE [STRING, PupAddress];
AppendHostName: PROCEDURE [STRING, PupAddress];
AppendMyName: PROCEDURE [STRING];
MoveStringBodyToPupBuffer: PROCEDURE [PupBuffer, STRING];
AppendStringBodyToPupBuffer: PROCEDURE [PupBuffer, STRING];
-- Does SwapPupSourceAndDest and such, then PupRouterSendThis
SendErrorPup: PROCEDURE [PupBuffer, PupTypes.PupErrorCode, STRING];
-- ERRORs
PupNameTrouble: ERROR [e: STRING, code: NameLookupErrorCode];
TockConversionTroubles: ERROR;
-- Printout
PrintErrorPup: PROCEDURE [PupBuffer]; -- in PupPrint.bcd
PrintPupAddress: PROCEDURE [PupAddress]; -- in PupPrint.bcd
-- Debugging
SetLocalOnly: PROCEDURE [BOOLEAN];
SetPupCheckit: PROCEDURE [BOOLEAN];
SetPupStormy: PROCEDURE [BOOLEAN]; -- lightning in Router
SetErrorSuppression: PROCEDURE [dontSendErrors: BOOLEAN];
SetBufferFullSuppression: PROCEDURE [dontSend: BOOLEAN];
GetDoStats: PROCEDURE RETURNS [BOOLEAN];
CaptureErrors: PROCEDURE [PROCEDURE [ERROR]];
DefaultErrorHandler: PROCEDURE [ERROR];
InspectIncomingPups: PROCEDURE [BOOLEAN, PROCEDURE[CARDINAL,PupBuffer]];
InspectOutgoingPups: PROCEDURE [BOOLEAN, PROCEDURE[CARDINAL,PupBuffer]];
ShowPupBuffer: PROCEDURE [CARDINAL, PupBuffer]; -- in PupShow.bcd
incomingPup: CARDINAL = 100; -- code numbers for Show
outgoingPup: CARDINAL = 101;
zappedIncomingPup: CARDINAL = 102;
zappedOutgoingPup: CARDINAL = 103;
END.