-- File: AltoSlaStats.mesa, Last Edit: HGM October 19, 1980 2:08 AM DIRECTORY InlineDefs USING [MesaToBcplLongNumber], AltoSlaDefs USING [ maxSlaHost, SlaHost, RoutingTableEntry, Line, LineInfoBlock, LIB, GetSlaRoutingTable, GetSlaInfoBlocks, SlaStatsEntry, slaStatsReply, slaVersion], PupDefs USING [PupBuffer], DriverDefs USING [Network]; AltoSlaStats: PROGRAM IMPORTS InlineDefs, AltoSlaDefs EXPORTS DriverDefs = BEGIN OPEN PupDefs; SlaStats: PUBLIC PROCEDURE [b: PupBuffer, network: DriverDefs.Network] RETURNS [BOOLEAN] = BEGIN OPEN AltoSlaDefs; sizeOfRoutingTable: CARDINAL = maxSlaHost*SIZE[RoutingTableEntry]; routingTable: POINTER TO ARRAY SlaHost OF RoutingTableEntry; lineInfo: DESCRIPTOR FOR ARRAY OF LineInfoBlock; activeLines: Line; line: Line; host: SlaHost; lib: LIB; rte: LONG POINTER TO RoutingTableEntry; sse: LONG POINTER TO SlaStatsEntry; routingTable _ GetSlaRoutingTable[]; lineInfo _ GetSlaInfoBlocks[]; activeLines _ LENGTH[lineInfo]; b.pupWords[0] _ slaStatsReply; b.pupWords[1] _ slaVersion; b.pupWords[2] _ maxSlaHost; rte _ LOOPHOLE[@b.pupWords[3]]; FOR host IN SlaHost DO rte^ _ routingTable[host]; rte _ rte + SIZE[RoutingTableEntry]; ENDLOOP; b.pupWords[3 + sizeOfRoutingTable] _ activeLines - 1; sse _ LOOPHOLE[@b.pupWords[4 + sizeOfRoutingTable]]; FOR line IN [0..activeLines) DO lib _ @lineInfo[line]; sse^ _ [packetsSent: InlineDefs.MesaToBcplLongNumber[lib.packetsSent], packetsRecv: InlineDefs.MesaToBcplLongNumber[lib.packetsRecv], bytesSent: InlineDefs.MesaToBcplLongNumber[lib.bytesSent], bytesRecv: InlineDefs.MesaToBcplLongNumber[lib.bytesRecv], syncErrors: lib.syncErrors, badCrc: lib.crcErrors, controlError: lib.controlErrors, state: LOOPHOLE[lib.state]]; sse _ sse + SIZE[SlaStatsEntry]; ENDLOOP; b.pupLength _ 22 + 2*(4 + sizeOfRoutingTable + activeLines*SIZE[SlaStatsEntry]); RETURN[TRUE]; END; -- initialization END.