Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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