Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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