Leaked source code of windows server 2003
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.

139 lines
5.0 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ConnectivityLib.h
  5. Abstract:
  6. This file contains the declaration of the classes used to
  7. detect the status of the network.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 04/15/200
  10. created
  11. ******************************************************************************/
  12. #if !defined(__INCLUDED___PCH___CONNECTIVITYLIB_H___)
  13. #define __INCLUDED___PCH___CONNECTIVITYLIB_H___
  14. #include <MPC_COM.h>
  15. #include <MPC_Utils.h>
  16. /////////////////////////////////////////////////////////////////////////////
  17. class ATL_NO_VTABLE CPCHConnectionCheck : // Hungarian: pchcc
  18. public MPC::Thread < CPCHConnectionCheck, IPCHConnectionCheck >,
  19. public MPC::ConnectionPointImpl< CPCHConnectionCheck, &DIID_DPCHConnectionCheckEvents, MPC::CComSafeMultiThreadModel >,
  20. public IDispatchImpl < IPCHConnectionCheck, &IID_IPCHConnectionCheck, &LIBID_HelpCenterTypeLib >
  21. {
  22. class UrlEntry
  23. {
  24. public:
  25. CN_URL_STATUS m_lStatus;
  26. CComBSTR m_bstrURL;
  27. MPC::AsyncInvoke::CallItem m_vCtx;
  28. UrlEntry();
  29. HRESULT CheckStatus();
  30. };
  31. typedef std::list<UrlEntry> UrlList;
  32. typedef UrlList::iterator UrlIter;
  33. typedef UrlList::const_iterator UrlIterConst;
  34. CN_STATUS m_cnStatus;
  35. UrlList m_lstUrl;
  36. MPC::CComPtrThreadNeutral<IDispatch> m_sink_onCheckDone;
  37. MPC::CComPtrThreadNeutral<IDispatch> m_sink_onStatusChange;
  38. //////////////////////////////////////////////////////////////////////
  39. HRESULT Run();
  40. HRESULT put_Status( /*[in]*/ CN_STATUS pVal );
  41. //////////////////////////////////////////////////////////////////////
  42. //
  43. // Event firing methods.
  44. //
  45. HRESULT Fire_onCheckDone ( IPCHConnectionCheck* obj, CN_URL_STATUS lStatus, HRESULT hr, BSTR bstrURL, VARIANT vCtx );
  46. HRESULT Fire_onStatusChange( IPCHConnectionCheck* obj, CN_STATUS lStatus );
  47. //////////////////////////////////////////////////////////////////////
  48. public:
  49. DECLARE_NO_REGISTRY()
  50. DECLARE_NOT_AGGREGATABLE(CPCHConnectionCheck)
  51. DECLARE_GET_CONTROLLING_UNKNOWN()
  52. BEGIN_COM_MAP(CPCHConnectionCheck)
  53. COM_INTERFACE_ENTRY(IDispatch)
  54. COM_INTERFACE_ENTRY(IPCHConnectionCheck)
  55. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  56. END_COM_MAP()
  57. CPCHConnectionCheck();
  58. void FinalRelease();
  59. public:
  60. // IPCHConnectionCheck
  61. STDMETHOD(put_onCheckDone )( /*[in] */ IDispatch* function );
  62. STDMETHOD(put_onStatusChange)( /*[in] */ IDispatch* function );
  63. STDMETHOD(get_Status )( /*[out]*/ CN_STATUS *pVal );
  64. STDMETHOD(StartUrlCheck)( /*[in]*/ BSTR bstrURL, /*[in]*/ VARIANT vCtx );
  65. STDMETHOD(Abort )( );
  66. };
  67. ////////////////////////////////////////////////////////////////////////////////
  68. class CPCHHelpCenterExternal;
  69. class ATL_NO_VTABLE CPCHConnectivity : // Hungarian: pchcc
  70. public CComObjectRootEx<MPC::CComSafeMultiThreadModel>,
  71. public IDispatchImpl<IPCHConnectivity, &IID_IPCHConnectivity, &LIBID_HelpCenterTypeLib>
  72. {
  73. CPCHHelpCenterExternal* m_parent;
  74. public:
  75. BEGIN_COM_MAP(CPCHConnectivity)
  76. COM_INTERFACE_ENTRY(IDispatch)
  77. COM_INTERFACE_ENTRY(IPCHConnectivity)
  78. END_COM_MAP()
  79. CPCHConnectivity();
  80. HRESULT ConnectToParent( /*[in]*/ CPCHHelpCenterExternal* parent );
  81. ////////////////////////////////////////////////////////////////////////////////
  82. // IPCHConnectivity
  83. STDMETHOD(get_IsAModem )( /*[out, retval]*/ VARIANT_BOOL *pVal );
  84. STDMETHOD(get_IsALan )( /*[out, retval]*/ VARIANT_BOOL *pVal );
  85. STDMETHOD(get_AutoDialEnabled)( /*[out, retval]*/ VARIANT_BOOL *pVal );
  86. STDMETHOD(get_HasConnectoid )( /*[out, retval]*/ VARIANT_BOOL *pVal );
  87. STDMETHOD(get_IPAddresses )( /*[out, retval]*/ BSTR *pVal );
  88. STDMETHOD(CreateObject_ConnectionCheck)( /*[out, retval]*/ IPCHConnectionCheck* *ppCC );
  89. STDMETHOD(NetworkAlive )( /*[out, retval]*/ VARIANT_BOOL *pVal );
  90. STDMETHOD(DestinationReachable)( /*[in]*/ BSTR bstrURL, /*[out, retval]*/ VARIANT_BOOL *pVal );
  91. STDMETHOD(AutoDial )( /*[in]*/ VARIANT_BOOL bUnattended );
  92. STDMETHOD(AutoDialHangup)( );
  93. STDMETHOD(NavigateOnline)( /*[in ]*/ BSTR bstrTargetURL ,
  94. /*[in ]*/ BSTR bstrTopicTitle ,
  95. /*[in ]*/ BSTR bstrTopicIntro ,
  96. /*[in,optional]*/ VARIANT vOfflineURL );
  97. };
  98. ////////////////////////////////////////////////////////////////////////////////
  99. #endif // !defined(__INCLUDED___PCH___CONNECTIVITYLIB_H___)