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.

346 lines
6.3 KiB

  1. #ifndef _CHILDCONTEXT_HXX_
  2. #define _CHILDCONTEXT_HXX_
  3. class W3_CHILD_CONTEXT : public W3_CONTEXT
  4. {
  5. public:
  6. W3_CHILD_CONTEXT(
  7. W3_MAIN_CONTEXT * pMainContext,
  8. W3_CONTEXT * pParentContext,
  9. W3_REQUEST * pRequest,
  10. BOOL fOwnRequest,
  11. W3_USER_CONTEXT * pUserContext,
  12. DWORD dwExecFlags
  13. );
  14. ~W3_CHILD_CONTEXT();
  15. VOID *
  16. operator new(
  17. size_t size
  18. )
  19. {
  20. DBG_ASSERT( size == sizeof( W3_CHILD_CONTEXT ) );
  21. DBG_ASSERT( sm_pachChildContexts != NULL );
  22. return sm_pachChildContexts->Alloc();
  23. }
  24. VOID
  25. operator delete(
  26. VOID * pChildContext
  27. )
  28. {
  29. DBG_ASSERT( pChildContext != NULL );
  30. DBG_ASSERT( sm_pachChildContexts != NULL );
  31. DBG_REQUIRE( sm_pachChildContexts->Free( pChildContext ) );
  32. }
  33. //
  34. // Overridden W3_CONTEXT methods
  35. //
  36. BOOL
  37. QueryProviderHandled(
  38. VOID
  39. )
  40. {
  41. return _pMainContext->QueryProviderHandled();
  42. }
  43. ULATQ_CONTEXT
  44. QueryUlatqContext(
  45. VOID
  46. )
  47. {
  48. return _pMainContext->QueryUlatqContext();
  49. }
  50. W3_REQUEST *
  51. QueryRequest(
  52. VOID
  53. )
  54. {
  55. return _pRequest;
  56. }
  57. W3_RESPONSE *
  58. QueryResponse(
  59. VOID
  60. )
  61. {
  62. return _pMainContext->QueryResponse();
  63. }
  64. BOOL
  65. QuerySendLocation(
  66. VOID
  67. )
  68. {
  69. return TRUE;
  70. }
  71. BOOL
  72. QueryResponseSent(
  73. VOID
  74. )
  75. {
  76. return _pMainContext->QueryResponseSent();
  77. }
  78. BOOL
  79. QueryNeedFinalDone(
  80. VOID
  81. )
  82. {
  83. return _pMainContext->QueryNeedFinalDone();
  84. }
  85. VOID
  86. SetNeedFinalDone(
  87. VOID
  88. )
  89. {
  90. _pMainContext->SetNeedFinalDone();
  91. }
  92. W3_USER_CONTEXT *
  93. QueryUserContext(
  94. VOID
  95. )
  96. {
  97. if ( _pCustomUserContext != NULL )
  98. {
  99. return _pCustomUserContext;
  100. }
  101. else
  102. {
  103. return _pMainContext->QueryUserContext();
  104. }
  105. }
  106. W3_FILTER_CONTEXT *
  107. QueryFilterContext(
  108. BOOL fCreateIfNotFound = TRUE
  109. )
  110. {
  111. return _pMainContext->QueryFilterContext( fCreateIfNotFound );
  112. }
  113. URL_CONTEXT *
  114. QueryUrlContext(
  115. VOID
  116. )
  117. {
  118. return _pUrlContext;
  119. }
  120. W3_SITE *
  121. QuerySite(
  122. VOID
  123. )
  124. {
  125. return _pMainContext->QuerySite();
  126. }
  127. BOOL
  128. QueryDisconnect(
  129. VOID
  130. )
  131. {
  132. return _pMainContext->QueryDisconnect();
  133. }
  134. VOID
  135. SetDisconnect(
  136. BOOL fDisconnect
  137. )
  138. {
  139. if ( ( _dwExecFlags & W3_FLAG_NO_HEADERS ) == 0 )
  140. {
  141. _pMainContext->SetDisconnect( fDisconnect );
  142. }
  143. }
  144. BOOL
  145. QueryIsUlCacheable(
  146. VOID
  147. )
  148. {
  149. //
  150. // Child requests are never cached in UL
  151. //
  152. return FALSE;
  153. }
  154. VOID
  155. DisableUlCache(
  156. VOID
  157. )
  158. {
  159. }
  160. VOID
  161. SetDoneWithCompression(
  162. VOID
  163. )
  164. {
  165. _pMainContext->SetDoneWithCompression();
  166. }
  167. BOOL
  168. QueryDoneWithCompression(
  169. VOID
  170. )
  171. {
  172. return _pMainContext->QueryDoneWithCompression();
  173. }
  174. VOID
  175. SetCompressionContext(
  176. IN COMPRESSION_CONTEXT * pCompressionContext
  177. )
  178. {
  179. _pMainContext->SetCompressionContext(pCompressionContext);
  180. }
  181. COMPRESSION_CONTEXT *
  182. QueryCompressionContext(
  183. VOID
  184. )
  185. {
  186. return _pMainContext->QueryCompressionContext();
  187. }
  188. HTTP_LOG_FIELDS_DATA *
  189. QueryUlLogData(
  190. VOID
  191. )
  192. {
  193. return _pMainContext->QueryUlLogData();
  194. }
  195. VOID
  196. SetLastIOPending(
  197. LAST_IO_PENDING ioPending
  198. )
  199. {
  200. _pMainContext->SetLastIOPending(ioPending);
  201. }
  202. VOID
  203. IncrementBytesRecvd(
  204. DWORD dwRead
  205. )
  206. {
  207. _pMainContext->IncrementBytesRecvd(dwRead);
  208. }
  209. VOID
  210. IncrementBytesSent(
  211. DWORD dwSent
  212. )
  213. {
  214. _pMainContext->IncrementBytesSent(dwSent);
  215. }
  216. W3_CONTEXT *
  217. QueryParentContext(
  218. VOID
  219. )
  220. {
  221. return _pParentContext;
  222. }
  223. W3_MAIN_CONTEXT *
  224. QueryMainContext(
  225. VOID
  226. )
  227. {
  228. return _pMainContext;
  229. }
  230. HRESULT
  231. RetrieveUrlContext(
  232. BOOL * pfFinished
  233. );
  234. HRESULT
  235. ReceiveEntity(
  236. BOOL fAsync,
  237. VOID * pBuffer,
  238. DWORD cbBuffer,
  239. DWORD * pBytesReceived
  240. )
  241. {
  242. return _pMainContext->ReceiveEntity( fAsync,
  243. pBuffer,
  244. cbBuffer,
  245. pBytesReceived );
  246. }
  247. BOOL
  248. NotifyFilters(
  249. DWORD dwNotification,
  250. VOID * pvFilterInfo,
  251. BOOL * pfFinished
  252. )
  253. {
  254. return _pMainContext->NotifyFilters( dwNotification,
  255. pvFilterInfo,
  256. pfFinished );
  257. }
  258. BOOL
  259. IsNotificationNeeded(
  260. DWORD dwNotification
  261. )
  262. {
  263. return _pMainContext->IsNotificationNeeded( dwNotification );
  264. }
  265. HRESULT
  266. SendResponse(
  267. DWORD dwFlags
  268. )
  269. {
  270. return _pMainContext->SendResponse( dwFlags );
  271. }
  272. HRESULT
  273. SendEntity(
  274. DWORD dwFlags
  275. )
  276. {
  277. return _pMainContext->SendEntity( dwFlags );
  278. }
  279. static
  280. HRESULT
  281. Initialize(
  282. VOID
  283. );
  284. static
  285. VOID
  286. Terminate(
  287. VOID
  288. );
  289. private:
  290. W3_MAIN_CONTEXT * _pMainContext;
  291. W3_CONTEXT * _pParentContext;
  292. W3_REQUEST * _pRequest;
  293. BOOL _fOwnRequest;
  294. URL_CONTEXT * _pUrlContext;
  295. W3_USER_CONTEXT * _pCustomUserContext;
  296. //
  297. // Lookaside for main contexts
  298. //
  299. static ALLOC_CACHE_HANDLER * sm_pachChildContexts;
  300. };
  301. #endif