Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers icmp6.h Source File

icmp6.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * ICMP6 protocol definitions
00004  */
00005 
00006 /*
00007  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * This file is part of the lwIP TCP/IP stack.
00033  *
00034  * Author: Adam Dunkels <adam@sics.se>
00035  *
00036  */
00037 #ifndef LWIP_HDR_PROT_ICMP6_H
00038 #define LWIP_HDR_PROT_ICMP6_H
00039 
00040 #include "lwip/arch.h"
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /** ICMP type */
00047 enum icmp6_type {
00048   /** Destination unreachable */
00049   ICMP6_TYPE_DUR = 1,
00050   /** Packet too big */
00051   ICMP6_TYPE_PTB = 2,
00052   /** Time exceeded */
00053   ICMP6_TYPE_TE = 3,
00054   /** Parameter problem */
00055   ICMP6_TYPE_PP = 4,
00056   /** Private experimentation */
00057   ICMP6_TYPE_PE1 = 100,
00058   /** Private experimentation */
00059   ICMP6_TYPE_PE2 = 101,
00060   /** Reserved for expansion of error messages */
00061   ICMP6_TYPE_RSV_ERR = 127,
00062 
00063   /** Echo request */
00064   ICMP6_TYPE_EREQ = 128,
00065   /** Echo reply */
00066   ICMP6_TYPE_EREP = 129,
00067   /** Multicast listener query */
00068   ICMP6_TYPE_MLQ = 130,
00069   /** Multicast listener report */
00070   ICMP6_TYPE_MLR = 131,
00071   /** Multicast listener done */
00072   ICMP6_TYPE_MLD = 132,
00073   /** Router solicitation */
00074   ICMP6_TYPE_RS = 133,
00075   /** Router advertisement */
00076   ICMP6_TYPE_RA = 134,
00077   /** Neighbor solicitation */
00078   ICMP6_TYPE_NS = 135,
00079   /** Neighbor advertisement */
00080   ICMP6_TYPE_NA = 136,
00081   /** Redirect */
00082   ICMP6_TYPE_RD = 137,
00083   /** Multicast router advertisement */
00084   ICMP6_TYPE_MRA = 151,
00085   /** Multicast router solicitation */
00086   ICMP6_TYPE_MRS = 152,
00087   /** Multicast router termination */
00088   ICMP6_TYPE_MRT = 153,
00089   /** Private experimentation */
00090   ICMP6_TYPE_PE3 = 200,
00091   /** Private experimentation */
00092   ICMP6_TYPE_PE4 = 201,
00093   /** Reserved for expansion of informational messages */
00094   ICMP6_TYPE_RSV_INF = 255
00095 };
00096 
00097 /** ICMP destination unreachable codes */
00098 enum icmp6_dur_code {
00099   /** No route to destination */
00100   ICMP6_DUR_NO_ROUTE = 0,
00101   /** Communication with destination administratively prohibited */
00102   ICMP6_DUR_PROHIBITED = 1,
00103   /** Beyond scope of source address */
00104   ICMP6_DUR_SCOPE = 2,
00105   /** Address unreachable */
00106   ICMP6_DUR_ADDRESS = 3,
00107   /** Port unreachable */
00108   ICMP6_DUR_PORT = 4,
00109   /** Source address failed ingress/egress policy */
00110   ICMP6_DUR_POLICY = 5,
00111   /** Reject route to destination */
00112   ICMP6_DUR_REJECT_ROUTE = 6
00113 };
00114 
00115 /** ICMP time exceeded codes */
00116 enum icmp6_te_code {
00117   /** Hop limit exceeded in transit */
00118   ICMP6_TE_HL = 0,
00119   /** Fragment reassembly time exceeded */
00120   ICMP6_TE_FRAG = 1
00121 };
00122 
00123 /** ICMP parameter code */
00124 enum icmp6_pp_code {
00125   /** Erroneous header field encountered */
00126   ICMP6_PP_FIELD = 0,
00127   /** Unrecognized next header type encountered */
00128   ICMP6_PP_HEADER = 1,
00129   /** Unrecognized IPv6 option encountered */
00130   ICMP6_PP_OPTION = 2
00131 };
00132 
00133 /** This is the standard ICMP6 header. */
00134 #ifdef PACK_STRUCT_USE_INCLUDES
00135 #  include "arch/bpstruct.h"
00136 #endif
00137 PACK_STRUCT_BEGIN
00138 struct icmp6_hdr {
00139   PACK_STRUCT_FLD_8(u8_t type);
00140   PACK_STRUCT_FLD_8(u8_t code);
00141   PACK_STRUCT_FIELD(u16_t chksum);
00142   PACK_STRUCT_FIELD(u32_t data);
00143 } PACK_STRUCT_STRUCT;
00144 PACK_STRUCT_END
00145 #ifdef PACK_STRUCT_USE_INCLUDES
00146 #  include "arch/epstruct.h"
00147 #endif
00148 
00149 /** This is the ICMP6 header adapted for echo req/resp. */
00150 #ifdef PACK_STRUCT_USE_INCLUDES
00151 #  include "arch/bpstruct.h"
00152 #endif
00153 PACK_STRUCT_BEGIN
00154 struct icmp6_echo_hdr {
00155   PACK_STRUCT_FLD_8(u8_t type);
00156   PACK_STRUCT_FLD_8(u8_t code);
00157   PACK_STRUCT_FIELD(u16_t chksum);
00158   PACK_STRUCT_FIELD(u16_t id);
00159   PACK_STRUCT_FIELD(u16_t seqno);
00160 } PACK_STRUCT_STRUCT;
00161 PACK_STRUCT_END
00162 #ifdef PACK_STRUCT_USE_INCLUDES
00163 #  include "arch/epstruct.h"
00164 #endif
00165 
00166 #ifdef __cplusplus
00167 }
00168 #endif
00169 
00170 #endif /* LWIP_HDR_PROT_ICMP6_H */