nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / igmp.h
CommitLineData
1da177e4
LT
1/*
2 * Linux NET3: Internet Group Management Protocol [IGMP]
3 *
4 * Authors:
113aa838 5 * Alan Cox <alan@lxorguk.ukuu.org.uk>
1da177e4
LT
6 *
7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
1da177e4
LT
15#ifndef _LINUX_IGMP_H
16#define _LINUX_IGMP_H
17
1da177e4 18#include <linux/skbuff.h>
d7fe0f24 19#include <linux/timer.h>
1da177e4 20#include <linux/in.h>
607ca46e 21#include <uapi/linux/igmp.h>
1da177e4 22
cc32e054
JP
23static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
24{
25 return (struct igmphdr *)skb_transport_header(skb);
26}
27
28static inline struct igmpv3_report *
29 igmpv3_report_hdr(const struct sk_buff *skb)
30{
31 return (struct igmpv3_report *)skb_transport_header(skb);
32}
33
34static inline struct igmpv3_query *
35 igmpv3_query_hdr(const struct sk_buff *skb)
36{
37 return (struct igmpv3_query *)skb_transport_header(skb);
38}
39
20380731
ACM
40extern int sysctl_igmp_max_memberships;
41extern int sysctl_igmp_max_msf;
42
d94d9fee 43struct ip_sf_socklist {
1da177e4
LT
44 unsigned int sl_max;
45 unsigned int sl_count;
c85bb41e 46 struct rcu_head rcu;
ea4d9e72 47 __be32 sl_addr[0];
1da177e4
LT
48};
49
50#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \
63007727 51 (count) * sizeof(__be32))
1da177e4
LT
52
53#define IP_SFBLOCK 10 /* allocate this many at once */
54
55/* ip_mc_socklist is real list now. Speed is not argument;
56 this list never used in fast path code
57 */
58
d94d9fee 59struct ip_mc_socklist {
1d7138de 60 struct ip_mc_socklist __rcu *next_rcu;
1da177e4
LT
61 struct ip_mreqn multi;
62 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
1d7138de 63 struct ip_sf_socklist __rcu *sflist;
c85bb41e 64 struct rcu_head rcu;
1da177e4
LT
65};
66
d94d9fee 67struct ip_sf_list {
1da177e4 68 struct ip_sf_list *sf_next;
ea4d9e72 69 __be32 sf_inaddr;
1da177e4
LT
70 unsigned long sf_count[2]; /* include/exclude counts */
71 unsigned char sf_gsresp; /* include in g & s response? */
72 unsigned char sf_oldin; /* change state */
73 unsigned char sf_crcount; /* retrans. left to send */
74};
75
d94d9fee 76struct ip_mc_list {
1da177e4 77 struct in_device *interface;
338fcf98 78 __be32 multiaddr;
1d7138de 79 unsigned int sfmode;
1da177e4
LT
80 struct ip_sf_list *sources;
81 struct ip_sf_list *tomb;
1da177e4 82 unsigned long sfcount[2];
1d7138de
ED
83 union {
84 struct ip_mc_list *next;
85 struct ip_mc_list __rcu *next_rcu;
86 };
1da177e4
LT
87 struct timer_list timer;
88 int users;
89 atomic_t refcnt;
90 spinlock_t lock;
91 char tm_running;
92 char reporter;
93 char unsolicit_count;
94 char loaded;
95 unsigned char gsquery; /* check source marks? */
96 unsigned char crcount;
1d7138de 97 struct rcu_head rcu;
1da177e4
LT
98};
99
100/* V3 exponential field decoding */
101#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
102#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
103 ((value) < (thresh) ? (value) : \
fb47ddb2 104 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
1da177e4
LT
105 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
106
107#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
108#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
109
dbdd9a52 110extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
1da177e4
LT
111extern int igmp_rcv(struct sk_buff *);
112extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
113extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
114extern void ip_mc_drop_socket(struct sock *sk);
115extern int ip_mc_source(int add, int omode, struct sock *sk,
116 struct ip_mreq_source *mreqs, int ifindex);
117extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
118extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
119 struct ip_msfilter __user *optval, int __user *optlen);
120extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
121 struct group_filter __user *optval, int __user *optlen);
c0cda068 122extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
1da177e4
LT
123extern void ip_mc_init_dev(struct in_device *);
124extern void ip_mc_destroy_dev(struct in_device *);
125extern void ip_mc_up(struct in_device *);
126extern void ip_mc_down(struct in_device *);
75c78500
MS
127extern void ip_mc_unmap(struct in_device *);
128extern void ip_mc_remap(struct in_device *);
8f935bbd
AV
129extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
130extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
866f3b25 131extern void ip_mc_rejoin_groups(struct in_device *in_dev);
a816c7c7 132
1da177e4 133#endif