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.

297 lines
7.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. net\routing\ipx\sap\workers.h
  5. Abstract:
  6. Header file for agent work items
  7. Author:
  8. Vadim Eydelman 05-15-1995
  9. Revision History:
  10. --*/
  11. #ifndef _SAP_WORKERS_
  12. #define _SAP_WORKERS_
  13. // Max number of pending recv work items
  14. extern LONG MaxUnprocessedRequests;
  15. // Minimum number of queued recv requests
  16. extern LONG MinPendingRequests;
  17. // How often to check on pending triggered update
  18. extern ULONG TriggeredUpdateCheckInterval;
  19. // How many requests to send if no response received within check interval
  20. extern ULONG MaxTriggeredUpdateRequests;
  21. // Whether to respond for internal servers that are not registered with SAP
  22. // through the API calls (for standalone service only)
  23. extern ULONG RespondForInternalServers;
  24. // Delay in response to general reguests for specific server type
  25. // if local servers are included in the packet
  26. extern ULONG DelayResponseToGeneral;
  27. // Delay in sending change broadcasts if packet is not full
  28. extern ULONG DelayChangeBroadcast;
  29. // Workers that are enqueued for io processing
  30. typedef struct _IO_WORKER {
  31. WORKERFUNCTION worker;
  32. IO_PARAM_BLOCK io;
  33. } IO_WORKER, *PIO_WORKER;
  34. // Workers that are enqueued for timer processing
  35. typedef struct _TIMER_WORKER {
  36. WORKERFUNCTION worker;
  37. TM_PARAM_BLOCK tm;
  38. } TIMER_WORKER, *PTIMER_WORKER;
  39. // Workers that are enqueued to receive LPC request
  40. typedef struct _LPC_WORKER {
  41. WORKERFUNCTION worker;
  42. LPC_PARAM_BLOCK lpc;
  43. } LPC_WORKER, *PLPC_WORKER;
  44. /*
  45. VOID
  46. ScheduleWorkItem (
  47. WORKERFUNCTION *worker
  48. );
  49. */
  50. #define ScheduleWorkItem(worker) RtlQueueWorkItem(*worker,worker,0)
  51. #define ProcessCompletedIORequest(ioreq) \
  52. ScheduleWorkItem (&CONTAINING_RECORD(ioreq,IO_WORKER,io)->worker)
  53. #define ProcessCompletedTimerRequest(tmreq) \
  54. ScheduleWorkItem (&CONTAINING_RECORD(tmreq,TIMER_WORKER,tm)->worker);
  55. #define ProcessCompletedLpcRequest(lpcreq) \
  56. ScheduleWorkItem (&CONTAINING_RECORD(lpcreq,LPC_WORKER,lpc)->worker)
  57. /*++
  58. *******************************************************************
  59. I n i t i a l i z e W o r k e r s
  60. Routine Description:
  61. Initialize heap to be used for allocation of work items
  62. Arguments:
  63. None
  64. Return Value:
  65. NO_ERROR - heap was initialized OK
  66. other - operation failed (windows error code)
  67. *******************************************************************
  68. --*/
  69. DWORD
  70. InitializeWorkers (
  71. HANDLE RecvEvent
  72. );
  73. /*++
  74. *******************************************************************
  75. S h u t d o w n W o r k e r s
  76. Routine Description:
  77. Stops new worker creation and signals event when all
  78. workers are deleted
  79. Arguments:
  80. doneEvent - event to be signalled when all workers are deleted
  81. Return Value:
  82. None
  83. *******************************************************************
  84. --*/
  85. VOID
  86. ShutdownWorkers (
  87. IN HANDLE doneEvent
  88. );
  89. /*++
  90. *******************************************************************
  91. D e l e t e W o r k e r s
  92. Routine Description:
  93. Deletes heap used for work items
  94. Arguments:
  95. None
  96. Return Value:
  97. None
  98. *******************************************************************
  99. --*/
  100. VOID
  101. DeleteWorkers (
  102. void
  103. );
  104. VOID
  105. AddRecvRequests (
  106. LONG count
  107. );
  108. VOID
  109. RemoveRecvRequests (
  110. LONG count
  111. );
  112. /*++
  113. *******************************************************************
  114. I n i t R e q I t e m
  115. Routine Description:
  116. Allocate and initialize IO request item
  117. Enqueue the request
  118. Arguments:
  119. None
  120. Return Value:
  121. NO_ERROR - item was initialized and enqueued OK
  122. other - operation failed (windows error code)
  123. *******************************************************************
  124. --*/
  125. DWORD
  126. InitReqItem (
  127. void
  128. );
  129. /*++
  130. *******************************************************************
  131. I n i t R e s p I t e m
  132. Routine Description:
  133. Allocate and initialize SAP response item
  134. Call ProcessRespItem to fill the packet and send it
  135. Arguments:
  136. intf - pointer to interface control block to send on
  137. svrType - type of servers to put in response packet
  138. dst - where to send the response packet
  139. bcast - are we responding to broadcasted request
  140. Return Value:
  141. NO_ERROR - item was initialized and enqueued OK
  142. other - operation failed (windows error code)
  143. *******************************************************************
  144. --*/
  145. DWORD
  146. InitRespItem (
  147. PINTERFACE_DATA intf,
  148. USHORT svrType,
  149. PIPX_ADDRESS_BLOCK dst,
  150. BOOL bcast
  151. );
  152. /*++
  153. *******************************************************************
  154. I n i t G n e a r I t e m
  155. Routine Description:
  156. Allocate and initialize GETNEAREST response work item
  157. Arguments:
  158. intf - pointer to interface control block to send on
  159. svrType - type of servers to put in response packet
  160. dst - where to send the response packet
  161. Return Value:
  162. NO_ERROR - item was initialized and enqueued OK
  163. other - operation failed (windows error code)
  164. *******************************************************************
  165. --*/
  166. DWORD
  167. InitGnearItem (
  168. PINTERFACE_DATA intf,
  169. USHORT svrType,
  170. PIPX_ADDRESS_BLOCK dest
  171. );
  172. /*++
  173. *******************************************************************
  174. I n i t B c a s t I t e m
  175. Routine Description:
  176. Allocate and initialize broadcast item
  177. Arguments:
  178. intf - pointer to interface control block to send on
  179. chngEnum - enumeration handle in SDB change queue to track changed servers
  180. Return Value:
  181. NO_ERROR - item was initialized and enqueued OK
  182. other - operation failed (windows error code)
  183. *******************************************************************
  184. --*/
  185. DWORD
  186. InitBcastItem (
  187. PINTERFACE_DATA intf
  188. );
  189. /*++
  190. *******************************************************************
  191. I n i t S r e q I t e m
  192. Routine Description:
  193. Allocate and initialize send request item (send SAP request on interface)
  194. Arguments:
  195. intf - pointer to interface control block to send on
  196. Return Value:
  197. NO_ERROR - item was initialized and enqueued OK
  198. other - operation failed (windows error code)
  199. *******************************************************************
  200. --*/
  201. DWORD
  202. InitSreqItem (
  203. PINTERFACE_DATA intf
  204. );
  205. /*++
  206. *******************************************************************
  207. I n i t L P C I t e m
  208. Routine Description:
  209. Allocate and initialize LPC work item
  210. Arguments:
  211. None
  212. Return Value:
  213. NO_ERROR - item was initialized and enqueued OK
  214. other - operation failed (windows error code)
  215. *******************************************************************
  216. --*/
  217. DWORD
  218. InitLPCItem (
  219. void
  220. );
  221. /*++
  222. *******************************************************************
  223. I n i t T r e q I t e m
  224. Routine Description:
  225. Allocate and initialize triggered request item (send SAP request on interface
  226. and wait for responces to arrive)
  227. Arguments:
  228. intf - pointer to interface control block to send on
  229. Return Value:
  230. NO_ERROR - item was initialized and enqueued OK
  231. other - operation failed (windows error code)
  232. *******************************************************************
  233. --*/
  234. DWORD
  235. InitTreqItem (
  236. PINTERFACE_DATA intf
  237. );
  238. #endif