#ifndef __Service_h__ #define __Service_h__ #include "Object.h" #include "CommandList.h" namespace core { // class TCPServerSocket; /// /// Service /// /// The Service object is instantiated as a single object upon construction /// of the parent TCPServerSocket and is provided as a parameter whenever /// a new Session object is created. It provides server level services to /// Command handlers as well as determining the behavior of the socket. /// class Service : public Command { public: /// /// Use this constructor to create a new Service object. /// /// @param server A reference to the parent server creating the object. /// Service(); void removeFromSessionList(Session *session); virtual void sessionErrorHandler(std::string errorString, Session *session); /// /// getSocketAccept is designed to allow a polymorphic extension of this object to /// return a type of object that extends the definition of the server socket. /// Returning the appropriate session object that extends from Session provides /// the mechanism where the server can select the protocol dialog for the desired /// service. /// virtual Session * getSocketAccept(EPoll &epoll); void output(Session *session) override; /// sessions; /// /// The commands object is a CommandList and is used to store Command objects to be /// parsed and run as data comes into the session. /// CommandList commands; }; } #endif