1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)routed.h 5.1 (Berkeley) 06/04/85 7 */ 8 9 /* 10 * Routing Information Protocol 11 * 12 * Derived from Xerox NS Routing Information Protocol 13 * by changing 32-bit net numbers to sockaddr's and 14 * padding stuff to 32-bit boundaries. 15 */ 16 #define RIPVERSION 1 17 18 struct netinfo { 19 struct sockaddr rip_dst; /* destination net/host */ 20 int rip_metric; /* cost of route */ 21 }; 22 23 struct rip { 24 u_char rip_cmd; /* request/response */ 25 u_char rip_vers; /* protocol version # */ 26 u_char rip_res1[2]; /* pad to 32-bit boundary */ 27 union { 28 struct netinfo ru_nets[1]; /* variable length... */ 29 char ru_tracefile[1]; /* ditto ... */ 30 } ripun; 31 #define rip_nets ripun.ru_nets 32 #define rip_tracefile ripun.ru_tracefile 33 }; 34 35 /* 36 * Packet types. 37 */ 38 #define RIPCMD_REQUEST 1 /* want info */ 39 #define RIPCMD_RESPONSE 2 /* responding to request */ 40 #define RIPCMD_TRACEON 3 /* turn tracing on */ 41 #define RIPCMD_TRACEOFF 4 /* turn it off */ 42 43 #define RIPCMD_MAX 5 44 #ifdef RIPCMDS 45 char *ripcmds[RIPCMD_MAX] = 46 { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; 47 #endif 48 49 #define HOPCNT_INFINITY 16 /* per Xerox NS */ 50 #define MAXPACKETSIZE 512 /* max broadcast size */ 51 52 /* 53 * Timer values used in managing the routing table. 54 * Every update forces an entry's timer to be reset. After 55 * EXPIRE_TIME without updates, the entry is marked invalid, 56 * but held onto until GARBAGE_TIME so that others may 57 * see it "be deleted". 58 */ 59 #define TIMER_RATE 30 /* alarm clocks every 30 seconds */ 60 61 #define SUPPLY_INTERVAL 30 /* time to supply tables */ 62 63 #define EXPIRE_TIME 180 /* time to mark entry invalid */ 64 #define GARBAGE_TIME 240 /* time to garbage collect */ 65