/*===================================================================
Microsoft Denali

Microsoft Confidential.
Copyright 1997 Microsoft Corporation. All Rights Reserved.

Component: IDL

File: wam.idl

===================================================================*/

import "oaidl.idl";
import "ocidl.idl";
import "iwr.idl";

/*------------------------------------------------------------
 *  Statistics Object exchanged between IIS & WAM
 ------------------------------------------------------------*/
typedef struct _WAM_STATISTICS_0 {
    DWORD                  CurrentWamRequests;
    DWORD                  MaxWamRequests;
    DWORD                  TotalWamRequests;
    DWORD                  TimeOfLastClear;
} WAM_STATISTICS_0;

typedef WAM_STATISTICS_0  * PWAM_STATISTICS_0;


typedef [switch_type(unsigned long)] union _WAM_STATISTICS_INFO
{
    [case(0)]
        WAM_STATISTICS_0 WamStats0;
    [default]
        ;
} WAM_STATISTICS_INFO, * LPWAM_STATISTICS_INFO;



	[
	
		uuid(888ADDCF-9993-11D0-A539-00A0C922E798),
	
		helpstring("IWam Interface"),
		pointer_default(unique)
	]
	interface IWam : IUnknown
	{
        // For OOP applications we will pass in the core state
        // on the ProcessRequest call. For IP applications it
        // is NULL
        typedef struct 
        {
            DWORD                                   cbCoreState;
            [size_is(cbCoreState)] unsigned char *  pbCoreState;

            DWORD                                   cbFixedCore;
            [size_is(cbFixedCore)] unsigned char *  pbFixedCore;

            // Temporarily use a separate buffer for the sv data
            DWORD                                   cbServerVarData;
            [size_is(cbServerVarData)]
                unsigned char *                     pbServerVarData;
            
            DWORD                                   cbServerVars;
            [size_is(cbServerVars)] 
                unsigned char *                     pbServerVarCache;
        
        } OOP_CORE_STATE;

		[helpstring("method InitWam")]
		HRESULT InitWam
            (
            [in]    BOOL    fInProcess,         // are we in-proc or out-of-proc?
            [in]    BOOL    fInPool,            // !Isolated
            [in]    BOOL    fEnableTryExcept,   // catch exceptions in ISAPI calls?
            [in]    int     pt,                 // PLATFORM_TYPE - are we running on Win95?
            [out]   DWORD   *pPID               // Returned ProcessId of created process
            );

		[helpstring("method StartShutdown")]
		HRESULT StartShutdown
		    (
		    );

		[helpstring("method UninitWam")]
		HRESULT UninitWam
		    (
		    );

		[helpstring("method ProcessRequest")]
		HRESULT ProcessRequest
            (
            [in]            IWamRequest *       pIWamRequest,
            [in]            DWORD               cbWrcStrings,
            [in, unique]    OOP_CORE_STATE *    pOopCoreState,
            [out]           BOOL *              pfHandled
            );

		[helpstring("method ProcessAsyncIO")]
		HRESULT ProcessAsyncIO
		    (
#ifdef _WIN64
            [in]    UINT64      pWamExecInfoIn,  // WAM_EXEC_INFO *
#else
            [in]    DWORD_PTR   pWamExecInfoIn,  // WAM_EXEC_INFO *
#endif
            [in]    DWORD       dwStatus,
            [in]    DWORD       cbWritten
            );

		[helpstring("method ProcessAsyncReadOop")]
		HRESULT ProcessAsyncReadOop
		    (
#ifdef _WIN64
            [in]                    UINT64          pWamExecInfoIn,  // WAM_EXEC_INFO *
#else
            [in]                    DWORD_PTR       pWamExecInfoIn,  // WAM_EXEC_INFO *
#endif
            [in]                    DWORD           dwStatus,
            [in]                    DWORD           cbRead,
            [in, size_is(cbRead)]   unsigned char * lpDataRead
            );

        [helpstring("get statistics")]
        HRESULT GetStatistics
            (
            [in]                    DWORD     Level,
            [out, switch_is(Level)] LPWAM_STATISTICS_INFO pWamStatsInfo
            );

	};
[
	uuid(888ADDC0-9993-11D0-A539-00A0C922E798),
	version(1.0),
	helpstring("Wam 1.0 Type Library")
]
library WAMLib
{
	importlib("stdole2.tlb");

	[
		uuid(888ADDD0-9993-11D0-A539-00A0C922E798),
		helpstring("Wam object class")
	]
	coclass Wam
	{
		[default] interface IWam;
	};
};


