The Pedigree Project  0.1
igmp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  * Copyright (c) 2002 CITEL Technologies Ltd.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  * 1. Redistributions of source code must retain the above copyright
33  * notice, this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright
35  * notice, this list of conditions and the following disclaimer in the
36  * documentation and/or other materials provided with the distribution.
37  * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
38  * may be used to endorse or promote products derived from this software
39  * without specific prior written permission.
40  *
41  * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
42  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  *
53  * This file is a contribution to the lwIP TCP/IP stack.
54  * The Swedish Institute of Computer Science and Adam Dunkels
55  * are specifically granted permission to redistribute this
56  * source code.
57 */
58 
59 #ifndef LWIP_HDR_IGMP_H
60 #define LWIP_HDR_IGMP_H
61 
62 #include "lwip/opt.h"
63 #include "lwip/ip_addr.h"
64 #include "lwip/netif.h"
65 #include "lwip/pbuf.h"
66 
67 #if LWIP_IPV4 && LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 /* IGMP timer */
74 #define IGMP_TMR_INTERVAL 100 /* Milliseconds */
75 #define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL)
76 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
77 
78 /* Compatibility defines (don't use for new code) */
79 #define IGMP_DEL_MAC_FILTER NETIF_DEL_MAC_FILTER
80 #define IGMP_ADD_MAC_FILTER NETIF_ADD_MAC_FILTER
81 
93 struct igmp_group {
95  struct igmp_group *next;
97  ip4_addr_t group_address;
99  u8_t last_reporter_flag;
101  u8_t group_state;
103  u16_t timer;
105  u8_t use;
106 };
107 
108 /* Prototypes */
109 void igmp_init(void);
110 err_t igmp_start(struct netif *netif);
111 err_t igmp_stop(struct netif *netif);
112 void igmp_report_groups(struct netif *netif);
113 struct igmp_group *igmp_lookfor_group(struct netif *ifp, const ip4_addr_t *addr);
114 void igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest);
115 err_t igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
116 err_t igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
117 err_t igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
118 err_t igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
119 void igmp_tmr(void);
120 
126 #define netif_igmp_data(netif) ((struct igmp_group *)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_IGMP))
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* LWIP_IPV4 && LWIP_IGMP */
133 
134 #endif /* LWIP_HDR_IGMP_H */
Definition: pbuf.h:161
Definition: netif.h:244
s8_t err_t
Definition: err.h:76