xref: /netbsd/usr.sbin/mrouted/vif.h (revision c60d41a9)
1 /*	$NetBSD: vif.h,v 1.8 2003/03/05 21:05:41 wiz 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  * User level Virtual Interface structure
14  *
15  * A "virtual interface" is either a physical, multicast-capable interface
16  * (called a "phyint") or a virtual point-to-point link (called a "tunnel").
17  * (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
18  */
19 struct uvif {
20     u_short	     uv_flags;	    /* VIFF_ flags defined below            */
21     u_char	     uv_metric;     /* cost of this vif                     */
22     u_int	     uv_rate_limit; /* rate limit on this vif               */
23     u_char	     uv_threshold;  /* min ttl required to forward on vif   */
24     u_int32_t	     uv_lcl_addr;   /* local address of this vif            */
25     u_int32_t	     uv_rmt_addr;   /* remote end-point addr (tunnels only) */
26     u_int32_t	     uv_subnet;     /* subnet number         (phyints only) */
27     u_int32_t	     uv_subnetmask; /* subnet mask           (phyints only) */
28     u_int32_t	     uv_subnetbcast;/* subnet broadcast addr (phyints only) */
29     char	     uv_name[IFNAMSIZ]; /* interface name                   */
30     struct listaddr *uv_groups;     /* list of local groups  (phyints only) */
31     struct listaddr *uv_neighbors;  /* list of neighboring routers          */
32     struct vif_acl  *uv_acl;	    /* access control list of groups        */
33     int		     uv_leaf_timer; /* time until this vif is considrd leaf */
34     struct phaddr   *uv_addrs;	    /* Additional subnets on this vif       */
35 };
36 
37 #define VIFF_KERNEL_FLAGS	(VIFF_TUNNEL|VIFF_SRCRT)
38 #define VIFF_DOWN		0x0100	       /* kernel state of interface */
39 #define VIFF_DISABLED		0x0200	       /* administratively disabled */
40 #define VIFF_QUERIER		0x0400	       /* I am the subnet's querier */
41 #define VIFF_ONEWAY		0x0800         /* Maybe one way interface   */
42 #define VIFF_LEAF		0x1000         /* all neighbors are leaves  */
43 #define VIFF_IGMPV1		0x2000         /* Act as an IGMPv1 Router   */
44 
45 struct phaddr {
46     struct phaddr   *pa_next;
47     u_int32_t	     pa_subnet;		/* extra subnet			*/
48     u_int32_t	     pa_subnetmask;	/* netmask of extra subnet	*/
49     u_int32_t	     pa_subnetbcast;	/* broadcast of extra subnet	*/
50 };
51 
52 struct vif_acl {
53     struct vif_acl  *acl_next;	    /* next acl member         */
54     u_int32_t	     acl_addr;	    /* Group address           */
55     u_int32_t	     acl_mask;	    /* Group addr. mask        */
56 };
57 
58 struct listaddr {
59     struct listaddr *al_next;		/* link to next addr, MUST BE FIRST */
60     u_int32_t	     al_addr;		/* local group or neighbor address  */
61     u_long	     al_timer;		/* for timing out group or neighbor */
62     time_t	     al_ctime;		/* neighbor creation time	    */
63     u_int32_t	     al_genid;		/* generation id for neighbor       */
64     u_char	     al_pv;		/* router protocol version	    */
65     u_char	     al_mv;		/* router mrouted version	    */
66     u_long           al_timerid;        /* returned by set timer            */
67     u_long	     al_query;		/* second query in case of leave    */
68     u_short          al_old;            /* time since heard old report      */
69     u_char	     al_flags;		/* flags related to this neighbor   */
70 };
71 
72 #define NF_LEAF			0x01	/* This neighbor is a leaf */
73 #define NF_PRUNE		0x02	/* This neighbor understands prunes */
74 #define NF_GENID		0x04	/* I supply genid & rtrlist in probe*/
75 #define NF_MTRACE		0x08	/* I can understand mtrace requests */
76 
77 #define NO_VIF		((vifi_t)MAXVIFS)  /* An invalid vif index */
78