MFC r1.6 r1.30 r1.28 (HEAD):
[dragonfly.git] / usr.sbin / mrouted / route.h
blob65cdd9a56948ada3877c45e206a6ef73e59caef5
1 /*
2 * The mrouted program is covered by the license in the accompanying file
3 * named "LICENSE". Use of the mrouted program represents acceptance of
4 * the terms and conditions listed in that file.
6 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
7 * Leland Stanford Junior University.
10 * $FreeBSD: src/usr.sbin/mrouted/route.h,v 1.9 1999/08/28 01:17:09 peter Exp $
11 * $DragonFly: src/usr.sbin/mrouted/route.h,v 1.2 2003/06/17 04:29:57 dillon Exp $
12 * route.h,v 3.8.4.6 1997/07/01 23:02:35 fenner Exp
16 * Routing Table Entry, one per subnet from which a multicast could originate.
17 * (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
19 * The Routing Table is stored as a doubly-linked list of these structures,
20 * ordered by decreasing value of rt_originmask and, secondarily, by
21 * decreasing value of rt_origin within each rt_originmask value.
22 * This data structure is efficient for generating route reports, whether
23 * full or partial, for processing received full reports, for clearing the
24 * CHANGED flags, and for periodically advancing the timers in all routes.
25 * It is not so efficient for updating a small number of routes in response
26 * to a partial report. In a stable topology, the latter are rare; if they
27 * turn out to be costing a lot, we can add an auxiliary hash table for
28 * faster access to arbitrary route entries.
30 struct rtentry {
31 struct rtentry *rt_next; /* link to next entry MUST BE FIRST */
32 u_int32 rt_origin; /* subnet origin of multicasts */
33 u_int32 rt_originmask; /* subnet mask for origin */
34 short rt_originwidth; /* # bytes of origin subnet number */
35 u_char rt_metric; /* cost of route back to origin */
36 u_char rt_flags; /* RTF_ flags defined below */
37 u_int32 rt_gateway; /* first-hop gateway back to origin */
38 vifi_t rt_parent; /* incoming vif (ie towards origin) */
39 vifbitmap_t rt_children; /* outgoing children vifs */
40 u_int32 *rt_dominants; /* per vif dominant gateways */
41 nbrbitmap_t rt_subordinates; /* bitmap of subordinate gateways */
42 nbrbitmap_t rt_subordadv; /* recently advertised subordinates */
43 u_int rt_timer; /* for timing out the route entry */
44 struct rtentry *rt_prev; /* link to previous entry */
45 struct gtable *rt_groups; /* link to active groups */
48 #define RTF_CHANGED 0x01 /* route changed but not reported */
49 #define RTF_HOLDDOWN 0x04 /* this route is in holddown */
51 #define ALL_ROUTES 0 /* possible arguments to report() */
52 #define CHANGED_ROUTES 1 /* and report_to_all_neighbors() */
54 #define RT_FMT(r, s) inet_fmts((r)->rt_origin, (r)->rt_originmask, s)