//
// Copyright (c) Microsoft Corporation. All rights reserved.

cpp_quote("/* Copyright (c) Microsoft Corporation. All rights reserved.*/")

// mdhcp.idl : IDL source for mdhcp.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (mdhcp.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
import "tapi3if.idl";

/////////////////////////////////////////////////////////////////

//
// This interface wraps the MCAST_SCOPE_INFO structure
//
// it is read only, and only obtained from
// enumeratescopes methods in the
// IMcastAddressAllocation interface.
//

[
    object,
    uuid(DF0DAEF4-A289-11D1-8697-006008B0E5D2),
    dual,
    helpstring("IMcastScope Interface"),
    pointer_default(unique)
]

interface IMcastScope : IDispatch
{
    [propget, id(1), helpstring("Get the scope ID for this scope.")]
    HRESULT ScopeID(
        [out, retval] long *pID
        );

    [propget, id(2), helpstring("Get the server ID for this scope.")]
    HRESULT ServerID(
        [out, retval] long *pID
        );

    [propget, id(3), helpstring("Get the interface ID for this scope.")]
    HRESULT InterfaceID(
        [out, retval] long *pID
        );

    [propget, id(4), helpstring("Get a textual description of this scope.")]
    HRESULT ScopeDescription(
        [out, retval] BSTR *ppDescription
        );

    [propget, id(5), helpstring("Get the TTL for leases in this scope.")]
    HRESULT TTL(
        [out, retval] long *pTTL
        );
}


//
// this interface wraps the MCAST_LEASE_REQUEST and/or MCAST_LEASE_RESPONSE
// structures
//
// It's read-write. Most properties can only be
// set from the client when the object
// is created, except the start and stop times, which can be
// set later for convenience when doing renewals.
//

[
    object,
    uuid(DF0DAEFD-A289-11D1-8697-006008B0E5D2),
    dual,
    helpstring("IMcastLeaseInfo Interface"),
    pointer_default(unique)
]

interface IMcastLeaseInfo : IDispatch
{
    [propget, id(1), helpstring("Get the request ID")]
    HRESULT RequestID(
        [out, retval ] BSTR * ppRequestID
        );

    [propget, id(2), helpstring("The start time of the lease.")]
    HRESULT LeaseStartTime(
        [out, retval] DATE *pTime
        );

    [propput, id(2), helpstring("The start time of the lease.")]
    HRESULT LeaseStartTime(
        [in] DATE time
        );

    [propget, id(3), helpstring("The stop time of the lease.")]
    HRESULT LeaseStopTime(
        [out, retval] DATE *pTime
        );

    [propput, id(3), helpstring("The stop time of the lease.")]
    HRESULT LeaseStopTime(
        [in] DATE time
        );

    [propget, id(4), helpstring("The number of addresses of the lease.")]
    HRESULT AddressCount(
        [out, retval] long *pCount
        );

    [propget, id(5), helpstring("The ip address of server where the lease was requested/renewed.")]
    HRESULT ServerAddress(
        [out, retval] BSTR *ppAddress
        );

    [propget, id(6), helpstring("The TTL of this lease assignment.")]
    HRESULT TTL(
        [out, retval] long *pTTL
        );

    //
    // collection (used in vb) for enumeration of addresses
    //
    [propget, id(7), helpstring("Get a collection of the addresses for this lease.")]
    HRESULT Addresses(
        [out, retval] VARIANT * pVariant
        );

    //
    // c method to enumerate addresses
    //
    [id(8), hidden, helpstring("Get an enumeration of the addresses for this lease.")]
    HRESULT EnumerateAddresses(
        [out, retval] IEnumBstr ** ppEnumAddresses
        );  
}

// Obtained using IMcastAddressAllocation::EnumerateScopes

[
    object,
    uuid(DF0DAF09-A289-11D1-8697-006008B0E5D2),
    hidden,
    helpstring("IEnumMcastScope Interface"),
    pointer_default(unique)
]

interface IEnumMcastScope : IUnknown
{
    HRESULT Next(
            [in] ULONG            celt,
            [out] IMcastScope  ** ppScopes,
            [in,out,ptr] ULONG  * pceltFetched
            );

    HRESULT Reset( void );

    HRESULT Skip (
            [in] ULONG celt
            );

    HRESULT Clone (
            [out, retval] IEnumMcastScope ** ppEnum
            );
}

//
// this interface encapsulates the 4
// multicast address allocation functions
//

[
    object,
    uuid(DF0DAEF1-A289-11D1-8697-006008B0E5D2),
    dual,
    helpstring("IMcastAddressAllocation Interface"),
    pointer_default(unique)
]

interface IMcastAddressAllocation : IDispatch
{
    // This function is for VB and other scripting languages. 
    // It returns a variant, which is a collection of IMcastScope pointers.
    [propget, id(1), helpstring("Get a collection of available scopes.")]
    HRESULT Scopes(
        [out, retval] VARIANT * pVariant
        );

    // This function is the same as the first one, but it is for C/C++.
    [id(2), hidden, helpstring("Get an enumeration of available scopes.")]
    HRESULT EnumerateScopes(
        [out] IEnumMcastScope        ** ppEnumMcastScope
        );

    [id(3), helpstring("Request a lease for one or more multicast addresses.")]
    HRESULT RequestAddress(
        [in]          IMcastScope      * pScope,            // from the scope enum
        [in]          DATE               LeaseStartTime,    // desired begin time
        [in]          DATE               LeaseStopTime,     // desired end time
        [in]          long               NumAddresses,      // how many addresses we want
        [out, retval] IMcastLeaseInfo ** ppLeaseResponse    // returned on success.
                                                            // contains parameters of what
                                                            // was actually granted
        );

    [id(4), helpstring("Renew a lease.")]
    HRESULT RenewAddress(
        [in] long                        lReserved,         // unused
        [in] IMcastLeaseInfo           * pRenewRequest,
        [out, retval] IMcastLeaseInfo ** ppRenewResponse
        );

    [id(5), helpstring("Release (unreserve) a lease.")]
    HRESULT ReleaseAddress(
        [in] IMcastLeaseInfo           * pReleaseRequest
        );

    [id(6), hidden, helpstring("Create a lease info object -- C++ version.")]
    HRESULT CreateLeaseInfo(
        [in] DATE                        LeaseStartTime,
        [in] DATE                        LeaseStopTime,
        [in] DWORD                       dwNumAddresses,
        [in] LPWSTR *                    ppAddresses,
        [in] LPWSTR                      pRequestID,
        [in] LPWSTR				         pServerAddress,
        [out, retval] IMcastLeaseInfo ** ppReleaseRequest
        );

    [id(7), helpstring("Create a lease info object -- Automation version.")]
    HRESULT CreateLeaseInfoFromVariant(
        [in] DATE                        LeaseStartTime,
        [in] DATE                        LeaseStopTime,
        [in] VARIANT                     vAddresses,
        [in] BSTR                        pRequestID,
        [in] BSTR				         pServerAddress,
        [out, retval] IMcastLeaseInfo ** ppReleaseRequest
        );
}


// The type library.

[
    uuid(64217CC0-A285-11D1-8697-006008B0E5D2),
    version(1.0),
    helpstring("Microsoft Multicast Address Allocation Client COM Wrapper 1.0 Type Library")
]

library McastLib
{
    importlib("stdole2.tlb");

    interface IMcastScope;
    interface IEnumBstr;
    interface IMcastLeaseInfo;
    interface IEnumMcastScope;
    interface IMcastAddressAllocation;

    [
        uuid(DF0DAEF2-A289-11D1-8697-006008B0E5D2),
        helpstring("Multicast Address Allocation Class")
    ]
    coclass McastAddressAllocation
    {
        [default] interface IMcastAddressAllocation;
    };
};
