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.

107 lines
3.0 KiB

  1. //******************************************************************************
  2. //
  3. // Copyright (c) 1999-2000, Microsoft Corporation, All rights reserved
  4. //
  5. //*****************************************************************************
  6. #ifndef __DELIVREC_H__
  7. #define __DELIVREC_H__
  8. #include <wmimsg.h>
  9. #include <wbemcli.h>
  10. #include <arrtempl.h>
  11. #include <comutl.h>
  12. #include <winntsec.h>
  13. #include <callsec.h>
  14. #include <unk.h>
  15. #include "evsink.h"
  16. class CQueueingEventSink;
  17. class CEssNamespace;
  18. /*************************************************************************
  19. CDeliveryRecord
  20. **************************************************************************/
  21. class CDeliveryRecord : public CUnk // for ref counting
  22. {
  23. private:
  24. DWORD m_dwSize;
  25. CRefedPointerArray<IWbemClassObject> m_Events;
  26. CWbemPtr<IWbemCallSecurity> m_pCallSec;
  27. CEssNamespace * m_pNamespace;
  28. //
  29. // later we'll have a consumer id here.
  30. //
  31. HRESULT AdjustTotalSize( IWbemClassObject* pObj );
  32. void* GetInterface( REFIID ) { return NULL; }
  33. public:
  34. CDeliveryRecord() : m_dwSize(0), m_pNamespace( NULL ) { }
  35. virtual ~CDeliveryRecord();
  36. void AddToCache( CEssNamespace * pNamespace, DWORD dwTotalSize, DWORD * pdwSleep );
  37. IWbemClassObject** GetEvents() { return m_Events.GetArrayPtr(); }
  38. IWbemCallSecurity* GetCallSecurity() { return m_pCallSec; }
  39. ULONG GetNumEvents() { return m_Events.GetSize(); }
  40. ULONG GetTotalBytes() { return m_dwSize; }
  41. void Clear() { m_Events.RemoveAll(); m_dwSize = 0; }
  42. HRESULT Initialize( IWbemClassObject** apEvents,
  43. ULONG cEvents,
  44. IWbemCallSecurity* pCallSec = NULL );
  45. virtual HRESULT PreDeliverAction( ITransaction* ppTxn ) = 0;
  46. virtual HRESULT PostDeliverAction( ITransaction* pTxn, HRESULT hres ) = 0;
  47. HRESULT Persist( IStream* pStrm );
  48. HRESULT Unpersist( IStream* pStrm );
  49. };
  50. /*************************************************************************
  51. CExpressDeliveryRecord
  52. **************************************************************************/
  53. class CExpressDeliveryRecord : public CDeliveryRecord
  54. {
  55. static CReuseMemoryManager mstatic_Manager;
  56. public:
  57. HRESULT PreDeliverAction( ITransaction* ppTxn );
  58. HRESULT PostDeliverAction( ITransaction* pTxn, HRESULT hres );
  59. void* operator new(size_t nSize);
  60. void operator delete(void* p);
  61. };
  62. /*************************************************************************
  63. CGuaranteedDeliveryRecord
  64. **************************************************************************/
  65. class CGuaranteedDeliveryRecord : public CDeliveryRecord
  66. {
  67. CQueueingEventSink* m_pSink;
  68. CWbemPtr<IWmiMessageQueueReceiver> m_pRcvr;
  69. public:
  70. void SetCB( CQueueingEventSink* pSink, IWmiMessageQueueReceiver* pRcvr )
  71. {
  72. m_pSink = pSink;
  73. m_pRcvr = pRcvr;
  74. }
  75. HRESULT PreDeliverAction( ITransaction* ppTxn ) ;
  76. HRESULT PostDeliverAction( ITransaction* pTxn, HRESULT hres );
  77. };
  78. #endif // __DELIVREC_H__