-- File: PupStream.Mesa, Last Edit: HGM March 3, 1980 4:02 PM

-- Copyright Xerox Corporation 1979, 1980

DIRECTORY
Stream: FROM "Stream" USING [Handle],
PupDefs: FROM "PupDefs" USING [
NameLookupErrorCode,
Tocks, veryLongWait, veryShortWait],
PupTypes: FROM "PupTypes" USING [Pair, PupAddress, PupHostID, PupNetID, PupSocketID];

PupStream: DEFINITIONS =
BEGIN

-- Copied things from PupTypes
PupAddress: TYPE = PupTypes.PupAddress;
PupNetID: TYPE = PupTypes.PupNetID;
PupHostID: TYPE = PupTypes.PupHostID
;
PupSocketID: TYPE = PupTypes.PupSocketID;

PupOpenMode: TYPE = {alreadyOpened, sen
dRfc, wait};
CloseReason: TYPE = {localClose, remoteClose,
noRouteToNetwork, transmissionTimeou
t, remoteReject };

-- Byte Stream Interface
PupByteStreamCreate: PROCEDURE [remote: PupAddr
ess, ticks: Tocks]
RETURNS [Stream
.Handle];

-- Listeners
PupListener: TYPE = POINTER TO P
upListenerObject;
PupListenerObject: TYPE = RECORD [PROCEDURE];
CreatePupByteStreamListener: PROCEDURE [
local: PupSocketID, proc: PROCEDURE[Stream.Handle,PupAddress], ticks: Tocks,
filter: PROCEDURE [PupAddress] ← DontReject]
RETURNS [PupListener];
D
estroyPupListener: PROCEDURE [PupListener];
DontReject: PROCEDURE [PupAddress]
;
RejectThisReque
st: ERROR [error: STRING];

-- Used only by Listeners+Debugging
PupByteStreamMake: PROCEDURE [
local: PupSocketID, remote: PupAddress, ticks: Tocks,
mode: PupOpenMode,
id: PupTypes.Pair]
RETURNS [Stream.Handle];

-- Start and Stop
AdjustBufferParms: PROCEDURE [ bufferPoolSize, bufferSize: CARDINAL ];
PupPackageMak
e: PROCEDURE;
PupPackageDestroy: PROCEDURE;

-- NameConversion
GetPupAddress: PROCEDURE[a: POINTER TO PupAddress, s: STRING];
AppendPupAddr
ess: PROCEDURE [s: STRING, a: PupAddress];

-- ERRORs
StreamClo
sing: ERROR [why: CloseReason, text: STRING];
PupNameTrouble: ERROR [e: STRING, code: PupDefs.NameLooku
pErrorCode];
TockConversionTroubles: ERROR;

-- Timeout things
Tocks: TYPE = PupDefs.Tocks;
veryLongWait: Tocks = PupDefs.veryLongWait;
veryShortWait: Tocks = PupDefs.veryShortWait;
SecondsToTocks: PROCEDURE [CARDINAL] RETURNS [Tocks];
MsToTocks: PROCEDURE [CARDINAL] RETURNS [Tocks];

-- Performance tuning and debugging
-- Call these before cr
eating the connection
SetMaxAllocation:
PROCEDURE [CARDINAL];
SetMaxBuffer
Size: PROCEDURE [CARDINAL];
SetPinging: PROCEDURE [BOOLEAN];

END.