-- File: ForwarderCold.mesa -- Last Edit: HGM February 5, 1981 4:01 AM -- Last Edit: BLyon January 16, 1981 5:21 PM DIRECTORY Event USING [Item, Reason, Masks, AddNotifier], Trouble USING [Bug], StatsDefs USING [StatCounterIndex, StatsStringToIndex], ForwarderDefs USING [PupForwarderOff], BufferDefs USING [PupBuffer], DriverDefs USING [Network], PupDefs USING [ReturnFreePupBuffer], PupTypes USING [gatewaySoc]; ForwarderCold: PROGRAM IMPORTS Event, Trouble, StatsDefs, PupDefs, ForwarderDefs EXPORTS BufferDefs, ForwarderDefs SHARES BufferDefs = BEGIN OPEN StatsDefs; -- EXPORTed TYPEs Network: PUBLIC TYPE = DriverDefs.Network; eventItem: Event.Item ← [eventMask: Event.Masks[stopMesa], eventProc: Broom]; statGateInfoReplies: PUBLIC StatCounterIndex; statGateInfoBC: PUBLIC StatCounterIndex; statRoutingTableChanges: PUBLIC StatCounterIndex; statGateLowOnBuffers: PUBLIC StatCounterIndex; statGarbageSourceOrDest: PUBLIC StatCounterIndex; statNoRouteToNet: PUBLIC StatCounterIndex; statTooManyHops: PUBLIC StatCounterIndex; Broom: PROCEDURE [why: Event.Reason] = BEGIN SELECT why FROM stopMesa => ForwarderDefs.PupForwarderOff[]; ENDCASE => NULL; END; SetupForwarderThings: PUBLIC PROCEDURE = BEGIN statGateInfoReplies ← StatsStringToIndex["Pup Gateway Info Replies"]; statGateInfoBC ← StatsStringToIndex["Pup Gateway Info Broadcasts"]; statRoutingTableChanges ← StatsStringToIndex["Pup Routing Table Changes"]; statGateLowOnBuffers ← StatsStringToIndex[ "Pups not forwarded: Gateway low on buffers"]; statGarbageSourceOrDest ← StatsStringToIndex[ "Pups not forwarded: Garbage source or dest"]; statNoRouteToNet ← StatsStringToIndex[ "Pups not forwarded: No route to that network"]; statTooManyHops ← StatsStringToIndex[ "Pups not forwarded: Hop count exceeded"]; END; PeekAtRoutingPup: PUBLIC PROCEDURE [b: BufferDefs.PupBuffer] = BEGIN net: CARDINAL ← b.source.net; network: Network ← b.network; -- Forwarder got a Pup before it was turned on. See if it is the reply that would tell us that we have a buggy network number. IF b.pupType = gatewayInfo AND b.source.socket = PupTypes.gatewaySoc AND (net # network.netNumber.b OR b.pupTransportControl # 0) AND network.netNumber.b < 400B THEN Trouble.Bug["Wrong network number"L]; PupDefs.ReturnFreePupBuffer[b]; END; -- initialization SetupForwarderThings[]; Event.AddNotifier[@eventItem]; END.