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