Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. icmp.h
  5. Abstract:
  6. This module declares the ICMP APIs that are provided for use
  7. primarily by the NT tcp/ip utilities.
  8. Author:
  9. John Ballard (jballard) April 1, 1993
  10. Revision History:
  11. --*/
  12. #ifndef _ICMP_
  13. #define _ICMP_
  14. #if (_MSC_VER >= 800)
  15. #define STRMAPI __stdcall
  16. #else
  17. #define _cdecl
  18. #define STRMAPI
  19. #endif
  20. /*
  21. *
  22. * register_icmp returns a handle to an open stream to icmp or
  23. * ICMP_ERROR if an error occurs.
  24. *
  25. */
  26. extern HANDLE STRMAPI register_icmp(void);
  27. #define ICMP_ERROR ((HANDLE) -3)
  28. /*
  29. *
  30. * If an error occurs a GetLastError() will return the reason for the error.
  31. *
  32. */
  33. #define ICMP_OPEN_ERROR 1
  34. #define ICMP_PUTMSG_ERROR 2
  35. #define ICMP_GETMSG_ERROR 3
  36. #define ICMP_IN_USE 4
  37. #define ICMP_INVALID_PROT 5
  38. /*
  39. *
  40. * do_echo_req generates an icmp echo request packet
  41. *
  42. * parameters are:
  43. *
  44. * fd - handle of stream to icmp (returned by register_icmp call)
  45. * addr - ip address of host to ping in form returned by inet_addr()
  46. * data - buffer containing data for ping packet
  47. * datalen - length of data buffer
  48. * optptr - buffer containing ip options to use for this packet
  49. * optlen - option buffer length
  50. * df - don't fragment flag
  51. * ttl - time to live value
  52. * tos - type of service value
  53. * preced - precedence value
  54. *
  55. * returns:
  56. *
  57. * 0 if no error occured or
  58. * standard unix error values ENOMEM, ERANGE, etc.
  59. *
  60. */
  61. extern int STRMAPI
  62. do_echo_req( HANDLE fd, long addr, char * data, int datalen,
  63. char *optptr, int optlen, int df, int ttl, int tos, int preced);
  64. /*
  65. *
  66. * do_echo_rep receives the reply to an icmp echo request packet
  67. *
  68. * parameters are:
  69. *
  70. * fd - handle of stream to icmp (returned by register_icmp call)
  71. * rdata - buffer containing data for ping packet
  72. * rdatalen - length of data buffer
  73. * rtype - type of packet returned (see
  74. * rttl - time to live value
  75. * rtos - type of service value
  76. * rpreced - precedence value
  77. * rdf - don't fragment flag
  78. * roptptr - buffer containing ip options to use for this packet
  79. * roptlen - option buffer length
  80. *
  81. * returns:
  82. *
  83. * 0 if no error occured. rtype will indicate type of packet received.
  84. * -1 if error occured. GetLastError() will indicate actual error.
  85. * -3 if invalid msg returned. GetLastError() will indicate type.
  86. *
  87. */
  88. extern int STRMAPI
  89. do_echo_rep( HANDLE fd, char *rdata, int rdatalen, int *rtype,
  90. int *rttl, int *rtos, int *rpreced, int *rdf,
  91. char *roptptr, int *roptlen);
  92. /*
  93. * If -1 return then GetLastError returns the following.
  94. */
  95. #define POLL_TIMEOUT 0
  96. #define POLL_FAILED 1
  97. /*
  98. * Values returned by do_echo_rep in rtype
  99. */
  100. #define ECHO_REPLY 0 /* echo reply */
  101. #define DEST_UNR 3 /* destination unreachable: */
  102. #define TIME_EXCEEDED 11 /* time exceeded: */
  103. #define PARAMETER_ERROR 12 /* parameter problem */
  104. #endif