LwIP with PPP & Ethernet integration

Dependents:   NetworkingCoreLib

This is the mbed port of the LwIP stack: http://savannah.nongnu.org/projects/lwip/

It includes contributed content from NXP's port for LPCxxxx devices: http://www.lpcware.com/content/project/lightweight-ip-lwip-networking-stack

Licence

LwIP is licenced under the BSD licence:

Copyright (c) 2001-2004 Swedish Institute of Computer Science. 
All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution. 
3. The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission. 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
donatien
Date:
Thu May 24 15:53:48 2012 +0000
Revision:
0:8e01dca41002
Merge with Emilio's LwIp

Who changed what in which revision?

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