icmp.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* ICMP for IP v4 and v6 */
  2. enum
  3. {
  4. /* Packet Types, icmp v4 (rfc 792) */
  5. EchoReply = 0,
  6. Unreachable = 3,
  7. SrcQuench = 4,
  8. Redirect = 5,
  9. EchoRequest = 8,
  10. TimeExceed = 11,
  11. InParmProblem = 12,
  12. Timestamp = 13,
  13. TimestampReply = 14,
  14. InfoRequest = 15,
  15. InfoReply = 16,
  16. AddrMaskRequest = 17,
  17. AddrMaskReply = 18,
  18. Traceroute = 30,
  19. IPv6WhereAreYou = 33,
  20. IPv6IAmHere = 34,
  21. /* packet types, icmp v6 (rfc 2463) */
  22. /* error messages */
  23. UnreachableV6 = 1,
  24. PacketTooBigV6 = 2,
  25. TimeExceedV6 = 3,
  26. ParamProblemV6 = 4,
  27. /* informational messages (rfc 2461 also) */
  28. EchoRequestV6 = 128,
  29. EchoReplyV6 = 129,
  30. RouterSolicit = 133,
  31. RouterAdvert = 134,
  32. NbrSolicit = 135,
  33. NbrAdvert = 136,
  34. RedirectV6 = 137,
  35. Maxtype6 = 137,
  36. ICMP_IPSIZE = 20,
  37. ICMP_HDRSIZE = 8,
  38. };
  39. typedef struct Icmp Icmp;
  40. struct Icmp
  41. {
  42. uchar vihl; /* Version and header length */
  43. uchar tos; /* Type of service */
  44. uchar length[2]; /* packet length */
  45. uchar id[2]; /* Identification */
  46. uchar frag[2]; /* Fragment information */
  47. uchar ttl; /* Time to live */
  48. uchar proto; /* Protocol */
  49. uchar ipcksum[2]; /* Header checksum */
  50. uchar src[4]; /* Ip source */
  51. uchar dst[4]; /* Ip destination */
  52. uchar type;
  53. uchar code;
  54. uchar cksum[2];
  55. uchar icmpid[2];
  56. uchar seq[2];
  57. uchar data[1];
  58. };
  59. typedef struct Icmp6 Icmp6;
  60. struct Icmp6
  61. {
  62. uchar vcf[4];
  63. uchar ploadlen[2];
  64. uchar proto;
  65. uchar ttl;
  66. uchar src[16]; /* Ip source */
  67. uchar dst[16]; /* Ip destination */
  68. uchar type;
  69. uchar code;
  70. uchar cksum[2];
  71. uchar icmpid[2];
  72. uchar seq[2];
  73. uchar data[1];
  74. };