nip_icmph.inc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. type
  2. Picmphdr = ^icmphdr;
  3. icmphdr = record
  4. _type : u_int8_t;
  5. code : u_int8_t;
  6. checksum : u_int16_t;
  7. un : record
  8. case longint of
  9. 0 : ( echo : record
  10. id : u_int16_t;
  11. sequence : u_int16_t;
  12. end );
  13. 1 : ( gateway : u_int32_t );
  14. 2 : ( frag : record
  15. __unused : u_int16_t;
  16. mtu : u_int16_t;
  17. end );
  18. end;
  19. end;
  20. const
  21. ICMP_ECHOREPLY = 0;
  22. ICMP_DEST_UNREACH = 3;
  23. ICMP_SOURCE_QUENCH = 4;
  24. ICMP_REDIRECT = 5;
  25. ICMP_ECHO = 8;
  26. ICMP_TIME_EXCEEDED = 11;
  27. ICMP_PARAMETERPROB = 12;
  28. ICMP_TIMESTAMP = 13;
  29. ICMP_TIMESTAMPREPLY = 14;
  30. ICMP_INFO_REQUEST = 15;
  31. ICMP_INFO_REPLY = 16;
  32. ICMP_ADDRESS = 17;
  33. ICMP_ADDRESSREPLY = 18;
  34. NR_ICMP_TYPES = 18;
  35. ICMP_NET_UNREACH = 0;
  36. ICMP_HOST_UNREACH = 1;
  37. ICMP_PROT_UNREACH = 2;
  38. ICMP_PORT_UNREACH = 3;
  39. ICMP_FRAG_NEEDED = 4;
  40. ICMP_SR_FAILED = 5;
  41. ICMP_NET_UNKNOWN = 6;
  42. ICMP_HOST_UNKNOWN = 7;
  43. ICMP_HOST_ISOLATED = 8;
  44. ICMP_NET_ANO = 9;
  45. ICMP_HOST_ANO = 10;
  46. ICMP_NET_UNR_TOS = 11;
  47. ICMP_HOST_UNR_TOS = 12;
  48. ICMP_PKT_FILTERED = 13;
  49. ICMP_PREC_VIOLATION = 14;
  50. ICMP_PREC_CUTOFF = 15;
  51. NR_ICMP_UNREACH = 15;
  52. ICMP_REDIR_NET = 0;
  53. ICMP_REDIR_HOST = 1;
  54. ICMP_REDIR_NETTOS = 2;
  55. ICMP_REDIR_HOSTTOS = 3;
  56. ICMP_EXC_TTL = 0;
  57. ICMP_EXC_FRAGTIME = 1;
  58. type
  59. Picmp_ra_addr = ^icmp_ra_addr;
  60. icmp_ra_addr = record
  61. ira_addr : u_int32_t;
  62. ira_preference : u_int32_t;
  63. end;
  64. Picmp = ^icmp;
  65. icmp = record
  66. icmp_type : u_int8_t;
  67. icmp_code : u_int8_t;
  68. icmp_cksum : u_int16_t;
  69. icmp_hun : record
  70. case longint of
  71. 0 : ( ih_pptr : u_char );
  72. 1 : ( ih_gwaddr : in_addr );
  73. 2 : ( ih_idseq : record
  74. icd_id : u_int16_t;
  75. icd_seq : u_int16_t;
  76. end );
  77. 3 : ( ih_void : u_int32_t );
  78. 4 : ( ih_pmtu : record
  79. ipm_void : u_int16_t;
  80. ipm_nextmtu : u_int16_t;
  81. end );
  82. 5 : ( ih_rtradv : record
  83. irt_num_addrs : u_int8_t;
  84. irt_wpa : u_int8_t;
  85. irt_lifetime : u_int16_t;
  86. end );
  87. end;
  88. icmp_dun : record
  89. case longint of
  90. 0 : ( id_ts : record
  91. its_otime : u_int32_t;
  92. its_rtime : u_int32_t;
  93. its_ttime : u_int32_t;
  94. end );
  95. 1 : ( id_ip : record
  96. idi_ip : ip;
  97. end );
  98. 2 : ( id_radv : icmp_ra_addr );
  99. 3 : ( id_mask : u_int32_t );
  100. 4 : ( id_data : array[0..0] of u_int8_t );
  101. end;
  102. end;
  103. const
  104. ICMP_MINLEN = 8;
  105. ICMP_TSLEN = 8 + (3 * (sizeof(n_time)));
  106. ICMP_MASKLEN = 12;
  107. ICMP_ADVLENMIN = (8 + SizeOf(ip)+8);
  108. const
  109. ICMP_UNREACH = 3;
  110. ICMP_SOURCEQUENCH = 4;
  111. ICMP_ROUTERADVERT = 9;
  112. ICMP_ROUTERSOLICIT = 10;
  113. ICMP_TIMXCEED = 11;
  114. ICMP_PARAMPROB = 12;
  115. ICMP_TSTAMP = 13;
  116. ICMP_TSTAMPREPLY = 14;
  117. ICMP_IREQ = 15;
  118. ICMP_IREQREPLY = 16;
  119. ICMP_MASKREQ = 17;
  120. ICMP_MASKREPLY = 18;
  121. ICMP_MAXTYPE = 18;
  122. ICMP_UNREACH_NET = 0;
  123. ICMP_UNREACH_HOST = 1;
  124. ICMP_UNREACH_PROTOCOL = 2;
  125. ICMP_UNREACH_PORT = 3;
  126. ICMP_UNREACH_NEEDFRAG = 4;
  127. ICMP_UNREACH_SRCFAIL = 5;
  128. ICMP_UNREACH_NET_UNKNOWN = 6;
  129. ICMP_UNREACH_HOST_UNKNOWN = 7;
  130. ICMP_UNREACH_ISOLATED = 8;
  131. ICMP_UNREACH_NET_PROHIB = 9;
  132. ICMP_UNREACH_HOST_PROHIB = 10;
  133. ICMP_UNREACH_TOSNET = 11;
  134. ICMP_UNREACH_TOSHOST = 12;
  135. ICMP_UNREACH_FILTER_PROHIB = 13;
  136. ICMP_UNREACH_HOST_PRECEDENCE = 14;
  137. ICMP_UNREACH_PRECEDENCE_CUTOFF = 15;
  138. ICMP_REDIRECT_NET = 0;
  139. ICMP_REDIRECT_HOST = 1;
  140. ICMP_REDIRECT_TOSNET = 2;
  141. ICMP_REDIRECT_TOSHOST = 3;
  142. ICMP_TIMXCEED_INTRANS = 0;
  143. ICMP_TIMXCEED_REASS = 1;
  144. ICMP_PARAMPROB_OPTABSENT = 1;
  145. function ICMP_ADVLEN(const p: icmp): cardinal;
  146. Function ICMP_INFOTYPE(_type: cardinal): boolean;
  147. { ---------------------------------------------------------------------
  148. Borland compatibility types
  149. ---------------------------------------------------------------------}
  150. // Type