ip_icmp.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #ifndef _NETINET_IP_ICMP_H_
  2. #define _NETINET_IP_ICMP_H_
  3. /*
  4. * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  23. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. * -
  35. * Portions Copyright (C) 2000 David J. Hudson <dave@humbug.demon.co.uk>
  36. *
  37. * This file is distributed in the hope that it will be useful, but WITHOUT
  38. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  39. * FITNESS FOR A PARTICULAR PURPOSE.
  40. *
  41. * You can redistribute this file and/or modify it under the terms of the GNU
  42. * General Public License (GPL) as published by the Free Software Foundation;
  43. * either version 2 of the License, or (at your discretion) any later version.
  44. * See the accompanying file "copying-gpl.txt" for more details.
  45. *
  46. * As a special exception to the GPL, permission is granted for additional
  47. * uses of the text contained in this file. See the accompanying file
  48. * "copying-liquorice.txt" for details.
  49. * -
  50. * Portions Copyright (c) 1983, 1993 by
  51. * The Regents of the University of California. All rights reserved.
  52. *
  53. * Redistribution and use in source and binary forms, with or without
  54. * modification, are permitted provided that the following conditions
  55. * are met:
  56. * 1. Redistributions of source code must retain the above copyright
  57. * notice, this list of conditions and the following disclaimer.
  58. * 2. Redistributions in binary form must reproduce the above copyright
  59. * notice, this list of conditions and the following disclaimer in the
  60. * documentation and/or other materials provided with the distribution.
  61. * 3. Neither the name of the University nor the names of its contributors
  62. * may be used to endorse or promote products derived from this software
  63. * without specific prior written permission.
  64. *
  65. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  66. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  67. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  68. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  69. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  70. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  71. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  72. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  73. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  74. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  75. * SUCH DAMAGE.
  76. */
  77. /*
  78. * $Log: ip_icmp.h,v $
  79. * Revision 1.1.1.1 2003/05/09 14:41:15 haraldkipp
  80. * Initial using 3.2.1
  81. *
  82. * Revision 1.6 2003/02/04 18:00:46 harald
  83. * Version 3 released
  84. *
  85. * Revision 1.5 2002/06/26 17:29:21 harald
  86. * First pre-release with 2.4 stack
  87. *
  88. */
  89. #include <sys/types.h>
  90. #include <net/if_arp.h>
  91. #include <netinet/ip.h>
  92. /*!
  93. * \file netinet/ip_icmp.h
  94. * \brief Interface control message protocol definitions.
  95. *
  96. * RFC 792.
  97. */
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. /*
  102. * Definition of type and code field values.
  103. */
  104. #define ICMP_ECHOREPLY 0 /*!< \brief Echo reply type. */
  105. #define ICMP_UNREACH 3 /*!< \brief Destination unreachable type. */
  106. #define ICMP_UNREACH_NET 0 /*!< \brief Destination unreachable: Bad net code. */
  107. #define ICMP_UNREACH_HOST 1 /*!< \brief Destination unreachable: Bad host. */
  108. #define ICMP_UNREACH_PROTOCOL 2 /*!< \brief Destination unreachable: Bad protocol. */
  109. #define ICMP_UNREACH_PORT 3 /*!< \brief Destination unreachable: Bad port. */
  110. #define ICMP_UNREACH_NEEDFRAG 4 /*!< \brief Destination unreachable: Fragmentation needed. */
  111. #define ICMP_UNREACH_SRCFAIL 5 /*!< \brief Destination unreachable: Source route failed. */
  112. #define ICMP_UNREACH_NET_UNKNOWN 6 /*!< \brief Destination unreachable: Unknown net. */
  113. #define ICMP_UNREACH_HOST_UNKNOWN 7 /*!< \brief Destination unreachable: Unknown host. */
  114. #define ICMP_UNREACH_ISOLATED 8 /*!< \brief Destination unreachable: Source host isolated. */
  115. #define ICMP_UNREACH_NET_PROHIB 9 /*!< \brief Destination unreachable: Net access prohibited. */
  116. #define ICMP_UNREACH_HOST_PROHIB 10 /*!< \brief Destination unreachable: Host access prohibited. */
  117. #define ICMP_UNREACH_TOSNET 11 /*!< \brief Destination unreachable: Bad tos for net. */
  118. #define ICMP_UNREACH_TOSHOST 12 /*!< \brief Destination unreachable: Bad tos for host. */
  119. #define ICMP_SOURCEQUENCH 4 /*!< \brief Packet lost type. */
  120. #define ICMP_REDIRECT 5 /*!< \brief Shorter route type. */
  121. #define ICMP_REDIRECT_NET 0 /*!< \brief Shorter route for network. */
  122. #define ICMP_REDIRECT_HOST 1 /*!< \brief Shorter route for host. */
  123. #define ICMP_REDIRECT_TOSNET 2 /*!< \brief Shorter route for tos and net. */
  124. #define ICMP_REDIRECT_TOSHOST 3 /*!< \brief Shorter route for tos and host. */
  125. #define ICMP_ECHO 8 /*!< \brief Echo reply type. */
  126. #define ICMP_ROUTERADVERT 9 /*!< \brief Router advertisement type. */
  127. #define ICMP_ROUTERSOLICIT 10 /*!< \brief Router solicitation type. */
  128. #define ICMP_TIMXCEED 11 /*!< \brief Time exceeded type. */
  129. #define ICMP_TIMXCEED_INTRANS 0 /*!< \brief Time exceeded in transit. */
  130. #define ICMP_TIMXCEED_REASS 1 /*!< \brief Time exceeded in reassembly. */
  131. #define ICMP_PARAMPROB 12 /*!< \brief Bad IP header type. */
  132. #define ICMP_PARAMPROB_OPTABSENT 1 /*!< \brief Bad IP header: Required option missing. */
  133. #define ICMP_TSTAMP 13 /*!< \brief Timestamp request type. */
  134. #define ICMP_TSTAMPREPLY 14 /*!< \brief Timestamp reply type. */
  135. #define ICMP_IREQ 15 /*!< \brief Information request type. */
  136. #define ICMP_IREQREPLY 16 /*!< \brief Information reply type. */
  137. #define ICMP_MASKREQ 17 /*!< \brief Address mask request type. */
  138. #define ICMP_MASKREPLY 18 /*!< \brief Address mask reply type. */
  139. #define ICMP_MAXTYPE 18 /*!< \brief Maximum ICMP type number. */
  140. #define ICMP_MINLEN 8 /*!< \brief Lower bounds on packet length. */
  141. /*!
  142. * \struct icmp ip_icmp.h netinet/ip_icmp.h
  143. * \brief ICMP protocol header structure.
  144. */
  145. /*!
  146. * \typedef ICMPHDR
  147. * \brief ICMP protocol header type.
  148. */
  149. typedef struct icmp {
  150. u_char icmp_type; /*!< \brief Type of message. */
  151. u_char icmp_code; /*!< \brief Type sub code. */
  152. u_short icmp_cksum; /*!< \brief Ones complement header checksum. */
  153. u_long icmp_spec; /*!< \brief Type specific information. */
  154. } ICMPHDR;
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158. #endif