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.

294 lines
5.3 KiB

  1. /*=====================================================================*
  2. Copyright (c) 1995-1997 Microsoft Corporation
  3. Module Name :
  4. wamxbase.hxx
  5. Abstract:
  6. Declaration of WAM_EXEC_BASE Object
  7. Author:
  8. David L. Kaplan ( DaveK ) 26-June-1997
  9. Environment:
  10. User Mode - Win32
  11. Project:
  12. WAM and ASP DLLs
  13. Revision History:
  14. ======================================================================*/
  15. # ifndef _WAMXBASE_HXX_
  16. # define _WAMXBASE_HXX_
  17. # include "iisext.h"
  18. # include "WamW3.hxx"
  19. /*---------------------------------------------------------------------*
  20. Forward references
  21. */
  22. interface IWamRequest;
  23. class WAM;
  24. class HSE_BASE;
  25. // first cleanup-capable thread to execute
  26. enum FIRST_THREAD
  27. {
  28. FT_NULL = 0, // ft is not yet known
  29. FT_MAINLINE, // ft is mainline (wam) thread
  30. FT_CALLBACK // ft is callback (ServerSupportFunction) thread
  31. };
  32. /*---------------------------------------------------------------------*
  33. class WAM_EXEC_BASE
  34. Base class for WAM_EXEC_INFO.
  35. Shareable with 'knowledgeable' ISAPIs, like asp.dll
  36. */
  37. class WAM_EXEC_BASE
  38. {
  39. public:
  40. //
  41. // This is what the ISA sees (must be first)
  42. //
  43. EXTENSION_CONTROL_BLOCK ecb;
  44. protected:
  45. //
  46. // m_pIWamReqIIS
  47. // iwamreq ptr which was passed to us by IIS
  48. //
  49. // m_pIWamReqInproc
  50. // iwamreq ptr used if request is in-process
  51. //
  52. // m_pIWamReqSmartISA
  53. // iwamreq ptr used if request is handled by a 'smart ISA'
  54. // (by definition, an ISA that alerts us when a sequence
  55. // of its callbacks will be on a single thread)
  56. //
  57. // NOTE asp.dll is a canonical example of a smart ISA.
  58. //
  59. // NOTE once ISA calls us to set this ptr, it must ensure
  60. // that it does all callbacks on the same thread, and that
  61. // it calls us on the same thread when done to release the ptr.
  62. // ISA is then free to call again on another thread and
  63. // do the same thing; the only requirement is that all
  64. // all callbacks between an "on" call and its "off" call
  65. // must be made on the same thread.
  66. //
  67. // ANY OTHER USE VOIDS WARRANTY.
  68. //
  69. // m_gipIWamRequest
  70. // gip cookie which can get a thread-valid iwamreq ptr
  71. // on any thread
  72. //
  73. IWamRequest * m_pIWamReqIIS;
  74. IWamRequest * m_pIWamReqInproc;
  75. IWamRequest * m_pIWamReqSmartISA;
  76. DWORD m_gipIWamRequest;
  77. //
  78. // are we in-proc or oop?
  79. // are we part of an application pool?
  80. //
  81. BOOL m_fInProcess;
  82. BOOL m_fInPool;
  83. //
  84. // m_dwThreadIdIIS
  85. // id of thread which called us 'from IIS'
  86. //
  87. // m_dwThreadIdISA
  88. // id of ISA callback thread
  89. //
  90. DWORD m_dwThreadIdIIS;
  91. DWORD m_dwThreadIdISA;
  92. protected:
  93. //
  94. // members formerly in WAM_EXEC_INFO
  95. // moved here to make debugging easier (inetdbg print, etc.)
  96. //
  97. long _cRefs;
  98. WAM * m_pWam;
  99. public:
  100. //
  101. // members formerly in WAM_EXEC_INFO
  102. // moved here to make debugging easier (inetdbg print, etc.)
  103. //
  104. // _ListEntry
  105. // list entry for this object in WAM's request list
  106. //
  107. // _psExtension
  108. // ptr to isapi extension dll struct for this request
  109. //
  110. // _FirstThread
  111. // first cleanup-capable thread to execute
  112. //
  113. LIST_ENTRY _ListEntry;
  114. DWORD _dwFlags;
  115. DWORD _dwIsaKeepConn;
  116. DWORD _dwChildExecFlags;
  117. HSE_BASE * _psExtension;
  118. FIRST_THREAD _FirstThread;
  119. ASYNC_IO_INFO _AsyncIoInfo;
  120. protected:
  121. DWORD m_dwSignature;
  122. public:
  123. HRESULT
  124. GetInterfaceForThread(
  125. );
  126. HRESULT
  127. ReleaseInterfaceForThread(
  128. );
  129. HRESULT
  130. GetIWamRequest(
  131. IWamRequest ** ppIWamRequest
  132. );
  133. VOID
  134. ReleaseIWamRequest(
  135. IWamRequest * pIWamRequest
  136. );
  137. HRESULT
  138. GetInterfaceFromGip(
  139. IWamRequest ** ppIWamRequest
  140. );
  141. inline
  142. BOOL
  143. FInProcess(
  144. );
  145. inline
  146. BOOL
  147. FInPool(
  148. );
  149. protected:
  150. WAM_EXEC_BASE(
  151. );
  152. HRESULT
  153. InitWamExecBase(
  154. IWamRequest * pIWamRequest
  155. );
  156. VOID
  157. CleanupWamExecBase(
  158. );
  159. HRESULT
  160. RegisterIWamRequest(
  161. IWamRequest * pIWamRequest
  162. );
  163. VOID
  164. RevokeIWamRequest(
  165. );
  166. inline
  167. BOOL
  168. AssertInpValid(
  169. );
  170. inline
  171. BOOL
  172. AssertOopValid(
  173. );
  174. public:
  175. BOOL
  176. AssertSmartISAValid(
  177. );
  178. }; // class WAM_EXEC_BASE
  179. /*---------------------------------------------------------------------*
  180. Inlines
  181. */
  182. inline
  183. BOOL
  184. WAM_EXEC_BASE::FInProcess()
  185. {
  186. return m_fInProcess;
  187. }
  188. inline
  189. BOOL
  190. WAM_EXEC_BASE::FInPool()
  191. {
  192. return m_fInPool;
  193. }
  194. inline
  195. BOOL
  196. WAM_EXEC_BASE::AssertInpValid()
  197. {
  198. return(
  199. m_fInProcess
  200. && m_pIWamReqInproc
  201. && (m_pIWamReqSmartISA == m_pIWamReqInproc)
  202. && !m_gipIWamRequest
  203. && !m_dwThreadIdISA
  204. );
  205. }
  206. inline
  207. BOOL
  208. WAM_EXEC_BASE::AssertOopValid()
  209. {
  210. return(
  211. !m_fInProcess
  212. && m_gipIWamRequest
  213. );
  214. }
  215. # endif // _WAMXBASE_HXX_
  216. /************************ End of File *********************************/