Commit | Line | Data |
---|---|---|
6db0b3a4 | 1 | /* defs.h 4.8 82/06/09 */ |
b242391c SL |
2 | |
3 | /* | |
4 | * Internal data structure definitions for | |
5 | * user routing process. Based on Xerox NS | |
6 | * protocol specs with mods relevant to more | |
7 | * general addressing scheme. | |
8 | */ | |
3cec0c76 | 9 | #include <net/route.h> |
b242391c SL |
10 | |
11 | /* | |
e6b5ed24 SL |
12 | * Routing table structure; differs a bit from kernel tables. |
13 | * | |
14 | * Note: the union below must agree in the first 4 members | |
15 | * so the ioctl's will work. | |
b242391c | 16 | */ |
3cec0c76 | 17 | struct rthash { |
b242391c SL |
18 | struct rt_entry *rt_forw; |
19 | struct rt_entry *rt_back; | |
20 | }; | |
21 | ||
22 | struct rt_entry { | |
23 | struct rt_entry *rt_forw; | |
24 | struct rt_entry *rt_back; | |
3cec0c76 SL |
25 | union { |
26 | struct rtentry rtu_rt; | |
27 | struct { | |
28 | u_long rtu_hash; | |
29 | struct sockaddr rtu_dst; | |
6a8616d4 | 30 | struct sockaddr rtu_router; |
3cec0c76 | 31 | short rtu_flags; |
e6b5ed24 | 32 | short rtu_state; |
6a8616d4 | 33 | int rtu_timer; |
3cec0c76 SL |
34 | int rtu_metric; |
35 | struct ifnet *rtu_ifp; | |
6a8616d4 | 36 | struct sockaddr rtu_newrouter; |
3cec0c76 SL |
37 | } rtu_entry; |
38 | } rt_rtu; | |
b242391c SL |
39 | }; |
40 | ||
3cec0c76 SL |
41 | #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */ |
42 | #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */ | |
43 | #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */ | |
6a8616d4 | 44 | #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */ |
e6b5ed24 | 45 | #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */ |
3cec0c76 | 46 | #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ |
e6b5ed24 | 47 | #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */ |
3cec0c76 SL |
48 | #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ |
49 | #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ | |
6a8616d4 | 50 | #define rt_newrouter rt_rtu.rtu_entry.rtu_newrouter /* for change's */ |
3cec0c76 | 51 | |
b242391c SL |
52 | #define ROUTEHASHSIZ 19 |
53 | ||
54 | /* | |
e6b5ed24 | 55 | * "State" of routing table entry. |
b242391c | 56 | */ |
e6b5ed24 SL |
57 | #define RTS_DELRT 0x1 /* delete pending */ |
58 | #define RTS_CHGRT 0x2 /* change command pending */ | |
59 | #define RTS_ADDRT 0x4 /* add command pending */ | |
6a8616d4 BJ |
60 | #define RTS_PASSIVE 0x8 /* don't send to router */ |
61 | #define RTS_INTERFACE 0x10 /* route is for an interface */ | |
6db0b3a4 | 62 | #define RTS_GLOBAL 0x20 /* entry is non-local, don't lose it */ |
b242391c | 63 | |
3cec0c76 | 64 | struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ]; |
eae14a37 | 65 | struct rt_entry *rtlookup(), *rtfind(); |
b242391c SL |
66 | |
67 | /* | |
e6b5ed24 | 68 | * Per address family routines. |
b242391c SL |
69 | */ |
70 | struct afswitch { | |
e6b5ed24 SL |
71 | int (*af_hash)(); /* returns keys based on address */ |
72 | int (*af_netmatch)(); /* verifies net # matching */ | |
73 | int (*af_output)(); /* interprets address for sending */ | |
75659c93 SL |
74 | int (*af_portmatch)(); /* packet from some other router? */ |
75 | int (*af_portcheck)(); /* packet from priviledged peer? */ | |
e6b5ed24 | 76 | int (*af_checkhost)(); /* tells if address for host or net */ |
75659c93 | 77 | int (*af_canon)(); /* canonicalize address for compares */ |
b242391c SL |
78 | }; |
79 | ||
e6b5ed24 SL |
80 | /* |
81 | * Structure returned by af_hash routines. | |
82 | */ | |
b242391c | 83 | struct afhash { |
e6b5ed24 SL |
84 | u_int afh_hosthash; /* host based hash */ |
85 | u_int afh_nethash; /* network based hash */ | |
b242391c SL |
86 | }; |
87 | ||
e6b5ed24 | 88 | struct afswitch afswitch[AF_MAX]; /* table proper */ |