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.

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