//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//+---------------------------------------------------------------------------
//
//  Microsoft Windows
//
//  File:       U P N P H O S T . I D L
//
//  Contents:   Objects and interfaces for hosting UPnP Devices
//
//----------------------------------------------------------------------------


#ifndef DO_NO_IMPORTS
import "oaidl.idl";
#endif

// Reserved GUIDS for our use
//
// 204810b3-73b2-11d4-bf42-00b0d0118b56   LIBID_UPnPHostLib
// 204810b4-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPEventSink
// 204810b5-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPEventSource
// 204810b6-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPRegistrar
// 204810b7-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPReregistrar
// 204810b8-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPDeviceProvider
// 204810b9-73b2-11d4-bf42-00b0d0118b56   CLSID_UPnPRegistrar
// 204810ba-73b2-11d4-bf42-00b0d0118b56   IID_IUPnPDeviceControl
// 204810bb-73b2-11d4-bf42-00b0d0118b56
// 204810bc-73b2-11d4-bf42-00b0d0118b56
// 204810bd-73b2-11d4-bf42-00b0d0118b56
// 204810be-73b2-11d4-bf42-00b0d0118b56
// 204810bf-73b2-11d4-bf42-00b0d0118b56
// 204810c0-73b2-11d4-bf42-00b0d0118b56
// 204810c1-73b2-11d4-bf42-00b0d0118b56
// 204810c2-73b2-11d4-bf42-00b0d0118b56
// 204810c3-73b2-11d4-bf42-00b0d0118b56
// 204810c4-73b2-11d4-bf42-00b0d0118b56
// 204810c5-73b2-11d4-bf42-00b0d0118b56
// 204810c6-73b2-11d4-bf42-00b0d0118b56
// 204810c7-73b2-11d4-bf42-00b0d0118b56
// 204810c8-73b2-11d4-bf42-00b0d0118b56
// 204810c9-73b2-11d4-bf42-00b0d0118b56
// 204810ca-73b2-11d4-bf42-00b0d0118b56
// 204810cb-73b2-11d4-bf42-00b0d0118b56
// 204810cc-73b2-11d4-bf42-00b0d0118b56
// 204810cd-73b2-11d4-bf42-00b0d0118b56
// ....
// 20481499-73b2-11d4-bf42-00b0d0118b56
// 2048149a-73b2-11d4-bf42-00b0d0118b56

/////////////////////////////////////
// Interface forward declarations

interface IUPnPEventSink;
interface IUPnPEventSource;
interface IUPnPRegistrar;
interface IUPnPReregistrar;
interface IUPnPDeviceControl;
interface IUPnPDeviceProvider;

////////////////////////////////////
// Error definitions
cpp_quote("#define UPNP_E_REQUIRED_ELEMENT_ERROR        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA020)")
cpp_quote("#define UPNP_E_DUPLICATE_NOT_ALLOWED         MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA021)")
cpp_quote("#define UPNP_E_DUPLICATE_SERVICE_ID          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA022)")
cpp_quote("#define UPNP_E_INVALID_DESCRIPTION           MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA023)")
cpp_quote("#define UPNP_E_INVALID_SERVICE               MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA024)")
cpp_quote("#define UPNP_E_INVALID_ICON                  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA025)")
cpp_quote("#define UPNP_E_INVALID_XML                   MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA026)")
cpp_quote("#define UPNP_E_INVALID_ROOT_NAMESPACE        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA027)")
cpp_quote("#define UPNP_E_SUFFIX_TOO_LONG               MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA028)")
cpp_quote("#define UPNP_E_URLBASE_PRESENT               MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA029)")
cpp_quote("#define UPNP_E_VALUE_TOO_LONG                MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA030)")

////////////////////////////////////
// Interface definitions

[
    uuid(204810b4-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique)
]
interface IUPnPEventSink: IUnknown
{
    [helpstring("method OnStateChanged"), hidden]
    HRESULT OnStateChanged(
        [in] DWORD cChanges,
        [in, size_is(cChanges)] DISPID rgdispidChanges[]);

    [helpstring("method OnStateChangedSafe")]
    HRESULT OnStateChangedSafe(
        [in] VARIANT varsadispidChanges);
}

[
    uuid(204810b5-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique)
]
interface IUPnPEventSource: IUnknown
{
    [helpstring("method Advise")]
    HRESULT Advise(
        [in] IUPnPEventSink * pesSubscriber);

    [helpstring("method Unadvise")]
    HRESULT Unadvise(
        [in] IUPnPEventSink * pesSubscriber);
}

[
    uuid(204810b6-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique)
]
interface IUPnPRegistrar : IUnknown
{
    HRESULT RegisterDevice(
        [in] BSTR     bstrXMLDesc,
        [in] BSTR     bstrProgIDDeviceControlClass,
        [in] BSTR     bstrInitString,
        [in] BSTR     bstrContainerId,
        [in] BSTR     bstrResourcePath,
        [in] long     nLifeTime,
        [out, retval] BSTR * pbstrDeviceIdentifier);
    HRESULT RegisterRunningDevice(
        [in] BSTR     bstrXMLDesc,
        [in] IUnknown * punkDeviceControl,
        [in] BSTR     bstrInitString,
        [in] BSTR     bstrResourcePath,
        [in] long     nLifeTime,
        [out, retval] BSTR * pbstrDeviceIdentifier);
    HRESULT RegisterDeviceProvider(
        [in] BSTR     bstrProviderName,
        [in] BSTR     bstrProgIDProviderClass,
        [in] BSTR     bstrInitString,
        [in] BSTR     bstrContainerId);
    HRESULT GetUniqueDeviceName(
        [in]          BSTR   bstrDeviceIdentifier,
        [in]          BSTR   bstrTemplateUDN,
        [out, retval] BSTR * pbstrUDN);
    HRESULT UnregisterDevice(
        [in] BSTR     bstrDeviceIdentifier,
        [in] BOOL     fPermanent);
    HRESULT UnregisterDeviceProvider(
        [in] BSTR     bstrProviderName);
}

[
    uuid(204810b7-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique)
]
interface IUPnPReregistrar : IUnknown
{
    HRESULT ReregisterDevice(
        [in] BSTR     bstrDeviceIdentifier,
        [in] BSTR     bstrXMLDesc,
        [in] BSTR     bstrProgIDDeviceControlClass,
        [in] BSTR     bstrInitString,
        [in] BSTR     bstrContainerId,
        [in] BSTR     bstrResourcePath,
        [in] long     nLifeTime);
    HRESULT ReregisterRunningDevice(
        [in] BSTR     bstrDeviceIdentifier,
        [in] BSTR     bstrXMLDesc,
        [in] IUnknown * punkDeviceControl,
        [in] BSTR     bstrInitString,
        [in] BSTR     bstrResourcePath,
        [in] long     nLifeTime);
}

[
    uuid(204810ba-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique),
]
interface IUPnPDeviceControl : IUnknown
{
   HRESULT Initialize(
       [in] BSTR     bstrXMLDesc,
       [in] BSTR     bstrDeviceIdentifier,
       [in] BSTR     bstrInitString);
   HRESULT GetServiceObject(
       [in]          BSTR     bstrUDN,
       [in]          BSTR     bstrServiceId,
       [out, retval] IDispatch ** ppdispService);
}

[
    uuid(204810b8-73b2-11d4-bf42-00b0d0118b56),
    pointer_default(unique),
]
interface IUPnPDeviceProvider : IUnknown
{
   HRESULT Start([in] BSTR   bstrInitString);
   HRESULT Stop();
}

////////////////////////////////////////
// Type library

#ifndef DO_NO_IMPORTS

[
    uuid(204810b3-73b2-11d4-bf42-00b0d0118b56),
    version(1.0),
    helpstring("UPnP 1.0 Type Library")
]
library UPnPHostLib
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");

    interface IUPnPEventSink;
    interface IUPnPEventSource;
    interface IUPnPRegistrar;
    interface IUPnPReregistrar;
    interface IUPnPDeviceControl;
    interface IUPnPDeviceProvider;

    [
        uuid(204810b9-73b2-11d4-bf42-00b0d0118b56)
    ]
    coclass UPnPRegistrar
    {
        [default] interface IUnknown;
    };
};

#endif // DO_NO_IMPORTS

