12e951869Skarels /*- 2*3cccd19bSbostic * Copyright (c) 1983, 1989, 1993 3*3cccd19bSbostic * The Regents of the University of California. All rights reserved. 4328f182eSdist * 52e951869Skarels * %sccs.include.redist.c% 62e951869Skarels * 7*3cccd19bSbostic * @(#)routed.h 8.1 (Berkeley) 06/02/93 8328f182eSdist */ 9328f182eSdist 107c201f45Sbostic #ifndef _ROUTED_H_ 117c201f45Sbostic #define _ROUTED_H_ 127c201f45Sbostic 1324f1d79fSsam /* 1424f1d79fSsam * Routing Information Protocol 1506dad7edSsam * 1606dad7edSsam * Derived from Xerox NS Routing Information Protocol 1706dad7edSsam * by changing 32-bit net numbers to sockaddr's and 1806dad7edSsam * padding stuff to 32-bit boundaries. 1924f1d79fSsam */ 20202044daSsam #define RIPVERSION 1 21202044daSsam 2224f1d79fSsam struct netinfo { 2324f1d79fSsam struct sockaddr rip_dst; /* destination net/host */ 2424f1d79fSsam int rip_metric; /* cost of route */ 2524f1d79fSsam }; 2624f1d79fSsam 2724f1d79fSsam struct rip { 2824f1d79fSsam u_char rip_cmd; /* request/response */ 29202044daSsam u_char rip_vers; /* protocol version # */ 30202044daSsam u_char rip_res1[2]; /* pad to 32-bit boundary */ 3170ce991fSsam union { 3270ce991fSsam struct netinfo ru_nets[1]; /* variable length... */ 3370ce991fSsam char ru_tracefile[1]; /* ditto ... */ 3470ce991fSsam } ripun; 3570ce991fSsam #define rip_nets ripun.ru_nets 3670ce991fSsam #define rip_tracefile ripun.ru_tracefile 3724f1d79fSsam }; 3824f1d79fSsam 39202044daSsam /* 40202044daSsam * Packet types. 41202044daSsam */ 42fe77bfd9Ssam #define RIPCMD_REQUEST 1 /* want info */ 43fe77bfd9Ssam #define RIPCMD_RESPONSE 2 /* responding to request */ 44fe77bfd9Ssam #define RIPCMD_TRACEON 3 /* turn tracing on */ 45fe77bfd9Ssam #define RIPCMD_TRACEOFF 4 /* turn it off */ 46fe77bfd9Ssam 47fe77bfd9Ssam #define RIPCMD_MAX 5 48fe77bfd9Ssam #ifdef RIPCMDS 49fe77bfd9Ssam char *ripcmds[RIPCMD_MAX] = 50fe77bfd9Ssam { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; 51fe77bfd9Ssam #endif 5224f1d79fSsam 5324f1d79fSsam #define HOPCNT_INFINITY 16 /* per Xerox NS */ 5406dad7edSsam #define MAXPACKETSIZE 512 /* max broadcast size */ 5524f1d79fSsam 5624f1d79fSsam /* 5706dad7edSsam * Timer values used in managing the routing table. 582e951869Skarels * Complete tables are broadcast every SUPPLY_INTERVAL seconds. 592e951869Skarels * If changes occur between updates, dynamic updates containing only changes 602e951869Skarels * may be sent. When these are sent, a timer is set for a random value 612e951869Skarels * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates 622e951869Skarels * are sent until the timer expires. 632e951869Skarels * 642e951869Skarels * Every update of a routing entry forces an entry's timer to be reset. 652e951869Skarels * After EXPIRE_TIME without updates, the entry is marked invalid, 6624f1d79fSsam * but held onto until GARBAGE_TIME so that others may 672f60f4d7Swnj * see it "be deleted". 6824f1d79fSsam */ 6924f1d79fSsam #define TIMER_RATE 30 /* alarm clocks every 30 seconds */ 702f60f4d7Swnj 7124f1d79fSsam #define SUPPLY_INTERVAL 30 /* time to supply tables */ 722e951869Skarels #define MIN_WAITTIME 2 /* min. interval to broadcast changes */ 732e951869Skarels #define MAX_WAITTIME 5 /* max. time to delay changes */ 742f60f4d7Swnj 752f60f4d7Swnj #define EXPIRE_TIME 180 /* time to mark entry invalid */ 76a8867c37Ssam #define GARBAGE_TIME 240 /* time to garbage collect */ 777c201f45Sbostic 787c201f45Sbostic #endif /* !_ROUTED_H_ */ 79