1 #ifndef __LINUX_MROUTE_H
2 #define __LINUX_MROUTE_H
3
4
5
6
7
8
9
10
11
12 #define MRT_BASE 200
13 #define MRT_INIT (MRT_BASE)
14 #define MRT_DONE (MRT_BASE+1)
15 #define MRT_ADD_VIF (MRT_BASE+2)
16 #define MRT_DEL_VIF (MRT_BASE+3)
17 #define MRT_ADD_MFC (MRT_BASE+4)
18 #define MRT_DEL_MFC (MRT_BASE+5)
19 #define MRT_VERSION (MRT_BASE+6)
20 #define MRT_ASSERT (MRT_BASE+7)
21
22 #define SIOCGETVIFCNT SIOCPROTOPRIVATE
23 #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
24
25 #define MAXVIFS 32
26 typedef unsigned long vifbitmap_t;
27 typedef unsigned short vifi_t;
28 #define ALL_VIFS ((vifi_t)(-1))
29
30
31
32
33
34 #define VIFM_SET(n,m) ((m)|=(1<<(n)))
35 #define VIFM_CLR(n,m) ((m)&=~(1<<(n)))
36 #define VIFM_ISSET(n,m) ((m)&(1<<(n)))
37 #define VIFM_CLRALL(m) ((m)=0)
38 #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom))
39 #define VIFM_SAME(m1,m2) ((m1)==(m2))
40
41
42
43
44
45
46 struct vifctl {
47 vifi_t vifc_vifi;
48 unsigned char vifc_flags;
49 unsigned char vifc_threshold;
50 unsigned int vifc_rate_limit;
51 struct in_addr vifc_lcl_addr;
52 struct in_addr vifc_rmt_addr;
53 };
54
55 #define VIFF_TUNNEL 0x1
56 #define VIFF_SRCRT 0x02
57
58
59
60
61
62 struct mfcctl
63 {
64 struct in_addr mfcc_origin;
65 struct in_addr mfcc_mcastgrp;
66 vifi_t mfcc_parent;
67 unsigned char mfcc_ttls[MAXVIFS];
68 };
69
70
71
72
73
74 struct sioc_sg_req
75 {
76 struct in_addr src;
77 struct in_addr grp;
78 unsigned long pktcnt;
79 unsigned long bytecnt;
80 unsigned long wrong_if;
81 };
82
83
84
85
86
87 struct sioc_vif_req
88 {
89 vifi_t vifi;
90 unsigned long icount;
91 unsigned long ocount;
92 unsigned long ibytes;
93 unsigned long obytes;
94 };
95
96
97
98
99
100
101 struct igmpmsg
102 {
103 unsigned long unused1,unused2;
104 unsigned char im_msgtype;
105 unsigned char im_mbz;
106 unsigned char im_vif;
107 unsigned char unused3;
108 struct in_addr im_src,im_dst;
109 };
110
111
112
113
114
115 #ifdef __KERNEL__
116 extern struct sock *mroute_socket;
117 extern int ip_mroute_setsockopt(struct sock *, int, char *, int);
118 extern int ip_mroute_getsockopt(struct sock *, int, char *, int *);
119 extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg);
120 extern void mroute_close(struct sock *sk);
121 extern void ipmr_forward(struct sk_buff *skb, int is_frag);
122
123
124 struct vif_device
125 {
126 struct device *dev;
127 struct route *rt_cache;
128 unsigned long bytes_in,bytes_out;
129 unsigned long pkt_in,pkt_out;
130 unsigned long rate_limit;
131 unsigned char threshold;
132 unsigned short flags;
133 unsigned long local,remote;
134 };
135
136 struct mfc_cache
137 {
138 struct mfc_cache *next;
139 __u32 mfc_mcastgrp;
140 __u32 mfc_origin;
141 vifi_t mfc_parent;
142 struct timer_list mfc_timer;
143 int mfc_flags;
144 struct sk_buff_head mfc_unresolved;
145 int mfc_queuelen;
146 unsigned char mfc_ttls[MAXVIFS];
147 };
148
149 #define MFC_QUEUED 1
150 #define MFC_RESOLVED 2
151
152
153 #define MFC_LINES 64
154
155 #ifdef __BIG_ENDIAN
156 #define MFC_HASH(a,b) ((((a)>>24)^((b)>>26))&(MFC_LINES-1))
157 #else
158 #define MFC_HASH(a,b) (((a)^((b)>>2))&(MFC_LINES-1))
159 #endif
160
161 #endif
162
163
164
165
166
167 #define IGMPMSG_NOCACHE 1
168 #define IGMPMSG_WRONGVIF 2
169
170 #endif