Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
icmp6.h
00001 /** 00002 * @file 00003 * 00004 * IPv6 version of ICMP, as per RFC 4443. 00005 */ 00006 00007 /* 00008 * Copyright (c) 2010 Inico Technologies Ltd. 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. The name of the author may not be used to endorse or promote products 00020 * derived from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00023 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00024 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00025 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00027 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00028 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00029 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00030 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00031 * OF SUCH DAMAGE. 00032 * 00033 * This file is part of the lwIP TCP/IP stack. 00034 * 00035 * Author: Ivan Delamer <delamer@inicotech.com> 00036 * 00037 * 00038 * Please coordinate changes and requests with Ivan Delamer 00039 * <delamer@inicotech.com> 00040 */ 00041 #ifndef LWIP_HDR_ICMP6_H 00042 #define LWIP_HDR_ICMP6_H 00043 00044 #include "lwip/opt.h" 00045 #include "lwip/pbuf.h" 00046 #include "lwip/ip6_addr.h" 00047 #include "lwip/netif.h" 00048 00049 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #endif 00053 00054 /** ICMP type */ 00055 enum icmp6_type { 00056 /** Destination unreachable */ 00057 ICMP6_TYPE_DUR = 1, 00058 /** Packet too big */ 00059 ICMP6_TYPE_PTB = 2, 00060 /** Time exceeded */ 00061 ICMP6_TYPE_TE = 3, 00062 /** Parameter problem */ 00063 ICMP6_TYPE_PP = 4, 00064 /** Private experimentation */ 00065 ICMP6_TYPE_PE1 = 100, 00066 /** Private experimentation */ 00067 ICMP6_TYPE_PE2 = 101, 00068 /** Reserved for expansion of error messages */ 00069 ICMP6_TYPE_RSV_ERR = 127, 00070 00071 /** Echo request */ 00072 ICMP6_TYPE_EREQ = 128, 00073 /** Echo reply */ 00074 ICMP6_TYPE_EREP = 129, 00075 /** Multicast listener query */ 00076 ICMP6_TYPE_MLQ = 130, 00077 /** Multicast listener report */ 00078 ICMP6_TYPE_MLR = 131, 00079 /** Multicast listener done */ 00080 ICMP6_TYPE_MLD = 132, 00081 /** Router solicitation */ 00082 ICMP6_TYPE_RS = 133, 00083 /** Router advertisement */ 00084 ICMP6_TYPE_RA = 134, 00085 /** Neighbor solicitation */ 00086 ICMP6_TYPE_NS = 135, 00087 /** Neighbor advertisement */ 00088 ICMP6_TYPE_NA = 136, 00089 /** Redirect */ 00090 ICMP6_TYPE_RD = 137, 00091 /** Multicast router advertisement */ 00092 ICMP6_TYPE_MRA = 151, 00093 /** Multicast router solicitation */ 00094 ICMP6_TYPE_MRS = 152, 00095 /** Multicast router termination */ 00096 ICMP6_TYPE_MRT = 153, 00097 /** Private experimentation */ 00098 ICMP6_TYPE_PE3 = 200, 00099 /** Private experimentation */ 00100 ICMP6_TYPE_PE4 = 201, 00101 /** Reserved for expansion of informational messages */ 00102 ICMP6_TYPE_RSV_INF = 255 00103 }; 00104 00105 /** ICMP destination unreachable codes */ 00106 enum icmp6_dur_code { 00107 /** No route to destination */ 00108 ICMP6_DUR_NO_ROUTE = 0, 00109 /** Communication with destination administratively prohibited */ 00110 ICMP6_DUR_PROHIBITED = 1, 00111 /** Beyond scope of source address */ 00112 ICMP6_DUR_SCOPE = 2, 00113 /** Address unreachable */ 00114 ICMP6_DUR_ADDRESS = 3, 00115 /** Port unreachable */ 00116 ICMP6_DUR_PORT = 4, 00117 /** Source address failed ingress/egress policy */ 00118 ICMP6_DUR_POLICY = 5, 00119 /** Reject route to destination */ 00120 ICMP6_DUR_REJECT_ROUTE = 6 00121 }; 00122 00123 /** ICMP time exceeded codes */ 00124 enum icmp6_te_code { 00125 /** Hop limit exceeded in transit */ 00126 ICMP6_TE_HL = 0, 00127 /** Fragment reassembly time exceeded */ 00128 ICMP6_TE_FRAG = 1 00129 }; 00130 00131 /** ICMP parameter code */ 00132 enum icmp6_pp_code { 00133 /** Erroneous header field encountered */ 00134 ICMP6_PP_FIELD = 0, 00135 /** Unrecognized next header type encountered */ 00136 ICMP6_PP_HEADER = 1, 00137 /** Unrecognized IPv6 option encountered */ 00138 ICMP6_PP_OPTION = 2 00139 }; 00140 00141 /** This is the standard ICMP6 header. */ 00142 #ifdef PACK_STRUCT_USE_INCLUDES 00143 # include "arch/bpstruct.h" 00144 #endif 00145 PACK_STRUCT_BEGIN 00146 struct icmp6_hdr { 00147 PACK_STRUCT_FLD_8(u8_t type); 00148 PACK_STRUCT_FLD_8(u8_t code); 00149 PACK_STRUCT_FIELD(u16_t chksum); 00150 PACK_STRUCT_FIELD(u32_t data); 00151 } PACK_STRUCT_STRUCT; 00152 PACK_STRUCT_END 00153 #ifdef PACK_STRUCT_USE_INCLUDES 00154 # include "arch/epstruct.h" 00155 #endif 00156 00157 /** This is the ICMP6 header adapted for echo req/resp. */ 00158 #ifdef PACK_STRUCT_USE_INCLUDES 00159 # include "arch/bpstruct.h" 00160 #endif 00161 PACK_STRUCT_BEGIN 00162 struct icmp6_echo_hdr { 00163 PACK_STRUCT_FLD_8(u8_t type); 00164 PACK_STRUCT_FLD_8(u8_t code); 00165 PACK_STRUCT_FIELD(u16_t chksum); 00166 PACK_STRUCT_FIELD(u16_t id); 00167 PACK_STRUCT_FIELD(u16_t seqno); 00168 } PACK_STRUCT_STRUCT; 00169 PACK_STRUCT_END 00170 #ifdef PACK_STRUCT_USE_INCLUDES 00171 # include "arch/epstruct.h" 00172 #endif 00173 00174 00175 #if LWIP_ICMP6 && LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 00176 00177 void icmp6_input(struct pbuf *p, struct netif *inp); 00178 void icmp6_dest_unreach(struct pbuf *p, enum icmp6_dur_code c); 00179 void icmp6_packet_too_big(struct pbuf *p, u32_t mtu); 00180 void icmp6_time_exceeded(struct pbuf *p, enum icmp6_te_code c); 00181 void icmp6_param_problem(struct pbuf *p, enum icmp6_pp_code c, u32_t pointer); 00182 00183 #endif /* LWIP_ICMP6 && LWIP_IPV6 */ 00184 00185 00186 #ifdef __cplusplus 00187 } 00188 #endif 00189 00190 00191 #endif /* LWIP_HDR_ICMP6_H */
Generated on Tue Jul 12 2022 17:34:43 by
