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.

97 lines
3.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: S A M P L E D E V I C E . H
  7. //
  8. // Contents: UPnP Device Host Sample Device
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 26 Sep 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "InternetGatewayDevice.h"
  17. #include "dispimpl2.h"
  18. #include "resource.h" // main symbols
  19. #include "upnphost.h"
  20. #include "hnetcfg.h"
  21. #include "upnpp.h"
  22. #include "CWANIPConnectionService.h"
  23. #include "CWANPPPConnectionService.h"
  24. #include "CWANPOTSLinkConfigService.h"
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CInternetGatewayDevice
  27. class ATL_NO_VTABLE CWANCommonInterfaceConfigService :
  28. public CComObjectRootEx<CComMultiThreadModel>,
  29. public IDelegatingDispImpl<ICommonInterfaceConfigService>,
  30. public IUPnPEventSource
  31. {
  32. public:
  33. CWANCommonInterfaceConfigService();
  34. DECLARE_REGISTRY_RESOURCEID(IDR_SAMPLE_DEVICE)
  35. DECLARE_PROTECT_FINAL_CONSTRUCT()
  36. BEGIN_COM_MAP(CWANCommonInterfaceConfigService)
  37. COM_INTERFACE_ENTRY(ICommonInterfaceConfigService)
  38. COM_INTERFACE_ENTRY(IDispatch)
  39. COM_INTERFACE_ENTRY(IUPnPEventSource)
  40. END_COM_MAP()
  41. public:
  42. // IUPnPEventSource methods
  43. STDMETHOD(Advise)(
  44. /*[in]*/ IUPnPEventSink *pesSubscriber);
  45. STDMETHOD(Unadvise)(
  46. /*[in]*/ IUPnPEventSink *pesSubscriber);
  47. // ICommonInterfaceConfigService methods
  48. STDMETHODIMP get_WANAccessType(BSTR *pWANAccessType);
  49. STDMETHODIMP get_Layer1UpstreamMaxBitRate(ULONG *pLayer1UpstreamMaxBitRate);
  50. STDMETHODIMP get_Layer1DownstreamMaxBitRate(ULONG *pLayer1DownstreamMaxBitRate);
  51. STDMETHODIMP get_PhysicalLinkStatus(BSTR *pPhysicalLinkStatus);
  52. STDMETHODIMP get_TotalBytesSent(ULONG *pTotalBytesSent);
  53. STDMETHODIMP get_TotalBytesReceived(ULONG *pTotalBytesReceived);
  54. STDMETHODIMP get_TotalPacketsSent(ULONG *pTotalPacketsSent);
  55. STDMETHODIMP get_TotalPacketsReceived(ULONG *pTotalPacketsReceived);
  56. STDMETHODIMP get_WANAccessProvider(BSTR *pWANAccessProvider);
  57. STDMETHODIMP get_MaximumActiveConnections(USHORT *pMaximumActiveConnections);
  58. STDMETHODIMP get_X_PersonalFirewallEnabled(VARIANT_BOOL *pPersonalFirewallEnabled);
  59. STDMETHODIMP get_X_Uptime(ULONG* pUptime);
  60. STDMETHODIMP GetCommonLinkProperties(BSTR* pWANAccessType, ULONG* pLayer1UpstreamMaxBitRate, ULONG *pLayer1DownstreamMaxBitRate, BSTR *pPhysicalLinkStatus);
  61. STDMETHODIMP GetTotalBytesSent(ULONG *pTotalBytesSent);
  62. STDMETHODIMP GetTotalBytesReceived(ULONG *pTotalBytesReceived);
  63. STDMETHODIMP GetTotalPacketsSent(ULONG *pTotalPacketsSent);
  64. STDMETHODIMP GetTotalPacketsReceived(ULONG *pTotalPacketsReceived);
  65. STDMETHODIMP X_GetICSStatistics(ULONG *pTotalBytesSent, ULONG *pTotalBytesReceived, ULONG *pTotalPacketsSent, ULONG *pTotalPacketsReceived, ULONG *pSpeed, ULONG *pUptime);
  66. HRESULT FinalConstruct(void);
  67. HRESULT FinalRelease(void);
  68. CComObject<CWANIPConnectionService>* m_pWANIPConnectionService;
  69. CComObject<CWANPPPConnectionService>* m_pWANPPPConnectionService;
  70. CComObject<CWANPOTSLinkConfigService>* m_pWANPOTSLinkConfigService;
  71. NETCON_MEDIATYPE m_MediaType;
  72. private:
  73. HRESULT GetConnections(IHNetConnection** ppPublicConnection, IHNetConnection** ppPrivateConnection);
  74. IUPnPEventSink* m_pEventSink;
  75. IUPnPDeviceHostICSSupport* m_pICSSupport;
  76. BOOL m_bFirewalled;
  77. IStatisticsProvider* m_pStatisticsProvider;
  78. };