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.5 KiB

  1. // SMTPServer.h : Declaration of the CSMTPServer
  2. #ifndef __SMTPSERVER_H_
  3. #define __SMTPSERVER_H_
  4. #include "resource.h" // main symbols
  5. #include <smtpevent.h>
  6. /////////////////////////////////////////////////////////////////////////////
  7. // CSMTPServer
  8. //class ATL_NO_VTABLE CSMTPServer :
  9. class CSMTPServer :
  10. public ISupportErrorInfo,
  11. public ISMTPServerInternal,
  12. public IMailTransportRouterReset,
  13. public IMailTransportSetRouterReset,
  14. public IMailTransportRouterSetLinkState,
  15. public ISMTPServerEx,
  16. public ISMTPServerGetAuxDomainInfoFlags,
  17. public ISMTPServerAsync
  18. {
  19. public:
  20. CSMTPServer()
  21. {
  22. m_pInstance = NULL;
  23. m_pIRouterReset = NULL;
  24. m_pIRouterSetLinkState = NULL;
  25. m_ulRefCount = 0;
  26. }
  27. HRESULT Init(SMTP_SERVER_INSTANCE * pInstance);
  28. // ISupportsErrorInfo
  29. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  30. // ISMTPServer
  31. public:
  32. STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject);
  33. STDMETHOD_(ULONG, AddRef)(void) {return(InterlockedIncrement(&m_ulRefCount));};
  34. STDMETHOD_(ULONG, Release) (void)
  35. {
  36. LONG lRefCount = InterlockedDecrement(&m_ulRefCount);
  37. if (lRefCount == 0)
  38. {
  39. delete this;
  40. }
  41. return(lRefCount);
  42. };
  43. STDMETHOD (AllocMessage)(
  44. IMailMsgProperties **ppMsg
  45. );
  46. STDMETHOD (SubmitMessage)(
  47. IMailMsgProperties *pMsg
  48. );
  49. STDMETHOD (TriggerLocalDelivery)(IMailMsgProperties *pMsg, DWORD dwRecipientCount, DWORD * pdwRecipIndexes);
  50. STDMETHOD (TriggerServerEvent)(DWORD dwEventID, PVOID pvContext);
  51. STDMETHOD (ReadMetabaseString)(DWORD MetabaseId, LPBYTE Buffer, DWORD * BufferSize, BOOL fSecure);
  52. STDMETHOD (ReadMetabaseDword)(DWORD MetabaseId, DWORD * dwValue);
  53. STDMETHOD (ServerStartHintFunction)();
  54. STDMETHOD (ServerStopHintFunction)();
  55. STDMETHOD (AllocBoundMessage)(OUT IMailMsgProperties **ppMsg, OUT PFIO_CONTEXT *phContent);
  56. STDMETHOD (WriteLog)(IN LPMSG_TRACK_INFO pMsgTrackInfo,
  57. IN IMailMsgProperties *pMsg,
  58. IN LPEVENT_LOG_INFO pEventLogInfo,
  59. IN LPSTR pszProtocolLog );
  60. STDMETHOD (ReadMetabaseData)(IN DWORD MetabaseId,
  61. IN OUT BYTE * Buffer,
  62. IN OUT DWORD * BufferSize);
  63. public: //IMailTransportRouterReset
  64. STDMETHOD (ResetRoutes)(IN DWORD dwResetType);
  65. public: //IMailTransportSetRouterReset
  66. STDMETHOD (RegisterResetInterface)(IN DWORD dwVirtualServerID,
  67. IN IMailTransportRouterReset *pIRouterReset);
  68. public: //IMailTransportRouterSetLinkState
  69. STDMETHOD(SetLinkState)(
  70. IN LPSTR szLinkDomainName,
  71. IN GUID guidRouterGUID,
  72. IN DWORD dwScheduleID,
  73. IN LPSTR szConnectorName,
  74. IN DWORD dwSetLinkState,
  75. IN DWORD dwUnsetLinkState,
  76. IN FILETIME *pftNextScheduled,
  77. IN IMessageRouter *pMessageRouter);
  78. public: //ISMTPServerEx
  79. STDMETHOD(TriggerLogEvent)(
  80. IN DWORD idMessage,
  81. IN WORD idCategory,
  82. IN WORD cSubstrings,
  83. IN LPCSTR *rgszSubstrings,
  84. IN WORD wType,
  85. IN DWORD errCode,
  86. IN WORD iDebugLevel,
  87. IN LPCSTR szKey,
  88. IN DWORD dwOptions,
  89. IN DWORD iMessageString,
  90. IN HMODULE hModule);
  91. STDMETHOD(ResetLogEvent)(
  92. IN DWORD idMessage,
  93. IN LPCSTR szKey);
  94. public: //ISMTPServerGetAuxDomainInfoFlags
  95. STDMETHOD(HrTriggerGetAuxDomainInfoFlagsEvent)(
  96. IN LPCSTR pszDomainName,
  97. OUT DWORD *pdwDomainInfoFlags );
  98. public: //ISMTPServerAsync
  99. STDMETHOD(TriggerLocalDeliveryAsync)(IMailMsgProperties *pMsg,
  100. DWORD dwRecipientCount,
  101. DWORD * pdwRecipIndexes,
  102. IMailMsgNotify *pNotify);
  103. private:
  104. LONG m_ulRefCount;
  105. SMTP_SERVER_INSTANCE *m_pInstance;
  106. IMailTransportRouterReset *m_pIRouterReset;
  107. IMailTransportRouterSetLinkState *m_pIRouterSetLinkState;
  108. CShareLockNH m_slRouterReset;
  109. };
  110. #endif //__SMTPSERVER_H_