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.

304 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. sendresponsep.h
  5. Abstract:
  6. The private definition of response sending interfaces.
  7. Author:
  8. Michael Courage (mcourage) 15-Jun-1999
  9. Revision History:
  10. --*/
  11. #ifndef _SENDRESPONSEP_H_
  12. #define _SENDRESPONSEP_H_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. //
  17. // Private constants.
  18. //
  19. //
  20. // Convenience macro to test if a MDL describes locked memory.
  21. //
  22. #define IS_MDL_LOCKED(pmdl) (((pmdl)->MdlFlags & MDL_PAGES_LOCKED) != 0)
  23. #define HEADER_CHUNK_COUNT 2
  24. //
  25. // Private prototypes.
  26. //
  27. ULONG
  28. UlpComputeFixedHeaderSize(
  29. IN PHTTP_RESPONSE pUserResponse
  30. );
  31. VOID
  32. UlpComputeChunkBufferSizes(
  33. IN ULONG ChunkCount,
  34. IN PHTTP_DATA_CHUNK pDataChunks,
  35. IN ULONG Flags,
  36. OUT PULONG pAuxBufferSize,
  37. OUT PULONG pCopiedMemorySize,
  38. OUT PULONG pUncopiedMemorySize,
  39. OUT PULONGLONG pFromFileSize
  40. );
  41. VOID
  42. UlpDestroyCapturedResponse(
  43. IN PUL_INTERNAL_RESPONSE pResponse
  44. );
  45. VOID
  46. UlpSendHttpResponseWorker(
  47. IN PUL_WORK_ITEM pWorkItem
  48. );
  49. VOID
  50. UlpCloseConnectionComplete(
  51. IN PVOID pCompletionContext,
  52. IN NTSTATUS Status,
  53. IN ULONG_PTR Information
  54. );
  55. PUL_CHUNK_TRACKER
  56. UlpAllocateChunkTracker(
  57. IN UL_TRACKER_TYPE TrackerType,
  58. IN CCHAR SendIrpStackSize,
  59. IN CCHAR ReadIrpStackSize,
  60. IN PUL_HTTP_CONNECTION pHttpConnection,
  61. IN ULONG Flags,
  62. IN PUL_INTERNAL_REQUEST pRequest,
  63. IN PUL_INTERNAL_RESPONSE pResponse,
  64. IN PUL_COMPLETION_ROUTINE pCompletionRoutine,
  65. IN PVOID pCompletionContext
  66. );
  67. VOID
  68. UlpFreeChunkTracker(
  69. IN PUL_CHUNK_TRACKER pTracker
  70. );
  71. VOID
  72. UlpCompleteSendRequest(
  73. IN PUL_CHUNK_TRACKER pTracker,
  74. IN NTSTATUS Status
  75. );
  76. VOID
  77. UlpCompleteSendRequestWorker(
  78. IN PUL_WORK_ITEM pWorkItem
  79. );
  80. VOID
  81. UlpCompleteSendIrpEarly(
  82. PUL_COMPLETION_ROUTINE pCompletionRoutine,
  83. PVOID pCompletionContext,
  84. NTSTATUS Status,
  85. ULONGLONG BytesTransferred
  86. );
  87. NTSTATUS
  88. UlpRestartMdlRead(
  89. IN PDEVICE_OBJECT pDeviceObject,
  90. IN PIRP pIrp,
  91. IN PVOID pContext
  92. );
  93. VOID
  94. UlpRestartMdlSend(
  95. IN PVOID pCompletionContext,
  96. IN NTSTATUS Status,
  97. IN ULONG_PTR Information
  98. );
  99. VOID
  100. UlpSendCompleteWorker(
  101. IN PUL_WORK_ITEM pWorkItem
  102. );
  103. VOID
  104. UlpFreeMdlRuns(
  105. IN OUT PUL_CHUNK_TRACKER pTracker
  106. );
  107. VOID
  108. UlpIncrementChunkPointer(
  109. IN OUT PUL_CHUNK_TRACKER pTracker
  110. );
  111. __inline
  112. VOID
  113. FASTCALL
  114. UlpInitMdlRuns(
  115. IN OUT PUL_CHUNK_TRACKER pTracker
  116. )
  117. {
  118. pTracker->SendInfo.pMdlHead = NULL;
  119. pTracker->SendInfo.pMdlLink = &pTracker->SendInfo.pMdlHead;
  120. pTracker->SendInfo.MdlRunCount = 0;
  121. pTracker->SendInfo.BytesBuffered = 0;
  122. }
  123. //
  124. // read stuff into the cache
  125. //
  126. NTSTATUS
  127. UlpBuildCacheEntry(
  128. IN PUL_INTERNAL_REQUEST pRequest,
  129. IN PUL_INTERNAL_RESPONSE pResponse,
  130. IN PUL_APP_POOL_PROCESS pProcess,
  131. IN ULONG Flags,
  132. IN HTTP_CACHE_POLICY CachePolicy,
  133. IN PUL_COMPLETION_ROUTINE pCompletionRoutine,
  134. IN PVOID pCompletionContext
  135. );
  136. VOID
  137. UlpBuildBuildTrackerWorker(
  138. IN PUL_WORK_ITEM pWorkItem
  139. );
  140. VOID
  141. UlpBuildCacheEntryWorker(
  142. IN PUL_WORK_ITEM pWorkItem
  143. );
  144. NTSTATUS
  145. UlpRestartCacheMdlRead(
  146. IN PDEVICE_OBJECT pDeviceObject,
  147. IN PIRP pIrp,
  148. IN PVOID pContext
  149. );
  150. NTSTATUS
  151. UlpRestartCacheMdlFree(
  152. IN PDEVICE_OBJECT pDeviceObject,
  153. IN PIRP pIrp,
  154. IN PVOID pContext
  155. );
  156. VOID
  157. UlpCompleteCacheBuild(
  158. IN PUL_CHUNK_TRACKER pTracker,
  159. IN NTSTATUS Status
  160. );
  161. VOID
  162. UlpCompleteCacheBuildWorker(
  163. IN PUL_WORK_ITEM pWorkItem
  164. );
  165. //
  166. // send cache entry across the wire
  167. //
  168. NTSTATUS
  169. UlpSendCacheEntry(
  170. PUL_HTTP_CONNECTION pHttpConnection,
  171. ULONG Flags,
  172. PUL_URI_CACHE_ENTRY pUriCacheEntry,
  173. PUL_COMPLETION_ROUTINE pCompletionRoutine,
  174. PVOID pCompletionContext,
  175. PUL_LOG_DATA_BUFFER pLogData
  176. );
  177. VOID
  178. UlpCompleteSendCacheEntry(
  179. IN PVOID pCompletionContext,
  180. IN NTSTATUS Status,
  181. IN ULONG_PTR Information
  182. );
  183. VOID
  184. UlpCompleteSendCacheEntry(
  185. IN PVOID pCompletionContext,
  186. IN NTSTATUS Status,
  187. IN ULONG_PTR Information
  188. );
  189. VOID
  190. UlpCompleteSendCacheEntryWorker(
  191. IN PUL_WORK_ITEM pWorkItem
  192. );
  193. PUL_FULL_TRACKER
  194. UlpAllocateCacheTracker(
  195. IN CCHAR SendIrpStackSize
  196. );
  197. VOID
  198. UlpFreeCacheTracker(
  199. IN PUL_FULL_TRACKER pTracker
  200. );
  201. //
  202. // utility
  203. //
  204. ULONG
  205. UlpCheckCacheControlHeaders(
  206. IN PUL_INTERNAL_REQUEST pRequest,
  207. IN PUL_URI_CACHE_ENTRY pUriCacheEntry
  208. );
  209. BOOLEAN
  210. UlpIsAcceptHeaderOk(
  211. PUL_INTERNAL_REQUEST pRequest,
  212. PUL_URI_CACHE_ENTRY pUriCacheEntry
  213. );
  214. VOID
  215. UlpGetTypeAndSubType(
  216. PSTR pStr,
  217. ULONG StrLen,
  218. PUL_CONTENT_TYPE pContentType
  219. );
  220. VOID
  221. UlReferenceChunkTracker(
  222. IN PUL_CHUNK_TRACKER pTracker
  223. REFERENCE_DEBUG_FORMAL_PARAMS
  224. );
  225. VOID
  226. UlDereferenceChunkTracker(
  227. IN PUL_CHUNK_TRACKER pTracker
  228. REFERENCE_DEBUG_FORMAL_PARAMS
  229. );
  230. #define UL_REFERENCE_CHUNK_TRACKER( pTracker ) \
  231. UlReferenceChunkTracker( \
  232. (pTracker) \
  233. REFERENCE_DEBUG_ACTUAL_PARAMS \
  234. )
  235. #define UL_DEREFERENCE_CHUNK_TRACKER( pTracker ) \
  236. UlDereferenceChunkTracker( \
  237. (pTracker) \
  238. REFERENCE_DEBUG_ACTUAL_PARAMS \
  239. )
  240. #ifdef __cplusplus
  241. }; // extern "C"
  242. #endif
  243. #endif // _SENDRESPONSEP_H_