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