Dependencies:   mbed

Committer:
dirkx
Date:
Sat Aug 14 15:54:31 2010 +0000
Revision:
5:8e53abda9900
Parent:
0:355018f44c9f

        

Who changed what in which revision?

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