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) 2001-2004 Swedish Institute of Computer Science.
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 modification,
donatien 0:8e01dca41002 6 * are permitted provided that the following conditions are met:
donatien 0:8e01dca41002 7 *
donatien 0:8e01dca41002 8 * 1. Redistributions of source code must retain the above copyright notice,
donatien 0:8e01dca41002 9 * this list of conditions and the following disclaimer.
donatien 0:8e01dca41002 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
donatien 0:8e01dca41002 11 * this list of conditions and the following disclaimer in the documentation
donatien 0:8e01dca41002 12 * and/or other materials provided with the distribution.
donatien 0:8e01dca41002 13 * 3. The name of the author may not be used to endorse or promote products
donatien 0:8e01dca41002 14 * derived from this software without specific prior written permission.
donatien 0:8e01dca41002 15 *
donatien 0:8e01dca41002 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
donatien 0:8e01dca41002 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
donatien 0:8e01dca41002 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
donatien 0:8e01dca41002 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
donatien 0:8e01dca41002 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
donatien 0:8e01dca41002 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
donatien 0:8e01dca41002 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
donatien 0:8e01dca41002 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
donatien 0:8e01dca41002 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
donatien 0:8e01dca41002 25 * OF SUCH DAMAGE.
donatien 0:8e01dca41002 26 *
donatien 0:8e01dca41002 27 * This file is part of the lwIP TCP/IP stack.
donatien 0:8e01dca41002 28 *
donatien 0:8e01dca41002 29 * Author: Adam Dunkels <adam@sics.se>
donatien 0:8e01dca41002 30 *
donatien 0:8e01dca41002 31 */
donatien 0:8e01dca41002 32 #ifndef __LWIP_ICMP_H__
donatien 0:8e01dca41002 33 #define __LWIP_ICMP_H__
donatien 0:8e01dca41002 34
donatien 0:8e01dca41002 35 #include "lwip/opt.h"
donatien 0:8e01dca41002 36 #include "lwip/pbuf.h"
donatien 0:8e01dca41002 37 #include "lwip/ip_addr.h"
donatien 0:8e01dca41002 38 #include "lwip/netif.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 #define ICMP_ER 0 /* echo reply */
donatien 0:8e01dca41002 45 #define ICMP_DUR 3 /* destination unreachable */
donatien 0:8e01dca41002 46 #define ICMP_SQ 4 /* source quench */
donatien 0:8e01dca41002 47 #define ICMP_RD 5 /* redirect */
donatien 0:8e01dca41002 48 #define ICMP_ECHO 8 /* echo */
donatien 0:8e01dca41002 49 #define ICMP_TE 11 /* time exceeded */
donatien 0:8e01dca41002 50 #define ICMP_PP 12 /* parameter problem */
donatien 0:8e01dca41002 51 #define ICMP_TS 13 /* timestamp */
donatien 0:8e01dca41002 52 #define ICMP_TSR 14 /* timestamp reply */
donatien 0:8e01dca41002 53 #define ICMP_IRQ 15 /* information request */
donatien 0:8e01dca41002 54 #define ICMP_IR 16 /* information reply */
donatien 0:8e01dca41002 55
donatien 0:8e01dca41002 56 enum icmp_dur_type {
donatien 0:8e01dca41002 57 ICMP_DUR_NET = 0, /* net unreachable */
donatien 0:8e01dca41002 58 ICMP_DUR_HOST = 1, /* host unreachable */
donatien 0:8e01dca41002 59 ICMP_DUR_PROTO = 2, /* protocol unreachable */
donatien 0:8e01dca41002 60 ICMP_DUR_PORT = 3, /* port unreachable */
donatien 0:8e01dca41002 61 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
donatien 0:8e01dca41002 62 ICMP_DUR_SR = 5 /* source route failed */
donatien 0:8e01dca41002 63 };
donatien 0:8e01dca41002 64
donatien 0:8e01dca41002 65 enum icmp_te_type {
donatien 0:8e01dca41002 66 ICMP_TE_TTL = 0, /* time to live exceeded in transit */
donatien 0:8e01dca41002 67 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
donatien 0:8e01dca41002 68 };
donatien 0:8e01dca41002 69
donatien 0:8e01dca41002 70 #ifdef PACK_STRUCT_USE_INCLUDES
donatien 0:8e01dca41002 71 # include "arch/bpstruct.h"
donatien 0:8e01dca41002 72 #endif
donatien 0:8e01dca41002 73 /** This is the standard ICMP header only that the u32_t data
donatien 0:8e01dca41002 74 * is splitted to two u16_t like ICMP echo needs it.
donatien 0:8e01dca41002 75 * This header is also used for other ICMP types that do not
donatien 0:8e01dca41002 76 * use the data part.
donatien 0:8e01dca41002 77 */
donatien 0:8e01dca41002 78 PACK_STRUCT_BEGIN
donatien 0:8e01dca41002 79 struct icmp_echo_hdr {
donatien 0:8e01dca41002 80 PACK_STRUCT_FIELD(u8_t type);
donatien 0:8e01dca41002 81 PACK_STRUCT_FIELD(u8_t code);
donatien 0:8e01dca41002 82 PACK_STRUCT_FIELD(u16_t chksum);
donatien 0:8e01dca41002 83 PACK_STRUCT_FIELD(u16_t id);
donatien 0:8e01dca41002 84 PACK_STRUCT_FIELD(u16_t seqno);
donatien 0:8e01dca41002 85 } PACK_STRUCT_STRUCT;
donatien 0:8e01dca41002 86 PACK_STRUCT_END
donatien 0:8e01dca41002 87 #ifdef PACK_STRUCT_USE_INCLUDES
donatien 0:8e01dca41002 88 # include "arch/epstruct.h"
donatien 0:8e01dca41002 89 #endif
donatien 0:8e01dca41002 90
donatien 0:8e01dca41002 91 #define ICMPH_TYPE(hdr) ((hdr)->type)
donatien 0:8e01dca41002 92 #define ICMPH_CODE(hdr) ((hdr)->code)
donatien 0:8e01dca41002 93
donatien 0:8e01dca41002 94 /** Combines type and code to an u16_t */
donatien 0:8e01dca41002 95 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
donatien 0:8e01dca41002 96 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
donatien 0:8e01dca41002 97
donatien 0:8e01dca41002 98
donatien 0:8e01dca41002 99 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
donatien 0:8e01dca41002 100
donatien 0:8e01dca41002 101 void icmp_input(struct pbuf *p, struct netif *inp);
donatien 0:8e01dca41002 102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
donatien 0:8e01dca41002 103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
donatien 0:8e01dca41002 104
donatien 0:8e01dca41002 105 #endif /* LWIP_ICMP */
donatien 0:8e01dca41002 106
donatien 0:8e01dca41002 107 #ifdef __cplusplus
donatien 0:8e01dca41002 108 }
donatien 0:8e01dca41002 109 #endif
donatien 0:8e01dca41002 110
donatien 0:8e01dca41002 111 #endif /* __LWIP_ICMP_H__ */