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