TCPServer.h
Go to the documentation of this file.
#ifndef __TCPServer_h__
#define __TCPServer_h__
#include "Socket.h"
#include "TCPSocket.h"
#include "IPAddressList.h"
#include "Command.h"
#include "CommandList.h"
namespace core {
class TCPServer : public TCPSocket, public Command {
public:
TCPServer(EPoll &ePoll, IPAddress address, std::string text = "");
~TCPServer();
IPAddressList *blackList;
IPAddressList *whiteList;
void removeFromSessionList(TCPSession *session);
virtual void sessionErrorHandler(std::string errorString, std::stringstream &out);
virtual TCPSession * getSocketAccept(EPoll &epoll);
void output(TCPSession *session);
std::vector<TCPSession *> sessions;
CommandList commands;
protected:
void onDataReceived(std::string data) override;
int processCommand(std::string command, TCPSession *session, std::stringstream &data) override;
private:
TCPSession * accept();
std::mutex lock;
};
}
#endif
core::TCPSocket
Definition: TCPSocket.h:20
core::Socket::ePoll
EPoll & ePoll
Definition: Socket.h:117
TCPSocket.h
core::EPoll
Definition: EPoll.h:31
core::TCPServer::whiteList
IPAddressList * whiteList
Definition: TCPServer.h:60
core::TCPServer
Definition: TCPServer.h:24
core::TCPServer::commands
CommandList commands
Definition: TCPServer.h:89
core::TCPServer::processCommand
int processCommand(std::string command, TCPSession *session, std::stringstream &data) override
Definition: TCPServer.cpp:73
core::TCPServer::sessionErrorHandler
virtual void sessionErrorHandler(std::string errorString, std::stringstream &out)
Definition: TCPServer.cpp:59
core::TCPSession
Definition: TCPSession.h:25
core::TCPServer::getSocketAccept
virtual TCPSession * getSocketAccept(EPoll &epoll)
Definition: TCPServer.cpp:63
core::TCPServer::~TCPServer
~TCPServer()
Definition: TCPServer.cpp:20
core::IPAddress
Definition: IPAddress.h:9
core::IPAddressList
Definition: IPAddressList.h:9
core
Definition: Command.cpp:5
core::Command
Definition: Command.h:22
core::TCPServer::removeFromSessionList
void removeFromSessionList(TCPSession *session)
Definition: TCPServer.cpp:52
core::TCPServer::TCPServer
TCPServer(EPoll &ePoll, IPAddress address, std::string text="")
Definition: TCPServer.cpp:9
core::TCPServer::output
void output(TCPSession *session)
Output the consoles array to the console.
Definition: TCPServer.cpp:67
core::TCPServer::blackList
IPAddressList * blackList
Definition: TCPServer.h:52
core::TCPServer::sessions
std::vector< TCPSession * > sessions
Definition: TCPServer.h:82
core::TCPServer::onDataReceived
void onDataReceived(std::string data) override
Definition: TCPServer.cpp:25
core::CommandList
Definition: CommandList.h:18
CommandList.h
Command.h
IPAddressList.h
Socket.h