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.

290 lines
10 KiB

  1. // This is a part of the Active Template Library.
  2. // Copyright (C) 1996-2001 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Active Template Library Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Active Template Library product.
  10. #ifndef __ATLSIFACE_H__
  11. #define __ATLSIFACE_H__
  12. #pragma once
  13. #include <atlcoll.h>
  14. #include <httpext.h>
  15. #include <atlserr.h>
  16. namespace ATL{
  17. // Forward declarations of custom data types used in
  18. // interfaces declared in this file.
  19. struct AtlServerRequest;
  20. class CIsapiWorker;
  21. __interface IAtlMemMgr;
  22. class CCookie;
  23. // Forward declarations of all interfaces declared in this file.
  24. __interface IWriteStream;
  25. __interface IHttpFile;
  26. __interface IHttpServerContext;
  27. __interface IHttpRequestLookup;
  28. __interface IRequestHandler;
  29. __interface ITagReplacer;
  30. __interface IIsapiExtension;
  31. __interface IPageCacheControl;
  32. __interface IRequestStats;
  33. __interface IBrowserCaps;
  34. __interface IBrowserCapsSvc;
  35. // ATLS Interface declarations.
  36. // Interface for writing to a stream.
  37. __interface IWriteStream
  38. {
  39. HRESULT WriteStream(LPCSTR szOut, int nLen, DWORD *pdwWritten);
  40. HRESULT FlushStream();
  41. };
  42. // This is an interface that provides for basic accessor
  43. // functionality for files (see CHttpRequestFile).
  44. __interface __declspec(uuid("84a2e035-d9e5-4e60-a61b-bcd960897056"))
  45. IHttpFile : public IUnknown
  46. {
  47. LPCSTR GetParamName();
  48. LPCSTR GetFileName();
  49. LPCSTR GetFullFileName();
  50. LPCSTR GetContentType();
  51. LPCSTR GetTempFileName();
  52. ULONGLONG GetFileSize();
  53. };
  54. // This interface encapsulates the capabilities of the web server and provides information about
  55. // the current request being handled. See CServerContext for implementation.
  56. __interface ATL_NO_VTABLE __declspec(uuid("813F3F00-3881-11d3-977B-00C04F8EE25E"))
  57. IHttpServerContext : public IUnknown
  58. {
  59. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv);
  60. ULONG STDMETHODCALLTYPE AddRef();
  61. ULONG STDMETHODCALLTYPE Release();
  62. LPCSTR GetRequestMethod();
  63. LPCSTR GetQueryString();
  64. LPCSTR GetPathInfo();
  65. LPCSTR GetPathTranslated();
  66. LPCSTR GetScriptPathTranslated();
  67. DWORD GetTotalBytes();
  68. DWORD GetAvailableBytes();
  69. BYTE *GetAvailableData();
  70. LPCSTR GetContentType();
  71. BOOL GetServerVariable(LPCSTR pszVariableName,
  72. LPSTR pvBuffer, DWORD *pdwSize);
  73. BOOL GetImpersonationToken(HANDLE * pToken);
  74. BOOL WriteClient(void *pvBuffer, DWORD *pdwBytes);
  75. BOOL AsyncWriteClient(void *pvBuffer, DWORD *pdwBytes);
  76. BOOL ReadClient(void *pvBuffer, DWORD *pdwSize);
  77. BOOL AsyncReadClient(void *pvBuffer, DWORD *pdwSize);
  78. BOOL SendRedirectResponse(LPCSTR pszRedirectUrl);
  79. BOOL SendResponseHeader(LPCSTR pszHeader, LPCSTR pszStatusCode,
  80. BOOL fKeepConn);
  81. BOOL DoneWithSession(DWORD dwHttpStatusCode);
  82. BOOL RequestIOCompletion(PFN_HSE_IO_COMPLETION pfn, DWORD *pdwContext);
  83. BOOL TransmitFile(HANDLE hFile, PFN_HSE_IO_COMPLETION pfn, void *pContext,
  84. LPCSTR szStatusCode, DWORD dwBytesToWrite, DWORD dwOffset,
  85. void *pvHead, DWORD dwHeadLen, void *pvTail,
  86. DWORD dwTailLen, DWORD dwFlags);
  87. BOOL AppendToLog(LPCSTR szMessage, DWORD* pdwLen);
  88. BOOL MapUrlToPathEx(LPCSTR szLogicalPath, DWORD dwLen, HSE_URL_MAPEX_INFO *pumInfo);
  89. };
  90. // This interface is designed to allow one map to chain to another map.
  91. // The interface is implemented by the CHttpThunkMap and CHttpRequest classes.
  92. // Pointers to this interface are passed around by CRequestHandlerT and CHtmlTagReplacer.
  93. // dwType - the type of item being requested
  94. __interface ATL_NO_VTABLE __declspec(uuid("A5990B44-FF74-4bfe-B66D-F9E7E9F42D42"))
  95. IHttpRequestLookup : public IUnknown
  96. //interface IHttpRequestLookup
  97. {
  98. POSITION GetFirstQueryParam(LPCSTR *ppszName, LPCSTR *ppszValue) const;
  99. POSITION GetNextQueryParam(POSITION pos, LPCSTR *ppszName, LPCSTR *ppszValue) const;
  100. POSITION GetFirstFormVar(LPCSTR *ppszName, LPCSTR *ppszValue) const;
  101. POSITION GetNextFormVar(POSITION pos, LPCSTR *ppszName, LPCSTR *ppszValue) const;
  102. POSITION GetFirstFile(LPCSTR *ppszName, IHttpFile **ppFile) const;
  103. POSITION GetNextFile(POSITION pos, LPCSTR *ppszName, IHttpFile **ppFile) const;
  104. HRESULT GetServerContext(IHttpServerContext **ppOut);
  105. };
  106. __interface ATL_NO_VTABLE __declspec(uuid("D57F8D0C-751A-4223-92BC-0B29F65D2453"))
  107. IRequestHandler : public IUnknown
  108. {
  109. HTTP_CODE GetFlags(DWORD *pdwStatus);
  110. HTTP_CODE InitializeHandler(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider);
  111. HTTP_CODE InitializeChild(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider, IHttpRequestLookup *pLookup);
  112. HTTP_CODE HandleRequest(AtlServerRequest *pRequestInfo, IServiceProvider *pProvider);
  113. void UninitializeHandler();
  114. };
  115. // This interface defines the methods necessary for server response file processing.
  116. __interface ATL_NO_VTABLE __declspec(uuid("8FF5E90C-8CE0-43aa-96C4-3BF930837512"))
  117. ITagReplacer : public IUnknown
  118. {
  119. public:
  120. HTTP_CODE FindReplacementOffset(LPCSTR szMethodName, DWORD *pdwMethodOffset,
  121. LPCSTR szObjectName, DWORD *pdwObjOffset, DWORD *pdwMap, void **ppvParam, IAtlMemMgr *pMemMgr);
  122. HTTP_CODE RenderReplacement(DWORD dwFnOffset, DWORD dwObjOffset, DWORD dwMap, void *pvParam);
  123. HRESULT GetContext(REFIID riid, void** ppv);
  124. HTTP_CODE FreeParam(void *pvParam);
  125. IWriteStream *SetStream(IWriteStream *pStream);
  126. };
  127. __interface __declspec(uuid("79DD4A27-D820-4fa6-954D-E1DFC2C05978"))
  128. IIsapiExtension : public IUnknown
  129. {
  130. public:
  131. BOOL DispatchStencilCall(AtlServerRequest *pRequestInfo);
  132. void RequestComplete(AtlServerRequest *pRequestInfo, DWORD hStatus, DWORD dwSubStatus);
  133. BOOL OnThreadAttach();
  134. void OnThreadTerminate();
  135. BOOL QueueRequest(AtlServerRequest *pRequestInfo);
  136. CIsapiWorker *GetThreadWorker();
  137. BOOL SetThreadWorker(CIsapiWorker *pWorker);
  138. HTTP_CODE LoadRequestHandler(LPCSTR szDllPath, LPCSTR szHandlerName, IHttpServerContext *pServerContext,
  139. HINSTANCE *phInstance, IRequestHandler **ppHandler);
  140. HRESULT AddService(REFGUID guidService, REFIID riid, IUnknown *punk, HINSTANCE hInstance);
  141. HRESULT RemoveService(REFGUID guidService, REFIID riid);
  142. HTTP_CODE LoadDispatchFile(LPCSTR szFileName, AtlServerRequest *pRequestInfo);
  143. AtlServerRequest* CreateRequest();
  144. void FreeRequest(AtlServerRequest* pRequest);
  145. HTTP_CODE TransferRequest(
  146. AtlServerRequest *pRequest,
  147. IServiceProvider *pServiceProvider,
  148. IWriteStream *pWriteStream,
  149. IHttpRequestLookup *pLookup,
  150. LPCSTR szNewUrl,
  151. WORD nCodePage,
  152. bool bContinueAfterProcess = false,
  153. void *pState = NULL
  154. );
  155. };
  156. // This interface controls the cacheability of the current page
  157. __interface ATL_NO_VTABLE __declspec(uuid("9868BFC0-D44D-4154-931C-D186EC0C45D5"))
  158. IPageCacheControl : public IUnknown
  159. {
  160. HRESULT GetExpiration(FILETIME *pftExpiration);
  161. HRESULT SetExpiration(FILETIME ftExpiration);
  162. BOOL IsCached();
  163. BOOL Cache(BOOL bCache);
  164. };
  165. __interface ATL_NO_VTABLE __declspec(uuid("2B75C68D-0DDF-48d6-B58A-CC7C2387A6F2"))
  166. IRequestStats : public IUnknown
  167. {
  168. long GetTotalRequests();
  169. long GetFailedRequests();
  170. long GetAvgResponseTime();
  171. long GetCurrWaiting();
  172. long GetMaxWaiting();
  173. long GetActiveThreads();
  174. };
  175. __interface __declspec(uuid("3339FCE2-99BC-4985-A702-4ABC8304A995"))
  176. IBrowserCaps : public IUnknown
  177. {
  178. public:
  179. HRESULT GetPropertyString(BSTR bstrProperty, BSTR * pbstrOut);
  180. HRESULT GetBooleanPropertyValue(BSTR bstrProperty, BOOL* pbOut);
  181. HRESULT GetBrowserName(BSTR * pbstrName);
  182. HRESULT GetPlatform(BSTR * pbstrPlatform);
  183. HRESULT GetVersion(BSTR * pbstrVersion);
  184. HRESULT GetMajorVer(BSTR * pbstrMajorVer);
  185. HRESULT GetMinorVer(BSTR * pbstrMinorVer);
  186. HRESULT SupportsFrames(BOOL* pbFrames);
  187. HRESULT SupportsTables(BOOL* pbTables);
  188. HRESULT SupportsCookies(BOOL* pbCookies);
  189. HRESULT SupportsBackgroundSounds(BOOL* pbBackgroundSounds);
  190. HRESULT SupportsVBScript(BOOL* pbVBScript);
  191. HRESULT SupportsJavaScript(BOOL* pbJavaScript);
  192. HRESULT SupportsJavaApplets(BOOL* pbJavaApplets);
  193. HRESULT SupportsActiveXControls(BOOL* pbActiveXControls);
  194. HRESULT SupportsCDF(BOOL* pbCDF);
  195. HRESULT SupportsAuthenticodeUpdate(BOOL* pbAuthenticodeUpdate);
  196. HRESULT IsBeta(BOOL* pbIsBeta);
  197. HRESULT IsCrawler(BOOL* pbIsCrawler);
  198. HRESULT IsAOL(BOOL* pbIsAOL);
  199. HRESULT IsWin16(BOOL* pbIsWin16);
  200. HRESULT IsAK(BOOL* pbIsAK);
  201. HRESULT IsSK(BOOL* pbIsSK);
  202. HRESULT IsUpdate(BOOL* pbIsUpdate);
  203. };
  204. __interface __declspec(uuid("391E7418-863B-430e-81BB-1312ED2FF3E9"))
  205. IBrowserCapsSvc : public IUnknown
  206. {
  207. public:
  208. HRESULT GetCaps(IHttpServerContext * pContext, IBrowserCaps ** ppOut);
  209. HRESULT GetCapsUserAgent(BSTR bstrAgent, IBrowserCaps ** ppOut);
  210. };
  211. __interface __declspec(uuid("B1F64757-6E88-4fa2-8886-7848B0D7E660"))
  212. IThreadPoolConfig : public IUnknown
  213. {
  214. HRESULT STDMETHODCALLTYPE SetSize(int nNumThreads);
  215. HRESULT STDMETHODCALLTYPE GetSize(int *pnNumThreads);
  216. HRESULT STDMETHODCALLTYPE SetTimeout(DWORD dwMaxWait);
  217. HRESULT STDMETHODCALLTYPE GetTimeout(DWORD *pdwMaxWait);
  218. };
  219. typedef DWORD_PTR HSESSIONENUM;
  220. __interface ATL_NO_VTABLE __declspec(uuid("DEB69BE3-7AC9-4a13-9519-266C1EA3AB39"))
  221. ISession : public IUnknown
  222. {
  223. STDMETHOD(SetVariable)(LPCSTR szName, VARIANT NewVal);
  224. STDMETHOD(GetVariable)(LPCSTR szName, VARIANT *pVal);
  225. STDMETHOD(GetCount)(long *pnCount);
  226. STDMETHOD(RemoveVariable)(LPCSTR szName);
  227. STDMETHOD(RemoveAllVariables)();
  228. STDMETHOD(BeginVariableEnum)(HSESSIONENUM *phEnumHandle, POSITION *pPOS);
  229. STDMETHOD(GetNextVariable)(HSESSIONENUM hEnum, POSITION *pPOS, LPSTR szName, DWORD dwLen, VARIANT *pVal);
  230. STDMETHOD(CloseEnum)(HSESSIONENUM hEnumHandle);
  231. STDMETHOD(IsExpired)();
  232. STDMETHOD(SetTimeout)(unsigned __int64 dwNewTimeout);
  233. }; //ISession
  234. __interface ATL_NO_VTABLE __declspec(uuid("C5740C4F-0C6D-4b43-92C4-2AF778F35DDE"))
  235. ISessionStateService : public IUnknown
  236. {
  237. STDMETHOD(CreateNewSession)(LPSTR szNewID, DWORD *pdwSize, ISession** ppSession);
  238. STDMETHOD(GetSession)(LPCSTR szID, ISession **ppSession);
  239. STDMETHOD(CloseSession)(LPCSTR szID);
  240. };
  241. __interface ATL_NO_VTABLE __declspec(uuid("6C7F5F56-6CBD-49ee-9797-4C837D4C527A"))
  242. ISessionStateControl : public IUnknown
  243. {
  244. STDMETHOD(SetSessionTimeout)(unsigned __int64 nTimeout);
  245. STDMETHOD(GetSessionTimeout)(unsigned __int64 *pnTimeout);
  246. STDMETHOD(GetSessionCount)(DWORD *pnSessionCount);
  247. };
  248. //
  249. // IWorkerThreadClient
  250. // Interface to be used with CWorkerThread
  251. __interface IWorkerThreadClient
  252. {
  253. HRESULT Execute(DWORD_PTR dwParam, HANDLE hObject);
  254. HRESULT CloseHandle(HANDLE hHandle);
  255. };
  256. }; // namespace ATL
  257. #endif // __ATLSIFACE_H__