xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/linux/mroute.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 #ifndef __LINUX_MROUTE_H
2 #define __LINUX_MROUTE_H
3 
4 #include <linux/sockios.h>
5 #include <linux/types.h>
6 #include <linux/pim.h>
7 
8 /*
9  *	Based on the MROUTING 3.5 defines primarily to keep
10  *	source compatibility with BSD.
11  *
12  *	See the mrouted code for the original history.
13  *
14  *      Protocol Independent Multicast (PIM) data structures included
15  *      Carlos Picoto (cap@di.fc.ul.pt)
16  *
17  */
18 
19 #define MRT_BASE	200
20 #define MRT_INIT	(MRT_BASE)	/* Activate the kernel mroute code 	*/
21 #define MRT_DONE	(MRT_BASE+1)	/* Shutdown the kernel mroute		*/
22 #define MRT_ADD_VIF	(MRT_BASE+2)	/* Add a virtual interface		*/
23 #define MRT_DEL_VIF	(MRT_BASE+3)	/* Delete a virtual interface		*/
24 #define MRT_ADD_MFC	(MRT_BASE+4)	/* Add a multicast forwarding entry	*/
25 #define MRT_DEL_MFC	(MRT_BASE+5)	/* Delete a multicast forwarding entry	*/
26 #define MRT_VERSION	(MRT_BASE+6)	/* Get the kernel multicast version	*/
27 #define MRT_ASSERT	(MRT_BASE+7)	/* Activate PIM assert mode		*/
28 #define MRT_PIM		(MRT_BASE+8)	/* enable PIM code	*/
29 
30 #define SIOCGETVIFCNT	SIOCPROTOPRIVATE	/* IP protocol privates */
31 #define SIOCGETSGCNT	(SIOCPROTOPRIVATE+1)
32 #define SIOCGETRPF	(SIOCPROTOPRIVATE+2)
33 
34 #define MAXVIFS		32
35 typedef unsigned long vifbitmap_t;	/* User mode code depends on this lot */
36 typedef unsigned short vifi_t;
37 #define ALL_VIFS	((vifi_t)(-1))
38 
39 /*
40  *	Same idea as select
41  */
42 
43 #define VIFM_SET(n,m)	((m)|=(1<<(n)))
44 #define VIFM_CLR(n,m)	((m)&=~(1<<(n)))
45 #define VIFM_ISSET(n,m)	((m)&(1<<(n)))
46 #define VIFM_CLRALL(m)	((m)=0)
47 #define VIFM_COPY(mfrom,mto)	((mto)=(mfrom))
48 #define VIFM_SAME(m1,m2)	((m1)==(m2))
49 
50 /*
51  *	Passed by mrouted for an MRT_ADD_VIF - again we use the
52  *	mrouted 3.6 structures for compatibility
53  */
54 
55 struct vifctl {
56 	vifi_t	vifc_vifi;		/* Index of VIF */
57 	unsigned char vifc_flags;	/* VIFF_ flags */
58 	unsigned char vifc_threshold;	/* ttl limit */
59 	unsigned int vifc_rate_limit;	/* Rate limiter values (NI) */
60 	struct in_addr vifc_lcl_addr;	/* Our address */
61 	struct in_addr vifc_rmt_addr;	/* IPIP tunnel addr */
62 };
63 
64 #define VIFF_TUNNEL	0x1	/* IPIP tunnel */
65 #define VIFF_SRCRT	0x2	/* NI */
66 #define VIFF_REGISTER	0x4	/* register vif	*/
67 
68 /*
69  *	Cache manipulation structures for mrouted and PIMd
70  */
71 
72 struct mfcctl
73 {
74 	struct in_addr mfcc_origin;		/* Origin of mcast	*/
75 	struct in_addr mfcc_mcastgrp;		/* Group in question	*/
76 	vifi_t	mfcc_parent;			/* Where it arrived	*/
77 	unsigned char mfcc_ttls[MAXVIFS];	/* Where it is going	*/
78 	unsigned int mfcc_pkt_cnt;		/* pkt count for src-grp */
79 	unsigned int mfcc_byte_cnt;
80 	unsigned int mfcc_wrong_if;
81 	int	     mfcc_expire;
82 };
83 
84 /*
85  *	Group count retrieval for mrouted
86  */
87 
88 struct sioc_sg_req
89 {
90 	struct in_addr src;
91 	struct in_addr grp;
92 	unsigned long pktcnt;
93 	unsigned long bytecnt;
94 	unsigned long wrong_if;
95 };
96 
97 /*
98  *	To get vif packet counts
99  */
100 
101 struct sioc_vif_req
102 {
103 	vifi_t	vifi;		/* Which iface */
104 	unsigned long icount;	/* In packets */
105 	unsigned long ocount;	/* Out packets */
106 	unsigned long ibytes;	/* In bytes */
107 	unsigned long obytes;	/* Out bytes */
108 };
109 
110 /*
111  *	This is the format the mroute daemon expects to see IGMP control
112  *	data. Magically happens to be like an IP packet as per the original
113  */
114 
115 struct igmpmsg
116 {
117 	__u32 unused1,unused2;
118 	unsigned char im_msgtype;		/* What is this */
119 	unsigned char im_mbz;			/* Must be zero */
120 	unsigned char im_vif;			/* Interface (this ought to be a vifi_t!) */
121 	unsigned char unused3;
122 	struct in_addr im_src,im_dst;
123 };
124 
125 /*
126  *	That's all usermode folks
127  */
128 
129 
130 
131 #define MFC_ASSERT_THRESH (3*HZ)		/* Maximal freq. of asserts */
132 
133 /*
134  *	Pseudo messages used by mrouted
135  */
136 
137 #define IGMPMSG_NOCACHE		1		/* Kern cache fill request to mrouted */
138 #define IGMPMSG_WRONGVIF	2		/* For PIM assert processing (unused) */
139 #define IGMPMSG_WHOLEPKT	3		/* For PIM Register processing */
140 
141 
142 #endif
143