Commit | Line | Data |
---|---|---|
75659c93 | 1 | /* defs.h 4.6 82/06/05 */ |
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; | |
30 | struct sockaddr rtu_gateway; | |
31 | short rtu_flags; | |
32 | short rtu_retry; | |
e6b5ed24 SL |
33 | short rtu_timer; |
34 | short rtu_state; | |
3cec0c76 SL |
35 | int rtu_metric; |
36 | struct ifnet *rtu_ifp; | |
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 */ | |
44 | #define rt_gateway rt_rtu.rtu_entry.rtu_gateway /* who to forward to */ | |
e6b5ed24 | 45 | #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */ |
3cec0c76 SL |
46 | #define rt_retry rt_rtu.rtu_entry.rtu_retry /* retries of ioctl */ |
47 | #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ | |
e6b5ed24 | 48 | #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */ |
3cec0c76 SL |
49 | #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ |
50 | #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ | |
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 */ | |
98c1da1f | 60 | #define RTS_HIDDEN 0x8 /* don't send to router */ |
b242391c | 61 | |
3cec0c76 | 62 | struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ]; |
eae14a37 | 63 | struct rt_entry *rtlookup(), *rtfind(); |
b242391c SL |
64 | |
65 | /* | |
e6b5ed24 | 66 | * Per address family routines. |
b242391c SL |
67 | */ |
68 | struct afswitch { | |
e6b5ed24 SL |
69 | int (*af_hash)(); /* returns keys based on address */ |
70 | int (*af_netmatch)(); /* verifies net # matching */ | |
71 | int (*af_output)(); /* interprets address for sending */ | |
75659c93 SL |
72 | int (*af_portmatch)(); /* packet from some other router? */ |
73 | int (*af_portcheck)(); /* packet from priviledged peer? */ | |
e6b5ed24 | 74 | int (*af_checkhost)(); /* tells if address for host or net */ |
75659c93 | 75 | int (*af_canon)(); /* canonicalize address for compares */ |
b242391c SL |
76 | }; |
77 | ||
e6b5ed24 SL |
78 | /* |
79 | * Structure returned by af_hash routines. | |
80 | */ | |
b242391c | 81 | struct afhash { |
e6b5ed24 SL |
82 | u_int afh_hosthash; /* host based hash */ |
83 | u_int afh_nethash; /* network based hash */ | |
b242391c SL |
84 | }; |
85 | ||
e6b5ed24 | 86 | struct afswitch afswitch[AF_MAX]; /* table proper */ |