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.

190 lines
3.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000
  5. //
  6. // File: H N P R T M A P . H
  7. //
  8. // Contents: CHNetPortMappingProtocol declarations
  9. //
  10. // Notes:
  11. //
  12. // Author: jonburs 22 June 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "hnprivate.h"
  17. class ATL_NO_VTABLE CHNetPortMappingProtocol :
  18. public CComObjectRootEx<CComMultiThreadModel>,
  19. public IHNetPortMappingProtocol,
  20. public IHNetPrivate
  21. {
  22. private:
  23. //
  24. // IWbemServices for our namespace
  25. //
  26. IWbemServices *m_piwsHomenet;
  27. //
  28. // Path to WMI instance
  29. //
  30. BSTR m_bstrProtocol;
  31. //
  32. // True if this is a built-in protocol. We cache
  33. // this value as it will be used quite often, and
  34. // will never change for the instance.
  35. //
  36. BOOLEAN m_fBuiltIn;
  37. //
  38. // Commonly used BSTR
  39. //
  40. BSTR m_bstrWQL;
  41. //
  42. // Get protocol object from cached path
  43. //
  44. HRESULT
  45. GetProtocolObject(
  46. IWbemClassObject **ppwcoInstance
  47. );
  48. //
  49. // Sends an update notification for connections with
  50. // enabled bindings to this protocol.
  51. //
  52. HRESULT
  53. SendUpdateNotification();
  54. //
  55. // Queries for bindings for this protocol that are
  56. // enabled
  57. //
  58. HRESULT
  59. GetEnabledBindingEnumeration(
  60. IEnumHNetPortMappingBindings **ppEnum
  61. );
  62. public:
  63. BEGIN_COM_MAP(CHNetPortMappingProtocol)
  64. COM_INTERFACE_ENTRY(IHNetPortMappingProtocol)
  65. COM_INTERFACE_ENTRY(IHNetPrivate)
  66. END_COM_MAP()
  67. DECLARE_PROTECT_FINAL_CONSTRUCT()
  68. //
  69. // Inline constructor.
  70. //
  71. CHNetPortMappingProtocol()
  72. {
  73. m_piwsHomenet = NULL;
  74. m_bstrProtocol = NULL;
  75. m_fBuiltIn = FALSE;
  76. m_bstrWQL = NULL;
  77. };
  78. //
  79. // Atl methods
  80. //
  81. HRESULT
  82. FinalConstruct();
  83. HRESULT
  84. FinalRelease();
  85. //
  86. // Object initialization
  87. //
  88. HRESULT
  89. Initialize(
  90. IWbemServices *piwsNamespace,
  91. IWbemClassObject *pwcoInstance
  92. );
  93. //
  94. // IHNetPortMappingProtocol methods
  95. //
  96. STDMETHODIMP
  97. GetName(
  98. OLECHAR **ppszwName
  99. );
  100. STDMETHODIMP
  101. SetName(
  102. OLECHAR *pszwName
  103. );
  104. STDMETHODIMP
  105. GetIPProtocol(
  106. UCHAR *pucProtocol
  107. );
  108. STDMETHODIMP
  109. SetIPProtocol(
  110. UCHAR ucProtocol
  111. );
  112. STDMETHODIMP
  113. GetPort(
  114. USHORT *pusPort
  115. );
  116. STDMETHODIMP
  117. SetPort(
  118. USHORT usPort
  119. );
  120. STDMETHODIMP
  121. GetBuiltIn(
  122. BOOLEAN *pfBuiltIn
  123. );
  124. STDMETHODIMP
  125. Delete();
  126. STDMETHODIMP
  127. GetGuid(
  128. GUID **ppGuid
  129. );
  130. //
  131. // IHNetPrivate methods
  132. //
  133. STDMETHODIMP
  134. GetObjectPath(
  135. BSTR *pbstrPath
  136. );
  137. };
  138. //
  139. // Type to use for our enumeration class
  140. //
  141. typedef CHNCEnum<
  142. IEnumHNetPortMappingProtocols,
  143. IHNetPortMappingProtocol,
  144. CHNetPortMappingProtocol
  145. >
  146. CEnumHNetPortMappingProtocols;