Source code of Windows XP (NT5)
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.

126 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2001-2001 Microsoft Corporation
  3. Module Name:
  4. timeoutsp.h
  5. Abstract:
  6. Declaration for timeout monitoring private declarations.
  7. Author:
  8. Eric Stenson (EricSten) 24-Mar-2001
  9. Revision History:
  10. --*/
  11. #ifndef __TIMEOUTSP_H__
  12. #define __TIMEOUTSP_H__
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. //
  17. // Private macro definitions
  18. //
  19. #define DEFAULT_POLLING_INTERVAL (30 * C_NS_TICKS_PER_SEC)
  20. #define TIMER_WHEEL_SLOTS 509
  21. #define TIMER_OFF_SYSTIME (MAXLONGLONG)
  22. #define TIMER_OFF_TICK 0xffffffff
  23. #define TIMER_OFF_SLOT TIMER_WHEEL_SLOTS
  24. // NOTE: Slot number TIMER_WHEEL_SLOTS is reserved for TIMER_OFF_SYSTIME/TIMER_OFF_TICK
  25. #define IS_VALID_TIMER_WHEEL_SLOT(x) ( (x) <= TIMER_WHEEL_SLOTS )
  26. #define TIMER_WHEEL_TICKS(x) ((ULONG)( (x) / DEFAULT_POLLING_INTERVAL ))
  27. //
  28. // Connection Timeout Monitor Functions
  29. //
  30. VOID
  31. UlpSetTimeoutMonitorTimer(
  32. VOID
  33. );
  34. VOID
  35. UlpTimeoutMonitorDpcRoutine(
  36. IN PKDPC Dpc,
  37. IN PVOID DeferredContext,
  38. IN PVOID SystemArgument1,
  39. IN PVOID SystemArgument2
  40. );
  41. VOID
  42. UlpTimeoutMonitorWorker(
  43. IN PUL_WORK_ITEM pWorkItem
  44. );
  45. ULONG
  46. UlpTimeoutCheckExpiry(
  47. VOID
  48. );
  49. VOID
  50. UlpTimeoutInsertTimerWheelEntry(
  51. PUL_TIMEOUT_INFO_ENTRY pInfo
  52. );
  53. /***************************************************************************++
  54. Routine Description:
  55. Converts a system time/Timer Wheel Tick into a Timer Wheel(c) slot index.
  56. Arguments:
  57. SystemTime System Time to be converted
  58. Returns:
  59. Slot index into g_TimerWheel. TIMER_OFF is in TIMER_SLOT_OFF.
  60. --***************************************************************************/
  61. __inline
  62. USHORT
  63. UlpSystemTimeToTimerWheelSlot(
  64. LONGLONG SystemTime
  65. )
  66. {
  67. if ( TIMER_OFF_SYSTIME == SystemTime )
  68. {
  69. return TIMER_OFF_SLOT;
  70. }
  71. else
  72. {
  73. return (USHORT) (TIMER_WHEEL_TICKS(SystemTime) % TIMER_WHEEL_SLOTS);
  74. }
  75. } // UlpSystemTimeToTimerWheelSlot
  76. __inline
  77. USHORT
  78. UlpTimerWheelTicksToTimerWheelSlot(
  79. ULONG WheelTicks
  80. )
  81. {
  82. if ( TIMER_OFF_TICK == WheelTicks )
  83. {
  84. return TIMER_OFF_SLOT;
  85. }
  86. else
  87. {
  88. return (USHORT) (WheelTicks % TIMER_WHEEL_SLOTS);
  89. }
  90. } // UlpTimerWheelTicksToTimerWheelSlot
  91. #ifdef __cplusplus
  92. }; // extern "C"
  93. #endif
  94. #endif // __TIMEOUTSP_H__