Blame view

include/linux/igmp.h 4.15 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  /*
   *	Linux NET3:	Internet Group Management Protocol  [IGMP]
   *
   *	Authors:
113aa838e   Alan Cox   net: Rationalise ...
5
   *		Alan Cox <alan@lxorguk.ukuu.org.uk>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
9
10
11
12
13
14
   *
   *	Extended to talk the BSD extended IGMP protocol of mrouted 3.6
   *
   *
   *	This program is free software; you can redistribute it and/or
   *	modify it under the terms of the GNU General Public License
   *	as published by the Free Software Foundation; either version
   *	2 of the License, or (at your option) any later version.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
  #ifndef _LINUX_IGMP_H
  #define _LINUX_IGMP_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
  #include <linux/skbuff.h>
d7fe0f241   Al Viro   [PATCH] severing ...
18
  #include <linux/timer.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
  #include <linux/in.h>
8851ab526   Reshetova, Elena   net: convert ip_m...
20
  #include <linux/refcount.h>
607ca46e9   David Howells   UAPI: (Scripted) ...
21
  #include <uapi/linux/igmp.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22

cc32e0541   Joe Perches   [NET]: include/li...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
  {
  	return (struct igmphdr *)skb_transport_header(skb);
  }
  
  static inline struct igmpv3_report *
  			igmpv3_report_hdr(const struct sk_buff *skb)
  {
  	return (struct igmpv3_report *)skb_transport_header(skb);
  }
  
  static inline struct igmpv3_query *
  			igmpv3_query_hdr(const struct sk_buff *skb)
  {
  	return (struct igmpv3_query *)skb_transport_header(skb);
  }
d94d9fee9   Eric Dumazet   net: cleanup incl...
39
  struct ip_sf_socklist {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
  	unsigned int		sl_max;
  	unsigned int		sl_count;
c85bb41e9   Flavio Leitner   igmp: fix ip_mc_s...
42
  	struct rcu_head		rcu;
ea4d9e722   Al Viro   [IPV4]: struct ip...
43
  	__be32			sl_addr[0];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
45
46
  };
  
  #define IP_SFLSIZE(count)	(sizeof(struct ip_sf_socklist) + \
63007727e   Al Viro   [IPV4]: trivial i...
47
  	(count) * sizeof(__be32))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
50
51
52
53
  
  #define IP_SFBLOCK	10	/* allocate this many at once */
  
  /* ip_mc_socklist is real list now. Speed is not argument;
     this list never used in fast path code
   */
d94d9fee9   Eric Dumazet   net: cleanup incl...
54
  struct ip_mc_socklist {
1d7138de8   Eric Dumazet   igmp: RCU convers...
55
  	struct ip_mc_socklist __rcu *next_rcu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56
57
  	struct ip_mreqn		multi;
  	unsigned int		sfmode;		/* MCAST_{INCLUDE,EXCLUDE} */
1d7138de8   Eric Dumazet   igmp: RCU convers...
58
  	struct ip_sf_socklist __rcu	*sflist;
c85bb41e9   Flavio Leitner   igmp: fix ip_mc_s...
59
  	struct rcu_head		rcu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
  };
d94d9fee9   Eric Dumazet   net: cleanup incl...
61
  struct ip_sf_list {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
  	struct ip_sf_list	*sf_next;
ea4d9e722   Al Viro   [IPV4]: struct ip...
63
  	__be32			sf_inaddr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
65
66
67
68
  	unsigned long		sf_count[2];	/* include/exclude counts */
  	unsigned char		sf_gsresp;	/* include in g & s response? */
  	unsigned char		sf_oldin;	/* change state */
  	unsigned char		sf_crcount;	/* retrans. left to send */
  };
d94d9fee9   Eric Dumazet   net: cleanup incl...
69
  struct ip_mc_list {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
  	struct in_device	*interface;
338fcf988   Alexey Dobriyan   [IPV4] igmp: Fixu...
71
  	__be32			multiaddr;
1d7138de8   Eric Dumazet   igmp: RCU convers...
72
  	unsigned int		sfmode;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
  	struct ip_sf_list	*sources;
  	struct ip_sf_list	*tomb;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  	unsigned long		sfcount[2];
1d7138de8   Eric Dumazet   igmp: RCU convers...
76
77
78
79
  	union {
  		struct ip_mc_list *next;
  		struct ip_mc_list __rcu *next_rcu;
  	};
e98970713   Eric Dumazet   igmp: hash a hash...
80
  	struct ip_mc_list __rcu *next_hash;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
82
  	struct timer_list	timer;
  	int			users;
8851ab526   Reshetova, Elena   net: convert ip_m...
83
  	refcount_t		refcnt;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
84
85
86
87
88
89
90
  	spinlock_t		lock;
  	char			tm_running;
  	char			reporter;
  	char			unsolicit_count;
  	char			loaded;
  	unsigned char		gsquery;	/* check source marks? */
  	unsigned char		crcount;
1d7138de8   Eric Dumazet   igmp: RCU convers...
91
  	struct rcu_head		rcu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
92
93
94
95
96
97
  };
  
  /* V3 exponential field decoding */
  #define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
  #define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
  	((value) < (thresh) ? (value) : \
fb47ddb2d   David L Stevens   [IGMP]: Fix IGMPV...
98
          ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
99
100
101
102
           (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
  
  #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
  #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
2094acbb7   Alexander Duyck   net/ipv4: Pass pr...
103
  extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u8 proto);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
107
108
109
110
111
112
113
114
  extern int igmp_rcv(struct sk_buff *);
  extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
  extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
  extern void ip_mc_drop_socket(struct sock *sk);
  extern int ip_mc_source(int add, int omode, struct sock *sk,
  		struct ip_mreq_source *mreqs, int ifindex);
  extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
  extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
  		struct ip_msfilter __user *optval, int __user *optlen);
  extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
  		struct group_filter __user *optval, int __user *optlen);
60d9b0314   David Ahern   net: ipv4: add se...
115
116
  extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt,
  			  int dif, int sdif);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
119
120
  extern void ip_mc_init_dev(struct in_device *);
  extern void ip_mc_destroy_dev(struct in_device *);
  extern void ip_mc_up(struct in_device *);
  extern void ip_mc_down(struct in_device *);
75c78500d   Moni Shoua   bonding: remap mu...
121
122
  extern void ip_mc_unmap(struct in_device *);
  extern void ip_mc_remap(struct in_device *);
8f935bbd7   Al Viro   [IPV4]: ip_mc_{in...
123
124
  extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
  extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
9afd85c9e   Linus Lüssing   net: Export IGMP/...
125
  int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed);
a816c7c71   Jay Vosburgh   bonding: Improve ...
126

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
  #endif