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