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