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 * Redistribution and use in source and binary forms, with or without modification,
donatien 0:8e01dca41002 3 * are permitted provided that the following conditions are met:
donatien 0:8e01dca41002 4 *
donatien 0:8e01dca41002 5 * 1. Redistributions of source code must retain the above copyright notice,
donatien 0:8e01dca41002 6 * this list of conditions and the following disclaimer.
donatien 0:8e01dca41002 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
donatien 0:8e01dca41002 8 * this list of conditions and the following disclaimer in the documentation
donatien 0:8e01dca41002 9 * and/or other materials provided with the distribution.
donatien 0:8e01dca41002 10 * 3. The name of the author may not be used to endorse or promote products
donatien 0:8e01dca41002 11 * derived from this software without specific prior written permission.
donatien 0:8e01dca41002 12 *
donatien 0:8e01dca41002 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
donatien 0:8e01dca41002 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
donatien 0:8e01dca41002 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
donatien 0:8e01dca41002 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
donatien 0:8e01dca41002 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
donatien 0:8e01dca41002 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
donatien 0:8e01dca41002 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
donatien 0:8e01dca41002 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
donatien 0:8e01dca41002 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
donatien 0:8e01dca41002 22 * OF SUCH DAMAGE.
donatien 0:8e01dca41002 23 *
donatien 0:8e01dca41002 24 * This file is part of the lwIP TCP/IP stack.
donatien 0:8e01dca41002 25 *
donatien 0:8e01dca41002 26 */
donatien 0:8e01dca41002 27
donatien 0:8e01dca41002 28 #ifndef __LWIP_NETIFAPI_H__
donatien 0:8e01dca41002 29 #define __LWIP_NETIFAPI_H__
donatien 0:8e01dca41002 30
donatien 0:8e01dca41002 31 #include "lwip/opt.h"
donatien 0:8e01dca41002 32
donatien 0:8e01dca41002 33 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
donatien 0:8e01dca41002 34
donatien 0:8e01dca41002 35 #include "lwip/sys.h"
donatien 0:8e01dca41002 36 #include "lwip/netif.h"
donatien 0:8e01dca41002 37 #include "lwip/dhcp.h"
donatien 0:8e01dca41002 38 #include "lwip/autoip.h"
donatien 0:8e01dca41002 39
donatien 0:8e01dca41002 40 #ifdef __cplusplus
donatien 0:8e01dca41002 41 extern "C" {
donatien 0:8e01dca41002 42 #endif
donatien 0:8e01dca41002 43
donatien 0:8e01dca41002 44 typedef void (*netifapi_void_fn)(struct netif *netif);
donatien 0:8e01dca41002 45 typedef err_t (*netifapi_errt_fn)(struct netif *netif);
donatien 0:8e01dca41002 46
donatien 0:8e01dca41002 47 struct netifapi_msg_msg {
donatien 0:8e01dca41002 48 #if !LWIP_TCPIP_CORE_LOCKING
donatien 0:8e01dca41002 49 sys_sem_t sem;
donatien 0:8e01dca41002 50 #endif /* !LWIP_TCPIP_CORE_LOCKING */
donatien 0:8e01dca41002 51 err_t err;
donatien 0:8e01dca41002 52 struct netif *netif;
donatien 0:8e01dca41002 53 union {
donatien 0:8e01dca41002 54 struct {
donatien 0:8e01dca41002 55 ip_addr_t *ipaddr;
donatien 0:8e01dca41002 56 ip_addr_t *netmask;
donatien 0:8e01dca41002 57 ip_addr_t *gw;
donatien 0:8e01dca41002 58 void *state;
donatien 0:8e01dca41002 59 netif_init_fn init;
donatien 0:8e01dca41002 60 netif_input_fn input;
donatien 0:8e01dca41002 61 } add;
donatien 0:8e01dca41002 62 struct {
donatien 0:8e01dca41002 63 netifapi_void_fn voidfunc;
donatien 0:8e01dca41002 64 netifapi_errt_fn errtfunc;
donatien 0:8e01dca41002 65 } common;
donatien 0:8e01dca41002 66 } msg;
donatien 0:8e01dca41002 67 };
donatien 0:8e01dca41002 68
donatien 0:8e01dca41002 69 struct netifapi_msg {
donatien 0:8e01dca41002 70 void (* function)(struct netifapi_msg_msg *msg);
donatien 0:8e01dca41002 71 struct netifapi_msg_msg msg;
donatien 0:8e01dca41002 72 };
donatien 0:8e01dca41002 73
donatien 0:8e01dca41002 74
donatien 0:8e01dca41002 75 /* API for application */
donatien 0:8e01dca41002 76 err_t netifapi_netif_add ( struct netif *netif,
donatien 0:8e01dca41002 77 ip_addr_t *ipaddr,
donatien 0:8e01dca41002 78 ip_addr_t *netmask,
donatien 0:8e01dca41002 79 ip_addr_t *gw,
donatien 0:8e01dca41002 80 void *state,
donatien 0:8e01dca41002 81 netif_init_fn init,
donatien 0:8e01dca41002 82 netif_input_fn input);
donatien 0:8e01dca41002 83
donatien 0:8e01dca41002 84 err_t netifapi_netif_set_addr ( struct netif *netif,
donatien 0:8e01dca41002 85 ip_addr_t *ipaddr,
donatien 0:8e01dca41002 86 ip_addr_t *netmask,
donatien 0:8e01dca41002 87 ip_addr_t *gw );
donatien 0:8e01dca41002 88
donatien 0:8e01dca41002 89 err_t netifapi_netif_common ( struct netif *netif,
donatien 0:8e01dca41002 90 netifapi_void_fn voidfunc,
donatien 0:8e01dca41002 91 netifapi_errt_fn errtfunc);
donatien 0:8e01dca41002 92
donatien 0:8e01dca41002 93 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
donatien 0:8e01dca41002 94 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
donatien 0:8e01dca41002 95 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
donatien 0:8e01dca41002 96 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
donatien 0:8e01dca41002 97 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
donatien 0:8e01dca41002 98 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
donatien 0:8e01dca41002 99 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
donatien 0:8e01dca41002 100 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
donatien 0:8e01dca41002 101
donatien 0:8e01dca41002 102 #ifdef __cplusplus
donatien 0:8e01dca41002 103 }
donatien 0:8e01dca41002 104 #endif
donatien 0:8e01dca41002 105
donatien 0:8e01dca41002 106 #endif /* LWIP_NETIF_API */
donatien 0:8e01dca41002 107
donatien 0:8e01dca41002 108 #endif /* __LWIP_NETIFAPI_H__ */