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.

178 lines
5.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. server.h
  7. FILE HISTORY:
  8. */
  9. #ifndef _SERVER_H
  10. #define _SERVER_H
  11. #ifndef _TAPIHAND_H
  12. #include "tapihand.h"
  13. #endif
  14. #ifndef _TAPIDB_H
  15. #include "tapidb.h"
  16. #endif
  17. // options for the server outside of the API
  18. #define TAPISNAP_OPTIONS_REFRESH 0x00000001
  19. #define TAPISNAP_OPTIONS_EXTENSION 0x00000002
  20. // custom data types for query object
  21. #define TAPI_QDATA_REFRESH_STATS 0x00000001
  22. class CTapiServer;
  23. class CTimerDesc
  24. {
  25. public:
  26. SPITFSNode spNode;
  27. CTapiServer * pServer;
  28. UINT_PTR uTimer;
  29. TIMERPROC timerProc;
  30. };
  31. typedef CArray<CTimerDesc *, CTimerDesc *> CTimerArrayBase;
  32. class CTimerMgr : CTimerArrayBase
  33. {
  34. public:
  35. CTimerMgr();
  36. ~CTimerMgr();
  37. public:
  38. int AllocateTimer(ITFSNode * pNode, CTapiServer * pServer, UINT uTimerValue, TIMERPROC TimerProc);
  39. void FreeTimer(UINT_PTR uEventId);
  40. void ChangeInterval(UINT_PTR uEventId, UINT uNewInterval);
  41. CTimerDesc * GetTimerDesc(UINT_PTR uEventId);
  42. CCriticalSection m_csTimerMgr;
  43. };
  44. /*---------------------------------------------------------------------------
  45. Class: CTapiServer
  46. ---------------------------------------------------------------------------*/
  47. class CTapiServer : public CMTTapiHandler
  48. {
  49. public:
  50. CTapiServer(ITFSComponentData* pTFSComponentData);
  51. ~CTapiServer();
  52. // Interface
  53. public:
  54. // base handler functionality we override
  55. OVERRIDE_NodeHandler_HasPropertyPages();
  56. OVERRIDE_NodeHandler_CreatePropertyPages();
  57. OVERRIDE_NodeHandler_OnAddMenuItems();
  58. OVERRIDE_NodeHandler_OnCommand();
  59. OVERRIDE_NodeHandler_GetString()
  60. { return (nCol == 0) ? GetDisplayName() : NULL; }
  61. // Choose which messages we want to handle
  62. OVERRIDE_BaseHandlerNotify_OnCreateNodeId2();
  63. OVERRIDE_BaseHandlerNotify_OnDelete();
  64. OVERRIDE_BaseHandlerNotify_OnPropertyChange();
  65. // Result handler functionality we override
  66. // CMTHandler overridden
  67. virtual HRESULT OnRefresh(ITFSNode *, LPDATAOBJECT, DWORD, LPARAM, LPARAM);
  68. public:
  69. // CMTTapiHandler functionality
  70. virtual HRESULT InitializeNode(ITFSNode * pNode);
  71. virtual int GetImageIndex(BOOL bOpenImage);
  72. ITFSQueryObject* OnCreateQuery(ITFSNode * pNode);
  73. virtual void OnHaveData(ITFSNode * pParentNode, ITFSNode * pNode);
  74. virtual void OnHaveData(ITFSNode * pParentNode, DWORD dwData, DWORD dwType);
  75. STDMETHOD(OnNotifyExiting)(LPARAM);
  76. virtual void GetErrorPrefix(ITFSNode * pNode, CString * pstrMessage)
  77. {
  78. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  79. AfxFormatString1(*pstrMessage, IDS_ERR_SERVER_NODE, GetDisplayName());
  80. }
  81. virtual void UpdateConsoleVerbs(IConsoleVerb * pConsoleVerb, LONG_PTR dwNodeType, BOOL bMultiSelect = FALSE);
  82. public:
  83. // implementation specific
  84. HRESULT BuildDisplayName(CString * pstrDisplayName);
  85. void SetName(LPCTSTR pName) { m_strServerAddress = pName; }
  86. LPCTSTR GetName() { return m_strServerAddress; }
  87. HRESULT OnRefreshStats(ITFSNode * pNode,
  88. LPDATAOBJECT pDataObject,
  89. DWORD dwType,
  90. LPARAM arg,
  91. LPARAM param);
  92. void SetOptions(DWORD dwOptions) { m_dwOptions = dwOptions; }
  93. DWORD GetOptions() { return m_dwOptions; }
  94. HRESULT SetAutoRefresh(ITFSNode * pNode, BOOL bOn, DWORD dwRefreshInterval);
  95. BOOL IsAutoRefreshEnabled() { return m_dwOptions & TAPISNAP_OPTIONS_REFRESH; }
  96. DWORD GetAutoRefreshInterval() { return m_dwRefreshInterval; }
  97. DWORD GetCachedLineBuffSize();
  98. DWORD GetCachedPhoneBuffSize();
  99. VOID SetCachedLineBuffSize(DWORD dwLineSize);
  100. VOID SetCachedPhoneBuffSize(DWORD dwPhoneSize);
  101. BOOL IsCacheDirty();
  102. HRESULT AddProvider(ITFSNode * pNode, CTapiProvider * pProvider);
  103. HRESULT RemoveProvider(ITFSNode * pNode, DWORD dwProviderID);
  104. void SetExtensionName();
  105. // Implementation
  106. private:
  107. // Command handlers
  108. HRESULT OnAddProvider(ITFSNode * pNode);
  109. HRESULT OnEnableServer(ITFSNode * pNode);
  110. HRESULT OnDelete(ITFSNode * pNode);
  111. public:
  112. BOOL m_bStatsOnly;
  113. private:
  114. CString m_strServerAddress;
  115. SPITapiInfo m_spTapiInfo;
  116. DWORD m_dwOptions;
  117. DWORD m_dwRefreshInterval;
  118. int m_StatsTimerId;
  119. };
  120. /*---------------------------------------------------------------------------
  121. Class: CTapiServerQueryObj
  122. ---------------------------------------------------------------------------*/
  123. class CTapiServerQueryObj : public CTapiQueryObj
  124. {
  125. public:
  126. CTapiServerQueryObj(ITFSComponentData * pTFSComponentData,
  127. ITFSNodeMgr * pNodeMgr)
  128. : CTapiQueryObj(pTFSComponentData, pNodeMgr) {};
  129. STDMETHODIMP Execute();
  130. public:
  131. SPITapiInfo m_spTapiInfo;
  132. BOOL m_bStatsOnly;
  133. };
  134. #endif _SERVER_H