/*===================================================================
Microsoft K2

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

Component: IDL

File: IWR.idl  - Interface for Wam Request

===================================================================*/
import "basetsd.idl";
import "oaidl.idl";
import "ocidl.idl";

[

        uuid(888ADDDD-9993-11D0-A539-00A0C922E798),

        helpstring("IWamRequest Interface"),
        pointer_default(unique)

]
interface IWamRequest : IUnknown
{

    typedef struct {
        DWORD                               cbBuffer;
        [size_is(cbBuffer)] unsigned char * pbBuffer;
    } OOP_RESPONSE_BUFFER;

    typedef struct {
        DWORD                                       cBuffers;
        [size_is(cBuffers)] OOP_RESPONSE_BUFFER *   rgBuffers;
    } OOP_RESPONSE_INFO;

    [helpstring("method PrepCleanupWamRequest")]
    HRESULT PrepCleanupWamRequest(
        [in, size_is(cbLogData)]    unsigned char *  szLogData
        , [in]                      DWORD   cbLogData
        , [in]                      DWORD   dwHttpStatusCode
        , [in]                      DWORD dwIsaKeepConn
        );

    [helpstring("method CleanupWamRequest")]
    HRESULT CleanupWamRequest
        (
        [in, size_is(cbLogData)]    unsigned char *  szLogData
        , [in]                      DWORD   cbLogData
        , [in]                      DWORD   dwHttpStatusCode
        , [in]                      DWORD dwIsaKeepConn
        );


    [helpstring("method GetCoreState")]
    HRESULT GetCoreState
        (
        [in]                            DWORD           cbWrcData,
        [in, out, size_is(cbWrcData)]   unsigned char * pbWrcData,
        [in]                            DWORD           cbWRCF,
        [in, out, size_is(cbWRCF)]      unsigned char * pbWRCF
        );

    // NOTE not supported oop - by design
    [helpstring("method QueryEntityBody")]
    HRESULT QueryEntityBody
        (
        unsigned char ** ppbEntityBody
        );

    [helpstring("method SetKeepConn")]
        HRESULT SetKeepConn
            (
        [in] int  fKeepConn
        );

        [helpstring("method IsKeepConnSet")]
        HRESULT IsKeepConnSet
            (
            BOOL *  pfKeepConn
            );

    [helpstring("method SendURLRedirectResponse")]
    HRESULT SendURLRedirectResponse
        (
        [in, string]    unsigned char * pData
        );

    [helpstring("method GetInfoForName")]
    HRESULT GetInfoForName
        (
        [in, string]                    const unsigned char *   szVarName,
        [in, out, unique, size_is(cchBuffer)] unsigned char *      pchBuffer,
        [in]                            DWORD                   cchBuffer,
        [out]                           DWORD *                 pcchRequired
        );

        [helpstring("method AppendLogParameter")]
        HRESULT AppendLogParameter
            (
        [in, string]    unsigned char * pszParam
        );

    [helpstring("method LookupVirtualRoot")]
    HRESULT LookupVirtualRoot
        (
        [in, out, unique, size_is(cchBuffer)]   unsigned char * pchBuffer,
        [in]                            DWORD           cchBuffer,
        [out]                           DWORD *         pcchRequired
        );

    [helpstring("method LookupVirtualRootEx")]
    HRESULT LookupVirtualRootEx
        (
        [in, string]                unsigned char * szURL,
        [in, out, unique, size_is(cchBuffer)]   unsigned char * pchBuffer,
        [in]                        DWORD           cchBuffer,
        [out]                       DWORD *         pcchRequired,
        [out]                       DWORD *         pcchMatchingPath,
        [out]                       DWORD *         pcchMatchingURL,
        [out]                       DWORD *         pdwFlags
        );
        
    [helpstring("method GetVirtualPathToken")]
    HRESULT GetVirtualPathToken
        (
        [in, string]                unsigned char * szURL,
#ifdef _WIN64
        [out]                       UINT64 *         phToken
#else
        [out]                       ULONG_PTR *      phToken
#endif
        );

    // NOTE not supported oop - by design
        [helpstring("method GetPrivatePtr")]
        HRESULT GetPrivatePtr
        (
        [in]    DWORD               dwHSERequest,
        [out]   unsigned char **    ppData
        );

        // not supported oop - by design
        [helpstring("method AsyncReadClientExt")]
        HRESULT AsyncReadClientExt
        (
#ifdef _WIN64
        [in]                            UINT64    pWamExecInfo
#else
        [in]                            ULONG_PTR pWamExecInfo
#endif
        , [out, size_is(nBytesToRead)]  unsigned char * lpBuffer
        , [in]                          DWORD   nBytesToRead
        );

        [helpstring("method AsyncReadClientOop")]
        HRESULT AsyncReadClientOop
        (
#ifdef _WIN64
          [in]                          UINT64    pWamExecInfo
#else
          [in]                          ULONG_PTR pWamExecInfo
#endif
        , [in]                          DWORD   nBytesToRead
        );

        [helpstring("method AsyncWriteClient")]
        HRESULT AsyncWriteClient
        (
#ifdef _WIN64
        [in]                            UINT64    pWamExecInfo, // WAM_EXEC_INFO *
#else
        [in]                            ULONG_PTR pWamExecInfo, // WAM_EXEC_INFO *
#endif
        [in, size_is( nBytesToWrite )]  unsigned char * lpBuffer,
        [in]                            DWORD   nBytesToWrite,
        [in]                            DWORD   dwFlags
        );

        [helpstring("method SyncReadClient")]
        HRESULT SyncReadClient
        (
        [out, size_is(nBytesToRead)]    unsigned char * lpBuffer,
        [in]                            DWORD   nBytesToRead,
        [out]                           DWORD * pnBytesRead
        );

        [helpstring("method SyncWriteClient")]
        HRESULT SyncWriteClient
        (
        [in]                            DWORD   nBytesToWrite,
        [in, size_is( nBytesToWrite )]  unsigned char * lpBuffer,
        [out]                           DWORD * pnBytesWritten,
        [in]                            DWORD dwFlags
        );

    // NOTE not supported oop - by design
    [helpstring("method TransmitFileInProc")]
        HRESULT TransmitFileInProc(
#ifdef _WIN64
        [in]    UINT64           pWamExecInfo
#else
        [in]    ULONG_PTR        pWamExecInfo
#endif
        , [in]  unsigned char * pHseTfIn
    );

    [helpstring("method TransmitFileOutProc")]
        HRESULT TransmitFileOutProc(
#ifdef _WIN64
        [in]                            UINT64              pWamExecInfo
        , [in]                          UINT64              hFile
#else
        [in]                            ULONG_PTR           pWamExecInfo
        , [in]                          ULONG_PTR           hFile
#endif
        , [in, unique, size_is(cbStatusCode)] unsigned char * pszStatusCode
        , [in]                          DWORD              cbStatusCode
        , [in]                          DWORD              BytesToWrite
        , [in]                          DWORD              Offset
        , [in, unique, size_is(HeadLength)] unsigned char *   pHead
        , [in]                          DWORD              HeadLength
        , [in, unique, size_is(TailLength)] unsigned char *   pTail
        , [in]                          DWORD              TailLength
        , [in]                          DWORD              dwFlags
    );

        [helpstring("method SendHeader")]
        HRESULT SendHeader(
        [in, unique, size_is(cchStatus)]   unsigned char * szStatus
        , [in] DWORD                    cchStatus
        , [in,  unique, size_is(cchHeader)] unsigned char * szHeader
        , [in] DWORD                    cchHeader
        , [in] DWORD                    dwIsaKeepConn
        );

    // NOTE breaks oop - by design
        [helpstring("method SendEntireResponse")]
        HRESULT SendEntireResponse(
        unsigned char * pvHseResponseInfo   // HSE_SEND_ENTIRE_RESPONSE_INFO *
        );

        [helpstring("method SendEntireResponseAndCleanup")]
        HRESULT SendEntireResponseAndCleanup(
          [in, unique, size_is(cbStatus)]   unsigned char * szStatus
        , [in]                              DWORD           cbStatus
        , [in, unique, size_is(cbHeader)]   unsigned char * szHeader
        , [in]                              DWORD           cbHeader
        , [in, unique] OOP_RESPONSE_INFO *                  pOopResponseInfo
        , [in, unique, size_is(cbLogData)]  unsigned char * szLogData
        , [in]                              DWORD           cbLogData
        , [in]                              DWORD           dwIsaKeepConn
        , [out]                             BOOL *          pfDisconnected
        );

        [helpstring("method SendRedirectMessage")]
        HRESULT SendRedirectMessage
        (
        [in, string]    unsigned char * szRedirect
        );

    // NOTE breaks oop - by design
        [helpstring("method GetSslCtxt")]
        HRESULT GetSslCtxt
        (
        DWORD           cbCtxtHandle,
        unsigned char * pbCtxtHandle    // PBYTE   pbCtxtHandle
        );

        [helpstring("method GetClientCertInfoEx")]
        HRESULT GetClientCertInfoEx
        (
        [in]                        DWORD           cbAllocated,
        [out]                       DWORD *         pdwCertEncodingType,
        [out, size_is(cbAllocated)] unsigned char * pbCertEncoded,
        [out]                       DWORD *         pcbCertEncoded,
        [out]                       DWORD *         pdwCertificateFlags
        );

    // NOTE breaks oop - by design
        [helpstring("method GetSspiInfo")]
        HRESULT GetSspiInfo
        (
        DWORD  cbCtxtHandle,
        unsigned char * pbCtxtHandle,   // PBYTE   pbCtxtHandle
        DWORD  cbCredHandle,
        unsigned char * pbCredHandle    // PBYTE   pbCredHandle
        );

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

        [helpstring("method SSIncExec")]
        HRESULT SSIncExec
        (
        [in, string]    unsigned char * szCommand,
        [in]            DWORD           dwExecFlags,
        [in, string]    unsigned char * pszVerb
        );

        [helpstring("method GetAspMDAllData")]
        HRESULT GetAspMDAllData(
        [in, string]    unsigned char * pszMDPath
        , [in]  DWORD   dwMDUserType
        , [in]  DWORD   dwDefaultBufferSize
        , [in, out, unique, size_is(dwDefaultBufferSize)]   unsigned char * pBuffer
        , [out] DWORD * pdwRequiredBufferSize
        , [out] DWORD * pdwNumDataEntries
    );

        [helpstring("method GetAspMDData")]
        HRESULT GetAspMDData(
        [in, string]    unsigned char * pszMDPath
        , [in]    DWORD dwMDIdentifier
        , [in]    DWORD dwMDAttributes
        , [in]    DWORD dwMDUserType
        , [in]    DWORD dwMDDataType
        , [in]    DWORD dwMDDataLen
        , [in]    DWORD dwMDDataTag
        , [in, out, unique, size_is(dwMDDataLen)]   unsigned char * pbMDData
        , [out]   DWORD * pdwRequiredBufferSize
    );

    [helpstring("method GetCustomError")]
        HRESULT GetCustomError(
        [in]    DWORD dwError,
        [in]    DWORD dwSubError,
        [in]    DWORD dwBufferSize,
        [in, out, unique, size_is(dwBufferSize)] unsigned char *pbBuffer,
        [out]   DWORD *pdwRequiredBufferSize,
        [out]   BOOL  *pfIsFileError
    );

    [helpstring("method TestConnection")]
        HRESULT TestConnection(
        [out]   BOOL  *pfIsConnected
    );

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

    [helpstring("method LogEvent")]
    HRESULT LogEvent(
        [in]            DWORD dwEventId,
        [in, string]    unsigned char *szText
    );

    [helpstring("method ExtensionTrigger")]
        HRESULT ExtensionTrigger(
        [in]    unsigned char * pvContext,
        [in]    DWORD dwTriggerType
    );

    HRESULT DbgRefCount( );

};













