|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)table.h 5.8 (Berkeley) 6/1/90
20: */
21:
22: /*
23: * Routing table management daemon.
24: */
25:
26: /*
27: * Routing table structure; differs a bit from kernel tables.
28: *
29: * Note: the union below must agree in the first 4 members
30: * so the ioctl's will work.
31: */
32: struct rthash {
33: struct rt_entry *rt_forw;
34: struct rt_entry *rt_back;
35: };
36: #ifdef RTM_ADD
37: #define rtentry ortentry
38: #endif
39:
40: struct rt_entry {
41: struct rt_entry *rt_forw;
42: struct rt_entry *rt_back;
43: union {
44: struct rtentry rtu_rt;
45: struct {
46: u_long rtu_hash;
47: struct sockaddr rtu_dst;
48: struct sockaddr rtu_router;
49: short rtu_flags;
50: short rtu_state;
51: int rtu_timer;
52: int rtu_metric;
53: int rtu_ifmetric;
54: struct interface *rtu_ifp;
55: } rtu_entry;
56: } rt_rtu;
57: };
58:
59: #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */
60: #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */
61: #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */
62: #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */
63: #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */
64: #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */
65: #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */
66: #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */
67: #define rt_ifmetric rt_rtu.rtu_entry.rtu_ifmetric /* cost of route if */
68: #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */
69:
70: #define ROUTEHASHSIZ 32 /* must be a power of 2 */
71: #define ROUTEHASHMASK (ROUTEHASHSIZ - 1)
72:
73: /*
74: * "State" of routing table entry.
75: */
76: #define RTS_CHANGED 0x1 /* route has been altered recently */
77: #define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */
78: #define RTS_INTERNAL 0x4 /* internal route, not installed */
79: #define RTS_PASSIVE IFF_PASSIVE /* don't time out route */
80: #define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */
81: #define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */
82: #define RTS_SUBNET IFF_SUBNET /* route is for network subnet */
83:
84: /*
85: * Flags are same as kernel, with this addition for af_rtflags:
86: */
87: #define RTF_SUBNET 0x8000 /* pseudo: route to subnet */
88:
89: struct rthash nethash[ROUTEHASHSIZ];
90: struct rthash hosthash[ROUTEHASHSIZ];
91: struct rt_entry *rtlookup();
92: struct rt_entry *rtfind();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.