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.

133 lines
6.4 KiB

  1. // --------------------------------------------------------------------------------
  2. // Ixpsmtp.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Steven J. Bailey
  5. // --------------------------------------------------------------------------------
  6. #ifndef __IXPSMTP_H
  7. #define __IXPSMTP_H
  8. // ------------------------------------------------------------------------------------
  9. // Depends
  10. // ------------------------------------------------------------------------------------
  11. #include "ixpbase.h"
  12. #include "ixppop3.h"
  13. // --------------------------------------------------------------------------------
  14. // CSMTPTransport
  15. // --------------------------------------------------------------------------------
  16. class CSMTPTransport : public CIxpBase, public ISMTPTransport2
  17. {
  18. private:
  19. AUTHINFO m_rAuth; // Authorization Information
  20. SMTPCOMMAND m_command; // Current command being processed
  21. SMTPMESSAGE2 m_rMessage; // Current Message
  22. ULONG m_iAddress; // Current RCPT/MAIL address in rAdressList::prgAddress
  23. ULONG m_cRecipients; // Number of recipients for current message
  24. DWORD m_cbSent; // SendDataStream current Number of bytes sent
  25. DWORD m_cbTotal; // SendDataStream total bytes
  26. BOOL m_fSendMessage; // Are we in the process of a ::SendMessage
  27. BOOL m_fReset; // Is a reset needed on next ::SendMessage Call
  28. CHAR m_szEmail[255]; // The last sent email address using MAIL or RCPT
  29. BOOL m_fSTARTTLSAvail; // Is the STARTTLS command available on this server?
  30. BOOL m_fTLSNegotiation; // Are we in TLS negotiation?
  31. BOOL m_fSecured; // Is the connection secured?
  32. BOOL m_fDSNAvail; // Does the server support DSNs?
  33. private:
  34. void OnSocketReceive(void);
  35. void SendMessage_DATA(void);
  36. void SendMessage_MAIL(void);
  37. void SendMessage_RCPT(void);
  38. void SendMessage_DONE(HRESULT hrResult, LPSTR pszProblem=NULL);
  39. HRESULT HrGetResponse(void);
  40. void DispatchResponse(HRESULT hrResult, BOOL fDone, LPSTR pszProblem=NULL);
  41. void SendStreamResponse(BOOL fDone, HRESULT hrResult, DWORD cbIncrement);
  42. HRESULT _HrFormatAddressString(LPCSTR pszEmail, LPCSTR pszExtra, LPSTR *ppszAddress);
  43. void OnEHLOResponse(LPCSTR pszResponse);
  44. void ResponseAUTH(HRESULT hrResponse);
  45. BOOL FSendSicilyString(LPSTR pszData);
  46. void CancelAuthInProg(void);
  47. void StartLogon(void);
  48. void LogonRetry(void);
  49. void TryNextAuthPackage(void);
  50. void DoLoginAuth(HRESULT hrResponse);
  51. void DoPackageAuth(HRESULT hrResponse);
  52. void DoAuthNegoResponse(HRESULT hrResponse);
  53. void OnAuthorized(void);
  54. void RetryPackage(void);
  55. void DoAuthRespResponse(HRESULT hrResponse);
  56. HRESULT _HrHELO_Or_EHLO(LPCSTR pszCommand, SMTPCOMMAND eNewCommand);
  57. LPSTR _PszGetCurrentAddress(void);
  58. HRESULT CommandSTARTTLS(void);
  59. void StartTLS(void);
  60. void TryNextSecurityPkg(void);
  61. public:
  62. // ----------------------------------------------------------------------------
  63. // Construction
  64. // ----------------------------------------------------------------------------
  65. CSMTPTransport(void);
  66. ~CSMTPTransport(void);
  67. // ----------------------------------------------------------------------------
  68. // IUnknown methods
  69. // ----------------------------------------------------------------------------
  70. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  71. STDMETHODIMP_(ULONG) AddRef(void);
  72. STDMETHODIMP_(ULONG) Release(void);
  73. // ----------------------------------------------------------------------------
  74. // IAsyncConnCB methods
  75. // ----------------------------------------------------------------------------
  76. void OnNotify(ASYNCSTATE asOld, ASYNCSTATE asNew, ASYNCEVENT ae);
  77. // ----------------------------------------------------------------------------
  78. // IInternetTransport methods
  79. // ----------------------------------------------------------------------------
  80. STDMETHODIMP Connect(LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging);
  81. STDMETHODIMP DropConnection(void);
  82. STDMETHODIMP Disconnect(void);
  83. STDMETHODIMP IsState(IXPISSTATE isstate);
  84. STDMETHODIMP GetServerInfo(LPINETSERVER pInetServer);
  85. STDMETHODIMP_(IXPTYPE) GetIXPType(void);
  86. STDMETHODIMP InetServerFromAccount(IImnAccount *pAccount, LPINETSERVER pInetServer);
  87. STDMETHODIMP HandsOffCallback(void);
  88. STDMETHODIMP GetStatus(IXPSTATUS *pCurrentStatus);
  89. // ----------------------------------------------------------------------------
  90. // ISMTPTransport methods
  91. // ----------------------------------------------------------------------------
  92. STDMETHODIMP InitNew(LPSTR pszLogFilePath, ISMTPCallback *pCallback);
  93. STDMETHODIMP SendMessage(LPSMTPMESSAGE pMessage);
  94. STDMETHODIMP FreeInetAddrList(LPINETADDRLIST pAddressList);
  95. STDMETHODIMP CommandAUTH(LPSTR pszAuthType);
  96. STDMETHODIMP CommandMAIL(LPSTR pszEmailFrom);
  97. STDMETHODIMP CommandRCPT(LPSTR pszEmailTo);
  98. STDMETHODIMP CommandEHLO(void);
  99. STDMETHODIMP CommandHELO(void);
  100. STDMETHODIMP CommandQUIT(void);
  101. STDMETHODIMP CommandRSET(void);
  102. STDMETHODIMP CommandDATA(void);
  103. STDMETHODIMP CommandDOT(void);
  104. STDMETHODIMP SendDataStream(IStream *pStream, ULONG cbSize);
  105. // ----------------------------------------------------------------------------
  106. // ISMTPTransport2 methods
  107. // ----------------------------------------------------------------------------
  108. STDMETHODIMP SendMessage2(LPSMTPMESSAGE2 pMessage);
  109. STDMETHODIMP CommandRCPT2(LPSTR pszEmailTo, INETADDRTYPE atDSN);
  110. STDMETHODIMP SetWindow(void);
  111. STDMETHODIMP ResetWindow(void);
  112. // ----------------------------------------------------------------------------
  113. // CIxpBase methods
  114. // ----------------------------------------------------------------------------
  115. virtual void ResetBase(void);
  116. virtual void DoQuit(void);
  117. virtual void OnConnected(void);
  118. virtual void OnDisconnected(void);
  119. virtual void OnEnterBusy(void);
  120. virtual void OnLeaveBusy(void);
  121. };
  122. #endif // __IXPSMTP_H