+++ /dev/null
-/*\r
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.\r
- * All rights reserved. \r
- * \r
- * Redistribution and use in source and binary forms, with or without modification, \r
- * are permitted provided that the following conditions are met:\r
- *\r
- * 1. Redistributions of source code must retain the above copyright notice,\r
- * this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright notice,\r
- * this list of conditions and the following disclaimer in the documentation\r
- * and/or other materials provided with the distribution.\r
- * 3. The name of the author may not be used to endorse or promote products\r
- * derived from this software without specific prior written permission. \r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED \r
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \r
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, \r
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \r
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY \r
- * OF SUCH DAMAGE.\r
- *\r
- * This file is part of the lwIP TCP/IP stack.\r
- * \r
- * Author: Adam Dunkels <adam@sics.se>\r
- *\r
- */\r
-#ifndef __LWIP_ICMP_H__\r
-#define __LWIP_ICMP_H__\r
-\r
-#include "lwip/arch.h"\r
-\r
-#include "lwip/opt.h"\r
-#include "lwip/pbuf.h"\r
-\r
-#include "lwip/ip_addr.h"\r
-#include "lwip/netif.h"\r
-\r
-#define ICMP_ER 0 /* echo reply */\r
-#define ICMP_DUR 3 /* destination unreachable */\r
-#define ICMP_SQ 4 /* source quench */\r
-#define ICMP_RD 5 /* redirect */\r
-#define ICMP_ECHO 8 /* echo */\r
-#define ICMP_TE 11 /* time exceeded */\r
-#define ICMP_PP 12 /* parameter problem */\r
-#define ICMP_TS 13 /* timestamp */\r
-#define ICMP_TSR 14 /* timestamp reply */\r
-#define ICMP_IRQ 15 /* information request */\r
-#define ICMP_IR 16 /* information reply */\r
-\r
-enum icmp_dur_type {\r
- ICMP_DUR_NET = 0, /* net unreachable */\r
- ICMP_DUR_HOST = 1, /* host unreachable */\r
- ICMP_DUR_PROTO = 2, /* protocol unreachable */\r
- ICMP_DUR_PORT = 3, /* port unreachable */\r
- ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */\r
- ICMP_DUR_SR = 5 /* source route failed */\r
-};\r
-\r
-enum icmp_te_type {\r
- ICMP_TE_TTL = 0, /* time to live exceeded in transit */\r
- ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */\r
-};\r
-\r
-void icmp_input(struct pbuf *p, struct netif *inp);\r
-\r
-void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);\r
-void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);\r
-\r
-#ifdef PACK_STRUCT_USE_INCLUDES\r
-# include "arch/bpstruct.h"\r
-#endif\r
-PACK_STRUCT_BEGIN\r
-struct icmp_echo_hdr {\r
- PACK_STRUCT_FIELD(u16_t _type_code);\r
- PACK_STRUCT_FIELD(u16_t chksum);\r
- PACK_STRUCT_FIELD(u16_t id);\r
- PACK_STRUCT_FIELD(u16_t seqno);\r
-} PACK_STRUCT_STRUCT;\r
-PACK_STRUCT_END\r
-\r
-PACK_STRUCT_BEGIN\r
-struct icmp_dur_hdr {\r
- PACK_STRUCT_FIELD(u16_t _type_code);\r
- PACK_STRUCT_FIELD(u16_t chksum);\r
- PACK_STRUCT_FIELD(u32_t unused);\r
-} PACK_STRUCT_STRUCT;\r
-PACK_STRUCT_END\r
-\r
-PACK_STRUCT_BEGIN\r
-struct icmp_te_hdr {\r
- PACK_STRUCT_FIELD(u16_t _type_code);\r
- PACK_STRUCT_FIELD(u16_t chksum);\r
- PACK_STRUCT_FIELD(u32_t unused);\r
-} PACK_STRUCT_STRUCT;\r
-PACK_STRUCT_END\r
-#ifdef PACK_STRUCT_USE_INCLUDES\r
-# include "arch/epstruct.h"\r
-#endif\r
-\r
-#define ICMPH_TYPE(hdr) (ntohs((hdr)->_type_code) >> 8)\r
-#define ICMPH_CODE(hdr) (ntohs((hdr)->_type_code) & 0xff)\r
-\r
-#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(ICMPH_CODE(hdr) | ((type) << 8)))\r
-#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (ICMPH_TYPE(hdr) << 8)))\r
-\r
-#endif /* __LWIP_ICMP_H__ */\r
- \r