#ifndef __ConsoleSession_h__ #define __ConsoleSession_h__ #include "TerminalSession.h" #include "TCPSession.h" #include "CommandList.h" namespace core { /// /// ConsoleSession /// /// Extends the session parameters for this TCPSocket derived object. /// Extend the protocol() method in order to define the behavior and /// protocol interaction for this socket which is a console session. /// class ConsoleSession : public TerminalSession { public: ConsoleSession(EPoll &ePoll, TCPServer &server); ~ConsoleSession(); void writeLog(std::string data); protected: void protocol(coreutils::ZString &data) override; private: enum Status {WELCOME, LOGIN, WAIT_USER_PROFILE, PASSWORD, WAIT_PASSWORD, PROMPT, INPUT, PROCESS, DONE}; Status status = WELCOME; void doCommand(coreutils::ZString &request); coreutils::ZString command; }; } #endif