|
|
1.1 root 1: /*
2: * Copyright (c) 1983 The 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.1 (Berkeley) 6/4/85 (routed/table.h)
20: *
21: * @(#)table.h 5.3 (Berkeley) 6/1/90
22: */
23:
24: /*
25: * Routing table management daemon.
26: */
27:
28: /*
29: * Routing table structure; differs a bit from kernel tables.
30: *
31: * Note: the union below must agree in the first 4 members
32: * so the ioctl's will work.
33: */
34: struct rthash {
35: struct rt_entry *rt_forw;
36: struct rt_entry *rt_back;
37: };
38:
39: #ifdef RTM_ADD
40: #define rtentry ortentry
41: #endif
42:
43: struct rt_entry {
44: struct rt_entry *rt_forw;
45: struct rt_entry *rt_back;
46: union {
47: struct rtentry rtu_rt;
48: struct {
49: u_long rtu_hash;
50: struct sockaddr rtu_dst;
51: struct sockaddr rtu_router;
52: short rtu_flags;
53: short rtu_state;
54: int rtu_timer;
55: int rtu_metric;
56: struct interface *rtu_ifp;
57: } rtu_entry;
58: } rt_rtu;
59: };
60:
61: #define rt_rt rt_rtu.rtu_rt /* pass to ioctl */
62: #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */
63: #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */
64: #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */
65: #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */
66: #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */
67: #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */
68: #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */
69: #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */
70:
71: #define ROUTEHASHSIZ 32 /* must be a power of 2 */
72: #define ROUTEHASHMASK (ROUTEHASHSIZ - 1)
73:
74: /*
75: * "State" of routing table entry.
76: */
77: #define RTS_CHANGED 0x1 /* route has been altered recently */
78: #define RTS_PASSIVE IFF_PASSIVE /* don't time out route */
79: #define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */
80: #define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */
81:
82: struct rthash nethash[ROUTEHASHSIZ];
83: struct rthash hosthash[ROUTEHASHSIZ];
84: struct rt_entry *rtlookup();
85: struct rt_entry *rtfind();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.