dev

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
yihui
Date:
Mon Mar 02 08:19:15 2015 +0000
Revision:
19:6c91d95ef874
Parent:
0:51ac1d130fd4
minor changes

Who changed what in which revision?

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