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
4.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: I N B O U N D . H
  7. //
  8. // Contents: Inbound Connection object.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 23 Sep 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nmbase.h"
  17. #include "nmres.h"
  18. #include <rasuip.h>
  19. class ATL_NO_VTABLE CInboundConnection :
  20. public CComObjectRootEx <CComMultiThreadModel>,
  21. public CComCoClass <CInboundConnection,
  22. &CLSID_InboundConnection>,
  23. public INetConnection,
  24. public INetInboundConnection,
  25. public IPersistNetConnection,
  26. public INetConnectionSysTray
  27. {
  28. private:
  29. // This member will be TRUE if this connection object represents
  30. // the disconnected object used to configure inbound connections.
  31. // Only one of these objects exists and is created by the enumerator
  32. // only when no connected inbound objects exist.
  33. //
  34. BOOL m_fIsConfigConnection;
  35. // For connected inbound objects, this member is the handle to the
  36. // connection.
  37. //
  38. HRASSRVCONN m_hRasSrvConn;
  39. // This is the name of the connection object as shown in the shell.
  40. // This should never be empty.
  41. //
  42. tstring m_strName;
  43. // This is the name of the device associated with the connection.
  44. // This will be empty when m_fIsConfigConnection is TRUE.
  45. //
  46. tstring m_strDeviceName;
  47. // This is the media type of the connection.
  48. //
  49. NETCON_MEDIATYPE m_MediaType;
  50. // This is the id of the connection.
  51. //
  52. GUID m_guidId;
  53. // This member is TRUE only when we are fully initialized.
  54. //
  55. BOOL m_fInitialized;
  56. private:
  57. PCWSTR
  58. PszwName ()
  59. {
  60. //AssertH (!m_strName.empty());
  61. return m_strName.c_str();
  62. }
  63. PCWSTR
  64. PszwDeviceName ()
  65. {
  66. AssertH (FIff(m_strDeviceName.empty(), m_fIsConfigConnection));
  67. return (!m_strDeviceName.empty()) ? m_strDeviceName.c_str()
  68. : NULL;
  69. }
  70. VOID
  71. SetName (
  72. PCWSTR pszwName)
  73. {
  74. AssertH (pszwName);
  75. m_strName = pszwName;
  76. //AssertH (!m_strName.empty());
  77. }
  78. VOID
  79. SetDeviceName (
  80. PCWSTR pszwDeviceName)
  81. {
  82. if (pszwDeviceName && *pszwDeviceName)
  83. {
  84. AssertH (!m_fIsConfigConnection);
  85. m_strDeviceName = pszwDeviceName;
  86. }
  87. else
  88. {
  89. AssertH (m_fIsConfigConnection);
  90. m_strDeviceName.erase();
  91. }
  92. }
  93. HRESULT
  94. GetCharacteristics (
  95. DWORD* pdwFlags);
  96. HRESULT
  97. GetStatus (
  98. NETCON_STATUS* pStatus);
  99. public:
  100. CInboundConnection();
  101. ~CInboundConnection();
  102. DECLARE_REGISTRY_RESOURCEID(IDR_INBOUND_CONNECTION)
  103. BEGIN_COM_MAP(CInboundConnection)
  104. COM_INTERFACE_ENTRY(INetConnection)
  105. COM_INTERFACE_ENTRY(INetInboundConnection)
  106. COM_INTERFACE_ENTRY(IPersistNetConnection)
  107. COM_INTERFACE_ENTRY(INetConnectionSysTray)
  108. END_COM_MAP()
  109. // INetConnection
  110. STDMETHOD (Connect) ();
  111. STDMETHOD (Disconnect) ();
  112. STDMETHOD (Delete) ();
  113. STDMETHOD (Duplicate) (
  114. PCWSTR pszwDuplicateName,
  115. INetConnection** ppCon);
  116. STDMETHOD (GetProperties) (
  117. NETCON_PROPERTIES** ppProps);
  118. STDMETHOD (GetUiObjectClassId) (
  119. CLSID* pclsid);
  120. STDMETHOD (Rename) (
  121. PCWSTR pszwNewName);
  122. // INetInboundConnection
  123. STDMETHOD (GetServerConnectionHandle) (
  124. ULONG_PTR* phRasSrvConn);
  125. STDMETHOD (InitializeAsConfigConnection) (
  126. BOOL fStartRemoteAccess);
  127. // IPersistNetConnection
  128. STDMETHOD (GetClassID) (
  129. CLSID* pclsid);
  130. STDMETHOD (GetSizeMax) (
  131. ULONG* pcbSize);
  132. STDMETHOD (Load) (
  133. const BYTE* pbBuf,
  134. ULONG cbSize);
  135. STDMETHOD (Save) (
  136. BYTE* pbBuf,
  137. ULONG cbSize);
  138. // INetConnectionSysTray
  139. STDMETHOD (ShowIcon) (
  140. const BOOL bShowIcon)
  141. {
  142. return E_NOTIMPL;
  143. }
  144. STDMETHOD (IconStateChanged) ();
  145. public:
  146. static HRESULT CreateInstance (
  147. BOOL fIsConfigConnection,
  148. HRASSRVCONN hRasSrvConn,
  149. PCWSTR pszwName,
  150. PCWSTR pszwDeviceName,
  151. DWORD dwType,
  152. const GUID* pguidId,
  153. REFIID riid,
  154. VOID** ppv);
  155. };