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.

181 lines
3.0 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: CHNetPortMappingBinding declarations
  9. //
  10. // Notes:
  11. //
  12. // Author: jonburs 22 June 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class ATL_NO_VTABLE CHNetPortMappingBinding :
  17. public CComObjectRootEx<CComMultiThreadModel>,
  18. public IHNetPortMappingBinding
  19. {
  20. private:
  21. //
  22. // IWbemServices for our namespace
  23. //
  24. IWbemServices *m_piwsHomenet;
  25. //
  26. // Path to WMI instance.
  27. //
  28. BSTR m_bstrBinding;
  29. //
  30. // Commonly used BSTR
  31. //
  32. BSTR m_bstrWQL;
  33. //
  34. // Generate a target address w/in our DHCP scope when using
  35. // a name-based port mapping
  36. //
  37. HRESULT
  38. GenerateTargetAddress(
  39. LPCWSTR pszwTargetName,
  40. ULONG *pulAddress
  41. );
  42. //
  43. // Get the object corresponding to our stored path
  44. //
  45. HRESULT
  46. GetBindingObject(
  47. IWbemClassObject **ppwcoInstance
  48. );
  49. //
  50. // Sends an update notification to SharedAccess (if the
  51. // service is running).
  52. //
  53. HRESULT
  54. SendUpdateNotification();
  55. public:
  56. BEGIN_COM_MAP(CHNetPortMappingBinding)
  57. COM_INTERFACE_ENTRY(IHNetPortMappingBinding)
  58. END_COM_MAP()
  59. DECLARE_PROTECT_FINAL_CONSTRUCT()
  60. //
  61. // Inline constructor.
  62. //
  63. CHNetPortMappingBinding()
  64. {
  65. m_piwsHomenet = NULL;
  66. m_bstrBinding = NULL;
  67. m_bstrWQL = NULL;
  68. };
  69. //
  70. // Atl methods
  71. //
  72. HRESULT
  73. FinalConstruct();
  74. HRESULT
  75. FinalRelease();
  76. //
  77. // Object initialization
  78. //
  79. HRESULT
  80. Initialize(
  81. IWbemServices *piwsNamespace,
  82. IWbemClassObject *pwcoInstance
  83. );
  84. //
  85. // IHNetPortMappingBinding methods
  86. //
  87. STDMETHODIMP
  88. GetConnection(
  89. IHNetConnection **ppConnection
  90. );
  91. STDMETHODIMP
  92. GetProtocol(
  93. IHNetPortMappingProtocol **ppProtocol
  94. );
  95. STDMETHODIMP
  96. GetEnabled(
  97. BOOLEAN *pfEnabled
  98. );
  99. STDMETHODIMP
  100. SetEnabled(
  101. BOOLEAN fEnable
  102. );
  103. STDMETHODIMP
  104. GetCurrentMethod(
  105. BOOLEAN *pfUseName
  106. );
  107. STDMETHODIMP
  108. GetTargetComputerName(
  109. OLECHAR **ppszwName
  110. );
  111. STDMETHODIMP
  112. SetTargetComputerName(
  113. OLECHAR *pszwName
  114. );
  115. STDMETHODIMP
  116. GetTargetComputerAddress(
  117. ULONG *pulAddress
  118. );
  119. STDMETHODIMP
  120. SetTargetComputerAddress(
  121. ULONG ulAddress
  122. );
  123. STDMETHODIMP
  124. GetTargetPort(
  125. USHORT *pusPort
  126. );
  127. STDMETHODIMP
  128. SetTargetPort(
  129. USHORT usPort
  130. );
  131. };
  132. //
  133. // Type to use for our enumeration class
  134. //
  135. typedef CHNCEnum<
  136. IEnumHNetPortMappingBindings,
  137. IHNetPortMappingBinding,
  138. CHNetPortMappingBinding
  139. >
  140. CEnumHNetPortMappingBindings;