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.

107 lines
3.3 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. //
  4. // File: defdlvrq.h
  5. //
  6. // Description: Header file for CAQDeferredDeliveryQueue. This class
  7. // implements storage for msgs pending deferred delivery
  8. //
  9. // Author: Mike Swafford (MikeSwa)
  10. //
  11. // History:
  12. // 12/23/98 - MikeSwa Created
  13. //
  14. // Copyright (C) 1998 Microsoft Corporation
  15. //
  16. //-----------------------------------------------------------------------------
  17. #ifndef __DEFDLVRQ_H__
  18. #define __DEFDLVRQ_H__
  19. #include <aqincs.h>
  20. class CAQSvrInst;
  21. #define DEFERRED_DELIVERY_QUEUE_SIG 'QfeD'
  22. #define DEFERRED_DELIVERY_QUEUE_ENTRY_SIG 'nEQD'
  23. //---[ CAQDeferredDeliveryQueue ]----------------------------------------------
  24. //
  25. //
  26. // Description:
  27. // Priority Queue / timer management for deferred delivery messages.
  28. // Hungarian:
  29. // defq, pdefq
  30. //
  31. //-----------------------------------------------------------------------------
  32. class CAQDeferredDeliveryQueue
  33. {
  34. protected:
  35. DWORD m_dwSignature;
  36. LIST_ENTRY m_liQueueHead;
  37. CAQSvrInst *m_paqinst;
  38. CShareLockNH m_slPrivateData;
  39. DWORD m_cCallbacksPending;
  40. public:
  41. CAQDeferredDeliveryQueue();
  42. ~CAQDeferredDeliveryQueue();
  43. void Initialize(CAQSvrInst *paqinst);
  44. void Deinitialize();
  45. //Functions to enqueue and process entries... Any failures are handled
  46. //internally (by calling the HandleFailedMessage API).
  47. void Enqueue(IMailMsgProperties *pIMailMsgProperties, FILETIME *pft);
  48. void ProcessEntries();
  49. //callback function to "kick" queue
  50. static void TimerCallback(PVOID pvContext);
  51. void SetCallback();
  52. };
  53. //---[ CAQDeferredDeliveryQueueEntry ]-----------------------------------------
  54. //
  55. //
  56. // Description:
  57. // Queue Entry for for deferred delivery queue
  58. // Hungarian:
  59. // defqe, pdefqe
  60. //
  61. //-----------------------------------------------------------------------------
  62. class CAQDeferredDeliveryQueueEntry
  63. {
  64. protected:
  65. DWORD m_dwSignature;
  66. LIST_ENTRY m_liQueueEntry;
  67. FILETIME m_ftDeferredDeilveryTime;
  68. IMailMsgProperties *m_pIMailMsgProperties;
  69. BOOL m_fCallbackSet;
  70. public:
  71. CAQDeferredDeliveryQueueEntry(IMailMsgProperties *pIMailMsgProperties,
  72. FILETIME *pft);
  73. ~CAQDeferredDeliveryQueueEntry();
  74. FILETIME *pftGetDeferredDeliveryTime() {return &m_ftDeferredDeilveryTime;};
  75. void InsertBefore(LIST_ENTRY *pli)
  76. {
  77. _ASSERT(pli);
  78. InsertHeadList(pli, &m_liQueueEntry)
  79. };
  80. IMailMsgProperties *pmsgGetMsg();
  81. static CAQDeferredDeliveryQueueEntry *pdefqeGetEntry(LIST_ENTRY *pli)
  82. {
  83. _ASSERT(pli);
  84. CAQDeferredDeliveryQueueEntry *pdefqe = CONTAINING_RECORD(pli,
  85. CAQDeferredDeliveryQueueEntry,
  86. m_liQueueEntry);
  87. _ASSERT(DEFERRED_DELIVERY_QUEUE_ENTRY_SIG == pdefqe->m_dwSignature);
  88. return pdefqe;
  89. };
  90. BOOL fSetCallback(PVOID pvContext, CAQSvrInst *paqinst);
  91. void ResetCallbackFlag() {m_fCallbackSet = FALSE;};
  92. };
  93. #endif __DEFDLVRQ_H__