|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that this notice is preserved and that due credit is given ! 7: * to the University of California at Berkeley. The name of the University ! 8: * may not be used to endorse or promote products derived from this ! 9: * software without specific prior written permission. This software ! 10: * is provided ``as is'' without express or implied warranty. ! 11: * ! 12: * @(#)table.h 5.5 (Berkeley) 2/16/88 ! 13: */ ! 14: ! 15: /* ! 16: * Routing table management daemon. ! 17: */ ! 18: ! 19: /* ! 20: * Routing table structure; differs a bit from kernel tables. ! 21: * ! 22: * Note: the union below must agree in the first 4 members ! 23: * so the ioctl's will work. ! 24: */ ! 25: struct rthash { ! 26: struct rt_entry *rt_forw; ! 27: struct rt_entry *rt_back; ! 28: }; ! 29: ! 30: struct rt_entry { ! 31: struct rt_entry *rt_forw; ! 32: struct rt_entry *rt_back; ! 33: union { ! 34: struct rtentry rtu_rt; ! 35: struct { ! 36: u_long rtu_hash; ! 37: struct sockaddr rtu_dst; ! 38: struct sockaddr rtu_router; ! 39: short rtu_flags; ! 40: short rtu_state; ! 41: int rtu_timer; ! 42: int rtu_metric; ! 43: int rtu_ifmetric; ! 44: struct interface *rtu_ifp; ! 45: } rtu_entry; ! 46: } rt_rtu; ! 47: }; ! 48: ! 49: #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */ ! 50: #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */ ! 51: #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */ ! 52: #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */ ! 53: #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */ ! 54: #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ ! 55: #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */ ! 56: #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ ! 57: #define rt_ifmetric rt_rtu.rtu_entry.rtu_ifmetric /* cost of route if */ ! 58: #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ ! 59: ! 60: #define ROUTEHASHSIZ 32 /* must be a power of 2 */ ! 61: #define ROUTEHASHMASK (ROUTEHASHSIZ - 1) ! 62: ! 63: /* ! 64: * "State" of routing table entry. ! 65: */ ! 66: #define RTS_CHANGED 0x1 /* route has been altered recently */ ! 67: #define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */ ! 68: #define RTS_INTERNAL 0x4 /* internal route, not installed */ ! 69: #define RTS_PASSIVE IFF_PASSIVE /* don't time out route */ ! 70: #define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */ ! 71: #define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */ ! 72: #define RTS_SUBNET IFF_SUBNET /* route is for network subnet */ ! 73: ! 74: /* ! 75: * Flags are same as kernel, with this addition for af_rtflags: ! 76: */ ! 77: #define RTF_SUBNET 0x8000 /* pseudo: route to subnet */ ! 78: ! 79: struct rthash nethash[ROUTEHASHSIZ]; ! 80: struct rthash hosthash[ROUTEHASHSIZ]; ! 81: struct rt_entry *rtlookup(); ! 82: struct rt_entry *rtfind();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.