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.

130 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. buildq.hxx
  5. Abstract:
  6. This module defines the SMTP_BUILDQ class.
  7. This object maintains information about the initial
  8. list of messages to be delivered upon service startup
  9. Author:
  10. KeithLau 10/9/96
  11. Project:
  12. SMTP Server DLL
  13. Revision History:
  14. --*/
  15. #ifndef _SMTP_BUILDQ_HXX_
  16. #define _SMTP_BUILDQ_HXX_
  17. /************************************************************
  18. * Include Headers
  19. ************************************************************/
  20. //
  21. // Redefine the type to indicate that this is a call-back function
  22. //
  23. typedef ATQ_COMPLETION PFN_ATQ_COMPLETION;
  24. /************************************************************
  25. * Symbolic Constants
  26. ************************************************************/
  27. # define SMTP_BUILDQ_SIGNATURE_VALID 'BLQV'
  28. # define SMTP_BUILDQ_SIGNATURE_FREE 'BLQF'
  29. /************************************************************
  30. * Global functions
  31. ************************************************************/
  32. class SMTP_SERVER_INSTANCE;
  33. //BOOL InitBuildQueueObject(void);
  34. //void DestroyBuildQueueObject(void);
  35. //void ShutdownBuildQueue(SMTP_BUILDQ *pBuildQ);
  36. /*++
  37. class SMTP_BUILDQ
  38. It maintains the initial mail message list upon service startup.
  39. --*/
  40. class SMTP_BUILDQ
  41. {
  42. public:
  43. SMTP_BUILDQ (SMTP_SERVER_INSTANCE * pInst);
  44. ~SMTP_BUILDQ(void);
  45. BOOL InitializeObject(ATQ_COMPLETION pfnCompletion);
  46. BOOL ProcessQueueObject(DWORD InputBufferLen,
  47. DWORD dwCompletionStatus,
  48. OVERLAPPED * lpo);
  49. BOOL ProcessMailQIO(DWORD InputBufferLen,
  50. DWORD dwCompletionStatus,
  51. OVERLAPPED * lpo);
  52. DWORD BuildInitialQueue(void);
  53. void CloseAtqHandleAndFlushQueue(void);
  54. LONG GetThreadCount() const {return m_cActiveThreads;}
  55. PATQ_CONTEXT QueryAtqContext(void) const {return m_pAtqContext;}
  56. DWORD GetNumEntries(void) {return m_Entries;}
  57. BOOL InsertIntoInitialQueue(IN OUT PERSIST_QUEUE_ENTRY * pEntry);
  58. PQUEUE_ENTRY PopQEntry(void);
  59. void LockQ() {EnterCriticalSection (&m_CritSec);}
  60. void UnLockQ() {LeaveCriticalSection (&m_CritSec);}
  61. BOOL IsQueueEmpty(void) const {return IsListEmpty(&m_InitalQListHead);}
  62. BOOL IsValid(void) const
  63. {
  64. return(m_Signature == SMTP_BUILDQ_SIGNATURE_VALID);
  65. }
  66. SMTP_SERVER_INSTANCE * QuerySmtpInstance( VOID ) const
  67. { _ASSERT(m_pInstance != NULL); return m_pInstance; }
  68. BOOL IsSmtpInstance( VOID ) const
  69. { return m_pInstance != NULL; }
  70. VOID SetSmtpInstance( IN SMTP_SERVER_INSTANCE * pInstance )
  71. { _ASSERT(m_pInstance == NULL); m_pInstance = pInstance; }
  72. private :
  73. ULONG m_Signature;
  74. HANDLE m_hAtq;
  75. LONG m_cPendingIoCount;
  76. LONG m_cActiveThreads;
  77. DWORD m_Entries;
  78. PATQ_CONTEXT m_pAtqContext;
  79. LIST_ENTRY m_InitalQListHead;
  80. CRITICAL_SECTION m_CritSec;
  81. SMTP_SERVER_INSTANCE *m_pInstance;
  82. BOOL PostCompletionStatus(DWORD BytesTransferred);
  83. LONG IncPendingIoCount(void) { return InterlockedIncrement(&m_cPendingIoCount); }
  84. LONG DecPendingIoCount(void) { return InterlockedDecrement(&m_cPendingIoCount); }
  85. LONG IncThreadCount(void) { return InterlockedIncrement(&m_cActiveThreads); }
  86. LONG DecThreadCount(void) { return InterlockedDecrement(&m_cActiveThreads); }
  87. BOOL MakeAllAddrsLocal (HANDLE hFile, char * szBuffer, ENVELOPE_HEADER * pMyHeader);
  88. };
  89. #endif
  90. /************************ End of File ***********************/