xref: /netbsd-src/usr.sbin/mrouted/route.h (revision ae9172d6cd9432a6a1a56760d86b32c57a66c39c)
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  * $Id: route.h,v 1.1 1994/01/11 20:16:03 brezak Exp $
11  */
12 
13 /*
14  * Routing Table Entry, one per subnet from which a multicast could originate.
15  * (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
16  *
17  * The Routing Table is stored as a singly-linked list of these structures,
18  * ordered by increasing value of rt_originmask and, secondarily, by
19  * increasing value of rt_origin within each rt_originmask value.
20  * This data structure is efficient for generating route reports, whether
21  * full or partial, for processing received full reports, for clearing the
22  * CHANGED flags, and for periodically advancing the timers in all routes.
23  * It is not so efficient for updating a small number of routes in response
24  * to a partial report.  In a stable topology, the latter are rare; if they
25  * turn out to be costing a lot, we can add an auxiliary hash table for
26  * faster access to arbitrary route entries.
27  */
28 struct rtentry {
29     struct rtentry  *rt_next;		/* link to next entry MUST BE FIRST */
30     u_long	     rt_origin;		/* subnet origin of multicasts      */
31     u_long	     rt_originmask;	/* subnet mask for origin           */
32     short	     rt_originwidth;	/* # bytes of origin subnet number  */
33     u_char	     rt_metric;		/* cost of route back to origin     */
34     u_char	     rt_flags;		/* RTF_ flags defined below         */
35     u_long	     rt_gateway;	/* first-hop gateway back to origin */
36     vifi_t	     rt_parent;	    	/* incoming vif (ie towards origin) */
37     vifbitmap_t	     rt_children;	/* outgoing children vifs           */
38     vifbitmap_t	     rt_leaves;		/* subset of outgoing children vifs */
39     u_long	    *rt_dominants;      /* per vif dominant gateways        */
40     u_long	    *rt_subordinates;   /* per vif subordinate gateways     */
41     u_long	    *rt_leaf_timers;	/* per vif leaf confirmation timers */
42     u_long	     rt_timer;		/* for timing out the route entry   */
43 };
44 
45 #define	RTF_CHANGED		0x01	/* route changed but not reported   */
46 #define RTF_LEAF_TIMING		0x02	/* some leaf timers are running     */
47 
48 
49 #define ALL_ROUTES	0		/* possible arguments to report()   */
50 #define CHANGED_ROUTES	1		/*  and report_to_all_neighbors()   */
51