Commit | Line | Data |
---|---|---|
3cec0c76 | 1 | /* defs.h 4.2 82/05/25 */ |
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 | /* | |
12 | * Internal routing table structure. | |
13 | * Differs a bit from kernel tables. | |
14 | */ | |
3cec0c76 | 15 | struct rthash { |
b242391c SL |
16 | struct rt_entry *rt_forw; |
17 | struct rt_entry *rt_back; | |
18 | }; | |
19 | ||
20 | struct rt_entry { | |
21 | struct rt_entry *rt_forw; | |
22 | struct rt_entry *rt_back; | |
3cec0c76 SL |
23 | union { |
24 | struct rtentry rtu_rt; | |
25 | struct { | |
26 | u_long rtu_hash; | |
27 | struct sockaddr rtu_dst; | |
28 | struct sockaddr rtu_gateway; | |
29 | short rtu_flags; | |
30 | short rtu_retry; | |
31 | int rtu_timer; | |
32 | int rtu_metric; | |
33 | struct ifnet *rtu_ifp; | |
34 | } rtu_entry; | |
35 | } rt_rtu; | |
b242391c SL |
36 | }; |
37 | ||
3cec0c76 SL |
38 | #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */ |
39 | #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */ | |
40 | #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */ | |
41 | #define rt_gateway rt_rtu.rtu_entry.rtu_gateway /* who to forward to */ | |
42 | #define rt_flags rt_rtu.rtu_entry.rtu_flags /* see below */ | |
43 | #define rt_retry rt_rtu.rtu_entry.rtu_retry /* retries of ioctl */ | |
44 | #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */ | |
45 | #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */ | |
46 | #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */ | |
47 | ||
b242391c SL |
48 | #define ROUTEHASHSIZ 19 |
49 | ||
50 | /* | |
51 | * Flags used by routing process are not | |
52 | * interpreted by kernel. | |
53 | */ | |
54 | #define RTF_DELRT 0x8 /* delete pending */ | |
55 | #define RTF_CHGRT 0x10 /* change command pending */ | |
56 | #define RTF_ADDRT 0x20 /* add command pending */ | |
57 | #define RTF_SILENT 0x40 /* don't send to router */ | |
58 | ||
3cec0c76 | 59 | struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ]; |
b242391c SL |
60 | struct rt_entry *rtlookup(); |
61 | ||
62 | /* | |
63 | * Per address family routines. Hash returns hash key based | |
64 | * on address; netmatch verifies net # matching, output interprets | |
65 | * an address in preparation for sending; portmatch interprets | |
66 | * an address in verifying incoming packets were sent from the | |
67 | * appropriate port; checkhost is used to decide whether an | |
68 | * address is for a host, or for a network (e.g. broadcast); | |
69 | * canon purges any extraneous stuff from a sender's address | |
70 | * before pattern matching is performed (e.g. Internet ports). | |
71 | */ | |
72 | struct afswitch { | |
73 | int (*af_hash)(); | |
74 | int (*af_netmatch)(); | |
75 | int (*af_output)(); | |
76 | int (*af_portmatch)(); | |
77 | int (*af_checkhost)(); | |
78 | int (*af_canon)(); | |
79 | }; | |
80 | ||
81 | struct afhash { | |
82 | u_int afh_hosthash; | |
83 | u_int afh_nethash; | |
84 | }; | |
85 | ||
86 | struct afswitch afswitch[AF_MAX]; |