1 /* table.h 4.1 83/01/11 */ 2 3 /* 4 * Routing table management daemon. 5 */ 6 7 /* 8 * Routing table structure; differs a bit from kernel tables. 9 * 10 * Note: the union below must agree in the first 4 members 11 * so the ioctl's will work. 12 */ 13 struct rthash { 14 struct rt_entry *rt_forw; 15 struct rt_entry *rt_back; 16 }; 17 18 struct rt_entry { 19 struct rt_entry *rt_forw; 20 struct rt_entry *rt_back; 21 union { 22 struct rtentry rtu_rt; 23 struct { 24 u_long rtu_hash; 25 struct sockaddr rtu_dst; 26 struct sockaddr rtu_router; 27 short rtu_flags; 28 short rtu_state; 29 int rtu_timer; 30 int rtu_metric; 31 struct interface *rtu_ifp; 32 } rtu_entry; 33 } rt_rtu; 34 }; 35 36 #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */ 37 #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */ 38 #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */ 39 #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */ 40 #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */ 41 #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ 42 #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */ 43 #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ 44 #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ 45 46 #define ROUTEHASHSIZ 19 47 48 /* 49 * "State" of routing table entry. 50 */ 51 #define RTS_CHANGED 0x1 /* route has been altered recently */ 52 #define RTS_PASSIVE 0x20 /* don't time out route */ 53 #define RTS_INTERFACE 0x40 /* route is for network interface */ 54 #define RTS_REMOTE 0x80 /* route is for ``remote'' entity */ 55 56 struct rthash nethash[ROUTEHASHSIZ]; 57 struct rthash hosthash[ROUTEHASHSIZ]; 58 struct rt_entry *rtlookup(); 59 struct rt_entry *rtfind(); 60