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.

166 lines
4.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // Notify.h
  7. //
  8. // Implementation File:
  9. // Notify.cpp
  10. //
  11. // Description:
  12. // Definition of the CNotify class.
  13. //
  14. // Maintained By:
  15. // David Potter (davidp) May 22, 1996
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #pragma once
  23. #ifndef _NOTIFY_H_
  24. #define _NOTIFY_H_
  25. /////////////////////////////////////////////////////////////////////////////
  26. // Include Files
  27. /////////////////////////////////////////////////////////////////////////////
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Forward Class Declarations
  30. /////////////////////////////////////////////////////////////////////////////
  31. class CClusterNotifyKey;
  32. class CClusterNotify;
  33. class CClusterNotifyContext;
  34. /////////////////////////////////////////////////////////////////////////////
  35. // External Class Declarations
  36. /////////////////////////////////////////////////////////////////////////////
  37. class CClusterDoc;
  38. class CClusterItem;
  39. /////////////////////////////////////////////////////////////////////////////
  40. // ClusterNotifyKeyType
  41. /////////////////////////////////////////////////////////////////////////////
  42. enum ClusterNotifyKeyType
  43. {
  44. cnktUnknown,
  45. cnktDoc,
  46. cnktClusterItem
  47. };
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CNotifyKey
  50. /////////////////////////////////////////////////////////////////////////////
  51. class CClusterNotifyKey
  52. {
  53. public:
  54. CClusterNotifyKey( CClusterDoc * pdocIn );
  55. CClusterNotifyKey( CClusterItem * pciIn, LPCTSTR pszNameIn );
  56. ClusterNotifyKeyType m_cnkt;
  57. CString m_strName;
  58. union
  59. {
  60. CClusterDoc * m_pdoc;
  61. CClusterItem * m_pci;
  62. };
  63. }; //*** class CNotifyKey
  64. typedef CList< CClusterNotifyKey *, CClusterNotifyKey * > CClusterNotifyKeyList;
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CClusterNotify
  67. /////////////////////////////////////////////////////////////////////////////
  68. class CClusterNotify
  69. {
  70. public:
  71. enum EMessageType
  72. {
  73. mtMIN = 0 // Below the minimum valid value.
  74. , mtNotify // Normal notification message.
  75. , mtRefresh // Request to refresh the connections.
  76. , mtMAX // Above the maximum valid value.
  77. };
  78. EMessageType m_emt;
  79. union
  80. {
  81. DWORD_PTR m_dwNotifyKey;
  82. CClusterNotifyKey * m_pcnk;
  83. };
  84. DWORD m_dwFilterType;
  85. CString m_strName;
  86. CClusterNotify(
  87. EMessageType emtIn
  88. , DWORD_PTR dwNotifyKeyIn
  89. , DWORD dwFilterTypeIn
  90. , LPCWSTR pszNameIn
  91. );
  92. }; //*** class CClusterNotify
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CClusterNotifyList
  95. /////////////////////////////////////////////////////////////////////////////
  96. class CClusterNotifyList
  97. {
  98. private:
  99. // The actual list containing the data.
  100. CList< CClusterNotify *, CClusterNotify * > m_list;
  101. // Synchronization object to make sure only one caller is making changes to the list.
  102. CRITICAL_SECTION m_cs;
  103. public:
  104. CClusterNotifyList( void );
  105. ~CClusterNotifyList( void );
  106. POSITION Add( CClusterNotify ** ppcnNotifyInout );
  107. CClusterNotify * Remove( void );
  108. void RemoveAll( void );
  109. INT_PTR GetCount( void ) const { return m_list.GetCount(); }
  110. BOOL IsEmpty( void ) const { return m_list.IsEmpty(); }
  111. }; //*** class CClusterNotifyList
  112. /////////////////////////////////////////////////////////////////////////////
  113. // CClusterNotifyContext
  114. /////////////////////////////////////////////////////////////////////////////
  115. class CClusterNotifyContext : public CObject
  116. {
  117. DECLARE_DYNAMIC( CClusterNotifyContext )
  118. public:
  119. HCHANGE m_hchangeNotifyPort;
  120. HWND m_hwndFrame;
  121. CClusterNotifyList * m_pcnlList;
  122. }; //*** class CClusterNotifyContext
  123. /////////////////////////////////////////////////////////////////////////////
  124. // Global Function Prototypes
  125. /////////////////////////////////////////////////////////////////////////////
  126. #ifdef _DEBUG
  127. LPCTSTR PszNotificationName( DWORD dwNotificationIn );
  128. #endif // _DEBUG
  129. void DeleteAllItemData( CClusterNotifyKeyList & rcnklInout );
  130. /////////////////////////////////////////////////////////////////////////////
  131. #endif // _NOTIFY_H_