DIRECTORY
BufferDefs USING [OisBuffer],
DriverDefs USING [DriverXmitStatus, Network],
OISCPTypes USING [OISErrorCode],
SocketInternal USING [SocketHandle],
SpecialCommunication USING [RoutersFunction],
NSAddress USING [HostNumber, NetworkAddress, NetworkNumber];
Router:
DEFINITIONS =
BEGIN
TYPEs and definitions
SocketTable:
TYPE =
RECORD [
length: CARDINAL, first: SocketInternal.SocketHandle];
Nibble: TYPE = [0..17B];
RoutingTableEntry: TYPE = REF RoutingTableObject;
RoutingTableObject:
TYPE =
RECORD [
next: RoutingTableEntry,
destNetwork: NSAddress.NetworkNumber, -- ultimate destination network num.
delay: Nibble,
timeUnits: Nibble, -- if zero then this entry is discarded
route: NSAddress.HostNumber,
if =unknownHostID then the ultimate destination network is local.
network: DriverDefs.Network]; -- use this network driver to reach route.
XmitStatus: TYPE = DriverDefs.DriverXmitStatus;
variables
socketRouterLock: MONITORLOCK; -- lock shared by SocketImpl and RouterImpl.
primaryMDS: BOOLEAN; -- whether the router is in the primary MDS or not.
routersFunction: SpecialCommunication.RoutersFunction;
whether the router is an internet router or not.
checkIt: BOOLEAN; -- whether checksums are on or not.
interface
Procedures from RouterImpl
OisRouterOn: PROCEDURE;
OisRouterOff: PROCEDURE;
AssignOisAddress: PROCEDURE RETURNS [NSAddress.NetworkAddress];
AssignDestinationRelativeOisAddress: PROCEDURE [NSAddress.NetworkNumber] RETURNS [NSAddress.NetworkAddress];
AddSocket: PROCEDURE [SocketInternal.SocketHandle];
RemoveSocket: PROCEDURE [SocketInternal.SocketHandle];
SendPacket: PROCEDURE [BufferDefs.OisBuffer];
ReceivePacket: PROCEDURE [BufferDefs.OisBuffer];
BroadcastThisPacket: PROCEDURE [BufferDefs.OisBuffer]; -- called from a user (like INR)
SendBroadcastPacket: PROCEDURE [BufferDefs.OisBuffer]; -- called from dispatcher
SendErrorPacket:
PROCEDURE [offendingPkt: BufferDefs.OisBuffer,
errCode: OISCPTypes.OISErrorCode, errParm: CARDINAL ← 0]; -- sends error pkt back to offender's source; do not call from inside router's lock.
FindMyHostID: PROCEDURE RETURNS [NSAddress.HostNumber];
debugging
SetOisCheckit: PROCEDURE [BOOLEAN];
SetOisStormy: PROCEDURE [BOOLEAN];
SetOisDriverLoopback: PROCEDURE [BOOLEAN];
SetOisShowit: PROCEDURE [BOOLEAN];
InspectOutgoingOiss: PROCEDURE [PROCEDURE [BufferDefs.OisBuffer]];
InspectIncommingOiss: PROCEDURE [PROCEDURE [BufferDefs.OisBuffer]];
CaptureErrors: PROCEDURE [PROCEDURE [UNSPECIFIED]];
EnumerateRoutingTable: PROCEDURE [proc: PROCEDURE [RoutingTableEntry]];
Procedures from RoutingTableImpl
RoutingTableOn: PROCEDURE;
RoutingTableOff: PROCEDURE;
FindDestinationRelativeNetID: PROCEDURE [NSAddress.NetworkNumber] RETURNS [NSAddress.NetworkNumber];
AddNetwork: PROCEDURE [DriverDefs.Network];
RemoveNetwork: PROCEDURE [DriverDefs.Network];
StateChanged: PROCEDURE [DriverDefs.Network];
FindNetworkAndTransmit: PROCEDURE [BufferDefs.OisBuffer] RETURNS [XmitStatus];
ForwardPacket: PROCEDURE [BufferDefs.OisBuffer];
RoutingInformationPacket: PROCEDURE [BufferDefs.OisBuffer];
END. -- Router