Version:  2.0.40 2.2.26 2.4.37 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18

Linux/include/linux/igmp.h

  1 /*
  2  *      Linux NET3:     Internet Group Management Protocol  [IGMP]
  3  *
  4  *      Authors:
  5  *              Alan Cox <alan@lxorguk.ukuu.org.uk>
  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  */
 15 #ifndef _LINUX_IGMP_H
 16 #define _LINUX_IGMP_H
 17 
 18 #include <linux/skbuff.h>
 19 #include <linux/timer.h>
 20 #include <linux/in.h>
 21 #include <uapi/linux/igmp.h>
 22 
 23 static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
 24 {
 25         return (struct igmphdr *)skb_transport_header(skb);
 26 }
 27 
 28 static 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 
 34 static 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 
 40 extern int sysctl_igmp_max_memberships;
 41 extern int sysctl_igmp_max_msf;
 42 extern int sysctl_igmp_qrv;
 43 
 44 struct ip_sf_socklist {
 45         unsigned int            sl_max;
 46         unsigned int            sl_count;
 47         struct rcu_head         rcu;
 48         __be32                  sl_addr[0];
 49 };
 50 
 51 #define IP_SFLSIZE(count)       (sizeof(struct ip_sf_socklist) + \
 52         (count) * sizeof(__be32))
 53 
 54 #define IP_SFBLOCK      10      /* allocate this many at once */
 55 
 56 /* ip_mc_socklist is real list now. Speed is not argument;
 57    this list never used in fast path code
 58  */
 59 
 60 struct ip_mc_socklist {
 61         struct ip_mc_socklist __rcu *next_rcu;
 62         struct ip_mreqn         multi;
 63         unsigned int            sfmode;         /* MCAST_{INCLUDE,EXCLUDE} */
 64         struct ip_sf_socklist __rcu     *sflist;
 65         struct rcu_head         rcu;
 66 };
 67 
 68 struct ip_sf_list {
 69         struct ip_sf_list       *sf_next;
 70         __be32                  sf_inaddr;
 71         unsigned long           sf_count[2];    /* include/exclude counts */
 72         unsigned char           sf_gsresp;      /* include in g & s response? */
 73         unsigned char           sf_oldin;       /* change state */
 74         unsigned char           sf_crcount;     /* retrans. left to send */
 75 };
 76 
 77 struct ip_mc_list {
 78         struct in_device        *interface;
 79         __be32                  multiaddr;
 80         unsigned int            sfmode;
 81         struct ip_sf_list       *sources;
 82         struct ip_sf_list       *tomb;
 83         unsigned long           sfcount[2];
 84         union {
 85                 struct ip_mc_list *next;
 86                 struct ip_mc_list __rcu *next_rcu;
 87         };
 88         struct ip_mc_list __rcu *next_hash;
 89         struct timer_list       timer;
 90         int                     users;
 91         atomic_t                refcnt;
 92         spinlock_t              lock;
 93         char                    tm_running;
 94         char                    reporter;
 95         char                    unsolicit_count;
 96         char                    loaded;
 97         unsigned char           gsquery;        /* check source marks? */
 98         unsigned char           crcount;
 99         struct rcu_head         rcu;
100 };
101 
102 /* V3 exponential field decoding */
103 #define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
104 #define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
105         ((value) < (thresh) ? (value) : \
106         ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
107          (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
108 
109 #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
110 #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
111 
112 extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
113 extern int igmp_rcv(struct sk_buff *);
114 extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
115 extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
116 extern void ip_mc_drop_socket(struct sock *sk);
117 extern int ip_mc_source(int add, int omode, struct sock *sk,
118                 struct ip_mreq_source *mreqs, int ifindex);
119 extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
120 extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
121                 struct ip_msfilter __user *optval, int __user *optlen);
122 extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
123                 struct group_filter __user *optval, int __user *optlen);
124 extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
125 extern void ip_mc_init_dev(struct in_device *);
126 extern void ip_mc_destroy_dev(struct in_device *);
127 extern void ip_mc_up(struct in_device *);
128 extern void ip_mc_down(struct in_device *);
129 extern void ip_mc_unmap(struct in_device *);
130 extern void ip_mc_remap(struct in_device *);
131 extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
132 extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
133 
134 #endif
135 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us