icmp.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * INET An implementation of the TCP/IP protocol suite for the LINUX
  4. * operating system. INET is implemented using the BSD Socket
  5. * interface as the means of communication with the user level.
  6. *
  7. * Definitions for the ICMP protocol.
  8. *
  9. * Version: @(#)icmp.h 1.0.3 04/28/93
  10. *
  11. * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version
  16. * 2 of the License, or (at your option) any later version.
  17. */
  18. #ifndef _UAPI_LINUX_ICMP_H
  19. #define _UAPI_LINUX_ICMP_H
  20. #include <linux/types.h>
  21. #define ICMP_ECHOREPLY 0 /* Echo Reply */
  22. #define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
  23. #define ICMP_SOURCE_QUENCH 4 /* Source Quench */
  24. #define ICMP_REDIRECT 5 /* Redirect (change route) */
  25. #define ICMP_ECHO 8 /* Echo Request */
  26. #define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
  27. #define ICMP_PARAMETERPROB 12 /* Parameter Problem */
  28. #define ICMP_TIMESTAMP 13 /* Timestamp Request */
  29. #define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
  30. #define ICMP_INFO_REQUEST 15 /* Information Request */
  31. #define ICMP_INFO_REPLY 16 /* Information Reply */
  32. #define ICMP_ADDRESS 17 /* Address Mask Request */
  33. #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
  34. #define NR_ICMP_TYPES 18
  35. /* Codes for UNREACH. */
  36. #define ICMP_NET_UNREACH 0 /* Network Unreachable */
  37. #define ICMP_HOST_UNREACH 1 /* Host Unreachable */
  38. #define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
  39. #define ICMP_PORT_UNREACH 3 /* Port Unreachable */
  40. #define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
  41. #define ICMP_SR_FAILED 5 /* Source Route failed */
  42. #define ICMP_NET_UNKNOWN 6
  43. #define ICMP_HOST_UNKNOWN 7
  44. #define ICMP_HOST_ISOLATED 8
  45. #define ICMP_NET_ANO 9
  46. #define ICMP_HOST_ANO 10
  47. #define ICMP_NET_UNR_TOS 11
  48. #define ICMP_HOST_UNR_TOS 12
  49. #define ICMP_PKT_FILTERED 13 /* Packet filtered */
  50. #define ICMP_PREC_VIOLATION 14 /* Precedence violation */
  51. #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
  52. #define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
  53. /* Codes for REDIRECT. */
  54. #define ICMP_REDIR_NET 0 /* Redirect Net */
  55. #define ICMP_REDIR_HOST 1 /* Redirect Host */
  56. #define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
  57. #define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
  58. /* Codes for TIME_EXCEEDED. */
  59. #define ICMP_EXC_TTL 0 /* TTL count exceeded */
  60. #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
  61. struct icmphdr {
  62. __u8 type;
  63. __u8 code;
  64. __sum16 checksum;
  65. union {
  66. struct {
  67. __be16 id;
  68. __be16 sequence;
  69. } echo;
  70. __be32 gateway;
  71. struct {
  72. __be16 __unused;
  73. __be16 mtu;
  74. } frag;
  75. __u8 reserved[4];
  76. } un;
  77. };
  78. /*
  79. * constants for (set|get)sockopt
  80. */
  81. #define ICMP_FILTER 1
  82. struct icmp_filter {
  83. __u32 data;
  84. };
  85. #endif /* _UAPI_LINUX_ICMP_H */