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