-- SpecialCommunication.mesa. Last editted by: BLyon on: February 24, 1981 2:02 PM

DIRECTORY
DriverTypes USING [DeviceType],
NSAddress USING [HostNumber, NetworkNumber],
BufferDefs USING [Buffer];

SpecialCommunication: DEFINITIONS =
BEGIN OPEN NSAddress;

-- The router is either a plain router or an InterNetworkRouter.
RoutersFunction: TYPE = {vanillaRouting, interNetworkRouting};

-- A network is identified by its PhysicalMedium and its physical location on the
-- network device chain.
PhysicalMedium: TYPE = DriverTypes.DeviceType;

-- The router must be told which function to perform. Function is initially vanilla.
-- numberINRBuffers is ignored when newFunction=vanillaRouting.
SetRouterFunction: PROCEDURE [newFunction: RoutersFunction, numberINRBuffers: CARDINAL ← 20]
RETURNS [oldFunction: RoutersFunction];

-- This procedure returns what the router's current function is.
GetRouterFunction: PROCEDURE RETURNS [RoutersFunction];

-- The router/drivers may have to be told what its network numbers are.
-- This is certainly true if this is the first machine running on a network.
-- Physical order is the location of the network on the network chain (starting at 1).
-- I.E. GetNetworkID[2, ethernet] returns the OisNetID of the second ethernet network
-- driver. Getting or setting a NetworkID before the network exists is an error.
SetNetworkID: PROCEDURE [
physicalOrder: CARDINAL, medium: PhysicalMedium, newNetID: NetworkNumber]
RETURNS [oldNetID: NetworkNumber];

GetNetworkID: PROCEDURE [physicalOrder: CARDINAL, medium: PhysicalMedium]
RETURNS [NetworkNumber];

NetworkNonExistent: ERROR;

-- Hooks for Ois Peek (like Pup peek). This invovles grabbing a system buffer from the
-- Dispatcher before it get passed to a router. The User must inform the
-- Dispatcher if the buffer is still usable; if it is not then the user MUST REQUEUE
-- the buffer. This can be acomplished by b.requeueProcedure[b], for buffer b.

SpyProc: TYPE = PROCEDURE [b: BufferDefs.Buffer] RETURNS [BOOLEAN];
-- RETURN TRUE if the buffer is still to be processed by Dispatcher.
-- RETURN FALSE if the buffer was/will be requeued by callee.

SetSpyProc: PROCEDURE [spy: SpyProc ← NIL]; -- NIL is normal/default value.

-- These hooks are the user interface for setting addresses in the drivers.
-- Drivers are addressed like in SetNetworkID & GetNetworkID above.
SetEthernetListener: PROCEDURE [
physicalOrder: CARDINAL, newHostNumber: NSAddress.HostNumber]
RETURNS [success: BOOLEAN];
SetEthernetOneListener: PROCEDURE [
physicalOrder: CARDINAL, newHostNumber: CARDINAL] RETURNS [success: BOOLEAN];
SetEthernetCollectGarbageToo: PROCEDURE [
physicalOrder: CARDINAL, collectGarbage: BOOLEAN] RETURNS [success: BOOLEAN];
SetEthernetOneCollectGarbageToo: PROCEDURE [
physicalOrder: CARDINAL, collectGarbage: BOOLEAN] RETURNS [success: BOOLEAN];

END.