taskqueue.9: Do some mdoc cleanup & add missing MLINKS.
[dragonfly.git] / usr.sbin / IPXrouted / table.h
blob87b62483b0b35541aa7c0da486eeb891c0d10d3a
1 /*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Copyright (c) 1995 John Hay. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
35 * @(#)table.h 5.1 (Berkeley) 6/4/85 (routed/table.h)
37 * @(#)table.h 8.1 (Berkeley) 6/5/93
39 * $FreeBSD: src/usr.sbin/IPXrouted/table.h,v 1.6 1999/08/28 01:15:05 peter Exp $
40 * $DragonFly: src/usr.sbin/IPXrouted/table.h,v 1.2 2003/06/17 04:29:52 dillon Exp $
44 * Routing table management daemon.
48 * Routing table structure; differs a bit from kernel tables.
50 * Note: the union below must agree in the first 4 members
51 * so the ioctl's will work.
53 struct rthash {
54 struct rt_entry *rt_forw;
55 struct rt_entry *rt_back;
58 #ifdef RTM_ADD
59 #define rtentry ortentry
60 #endif
62 struct rt_entry {
63 struct rt_entry *rt_forw;
64 struct rt_entry *rt_back;
65 union {
66 struct rtentry rtu_rt;
67 struct rtuentry {
68 u_long rtu_hash;
69 struct sockaddr rtu_dst;
70 struct sockaddr rtu_router;
71 short rtu_rtflags; /* used by old rtioctl */
72 short rtu_wasted; /* XXX routed does it this way. */
73 int rtu_flags;
74 int rtu_state;
75 int rtu_timer;
76 int rtu_metric;
77 int rtu_ticks;
78 struct interface *rtu_ifp;
79 } rtu_entry;
80 } rt_rtu;
81 struct rt_entry *rt_clone;
84 #define rt_rt rt_rtu.rtu_entry /* pass to ioctl */
85 #define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */
86 #define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */
87 #define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */
88 #define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */
89 #define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */
90 #define rt_state rt_rtu.rtu_entry.rtu_state /* see below */
91 #define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */
92 #define rt_ticks rt_rtu.rtu_entry.rtu_ticks /* time of route */
93 #define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */
95 #define ROUTEHASHSIZ 128 /* must be a power of 2 */
96 #define ROUTEHASHMASK (ROUTEHASHSIZ - 1)
99 * "State" of routing table entry.
101 #define RTS_CHANGED 0x1 /* route has been altered recently */
102 #define RTS_PASSIVE IFF_PASSIVE /* don't time out route */
103 #define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */
104 #define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */
106 extern struct rthash nethash[ROUTEHASHSIZ];
107 struct rt_entry *rtlookup(struct sockaddr *);
108 struct rt_entry *rtfind(struct sockaddr *);
109 void rtadd(struct sockaddr *, struct sockaddr *, short, short, int);
110 void rtadd_clone(struct rt_entry *, struct sockaddr *, struct sockaddr *,
111 short, short, int);
112 void rtchange(struct rt_entry *, struct sockaddr *, short, short);
113 void rtdelete(struct rt_entry *);
114 int rtioctl(int, struct rtuentry *);
115 void rtinit(void);