Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / lwip / repo / lwip / src / include / lwip / igmp.h
1 /**
2  * @file
3  * IGMP API
4  */
5
6 /*
7  * Copyright (c) 2002 CITEL Technologies Ltd.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  * This file is a contribution to the lwIP TCP/IP stack.
35  * The Swedish Institute of Computer Science and Adam Dunkels
36  * are specifically granted permission to redistribute this
37  * source code.
38 */
39
40 #ifndef LWIP_HDR_IGMP_H
41 #define LWIP_HDR_IGMP_H
42
43 #include "lwip/opt.h"
44 #include "lwip/ip_addr.h"
45 #include "lwip/netif.h"
46 #include "lwip/pbuf.h"
47
48 #if LWIP_IPV4 && LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 /* IGMP timer */
55 #define IGMP_TMR_INTERVAL              100 /* Milliseconds */
56 #define IGMP_V1_DELAYING_MEMBER_TMR   (1000/IGMP_TMR_INTERVAL)
57 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
58
59 /* Compatibility defines (don't use for new code) */
60 #define IGMP_DEL_MAC_FILTER            NETIF_DEL_MAC_FILTER
61 #define IGMP_ADD_MAC_FILTER            NETIF_ADD_MAC_FILTER
62
63 /**
64  * igmp group structure - there is
65  * a list of groups for each interface
66  * these should really be linked from the interface, but
67  * if we keep them separate we will not affect the lwip original code
68  * too much
69  *
70  * There will be a group for the all systems group address but this
71  * will not run the state machine as it is used to kick off reports
72  * from all the other groups
73  */
74 struct igmp_group {
75   /** next link */
76   struct igmp_group *next;
77   /** multicast address */
78   ip4_addr_t         group_address;
79   /** signifies we were the last person to report */
80   u8_t               last_reporter_flag;
81   /** current state of the group */
82   u8_t               group_state;
83   /** timer for reporting, negative is OFF */
84   u16_t              timer;
85   /** counter of simultaneous uses */
86   u8_t               use;
87 };
88
89 /*  Prototypes */
90 void   igmp_init(void);
91 #ifdef LWIP_DEBUG
92 void   igmp_dump_group_list(void);
93 #endif
94 err_t  igmp_start(struct netif *netif);
95 err_t  igmp_stop(struct netif *netif);
96 void   igmp_report_groups(struct netif *netif);
97 struct igmp_group *igmp_lookfor_group(struct netif *ifp, const ip4_addr_t *addr);
98 void   igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest);
99 err_t  igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
100 err_t  igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
101 err_t  igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
102 err_t  igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
103 void   igmp_tmr(void);
104
105 /** @ingroup igmp 
106  * Get list head of IGMP groups for netif.
107  * Note: The allsystems group IP is contained in the list as first entry.
108  * @see @ref netif_set_igmp_mac_filter()
109  */
110 #define netif_igmp_data(netif) ((struct igmp_group *)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_IGMP))
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* LWIP_IPV4 && LWIP_IGMP */
117
118 #endif /* LWIP_HDR_IGMP_H */