#ifndef __SMTPSession_h__ # define __SMTPSession_h__ # include "TCPSession.h" # include "TCPServer.h" # include "MString.h" # define CRLF "\r\n" namespace mail { enum State {CONNECT, READY, MAIL, RCPT, DATA}; enum AuthState {USER_UNKNOWN, USER_QUERY, USER_SECRET_QUERY, USER_KNOWN}; enum Mode {WAIT_FOR_DATA, RECEIVE_DATA}; class SMTPSession : public core::TCPSession { public: SMTPSession(core::EPoll &ePoll, core::TCPServer &server); void onConnected() override; coreutils::MString clientDomainName; coreutils::MString userName; coreutils::MString password; std::stringstream mailData; State state = CONNECT; AuthState authState = USER_UNKNOWN; Mode mode = WAIT_FOR_DATA; bool relay = false; coreutils::MString sender; std::vector recipientList; }; } #endif