-- Copyright (C) 1984, 1985  by Xerox Corporation. All rights reserved. 
-- ForwarderDefs.Mesa, HGM,  7-Sep-85 15:23:13

DIRECTORY
  PupWireFormat USING [BcplLongNumber],
  Stats USING [StatCounterIndex],
  Buffer USING [PupBuffer],
  PupTypes USING [PupErrorCode, PupType];

ForwarderDefs: DEFINITIONS =
  BEGIN

  PupForwarderOn: PROCEDURE;
  PupForwarderOff: PROCEDURE;
  SetupForwarderThings: PROCEDURE;
  PeekAtRoutingPup: PROCEDURE [Buffer.PupBuffer];

  Counters: TYPE = RECORD [seq: SEQUENCE l: CARDINAL OF LONG CARDINAL];
  GetPointerToPupGateStats: PROCEDURE
    RETURNS [packets, bytes: LONG POINTER TO Counters, nets: CARDINAL];
  GetPointerToBadPupStats: PROCEDURE
    RETURNS [bad: LONG POINTER TO Counters];


  DoErrorPup: PROCEDURE [Buffer.PupBuffer, PupTypes.PupErrorCode, LONG STRING];

  -- internal things
  ForwarderStats: PROCEDURE [Buffer.PupBuffer];
  PrintBadPup: PROCEDURE [Buffer.PupBuffer];

  statPupGatewayPacketMs: Stats.StatCounterIndex;
  statGateInfoReplies: Stats.StatCounterIndex;
  statGateInfoBC: Stats.StatCounterIndex;
  statRoutingTableChanges: Stats.StatCounterIndex;
  statGateLowOnBuffers: Stats.StatCounterIndex;
  statGarbageSourceOrDest: Stats.StatCounterIndex;
  statNoRouteToNet: Stats.StatCounterIndex;
  statTooManyHops: Stats.StatCounterIndex;

  -- Forwarder Statistics

  forwarderStatsRequest: PupTypes.PupType = LOOPHOLE[203B];
  forwarderStatsReply: PupTypes.PupType = LOOPHOLE[204B];

  ForwardStatsEntry: TYPE = RECORD [
    version: WORD,
    routingInfoRequests: PupWireFormat.BcplLongNumber,
    numberOfNetworks: CARDINAL,
    numberOfTMEs: CARDINAL];
  -- xx: ARRAY [0..numberOfNetworks) OF CARDINAL
  -- xx: ARRAY [0..numberOfTMEs) OF TransitMatrixEntry
  forwardVersion: WORD = 1;

  Byte: TYPE = [0..400B);

  TransitMatrixEntry: TYPE = RECORD [
    sourceNet: Byte, destNet: Byte, count: PupWireFormat.BcplLongNumber];

  END.