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.

192 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. backpack.h
  5. Abstract:
  6. This module contains the package for pseudo polling. When a caller
  7. requests the same operation and gets the same error return the rdr
  8. must prevent flooding the network by backing off requests. Examples
  9. of when this is desirable are receiving 0 bytes on consequtive reads
  10. and consequtive fails on a file lock.
  11. If the caller is flooding the network, the rdr will return the 0 bytes
  12. or lock fail to the user until NextTime. When NextTime is reached
  13. the network will be used.
  14. Author:
  15. Colin Watson (colinw) 02-Jan-1991
  16. Revision History:
  17. ColinWatson [ColinW] 02-Jan-1991 Created
  18. Joe Linn [JoeLinn] 10-Oct-1996 Lifted from rdr1 and massaged for rdr2
  19. --*/
  20. #ifndef _BACKPACK_
  21. #define _BACKPACK_
  22. typedef struct _THROTTLING_STATE {
  23. LARGE_INTEGER NextTime; // Do not access the network until
  24. // CurrentTime >= NextTime
  25. ULONG CurrentIncrement; // Number of Increments applied to calculate NextTime
  26. ULONG MaximumDelay; // Specifies slowest rate that we will back off to
  27. // NextTime <= CurrentTime + (Interval * MaximumDelay)
  28. LARGE_INTEGER Increment;// {0,10000000} == 1 second
  29. ULONG NumberOfQueries;
  30. } THROTTLING_STATE, *PTHROTTLING_STATE;
  31. //++
  32. //
  33. // VOID
  34. // RxInitializeThrottlingState(
  35. // IN PTHROTTLING_STATE pBP,
  36. // IN ULONG Increment,
  37. // IN ULONG MaximumDelay
  38. // );
  39. //
  40. // Routine Description:
  41. //
  42. // This routine is called to initialize the back off structure (usually in
  43. // an Icb).
  44. //
  45. // Arguments:
  46. //
  47. // pBP - Supplies back pack data for this request.
  48. // Increment - Supplies the increase in delay in milliseconds, each time a request
  49. // to the network fails.
  50. // MaximumDelay- Supplies the longest delay the backoff package can introduce
  51. // in milliseconds.
  52. //
  53. // Return Value:
  54. //
  55. // None.
  56. //
  57. //--
  58. #define RxInitializeThrottlingState( _pBP, _Increment, _MaximumDelay ) { \
  59. if ((_Increment)>0) { \
  60. (_pBP)->Increment.QuadPart = (_Increment) * 10000; \
  61. (_pBP)->MaximumDelay = (_MaximumDelay) / (_Increment); \
  62. (_pBP)->CurrentIncrement = 0; \
  63. }}
  64. //++
  65. //
  66. // VOID
  67. // RxUninitializeBackPack(
  68. // IN PTHROTTLING_STATE pBP
  69. // )
  70. //
  71. // Routine Description:
  72. //
  73. // Resets the Back Pack specified. Currently no work needed.
  74. //
  75. // Arguments:
  76. //
  77. // pBP - Supplies back pack address.
  78. //
  79. // Return Value:
  80. //
  81. // None.
  82. //
  83. //--
  84. #define RxUninitializeBackPack( pBP ) ()
  85. // RxShouldRequestBeThrottled indicates when the request should not go to the network.
  86. BOOLEAN
  87. RxShouldRequestBeThrottled(
  88. IN PTHROTTLING_STATE pBP
  89. );
  90. // Register the last request as failed.
  91. VOID
  92. RxInitiateOrContinueThrottling (
  93. IN PTHROTTLING_STATE pBP
  94. );
  95. // Register the last request as worked.
  96. //++
  97. //
  98. // VOID
  99. // RxTerminateThrottling(
  100. // IN PTHROTTLING_STATE pBP
  101. // )
  102. //
  103. // Routine Description:
  104. //
  105. // Sets the Delay to zero. This routine is called each time that
  106. // a network request succeeds to avoid the next request backing off.
  107. //
  108. // Arguments:
  109. //
  110. // pBP - Supplies back pack address.
  111. //
  112. // Return Value:
  113. //
  114. // None.
  115. //
  116. //--
  117. #define RxTerminateThrottling( pBP ) ( (pBP)->CurrentIncrement = 0 )
  118. //++
  119. //
  120. // VOID
  121. // RxInitializeBackoffPackage (
  122. // VOID
  123. // )
  124. //
  125. // Routine Description:
  126. //
  127. // This routine initializes the redirector back off package.
  128. //
  129. // Arguments:
  130. //
  131. // None
  132. //
  133. // Return Value:
  134. //
  135. // None.
  136. //
  137. //--
  138. #define RxInitializeBackoffPackage( )
  139. //++
  140. //
  141. // VOID
  142. // RxUninitializeBackoffPackage (
  143. // VOID
  144. // )
  145. //
  146. // Routine Description:
  147. //
  148. // This routine uninitializes the redirector back off package.
  149. //
  150. // Arguments:
  151. //
  152. // None
  153. //
  154. // Return Value:
  155. //
  156. // None.
  157. //
  158. //--
  159. #define RxUninitializeBackoffPackage( )
  160. #endif /* _BACKPACK_ */
  161.