1/*	$NetBSD: route.h,v 1.1 2002/10/01 03:31:10 itojun Exp $	*/
2
3/*
4 * The mrouted program is covered by the license in the accompanying file
5 * named "LICENSE".  Use of the mrouted program represents acceptance of
6 * the terms and conditions listed in that file.
7 *
8 * The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
9 * Leland Stanford Junior University.
10 */
11
12/*
13 * Routing Table Entry, one per subnet from which a multicast could originate.
14 * (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
15 *
16 * The Routing Table is stored as a doubly-linked list of these structures,
17 * ordered by decreasing value of rt_originmask and, secondarily, by
18 * decreasing value of rt_origin within each rt_originmask value.
19 * This data structure is efficient for generating route reports, whether
20 * full or partial, for processing received full reports, for clearing the
21 * CHANGED flags, and for periodically advancing the timers in all routes.
22 * It is not so efficient for updating a small number of routes in response
23 * to a partial report.  In a stable topology, the latter are rare; if they
24 * turn out to be costing a lot, we can add an auxiliary hash table for
25 * faster access to arbitrary route entries.
26 */
27struct rtentry {
28    struct rtentry  *rt_next;		/* link to next entry MUST BE FIRST */
29    u_int32_t	     rt_origin;		/* subnet origin of multicasts      */
30    u_int32_t	     rt_originmask;	/* subnet mask for origin           */
31    short	     rt_originwidth;	/* # bytes of origin subnet number  */
32    u_char	     rt_metric;		/* cost of route back to origin     */
33    u_char	     rt_flags;		/* RTF_ flags defined below         */
34    u_int32_t	     rt_gateway;	/* first-hop gateway back to origin */
35    vifi_t	     rt_parent;	    	/* incoming vif (ie towards origin) */
36    vifbitmap_t	     rt_children;	/* outgoing children vifs           */
37    vifbitmap_t	     rt_leaves;		/* subset of outgoing children vifs */
38    u_int32_t	    *rt_dominants;      /* per vif dominant gateways        */
39    u_int32_t	    *rt_subordinates;   /* per vif subordinate gateways     */
40    u_int	    *rt_leaf_timers;	/* per vif leaf confirmation timers */
41    u_int	     rt_timer;		/* for timing out the route entry   */
42    struct rtentry  *rt_prev;		/* link to previous entry           */
43    struct gtable   *rt_groups;		/* link to active groups 	    */
44};
45
46#define	RTF_CHANGED		0x01	/* route changed but not reported   */
47#define RTF_LEAF_TIMING		0x02	/* some leaf timers are running     */
48
49#define ALL_ROUTES	0		/* possible arguments to report()   */
50#define CHANGED_ROUTES	1		/*  and report_to_all_neighbors()   */
51