|
||||
Warning, cross-references for /kernel/include/lwip/icmp.h need to be fixed.
0001 /* 0002 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 0003 * All rights reserved. 0004 * 0005 * Redistribution and use in source and binary forms, with or without modification, 0006 * are permitted provided that the following conditions are met: 0007 * 0008 * 1. Redistributions of source code must retain the above copyright notice, 0009 * this list of conditions and the following disclaimer. 0010 * 2. Redistributions in binary form must reproduce the above copyright notice, 0011 * this list of conditions and the following disclaimer in the documentation 0012 * and/or other materials provided with the distribution. 0013 * 3. The name of the author may not be used to endorse or promote products 0014 * derived from this software without specific prior written permission. 0015 * 0016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 0017 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 0018 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 0019 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 0020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 0021 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0023 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 0024 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 0025 * OF SUCH DAMAGE. 0026 * 0027 * This file is part of the lwIP TCP/IP stack. 0028 * 0029 * Author: Adam Dunkels <adam@sics.se> 0030 * 0031 */ 0032 #ifndef __LWIP_ICMP_H__ 0033 #define __LWIP_ICMP_H__ 0034 0035 #include "lwip/opt.h" 0036 #include "lwip/pbuf.h" 0037 #include "lwip/ip_addr.h" 0038 #include "lwip/netif.h" 0039 0040 #ifdef __cplusplus 0041 extern "C" { 0042 #endif 0043 0044 #define ICMP_ER 0 /* echo reply */ 0045 #define ICMP_DUR 3 /* destination unreachable */ 0046 #define ICMP_SQ 4 /* source quench */ 0047 #define ICMP_RD 5 /* redirect */ 0048 #define ICMP_ECHO 8 /* echo */ 0049 #define ICMP_TE 11 /* time exceeded */ 0050 #define ICMP_PP 12 /* parameter problem */ 0051 #define ICMP_TS 13 /* timestamp */ 0052 #define ICMP_TSR 14 /* timestamp reply */ 0053 #define ICMP_IRQ 15 /* information request */ 0054 #define ICMP_IR 16 /* information reply */ 0055 0056 enum icmp_dur_type { 0057 ICMP_DUR_NET = 0, /* net unreachable */ 0058 ICMP_DUR_HOST = 1, /* host unreachable */ 0059 ICMP_DUR_PROTO = 2, /* protocol unreachable */ 0060 ICMP_DUR_PORT = 3, /* port unreachable */ 0061 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ 0062 ICMP_DUR_SR = 5 /* source route failed */ 0063 }; 0064 0065 enum icmp_te_type { 0066 ICMP_TE_TTL = 0, /* time to live exceeded in transit */ 0067 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ 0068 }; 0069 0070 #ifdef PACK_STRUCT_USE_INCLUDES 0071 # include "arch/bpstruct.h" 0072 #endif 0073 /** This is the standard ICMP header only that the u32_t data 0074 * is splitted to two u16_t like ICMP echo needs it. 0075 * This header is also used for other ICMP types that do not 0076 * use the data part. 0077 */ 0078 PACK_STRUCT_BEGIN 0079 struct icmp_echo_hdr { 0080 PACK_STRUCT_FIELD(u8_t type); 0081 PACK_STRUCT_FIELD(u8_t code); 0082 PACK_STRUCT_FIELD(u16_t chksum); 0083 PACK_STRUCT_FIELD(u16_t id); 0084 PACK_STRUCT_FIELD(u16_t seqno); 0085 } PACK_STRUCT_STRUCT; 0086 PACK_STRUCT_END 0087 #ifdef PACK_STRUCT_USE_INCLUDES 0088 # include "arch/epstruct.h" 0089 #endif 0090 0091 #define ICMPH_TYPE(hdr) ((hdr)->type) 0092 #define ICMPH_CODE(hdr) ((hdr)->code) 0093 0094 /** Combines type and code to an u16_t */ 0095 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t)) 0096 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c)) 0097 0098 0099 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ 0100 0101 void icmp_input(struct pbuf *p, struct netif *inp); 0102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); 0103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); 0104 0105 #endif /* LWIP_ICMP */ 0106 0107 #ifdef __cplusplus 0108 } 0109 #endif 0110 0111 #endif /* __LWIP_ICMP_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |