Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
4.7 KiB

  1. /*
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. CMDhcp.h
  5. Abstract:
  6. Definition of the CMDhcp class
  7. Author:
  8. */
  9. #ifndef _MDHCP_COM_WRAPPER_CMDHCP_H_
  10. #define _MDHCP_COM_WRAPPER_CMDHCP_H_
  11. #include "resource.h" // for IDR_MDhcp
  12. #include "scope.h" // for scope delarations
  13. #include "objsf.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMDhcp
  16. class CMDhcp :
  17. public CComDualImpl<IMcastAddressAllocation, &IID_IMcastAddressAllocation, &LIBID_McastLib>,
  18. public CComObjectRoot,
  19. public CComCoClass<CMDhcp,&CLSID_McastAddressAllocation>,
  20. public CMdhcpObjectSafety
  21. {
  22. public:
  23. CMDhcp() :
  24. m_dwSafety (0),
  25. m_pFTM (NULL),
  26. m_fApiIsInitialized(FALSE)
  27. {}
  28. void FinalRelease(void);
  29. HRESULT FinalConstruct(void);
  30. BEGIN_COM_MAP(CMDhcp)
  31. COM_INTERFACE_ENTRY(IDispatch)
  32. COM_INTERFACE_ENTRY(IMcastAddressAllocation)
  33. COM_INTERFACE_ENTRY(IObjectSafety)
  34. COM_INTERFACE_ENTRY(IObjectWithSite)
  35. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  36. END_COM_MAP()
  37. DECLARE_REGISTRY_RESOURCEID(IDR_MDhcp)
  38. DECLARE_GET_CONTROLLING_UNKNOWN()
  39. public:
  40. //
  41. // IMcastAddressAllocation
  42. //
  43. STDMETHOD (get_Scopes) (
  44. VARIANT * pVariant
  45. );
  46. STDMETHOD (EnumerateScopes) (
  47. IEnumMcastScope ** ppEnumMcastScope
  48. );
  49. STDMETHOD (RequestAddress) (
  50. IMcastScope * pScope, // from the scope enum
  51. DATE LeaseStartTime,
  52. DATE LeaseStopTime,
  53. long NumAddresses,
  54. IMcastLeaseInfo ** ppLeaseResponse // returned on success.
  55. );
  56. STDMETHOD (RenewAddress) (
  57. long lReserved, // unused
  58. IMcastLeaseInfo * pRenewRequest,
  59. IMcastLeaseInfo ** ppRenewResponse
  60. );
  61. STDMETHOD (ReleaseAddress) (
  62. IMcastLeaseInfo * pReleaseRequest
  63. );
  64. STDMETHOD (CreateLeaseInfo) (
  65. DATE LeaseStartTime,
  66. DATE LeaseStopTime,
  67. DWORD dwNumAddresses,
  68. LPWSTR * ppAddresses,
  69. LPWSTR pRequestID,
  70. LPWSTR pServerAddress,
  71. IMcastLeaseInfo ** ppReleaseRequest
  72. );
  73. STDMETHOD (CreateLeaseInfoFromVariant) (
  74. DATE LeaseStartTime,
  75. DATE LeaseStopTime,
  76. VARIANT vAddresses,
  77. BSTR pRequestID,
  78. BSTR pServerAddress,
  79. IMcastLeaseInfo ** ppReleaseRequest
  80. );
  81. protected:
  82. //
  83. // Data
  84. //
  85. DWORD m_dwSafety; // object safety level
  86. IUnknown * m_pFTM; // ptr to free threaded marshaler
  87. BOOL m_fApiIsInitialized; // TRUE if api startup succeeded
  88. //
  89. // internal implementation
  90. //
  91. HRESULT CreateWrappers(
  92. DWORD dwScopeCount, // the number of scopes we were given
  93. MCAST_SCOPE_ENTRY * pScopeList, // array of scope structs
  94. IMcastScope *** pppWrappers, // here we will put an array of if ptrs
  95. BOOL fLocal // true = scopes are locally generated
  96. );
  97. HRESULT GetScopeList(
  98. DWORD * pdwScopeCount,
  99. MCAST_SCOPE_ENTRY ** ppScopeList,
  100. BOOL * pfLocal
  101. );
  102. HRESULT WrapMDhcpLeaseInfo(
  103. BOOL fGotTtl,
  104. long lTtl,
  105. BOOL fLocal,
  106. MCAST_LEASE_INFO * pLeaseInfo,
  107. MCAST_CLIENT_UID * pRequestID,
  108. IMcastLeaseInfo ** ppInterface
  109. );
  110. // Request
  111. HRESULT PrepareArgumentsRequest(
  112. IMcastScope IN * pScope,
  113. DATE IN LeaseStartTime,
  114. DATE IN LeaseStopTime,
  115. long IN lNumAddresses,
  116. MCAST_CLIENT_UID OUT * pRequestIDStruct,
  117. MCAST_SCOPE_CTX OUT * pScopeCtxStruct,
  118. MCAST_LEASE_INFO OUT ** ppLeaseStruct,
  119. BOOL OUT * pfLocal,
  120. long OUT * plTtl
  121. );
  122. // Release or Renew
  123. HRESULT PrepareArgumentsNonRequest(
  124. IMcastLeaseInfo IN * pLease,
  125. MCAST_CLIENT_UID OUT * pRequestIDStruct,
  126. MCAST_LEASE_INFO OUT ** ppLeaseStruct,
  127. BOOL OUT * pfLocal,
  128. BOOL OUT * pfGotTtl,
  129. long OUT * plTtl
  130. );
  131. };
  132. #endif // _MDHCP_COM_WRAPPER_CMDHCP_H_
  133. // eof