Commit | Line | Data |
---|---|---|
a9f3e174 | 1 | /* route.h 4.7 82/03/31 */ |
6c0a063b SL |
2 | |
3 | /* | |
a9f3e174 SL |
4 | * Kernel resident routing tables. |
5 | * | |
6 | * Each interface makes an entry at boot time so that | |
7 | * correspondents directly addressible can be found. | |
8 | * User programs can update this data base from information | |
9 | * stored in the file system or information gleaned from | |
10 | * routing protocol interactions with gateways. | |
6c0a063b | 11 | * |
a9f3e174 SL |
12 | * TODO: |
13 | * keep statistics | |
14 | * smooth usage figures | |
6c0a063b SL |
15 | */ |
16 | struct rtentry { | |
fc74f0c9 | 17 | u_long rt_hash; /* for net or for host */ |
6c0a063b SL |
18 | struct sockaddr rt_dst; /* match value */ |
19 | struct sockaddr rt_gateway; /* who to forward to */ | |
20 | short rt_flags; /* see below */ | |
21 | short rt_refcnt; /* # held references */ | |
22 | u_long rt_use; /* raw # packets forwarded */ | |
23 | struct ifnet *rt_ifp; /* interface to use */ | |
24 | }; | |
25 | ||
26 | struct route { | |
27 | struct rtentry *ro_rt; | |
28 | struct sockaddr ro_dst; | |
29 | caddr_t ro_pcb; /* back pointer? */ | |
30 | }; | |
31 | ||
32 | /* | |
33 | * Flags and host/network status. | |
34 | */ | |
ee787340 | 35 | #define RTF_UP 0x1 /* route useable */ |
9f94300a | 36 | #define RTF_DIRECT 0x2 /* destination is a neighbor */ |
fc74f0c9 | 37 | #define RTF_HOST 0x4 /* host entry (net otherwise) */ |
6c0a063b | 38 | |
a9f3e174 SL |
39 | #define RTFREE(rt) \ |
40 | if ((rt)->rt_refcnt == 1) \ | |
41 | rtfree(rt); \ | |
42 | else \ | |
43 | (rt)->rt_refcnt--; | |
44 | ||
6c0a063b SL |
45 | #ifdef KERNEL |
46 | /* | |
47 | * Lookup are hashed by a key. Each hash bucket | |
48 | * consists of a linked list of mbuf's | |
49 | * containing routing entries. Dead entries are | |
50 | * reclaimed along with mbufs. | |
51 | */ | |
fc74f0c9 SL |
52 | #define RTHASHSIZ 7 |
53 | struct mbuf *rthost[RTHASHSIZ]; | |
54 | struct mbuf *rtnet[RTHASHSIZ]; | |
6c0a063b | 55 | #endif |