//+---------------------------------------------------------------------------
//
//  Copyright 1995 - 1997 Microsoft Corporation. All Rights Reserved.
//
//  Contents:   Conferencing Services Object interfaces
//
//----------------------------------------------------------------------------

cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright 1995-1997 Microsoft Corporation. All Rights Reserved.")
cpp_quote("//")
cpp_quote("//  File: imsconf3.h")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")

import "objidl.idl";
import "oleidl.idl";
import "oaidl.idl";

interface INmManager;
interface INmManagerNotify;
interface INmMember;
interface INmCall;
interface INmCallNotify;
interface INmConference;
interface INmConferenceNotify;
interface INmChannelData;
interface INmChannelDataNotify;
interface IEnumNmMember;


cpp_quote("")
cpp_quote("////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// Constants")
cpp_quote("")


cpp_quote("#define NO_LISTEN_PORT               0")
cpp_quote("#define DEFAULT_LISTEN_PORT          522")

cpp_quote("#define NMMANAGER_SERVICE            0x0001")
cpp_quote("#define NMMANAGER_SERVER             0x0002")
cpp_quote("#define NMMANAGER_CLIENT             0x0004")

cpp_quote("HRESULT WINAPI CreateNmManager(INmManager ** ppMan);")
cpp_quote("")
cpp_quote("////////////////////////////////////////////////////////////////////////////")
cpp_quote("//  Error Codes")
cpp_quote("")
cpp_quote("#define NM_E(e) (0x81000000UL | (ULONG) (e))")
cpp_quote("")
cpp_quote("enum {")

cpp_quote("")
cpp_quote("// Call specific error codes")
cpp_quote("//")
cpp_quote("  NM_CALLERR_NOT_INITIALIZED    = NM_E(0x0100),") // Local system not initialized
cpp_quote("  NM_CALLERR_NAME_RESOLUTION    = NM_E(0x0102),") // Name resolution failed
cpp_quote("  NM_CALLERR_PASSWORD           = NM_E(0x0103),") // Invalid conference password
cpp_quote("  NM_CALLERR_CONFERENCE_NAME    = NM_E(0x0104),") // Problem with the conference name
cpp_quote("  NM_CALLERR_IN_CONFERENCE      = NM_E(0x0105),") // Remote system is in a conference
cpp_quote("  NM_CALLERR_NOT_FOUND          = NM_E(0x0106),") // User/Address not found
cpp_quote("  NM_CALLERR_MCU                = NM_E(0x0107),") // Can't invite MCU into existing conference
cpp_quote("  NM_CALLERR_REJECTED           = NM_E(0x0108),") // Remote system rejected the request
cpp_quote("  NM_CALLERR_INVALID_IPADDRESS		= NM_E(0x01F2),") // Tried ip type with invalid ip address
cpp_quote("  NM_CALLERR_HOST_RESOLUTION_FAILED	= NM_E(0x01F3),") // Tried computer type with unreachable host name
cpp_quote("  NM_CALLERR_NO_ADDRESS				= NM_E(0x01F6),") // No address component
cpp_quote("  NM_CALLERR_INVALID_ADDRESS			= NM_E(0x01F7),") // Invalid address component
cpp_quote("  NM_CALLERR_PARAM_ERROR				= NM_E(0x01FA),") // Error in parameter syntax
cpp_quote("  NM_CALLERR_SECURITY_MISMATCH		= NM_E(0x01FB),") // Desired security didnt match policy or current conference
cpp_quote("  NM_CALLERR_UNESCAPE_ERROR			= NM_E(0x01FC),") // Parse error during unescaping
cpp_quote("  NM_CALLERR_ALREADY_CALLING    = NM_E(0x01FD),") // Already calling this person
cpp_quote("  NM_CALLERR_LOOPBACK           = NM_E(0x01FE),") // Called Local Machine
cpp_quote("  NM_CALLERR_UNKNOWN            = NM_E(0x01FF),") // Unknown call error
cpp_quote("")
cpp_quote("// other error codes")
cpp_quote("//")
cpp_quote("  NM_E_NOT_INITIALIZED          = NM_E(0x0200),") // INmManager not Initialized
cpp_quote("  NM_E_NO_T120_CONFERENCE       = NM_E(0x0202),") // Not in a T.120 data conference
cpp_quote("  NM_E_NOT_ACTIVE               = NM_E(0x0203),") // NetMeeting is not running
cpp_quote("  NM_E_USER_CANCELED_SETUP	   = NM_E(0x0205),") // User canceled NetMeeting setup wizard
cpp_quote("  NM_E_ALREADY_RUNNING		   = NM_E(0x0206),") // This means that NetMeeting is already running
cpp_quote("  NM_E_SHARING_NOT_AVAILABLE	   = NM_E(0x0207),") // This means that NetMeeting is already running



cpp_quote("};")
cpp_quote("")

cpp_quote("")
cpp_quote("// INmChannelDataNotify.DataReceived dwFlags")
cpp_quote("#define NM_DF_BROADCAST               0x00000010") // data was broadcast to everyone
cpp_quote("#define NM_DF_PRIVATE                 0x00000020") // data was private
cpp_quote("#define NM_DF_SEGMENT_END             0x00000040") // end of data block
cpp_quote("#define NM_DF_SEGMENT_BEGIN           0x00000080") // start of data block

cpp_quote("// INmChannelData.SendData dwFlags")
cpp_quote("// NOTE THESE ARE THE MCSSenDataMasks values")
cpp_quote("#define	DATA_TOP_PRIORITY		    0x0001")
cpp_quote("#define	DATA_HIGH_PRIORITY		    0x0002")
cpp_quote("#define	DATA_MEDIUM_PRIORITY        0x0004")
cpp_quote("#define	DATA_LOW_PRIORITY		    0x0008")
cpp_quote("#define	DATA_UNIFORM_SEND   	    0x0010")
cpp_quote("#define	DATA_NORMAL_SEND    	    0x0020")


typedef enum tagNmConferenceState{
    NM_CONFERENCE_IDLE                           = 0,
    NM_CONFERENCE_WAITING                        = 1,
    NM_CONFERENCE_INITIALIZING                   = 2,
    NM_CONFERENCE_ACTIVE                         = 3,
} NM_CONFERENCE_STATE;

typedef enum tagNM_ADDR_TYPE{
    NM_ADDR_IP                                   = 1,
    NM_ADDR_MACHINENAME                          = 2,
} NM_ADDR_TYPE;

typedef enum tagNmCallState{
    NM_CALL_INVALID                              = 0,
    NM_CALL_INIT                                 = 1,
    NM_CALL_RING                                 = 2,
    NM_CALL_SEARCH                               = 3,
    NM_CALL_WAIT                                 = 4,
    NM_CALL_ACCEPTED                             = 5,
    NM_CALL_REJECTED                             = 6,
    NM_CALL_CANCELED                             = 7,
} NM_CALL_STATE;

typedef enum tagNmMemberNotify{
    NM_MEMBER_ADDED                              = 0,
    NM_MEMBER_REMOVED                            = 1,
    NM_MEMBER_UPDATED                            = 2,
} NM_MEMBER_NOTIFY;


typedef enum tagConfn{
// Call control
    CONFN_CALL_IGNORED                           = 0x000403,
    CONFN_CALL_FAILED                            = 0x000404,
    CONFN_CALL_IN_CONFERENCE                     = 0x000405,
} CONFN;


//--------------------------------------------------------------------------
// INmManager Interface
[
    object,
    uuid(0855E276-E230-428e-ACB9-8F2C7CD42848),
    pointer_default(unique)
]
interface INmManager : IUnknown
{
    HRESULT Initialize(
        [in] BSTR       szName,
        [in] DWORD_PTR  pCredentials,
        [in] DWORD      port,
        [in] DWORD      flags);

    HRESULT Call(
        [out] INmCall **ppCall,		// Can be NULL
        [in] DWORD dwFlags,
        [in] NM_ADDR_TYPE addrType,
        [in] BSTR bstrAddr,
        [in] BSTR bstrConference,
        [in] BSTR bstrPassword);

    HRESULT CreateConference(
        [out] INmConference **ppConference,     // Can be NULL
        [in]  BSTR  bstrName,
        [in]  BSTR  bstrPassword,
        [in]  BOOL  fSecure);
}

//--------------------------------------------------------------------------
// INmManagerNotify Interface
[
    object,
    uuid(EC7A4454-9DB5-4f35-BC98-F04376CA984D),
    pointer_default(unique)
]
interface INmManagerNotify : IUnknown
{
    typedef [unique] INmManagerNotify *LPNMMANAGERNOTIFY;

    HRESULT NmUI(
        [in] CONFN uNotify);

    HRESULT ConferenceCreated(
        [in] INmConference *pConference);

    HRESULT CallCreated(
        [in] INmCall *pCall);
}



//--------------------------------------------------------------------------
// INmCall Interface
[
    object,
    uuid(F0E5EE14-8112-4af3-A0D3-94C9F43FABC4),
    pointer_default(unique)
]
interface INmCall : IUnknown
{
    typedef [unique] INmCall *LPNMCALL;

    HRESULT IsIncoming(
        void);

    HRESULT GetState(
        [out] NM_CALL_STATE *pState);

    HRESULT GetAddress(
        [out] BSTR *pbstrAddr);

    HRESULT GetConference(
        [out] INmConference **ppConference);

    HRESULT Accept(
        void);

    HRESULT Reject(
        void);

    HRESULT Cancel(
        void);
}

//--------------------------------------------------------------------------
// INmCallNotify Interface
[
    object,
    uuid(4C04DBFC-E935-411d-87B4-028148B6B60C),
    pointer_default(unique)
]
interface INmCallNotify : IUnknown
{
    HRESULT NmUI(
        [in] CONFN uNotify);

    HRESULT StateChanged(
        [in] NM_CALL_STATE uState);

    HRESULT Failed(
        [in] ULONG uError);

    HRESULT Accepted(
        [in] INmConference *pConference);

    HRESULT CallError(
        [in] UINT cns);

    HRESULT RemoteConference(
        [in] BOOL fMCU,
        [in] BSTR *pwszConfNames,
        [in, out] BSTR *pbstrConfToJoin);

    HRESULT RemotePassword(
        [in] BSTR bstrConference,
        [in, out] BSTR *pbstrPassword,
        [in] BYTE *pb,
        [in] DWORD cb);
}

//--------------------------------------------------------------------------
// INmConference Interface
[
    object,
    uuid(1BFBB75A-FBE3-4e7f-94C4-629A346F31F5),
    pointer_default(unique)
]
interface INmConference : IUnknown
{
    typedef [unique] INmConference *LPNMCONFERENCE;

    HRESULT GetName(
        [out] BSTR *pbstrName);

    HRESULT GetID(
        [out] ULONG *puID);

    HRESULT GetState(
        [out] NM_CONFERENCE_STATE *pState);

    HRESULT GetTopProvider(
        [out] INmMember **ppMember);

    HRESULT EnumMember(
        [out] IEnumNmMember **ppEnum);

    HRESULT GetMemberCount(
        [out] ULONG * puCount);

    HRESULT FindMember(
        [in]  ULONG gccID,
        [out] INmMember ** ppMember);

    HRESULT IsHosting(
        void);

    HRESULT Host(
        void);

    HRESULT Leave(
        void);

    HRESULT LaunchRemote(
        [in] REFGUID rguid,
        [in] INmMember *pMember);

    HRESULT CreateDataChannel(
        [out] INmChannelData **ppChannel,
        [in] REFGUID rguid);
}

//--------------------------------------------------------------------------
// INmConferenceNotify Interface
[
    object,
    uuid(3FA17F19-EB23-419b-85CA-882AA1ACF62D),
    pointer_default(unique)
]
interface INmConferenceNotify : IUnknown
{
    HRESULT NmUI(
        [in] CONFN uNotify);

    HRESULT StateChanged(
        [in] NM_CONFERENCE_STATE uState);

    HRESULT MemberChanged(
        [in] NM_MEMBER_NOTIFY uNotify,
        [in] INmMember *pMember);
}

//--------------------------------------------------------------------------
// INmMember Interface
[
    object,
    uuid(315D16C6-7854-4690-9C71-1358978E70DC),
    pointer_default(unique)
]
interface INmMember : IUnknown
{
    HRESULT GetName(
        [out] BSTR *pbstrName);

    HRESULT GetID(
        [out] ULONG *puID);

    HRESULT GetConference(
        [out] INmConference **ppConference);

    HRESULT IsSelf(
        void);

    HRESULT IsMCU(
        void);

    HRESULT Eject(
        void);
}



cpp_quote("")
cpp_quote("////////////////////////////////////////////////////////////////////////////")
cpp_quote("//  Enumerator Definitions")


//--------------------------------------------------------------------------
// IEnumNmMember Interface
[
    object,
    uuid(F246195B-FF07-4016-BB36-E0DBD4CF62FE),
    pointer_default(unique)
]
interface IEnumNmMember : IUnknown
{
	[local]
    HRESULT Next(
        [in] ULONG cMember,
        [out] INmMember **rgpMember,
        [out] ULONG *pcFetched);

	[call_as(Next)]
    HRESULT RemoteNext(
        [in] ULONG cMember,
        [out, size_is(cMember), length_is(*pcFetched) ] INmMember **rgpMember,
        [out] ULONG *pcFetched,
		[out] ULONG *pcItems,
		[in] BOOL bGetNumberRemaining);

    HRESULT Skip(
        [in] ULONG cMember);

    HRESULT Reset();

    HRESULT Clone(
        [out] IEnumNmMember **ppEnum);
}


//--------------------------------------------------------------------------
// INmChannelData Interface
[
    object,
    uuid(00DA3B21-2C7D-479a-8F43-5D0BF3E552EA),
    pointer_default(unique)
]
interface INmChannelData : IUnknown
{
    HRESULT IsActive(
        void);

    HRESULT SetActive(
        [in] BOOL fActive);

    HRESULT GetConference(
        [out] INmConference **ppConference);

    HRESULT EnumMember(
        [out] IEnumNmMember **ppEnum);

    HRESULT GetMemberCount(
        [out] ULONG * puCount);

    HRESULT GetGuid(
        [out] GUID *pguid);

    HRESULT SendData(
        [in] INmMember *pMember,
        [in] ULONG uSize,
        [in, size_is(uSize)] byte *pvBuffer,
        [in] ULONG uOptions);

    HRESULT RegistryAllocateHandle(
        [in]	ULONG numberOfHandlesRequested);
}


//--------------------------------------------------------------------------
// INmChannelDataNotify Interface
[
    object,
    uuid(BD8CED3B-6953-4375-9252-9F7C87EC2804),
    pointer_default(unique)
]
interface INmChannelDataNotify : IUnknown
{
    HRESULT NmUI(
        [in] CONFN uNotify);

    HRESULT MemberChanged(
        [in] NM_MEMBER_NOTIFY uNotify,
        [in] INmMember *pMember);

    HRESULT DataSent(
        [in] INmMember *pMember,
        [in] ULONG uSize,
        [in, size_is(uSize)] byte *pvBuffer);

    HRESULT DataReceived(
        [in] INmMember *pMember,
        [in] ULONG uSize,
        [in, size_is(uSize)] byte *pvBuffer,
        [in] ULONG dwFlags);

    HRESULT AllocateHandleConfirm(
        [in] ULONG handle_value,
        [in] ULONG chandles);
}

