-- File: ArpaRoutingTable.mesa - last edit:
-- JAV                 13-Oct-87 11:48:01
-- AOF                 10-Mar-87 19:31:47
-- SMA                 10-Jun-86 14:09:49
-- Copyright (C) 1985, 1986, 1987 by Xerox Corporation. All rights reserved.

DIRECTORY
  ArpaBuffer USING [Buffer],
  ArpaRouter USING [InternetAddress],
  Driver USING [Device];
  
ArpaRoutingTable: DEFINITIONS =
  BEGIN
  
  NetworkContext: TYPE = LONG POINTER TO ContextObject;
  ContextObject: TYPE = RECORD[
    protocol: ProtocolHandle,  --driver/network dependent
    network: Driver.Device, stats: LONG POINTER,
    host, net, hostMask, netMask: ArpaRouter.InternetAddress];
    
  ProtocolHandle: TYPE = LONG POINTER;
  
  --Routing table stuff.
  
  RoutersFunction: TYPE = {normal, gateway};
  
  Handle: TYPE = LONG POINTER TO Object;
  Object: TYPE = RECORD[
    type: RoutersFunction,  --what type of service provided
    start, stop: PROC,  --start/stop the service after/before registering
    startEnumeration: ArpaRouter.InternetAddress,  --starts enumeration
    endEnumeration: ArpaRouter.InternetAddress,  --ends enumeration
    enumerate: EnumerateProc,  --to enumerate current table
    fillTable: FillTableProc,  --to make enumerations meaningful
    getDelay: GetDelayProc,  --to find delay to specific network
    transmit: TransmitProc,  --transmit this packet towards destination net
    forward: ForwardProc,  --forward this packet towards destination net
    findNetwork: FindNetworkProc,  --find immediate net towards destination
    addNetwork: AddNetworkProc,  --add new network
    removeNetwork: RemoveNetworkProc,  --remove old network
    flushCache: FlushCacheProc,  --flush cache entry for 'net'
    stateChanged: StateChangedProc,  --state of network changed
    addRoute: AddRouteProc,        --for subnet static table routing.
    removeRoute: RemoveRouteProc];  --ditto
    
  Register: PROCEDURE [h: Handle ← NIL];  --(un)register new object (NIL => default)
    
  defaultRth: Handle;
  
  AddRouteProc: TYPE = PROC [dest, mask, route: ArpaRouter.InternetAddress, 
    delay: CARDINAL, context: NetworkContext];
  RemoveRouteProc: TYPE = PROC [dest: ArpaRouter.InternetAddress];  
  EnumerateProc: TYPE = PROC [previous: ArpaRouter.InternetAddress, delay: CARDINAL, onlyChangedValues: BOOLEAN ← FALSE]
    RETURNS[route: ArpaRouter.InternetAddress];
  FillTableProc: TYPE = PROC [maxDelay: CARDINAL];
  GetDelayProc: TYPE = PROC [net: ArpaRouter.InternetAddress]
    RETURNS [delay: CARDINAL];

  TransmitProc: TYPE = PROC[ArpaBuffer.Buffer];
  ForwardProc: TYPE = PROC[ArpaBuffer.Buffer];
  FindNetworkProc: TYPE = PROC[net: ArpaRouter.InternetAddress]
    RETURNS[ArpaRouter.InternetAddress];  

  AddNetworkProc: TYPE = PROC[NetworkContext];
  RemoveNetworkProc: TYPE = PROC[NetworkContext];
  FlushCacheProc: TYPE = PROC[net: ArpaRouter.InternetAddress];
  StateChangedProc: TYPE = PROC[NetworkContext];
  
  Redirect: PROCEDURE [b: ArpaBuffer.Buffer];
  
  InfoReply: PROCEDURE [b: ArpaBuffer.Buffer];
  
  ProbeGateway: PROCEDURE;

  END.
  
LOG

15-Jan-85 16:16:48  SMA  Created file.
 7-Jan-86 14:55:34  SMA  Added Redirect and InfoReply for icmp.
 9-Jan-86 12:23:43  SMA  Added ProbeGateway.
 2-Jun-86 15:57:15  SMA  Added procs for subnetting with static routing tables.
10-Jun-86 14:09:37  SMA  Changed type of EnumerateProc.
10-Mar-87 19:30:08  AOF  Funston buffer manager.