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.

138 lines
4.8 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. //
  4. // File: asyncqadm.h
  5. //
  6. // Description:
  7. // Header for for CAsyncAdminQueue class. This is the base class that
  8. // our QAPI implementation is based on.
  9. //
  10. // The object model for QAPI is (<>'s indicate a template class):
  11. // CAsyncQueueBase - pure base class for async queue
  12. // CAsyncQueue<> - original async queue implementations
  13. // CAsyncRetryQueue<> - async queue /w retry queue
  14. // CAsyncAdminQueue<> - Base for admin funtionality
  15. // CAsyncAdminMailMsgQueue - MailMsg specific
  16. // CAsyncAdminMsgRefQueue - MsgRef specific
  17. //
  18. // Author: Mike Swafford (MikeSwa)
  19. //
  20. // History:
  21. // 12/6/2000 - MikeSwa Created (from t-toddc's summer work)
  22. //
  23. // Copyright (C) 2000 Microsoft Corporation
  24. //
  25. //-----------------------------------------------------------------------------
  26. #ifndef __ASYNCQADM_H__
  27. #define __ASYNCQADM_H__
  28. #include <fifoq.h>
  29. #include <intrnlqa.h>
  30. #include <baseobj.h>
  31. #include <aqstats.h>
  32. #include <aqadmtyp.h>
  33. #include <aqnotify.h>
  34. #include <hndlmgr.h>
  35. class CAQSvrInst;
  36. //---[ CAsyncAdminQueue ]------------------------------------------------------
  37. //
  38. //
  39. // Description:
  40. // Base class that implements basic functionality of Administratable queues
  41. // Hungarian:
  42. //
  43. //
  44. //-----------------------------------------------------------------------------
  45. template<class PQDATA, DWORD TEMPLATE_SIG>
  46. class CAsyncAdminQueue :
  47. public IQueueAdminAction,
  48. public IQueueAdminQueue,
  49. public CAsyncRetryQueue<PQDATA, TEMPLATE_SIG>,
  50. public CBaseObject
  51. {
  52. private:
  53. DWORD m_cbDomain;
  54. LPSTR m_szDomain;
  55. DWORD m_cbLinkName;
  56. LPSTR m_szLinkName;
  57. GUID m_guid;
  58. DWORD m_dwID;
  59. protected:
  60. typename CFifoQueue<PQDATA>::MAPFNAPI m_pfnMessageAction;
  61. CAQSvrInst *m_paqinst;
  62. IAQNotify *m_pAQNotify;
  63. CQueueHandleManager m_qhmgr;
  64. public:
  65. HRESULT HrInitialize(
  66. DWORD cMaxSyncThreads,
  67. DWORD cItemsPerATQThread,
  68. DWORD cItemsPerSyncThread,
  69. PVOID pvContext,
  70. QCOMPFN pfnQueueCompletion,
  71. QCOMPFN pfnFailedItem,
  72. typename CFifoQueue<PQDATA>::MAPFNAPI pfnQueueFailure,
  73. DWORD cMaxPendingAsyncCompletions = 0);
  74. CAsyncAdminQueue(LPCSTR szDomain, LPCSTR szLinkName,
  75. const GUID *pguid, DWORD dwID, CAQSvrInst *paqinst,
  76. typename CFifoQueue<PQDATA>::MAPFNAPI pfnMessageAction);
  77. ~CAsyncAdminQueue();
  78. //
  79. // Used to set the interface to do stats updates to
  80. //
  81. inline void SetAQNotify(IAQNotify *pAQNotify) {m_pAQNotify = pAQNotify;};
  82. public: //IUnknown
  83. STDMETHOD(QueryInterface)(REFIID riid, LPVOID * ppvObj);
  84. STDMETHOD_(ULONG, AddRef)(void) {return CBaseObject::AddRef();};
  85. //All of these objects are allocated as part CAQSvrInst... we can
  86. //add the assert below to make sure that someone does not relese it
  87. //early
  88. STDMETHOD_(ULONG, Release)(void)
  89. {_ASSERT(m_lReferences > 1); return CBaseObject::Release();};
  90. public: //IQueueAdminAction
  91. STDMETHOD(HrApplyQueueAdminFunction)(
  92. IQueueAdminMessageFilter *pIQueueAdminMessageFilter);
  93. STDMETHOD(HrApplyActionToMessage)(
  94. IUnknown *pIUnknownMsg,
  95. MESSAGE_ACTION ma,
  96. PVOID pvContext,
  97. BOOL *pfShouldDelete);
  98. STDMETHOD_(BOOL, fMatchesID)
  99. (QUEUELINK_ID *QueueLinkID);
  100. STDMETHOD(QuerySupportedActions)(DWORD *pdwSupportedActions,
  101. DWORD *pdwSupportedFilterFlags)
  102. {
  103. return HrInternalQuerySupportedActions(pdwSupportedActions,
  104. pdwSupportedFilterFlags);
  105. };
  106. public: //IQueueAdminQueue
  107. STDMETHOD(HrGetQueueInfo)(
  108. QUEUE_INFO *pliQueueInfo);
  109. STDMETHOD(HrGetQueueID)(
  110. QUEUELINK_ID *pQueueID);
  111. protected: // Virutal functions used to implement msg specific actions
  112. virtual HRESULT HrDeleteMsgFromQueueNDR(IUnknown *pIUnknownMsg) = 0;
  113. virtual HRESULT HrDeleteMsgFromQueueSilent(IUnknown *pIUnknownMsg) = 0;
  114. virtual HRESULT HrFreezeMsg(IUnknown *pIUnknownMsg) = 0;
  115. virtual HRESULT HrThawMsg(IUnknown *pIUnknownMsg) = 0;
  116. virtual HRESULT HrGetStatsForMsg(IUnknown *pIUnknownMsg, CAQStats *paqstats) = 0;
  117. virtual HRESULT HrInternalQuerySupportedActions(DWORD *pdwSupportedActions,
  118. DWORD *pdwSupportedFilterFlags) = 0;
  119. };
  120. #endif //__ASYNCQADM_H__