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, std::string text = "");
39 
43 
44  ~TCPServer();
45 
51 
53 
59 
61 
62  void removeFromSessionList(TCPSession *session);
63 
64  virtual void sessionErrorHandler(std::string errorString, std::stringstream &out);
65 
73 
74  virtual TCPSession * getSocketAccept(EPoll &epoll);
75 
76  void output(TCPSession *session);
77 
81 
82  std::vector<TCPSession *> sessions;
83 
88 
90 
91  protected:
92 
102 
103  void onDataReceived(std::string data) override;
104 
111 
112  int processCommand(std::string command, TCPSession *session, std::stringstream &data) override;
113 
114  private:
115 
116  TCPSession * accept();
117 
118  };
119 
120 }
121 
122 #endif
IPAddressList * blackList
Definition: TCPServer.h:52
void onDataReceived(std::string data) override
Definition: TCPServer.cpp:25
TCPServer(EPoll &ePoll, IPAddress address, std::string text="")
Definition: TCPServer.cpp:9
Definition: Command.cpp:4
Definition: EPoll.h:31
std::vector< TCPSession * > sessions
Definition: TCPServer.h:82
Definition: IPAddress.h:9
Definition: CommandList.h:18
int processCommand(std::string command, TCPSession *session, std::stringstream &data) override
Definition: TCPServer.cpp:71
Definition: TCPSocket.h:20
Definition: TCPSession.h:23
IPAddressList * whiteList
Definition: TCPServer.h:60
Definition: Command.h:20
Definition: TCPServer.h:24
void output(TCPSession *session)
Output the consoles array to the console.
Definition: TCPServer.cpp:65
~TCPServer()
Definition: TCPServer.cpp:20
Definition: IPAddressList.h:9
CommandList commands
Definition: TCPServer.h:89
virtual TCPSession * getSocketAccept(EPoll &epoll)
Definition: TCPServer.cpp:61