My Project
TCPServer.h
1 #ifndef __TCPServer_h__
2 #define __TCPServer_h__
3 
4 #include "Socket.h"
5 #include "TCPSocket.h"
6 #include "IPAddressList.h"
7 #include "Command.h"
8 #include "CommandList.h"
9 
10 namespace core {
11 
23 
24  class TCPServer : public TCPSocket, public Command {
25 
26  public:
27 
37 
38  TCPServer(EPoll &ePoll, IPAddress address);
39 
43 
44  ~TCPServer();
45 
51 
58 
60 
61  void removeFromSessionList(TCPSession *session);
62 
63  virtual void sessionErrorHandler(std::string errorString);
64 
72 
73  virtual TCPSession * getSocketAccept(EPoll &epoll);
74 
75  void output(TCPSession *session);
76 
80 
81  std::vector<TCPSession *> sessions;
82 
87 
89 
90  protected:
91 
101 
102  void onDataReceived(std::string data) override;
103 
110 
111  int processCommand(std::string command, TCPSession *session, std::stringstream &data) override;
112 
113  private:
114 
115  TCPSession * accept();
116 
117  };
118 
119 }
120 
121 #endif
Definition: EPoll.h:31
void onDataReceived(std::string data) override
Definition: TCPServer.cpp:24
virtual TCPSession * getSocketAccept(EPoll &epoll)
Definition: TCPServer.cpp:61
std::vector< TCPSession * > sessions
Definition: TCPServer.h:81
Definition: Command.cpp:3
Definition: TCPSession.h:21
Definition: TCPServer.h:24
int processCommand(std::string command, TCPSession *session, std::stringstream &data) override
Definition: TCPServer.cpp:69
Definition: IPAddress.h:9
IPAddressList * whiteList
Definition: TCPServer.h:59
~TCPServer()
Definition: TCPServer.cpp:20
Definition: Command.h:19
void output(TCPSession *session)
Output the consoles array to the console.
Definition: TCPServer.cpp:65
Definition: TCPSocket.h:20
Definition: CommandList.h:18
IPAddressList * blackList
Definition: TCPServer.h:52
TCPServer(EPoll &ePoll, IPAddress address)
Definition: TCPServer.cpp:9
Definition: IPAddressList.h:9
CommandList commands
Definition: TCPServer.h:88