/*++

Copyright (c) 1995 Microsoft Corporation

Module Name:

    qm2qm.idl

Abstract:


Author:

    Doron Juster (DoronJ) 22-Apr-96

Revision History:
--*/

import "mqtypes.idl";


[
uuid(1088a980-eae5-11d0-8d9b-00a02453c337),
version(1.0),
pointer_default(unique)
]
interface qm2qm
{

typedef [context_handle] void *PCTX_RRSESSION_HANDLE_TYPE;
typedef [context_handle] void *PCTX_REMOTEREAD_HANDLE_TYPE;

typedef enum _REMOTEREADACK {
        RR_UNKNOWN,
        RR_NACK,
        RR_ACK
} REMOTEREADACK ;

typedef struct _REMOTEREADDESC {
    DWORD  hRemoteQueue ;
    DWORD  hCursor ;
    DWORD  ulAction ;
    DWORD  ulTimeout ;
    [range (0, 4325376)] DWORD  dwSize ;  // size of packet.
    DWORD  dwpQueue ;
    DWORD  dwRequestID; // Client request identification.
    DWORD  Reserved;	// MSMQ 1.0/2.0 and Whistler beta1 returns junk. Whistler beta2 and higher returns 0.
    DWORD  dwArriveTime ; // this property (arrival time) is not in packet.
                  //  it's in packetinfo which is not transfered on network.
    REMOTEREADACK eAckNack ;
    [unique, size_is(dwSize), length_is(dwSize)] byte *lpBuffer ;
} REMOTEREADDESC ;


[call_as(R_QMRemoteStartReceive)] HRESULT
R_RemoteQMStartReceive(
    [in] handle_t  hBind,
    [out] PCTX_REMOTEREAD_HANDLE_TYPE *pphContext,
    [in, out] REMOTEREADDESC* lpRemoteReadDesc
    );

[call_as(QMRemoteEndReceive)] HRESULT
RemoteQMEndReceive(
    [in] handle_t  hBind,
    [in, out] PCTX_REMOTEREAD_HANDLE_TYPE *pphContext,
    [in] DWORD dwAck
    );

[call_as(QMRemoteOpenQueue)] HRESULT
RemoteQMOpenQueue(
    [in] handle_t  hBind,
    [out] PCTX_RRSESSION_HANDLE_TYPE *phContext,
    [in] GUID  *pLicGuid,
    [in] DWORD dwMQS,
    [in] DWORD hQueue,
    [in] DWORD pQueue,
    [in] DWORD dwpContext
    );

[call_as(QMRemoteCloseQueue)] HRESULT
RemoteQMCloseQueue(
    [in] handle_t  hBind,
    [in, out] PCTX_RRSESSION_HANDLE_TYPE *pphContext
    );

[call_as(QMRemoteCloseCursor)] HRESULT
RemoteQMCloseCursor(
    [in] handle_t hBind,
    [in] DWORD hQueue, //hQueue is unused in this RPC
    [in] DWORD hCursor
    );

[call_as(QMRemoteCancelReceive)] HRESULT
RemoteQMCancelReceive(
    [in] handle_t  hBind,
    [in] DWORD hQueue,
    [in] DWORD pQueue,
    [in] DWORD Tag
    );

[call_as(QMRemotePurgeQueue)] HRESULT
RemoteQMPurgeQueue(
    [in] handle_t hBind,
    [in] DWORD hQueue
    );

[call_as(QMGetRemoteQMServerPort)] DWORD
RemoteQMGetQMQMServerPort( [in] handle_t hBind,
                           [in] DWORD    dwPortType ) ;


//
// The section below was added in MSMQ 3.0 (Whistler)
//

typedef struct _REMOTEREADDESC2 {
    REMOTEREADDESC * pRemoteReadDesc;
    ULONGLONG        SequentialId;
} REMOTEREADDESC2;

[call_as(R_QMRemoteGetVersion)] void
R_RemoteQmGetVersion(
    [in] handle_t  hBind,
    [out] UCHAR *  pMajor,
    [out] UCHAR *  pMinor,
    [out] USHORT * pBuildNumber
    );

[call_as(R_QMRemoteStartReceive2)] HRESULT
R_RemoteQMStartReceive2(
    [in] handle_t  hBind,
    [out] PCTX_REMOTEREAD_HANDLE_TYPE *pphContext,
    [in, out] REMOTEREADDESC2* lpRemoteReadDesc2
    );

[call_as(R_QMRemoteStartReceiveByLookupId)] HRESULT
R_RemoteQMStartReceiveByLookupId(
    [in] handle_t  hBind,
	[in] ULONGLONG LookupId,
    [out] PCTX_REMOTEREAD_HANDLE_TYPE *pphContext,
    [in, out] REMOTEREADDESC2* lpRemoteReadDesc2
    );

}

