#ifndef __ConsoleServer_h__ # define __ConsoleServer_h__ # include "TCPServer.h" # include "Command.h" # include "EPoll.h" # include "LogListener.h" # include "TLSInfo.h" # include # include namespace core { class TCPSocket; class TCPSession; /// /// /// class ConsoleServer : public TCPServer, public coreutils::LogListener { public: // // credentialChecker, when provided, is consulted by // ConsoleSession's login flow (see its own doc comment) instead // of the previous unconditional accept-anything behavior. Left // defaulting to nullptr so any other, unrelated use of // ConsoleServer that never cared about authentication is // unaffected. // ConsoleServer(EPoll &ePoll, IPAddress address, TLSInfo *tlsInfo, std::function credentialChecker = nullptr); // // // void logSend(std::string out) override; TCPSession * getSocketAccept(EPoll &ePoll) override; bool checkCredentials(std::string user, std::string password); private: std::function credentialChecker; }; } #endif