diff --git a/CommandList.cpp b/CommandList.cpp index b97386e..e33dc0e 100644 --- a/CommandList.cpp +++ b/CommandList.cpp @@ -9,13 +9,15 @@ namespace core { void CommandList::add(Command &command, std::string name) { command.setName(name); commands.push_back(&command); + } void CommandList::remove(Command &command) { } - bool CommandList::processRequest(std::string request, Session *session) { + bool CommandList::processRequest(std::string request, Session *session) { + for(auto *command : commands) { if(command->check(request)) { command->processCommand(request, session); diff --git a/ConsoleServer.cpp b/ConsoleServer.cpp index f898c5b..e6c5052 100644 --- a/ConsoleServer.cpp +++ b/ConsoleServer.cpp @@ -5,20 +5,20 @@ namespace core { - ConsoleServer::ConsoleServer(EPoll &ePoll, IPAddress address) - : TCPServerSocket(ePoll, address) { - Log(this); - } + ConsoleServer::ConsoleServer(EPoll &ePoll, Service service, IPAddress address) + : TCPServerSocket(ePoll, service, address) { + Log(this); + } ConsoleServer::~ConsoleServer() {} void ConsoleServer::sendToConnectedConsoles(std::string out) { - for(auto *session : service->sessions) - ((ConsoleSession *)session)->writeLog(out); + for(auto *session : service.sessions) + ((ConsoleSession *)session)->writeLog(out); } Session * ConsoleServer::getSocketAccept() { - return new ConsoleSession(ePoll, *this->service); + return new ConsoleSession(ePoll, this->service); } void ConsoleServer::output(Session *session) { diff --git a/ConsoleServer.h b/ConsoleServer.h index ef775a7..a8820fd 100644 --- a/ConsoleServer.h +++ b/ConsoleServer.h @@ -24,7 +24,7 @@ namespace core { // // - ConsoleServer(EPoll &ePoll, IPAddress address); + ConsoleServer(EPoll &ePoll, Service service, IPAddress address); // // diff --git a/IPAddress.cpp b/IPAddress.cpp index c36ffed..c4f5e69 100644 --- a/IPAddress.cpp +++ b/IPAddress.cpp @@ -3,8 +3,7 @@ namespace core { IPAddress::IPAddress() { - addressLength = sizeof(struct sockaddr_in); - pointer = (sockaddr *)&address; + addressLength = sizeof(addr); } IPAddress::IPAddress(std::string address) { @@ -16,19 +15,23 @@ namespace core { IPAddress(url, port); } - IPAddress::IPAddress(std::string address, short int port) { - struct sockaddr_in addr; + IPAddress::IPAddress(std::string address, int port) { memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); struct hostent *hp = gethostbyname(address.c_str()); memcpy((void *)&addr.sin_addr, hp->h_addr_list[0], hp->h_length); + addressLength = sizeof(addr); } IPAddress::~IPAddress() { } + struct sockaddr * IPAddress::getPointer() { + return (sockaddr *)&addr; + } + std::string IPAddress::getClientAddress() { std::string result; return result; @@ -36,8 +39,8 @@ namespace core { std::string IPAddress::getClientAddressAndPort() { std::stringstream out; - out << inet_ntoa(address.sin_addr); - out << ":" << address.sin_port; + out << inet_ntoa(addr.sin_addr); + out << ":" << addr.sin_port; return out.str(); } diff --git a/IPAddress.h b/IPAddress.h index f39ba15..4beca82 100644 --- a/IPAddress.h +++ b/IPAddress.h @@ -11,13 +11,13 @@ namespace core { public: IPAddress(); IPAddress(std::string address); - IPAddress(std::string address, short int port); + IPAddress(std::string address, int port); ~IPAddress(); - struct sockaddr_in address; + struct sockaddr_in addr; socklen_t addressLength; - struct sockaddr *pointer; + struct sockaddr * getPointer(); std::string getClientAddress(); /// + + diff --git a/Service.cpp b/Service.cpp index b1d19a7..b313c82 100644 --- a/Service.cpp +++ b/Service.cpp @@ -4,7 +4,11 @@ namespace core { - Service::Service(TCPServerSocket &server) : server(server) {} + Service::Service() {} + + void Service::init(TCPServerSocket *server) { + this->server = server; + } void Service::removeFromSessionList(Session *session) { std::vector::iterator cursor; diff --git a/Service.h b/Service.h index ae3eaf4..c2040b9 100644 --- a/Service.h +++ b/Service.h @@ -27,7 +27,9 @@ namespace core { /// @param server A reference to the parent server creating the object. /// - Service(TCPServerSocket &server); + Service(); + + virtual void init(TCPServerSocket *server); void removeFromSessionList(Session *session); @@ -44,7 +46,7 @@ namespace core { /// server values and methods through the Service object which behaves as an interface. /// - TCPServerSocket &server; + TCPServerSocket *server; /// /// The commands object is a CommandList and is used to store Command objects to be diff --git a/TCPServerSocket.cpp b/TCPServerSocket.cpp index 21516a2..d10f07a 100644 --- a/TCPServerSocket.cpp +++ b/TCPServerSocket.cpp @@ -5,54 +5,43 @@ namespace core { - TCPServerSocket::TCPServerSocket(EPoll &ePoll, IPAddress address) : TCPSocket(ePoll) { - + TCPServerSocket::TCPServerSocket(EPoll &ePoll, Service &service, IPAddress address) : TCPSocket(ePoll), service(service) { + service.init(this); setDescriptor(socket(AF_INET, SOCK_STREAM, 0)); int yes = 1; setsockopt(getDescriptor(), SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)); - if(bind(getDescriptor(), address.pointer, sizeof(address)) < 0) - throw Exception("Error on bind to socket"); + if(bind(getDescriptor(), address.getPointer(), address.addressLength) < 0) + throw Exception("Error on bind to socket: " + std::to_string(errno)); if(listen(getDescriptor(), 10) < 0) - throw Exception("Error on listen to socket"); + throw Exception("Error on listen to socket"); ePoll.registerSocket(this); - service = _getService(); } TCPServerSocket::~TCPServerSocket() { close(getDescriptor()); } - - void TCPServerSocket::init() {} - + void TCPServerSocket::onDataReceived(std::string data) { Log(LOG_DEBUG_2) << "Connection request on socket " << getDescriptor() << "."; Session *session = accept(); - service->sessions.push_back(session); + service.sessions.push_back(session); } Session * TCPServerSocket::accept() { Session *session = getSocketAccept(); - session->setDescriptor(::accept(getDescriptor(), (struct sockaddr *)&session->ipAddress.address, &session->ipAddress.addressLength)); + session->setDescriptor(::accept(getDescriptor(), (struct sockaddr *)&session->ipAddress.addr, &session->ipAddress.addressLength)); ePoll.registerSocket(session); Log(LOG_DEBUG_2) << "Session started on socket " << session->getDescriptor() << "."; return session; } Session * TCPServerSocket::getSocketAccept() { - return new Session(ePoll, *service); - } - - Service * TCPServerSocket::_getService() { - return getService(); - } - - Service * TCPServerSocket::getService() { - return new Service(*this); + return new Session(ePoll, service); } int TCPServerSocket::processCommand(std::string command, Session *session) { int sequence = 0; - for(auto *sessionx : service->sessions) { + for(auto *sessionx : service.sessions) { session->out << "|" << ++sequence; sessionx->output(session); session->out << "|" << std::endl; diff --git a/TCPServerSocket.h b/TCPServerSocket.h index febee0d..79a7879 100644 --- a/TCPServerSocket.h +++ b/TCPServerSocket.h @@ -32,7 +32,7 @@ namespace core { /// @param commandName the name of the command used to invoke the status display for this object. /// @return the instance of the BMATCPServerSocket. - TCPServerSocket(EPoll &ePoll, IPAddress address); + TCPServerSocket(EPoll &ePoll, Service &service, IPAddress address); /// /// The destructor for this object. @@ -40,11 +40,11 @@ namespace core { ~TCPServerSocket(); - Service *service; + Service &service; protected: - virtual void init(); +// virtual void init(); /// /// getSocketAccept is designed to allow a polymorphic extension of this object to @@ -55,14 +55,6 @@ namespace core { /// virtual Session * getSocketAccept(); - - /// - /// TCP servers can have an associated Service object that provides services for - /// sessions created by the server. You can extend the Service object and place - /// commands and server application support for extended servers. - /// - - virtual Service * getService(); /// /// Override the virtual dataReceived since for the server these @@ -88,7 +80,6 @@ namespace core { private: Session * accept(); - Service * _getService(); }; diff --git a/TCPSocket.cpp b/TCPSocket.cpp index 17c44a0..830ccf5 100644 --- a/TCPSocket.cpp +++ b/TCPSocket.cpp @@ -11,7 +11,7 @@ namespace core { void TCPSocket::connect(IPAddress &address) { setDescriptor(socket(AF_INET, SOCK_STREAM, 0)); - if(::connect(getDescriptor(), (struct sockaddr *)&address.address, address.addressLength) == -1) + if(::connect(getDescriptor(), (struct sockaddr *)&address.addr, address.addressLength) == -1) throw Exception("Error on connect to TCP socket."); } diff --git a/TLSServerSocket.cpp b/TLSServerSocket.cpp index e00df61..f445bcc 100644 --- a/TLSServerSocket.cpp +++ b/TLSServerSocket.cpp @@ -16,27 +16,27 @@ namespace core { // pthread_mutex_unlock(&(lockarray[type])); //} - TLSServerSocket::TLSServerSocket(EPoll &ePoll, IPAddress address) : TCPServerSocket(ePoll, address) { + TLSServerSocket::TLSServerSocket(EPoll &ePoll, Service service, IPAddress address) : TCPServerSocket(ePoll, service, address) { tlsServerInit(); // TODO: Convert to use core::Exception object. - if(!(((TLSService *)service)->ctx = SSL_CTX_new(SSLv23_server_method()))) + if(!(((TLSService &)service).ctx = SSL_CTX_new(SSLv23_server_method()))) throw Exception("Error while setting server method SSLv23."); - SSL_CTX_set_mode(((TLSService *)service)->ctx, SSL_MODE_RELEASE_BUFFERS | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); - SSL_CTX_set_options(((TLSService *)service)->ctx, SSL_OP_NO_TICKET); - SSL_CTX_set_session_cache_mode(((TLSService *)service)->ctx, SSL_SESS_CACHE_SERVER); + SSL_CTX_set_mode(((TLSService &)service).ctx, SSL_MODE_RELEASE_BUFFERS | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); + SSL_CTX_set_options(((TLSService &)service).ctx, SSL_OP_NO_TICKET); + SSL_CTX_set_session_cache_mode(((TLSService &)service).ctx, SSL_SESS_CACHE_SERVER); // SSL_CTX_set_generate_session_id(ctx, generate_session_id); - SSL_CTX_set_cipher_list(((TLSService *)service)->ctx, "ECDH-ECDSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA"); - if(SSL_CTX_use_certificate_file(((TLSService *)service)->ctx, sip_cert, SSL_FILETYPE_PEM) <= 0) + SSL_CTX_set_cipher_list(((TLSService &)service).ctx, "ECDH-ECDSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA"); + if(SSL_CTX_use_certificate_file(((TLSService &)service).ctx, sip_cert, SSL_FILETYPE_PEM) <= 0) throw Exception("Error looking up certificate."); - if(SSL_CTX_use_PrivateKey_file(((TLSService *)service)->ctx, sip_key, SSL_FILETYPE_PEM) < 0) + if(SSL_CTX_use_PrivateKey_file(((TLSService &)service).ctx, sip_key, SSL_FILETYPE_PEM) < 0) throw Exception("Error with private key."); - if(SSL_CTX_check_private_key(((TLSService *)service)->ctx) != 1) + if(SSL_CTX_check_private_key(((TLSService &)service).ctx) != 1) throw Exception("Private key does not match certificate."); - SSL_CTX_set_verify(((TLSService *)service)->ctx, SSL_VERIFY_PEER, NULL); - SSL_CTX_set_verify_depth(((TLSService *)service)->ctx, 1); - if(!SSL_CTX_load_verify_locations(((TLSService *)service)->ctx, sip_cacert, NULL)) + SSL_CTX_set_verify(((TLSService &)service).ctx, SSL_VERIFY_PEER, NULL); + SSL_CTX_set_verify_depth(((TLSService &)service).ctx, 1); + if(!SSL_CTX_load_verify_locations(((TLSService &)service).ctx, sip_cacert, NULL)) throw Exception("Cannot verify locations."); - SSL_CTX_set_client_CA_list(((TLSService *)service)->ctx, SSL_load_client_CA_file(sip_cacert)); + SSL_CTX_set_client_CA_list(((TLSService &)service).ctx, SSL_load_client_CA_file(sip_cacert)); Log(LOG_DEBUG_1) << "Server key authenticated."; } @@ -60,13 +60,8 @@ namespace core { } Session * TLSServerSocket::getSocketAccept() { - Session *session = new TLSSession(ePoll, *this->service); + Session *session = new TLSSession(ePoll, this->service); return session; } - Service * TLSServerSocket::getService() { - return new TLSService(*this); - } - - } diff --git a/TLSServerSocket.h b/TLSServerSocket.h index 4c86e8c..6f7d0a5 100644 --- a/TLSServerSocket.h +++ b/TLSServerSocket.h @@ -6,6 +6,7 @@ #include "Command.h" #include "Session.h" #include "IPAddress.h" +#include "Service.h" namespace core { @@ -29,7 +30,7 @@ namespace core { /// @param commandName the name of the command used to invoke the status display for this object. /// @return the instance of the BMATLSServerSocket. - TLSServerSocket(EPoll &ePoll, IPAddress address); + TLSServerSocket(EPoll &ePoll, Service service, IPAddress address); /// /// The destructor for this object. @@ -41,7 +42,6 @@ namespace core { protected: Session * getSocketAccept() override; - Service * getService() override; private: void tlsServerInit(); diff --git a/docs/html/_console_server_8h_source.html b/docs/html/_console_server_8h_source.html index 7c425a2..fa88f07 100644 --- a/docs/html/_console_server_8h_source.html +++ b/docs/html/_console_server_8h_source.html @@ -62,9 +62,11 @@ $(function() {
/home/barant/Development/BMA/server_core/ServerCore/ConsoleServer.h
-
1 #ifndef __ConsoleServer_h__
2 #define __ConsoleServer_h__
3 
4 #include "includes"
5 #include "TCPServerSocket.h"
6 #include "Service.h"
7 #include "Command.h"
8 #include "Session.h"
9 #include "EPoll.h"
10 
11 namespace core {
12 
13  class TCPSocket;
14 
18 
19  class ConsoleServer : public TCPServerSocket {
20 
21  public:
22 
23  //
24  //
25  //
26 
27  ConsoleServer(EPoll &ePoll, std::string url, short int port);
28 
29  //
30  //
31  //
32 
33  ~ConsoleServer();
34 
35  void sendToConnectedConsoles(std::string out);
36 
37  void output(Session *session) override;
38 
39  protected:
40 
41  Session * getSocketAccept() override;
42 
43  };
44 
45 }
46 
47 
48 #endif
Definition: EPoll.h:31
+
1 #ifndef __ConsoleServer_h__
2 #define __ConsoleServer_h__
3 
4 #include "includes"
5 #include "TCPServerSocket.h"
6 #include "Service.h"
7 #include "Command.h"
8 #include "Session.h"
9 #include "EPoll.h"
10 
11 namespace core {
12 
13  class TCPSocket;
14 
18 
19  class ConsoleServer : public TCPServerSocket {
20 
21  public:
22 
23  //
24  //
25  //
26 
27  ConsoleServer(EPoll &ePoll, Service service, IPAddress address);
28 
29  //
30  //
31  //
32 
33  ~ConsoleServer();
34 
35  void sendToConnectedConsoles(std::string out);
36 
37  void output(Session *session) override;
38 
39  protected:
40 
41  Session * getSocketAccept() override;
42 
43  };
44 
45 }
46 
47 
48 #endif
Definition: EPoll.h:31
Definition: Command.cpp:4
Definition: Session.h:22
+
Definition: IPAddress.h:9
+
Definition: Service.h:20
Session * getSocketAccept() override
Definition: ConsoleServer.cpp:20
void output(Session *session) override
Output the consoles array to the console.
Definition: ConsoleServer.cpp:24
Definition: ConsoleServer.h:19
diff --git a/docs/html/_i_p_address_8h_source.html b/docs/html/_i_p_address_8h_source.html index 19f61ea..8ab02af 100644 --- a/docs/html/_i_p_address_8h_source.html +++ b/docs/html/_i_p_address_8h_source.html @@ -62,11 +62,11 @@ $(function() {
/home/barant/Development/BMA/server_core/ServerCore/IPAddress.h
-
1 #ifndef __IPAddress_h__
2 #define __IPAddress_h__
3 
4 #include "includes"
5 #include "Object.h"
6 
7 namespace core {
8 
9  class IPAddress : public Object {
10 
11  public:
12  IPAddress();
13  ~IPAddress();
14 
15  struct sockaddr_in address;
16  socklen_t addressLength;
17 
18  std::string getClientAddress();
19  std::string getClientAddressAndPort();
20  int getClientPort();
21 
22  };
23 
24 }
25 
26 #endif
int getClientPort()
Get the client network port number.
Definition: IPAddress.cpp:25
+
1 #ifndef __IPAddress_h__
2 #define __IPAddress_h__
3 
4 #include "includes"
5 #include "Object.h"
6 
7 namespace core {
8 
9  class IPAddress : public Object {
10 
11  public:
12  IPAddress();
13  IPAddress(std::string address);
14  IPAddress(std::string address, int port);
15  ~IPAddress();
16 
17  struct sockaddr_in addr;
18  socklen_t addressLength;
19 
20  struct sockaddr * getPointer();
21  std::string getClientAddress();
22  std::string getClientAddressAndPort();
23  int getClientPort();
24 
25  };
26 
27 }
28 
29 #endif
int getClientPort()
Get the client network port number.
Definition: IPAddress.cpp:47
Definition: Command.cpp:4
-
std::string getClientAddressAndPort()
Get the client network address and port as xxx.xxx.xxx.xxx:ppppp.
Definition: IPAddress.cpp:18
+
std::string getClientAddressAndPort()
Get the client network address and port as xxx.xxx.xxx.xxx:ppppp.
Definition: IPAddress.cpp:40
Definition: IPAddress.h:9
-
std::string getClientAddress()
Get the client network address as xxx.xxx.xxx.xxx.
Definition: IPAddress.cpp:13
+
std::string getClientAddress()
Get the client network address as xxx.xxx.xxx.xxx.
Definition: IPAddress.cpp:35
Definition: Object.h:8
diff --git a/docs/html/_service_8h_source.html b/docs/html/_service_8h_source.html index 897b817..b5603ec 100644 --- a/docs/html/_service_8h_source.html +++ b/docs/html/_service_8h_source.html @@ -62,14 +62,14 @@ $(function() {
/home/barant/Development/BMA/server_core/ServerCore/Service.h
-
1 #ifndef __Service_h__
2 #define __Service_h__
3 
4 #include "Object.h"
5 #include "CommandList.h"
6 
7 namespace core {
8 
9  class TCPServerSocket;
10 
19 
20  class Service : public Object {
21 
22  public:
23 
29 
31 
32  void removeFromSessionList(Session *session);
33 
34  virtual void sessionErrorHandler(std::string errorString, Session *session);
35 
39 
40  std::vector<Session *> sessions;
41 
46 
48 
53 
55 
56  };
57 
58 }
59 
60 #endif
CommandList commands
Definition: Service.h:54
+
1 #ifndef __Service_h__
2 #define __Service_h__
3 
4 #include "Object.h"
5 #include "CommandList.h"
6 
7 namespace core {
8 
9  class TCPServerSocket;
10 
19 
20  class Service : public Object {
21 
22  public:
23 
29 
30  Service();
31 
32  virtual void init(TCPServerSocket *server);
33 
34  void removeFromSessionList(Session *session);
35 
36  virtual void sessionErrorHandler(std::string errorString, Session *session);
37 
41 
42  std::vector<Session *> sessions;
43 
48 
50 
55 
57 
58  };
59 
60 }
61 
62 #endif
Service()
Definition: Service.cpp:7
+
CommandList commands
Definition: Service.h:56
Definition: Command.cpp:4
Definition: Session.h:22
-
std::vector< Session * > sessions
Definition: Service.h:40
-
Service(TCPServerSocket &server)
Definition: Service.cpp:7
+
std::vector< Session * > sessions
Definition: Service.h:42
+
TCPServerSocket * server
Definition: Service.h:49
Definition: Service.h:20
Definition: Object.h:8
-
TCPServerSocket & server
Definition: Service.h:47
Definition: CommandList.h:17
Definition: TCPServerSocket.h:22
diff --git a/docs/html/_t_c_p_server_socket_8h_source.html b/docs/html/_t_c_p_server_socket_8h_source.html index 456bb90..6eaf43a 100644 --- a/docs/html/_t_c_p_server_socket_8h_source.html +++ b/docs/html/_t_c_p_server_socket_8h_source.html @@ -62,19 +62,19 @@ $(function() {
/home/barant/Development/BMA/server_core/ServerCore/TCPServerSocket.h
-
1 #ifndef __TCPServerSocket_h__
2 #define __TCPServerSocket_h__
3 
4 #include "Socket.h"
5 #include "TCPSocket.h"
6 #include "Service.h"
7 
8 namespace core {
9 
21 
22  class TCPServerSocket : public TCPSocket, public Command {
23 
24  public:
25 
34 
35  TCPServerSocket(EPoll &ePoll, std::string url, short int port);
36 
40 
42 
43  Service *service;
44 
45  protected:
46 
47  virtual void init();
48 
56 
57  virtual Session * getSocketAccept();
58 
64 
65  virtual Service * getService();
66 
76 
77  void onDataReceived(std::string data) override;
78 
85 
86  int processCommand(std::string command, Session *session) override;
87 
88  private:
89 
90  Session * accept();
91  Service * _getService();
92 
93  };
94 
95 }
96 
97 #endif
Definition: EPoll.h:31
+
1 #ifndef __TCPServerSocket_h__
2 #define __TCPServerSocket_h__
3 
4 #include "Socket.h"
5 #include "TCPSocket.h"
6 #include "Service.h"
7 
8 namespace core {
9 
21 
22  class TCPServerSocket : public TCPSocket, public Command {
23 
24  public:
25 
34 
35  TCPServerSocket(EPoll &ePoll, Service service, IPAddress address);
36 
40 
42 
43  Service &service;
44 
45  protected:
46 
47 // virtual void init();
48 
56 
57  virtual Session * getSocketAccept();
58 
68 
69  void onDataReceived(std::string data) override;
70 
77 
78  int processCommand(std::string command, Session *session) override;
79 
80  private:
81 
82  Session * accept();
83 
84  };
85 
86 }
87 
88 #endif
Definition: EPoll.h:31
Definition: Command.cpp:4
Definition: Session.h:22
-
void onDataReceived(std::string data) override
Definition: TCPServerSocket.cpp:34
-
TCPServerSocket(EPoll &ePoll, std::string url, short int port)
Definition: TCPServerSocket.cpp:8
-
virtual Session * getSocketAccept()
Definition: TCPServerSocket.cpp:48
-
virtual Service * getService()
Definition: TCPServerSocket.cpp:56
+
void onDataReceived(std::string data) override
Definition: TCPServerSocket.cpp:24
+
Definition: IPAddress.h:9
+
virtual Session * getSocketAccept()
Definition: TCPServerSocket.cpp:38
+
TCPServerSocket(EPoll &ePoll, Service service, IPAddress address)
Definition: TCPServerSocket.cpp:8
Definition: Service.h:20
-
int processCommand(std::string command, Session *session) override
Definition: TCPServerSocket.cpp:60
+
int processCommand(std::string command, Session *session) override
Definition: TCPServerSocket.cpp:42
Definition: Command.h:18
Definition: TCPSocket.h:20
Definition: TCPServerSocket.h:22
-
~TCPServerSocket()
Definition: TCPServerSocket.cpp:28
+
~TCPServerSocket()
Definition: TCPServerSocket.cpp:20
-
1 #ifndef TLSServerSocket_h__
2 #define TLSServerSocket_h__
3 
4 #include "Socket.h"
5 #include "TCPServerSocket.h"
6 #include "Command.h"
7 #include "Session.h"
8 
9 namespace core {
10 
17 
19 
20  public:
21 
30 
31  TLSServerSocket(EPoll &ePoll, std::string url, short int port);
32 
36 
38 
39 // SSL_CTX *ctx;
40 
41  protected:
42  Session * getSocketAccept() override;
43  Service * getService() override;
44 
45  private:
46  void tlsServerInit();
47 
48  char *sip_cacert = (char *)"/home/barant/testkeys/certs/pbxca.crt";
49  char *sip_cert = (char *)"/home/barant/testkeys/certs/pbxserver.crt";
50  char *sip_key = (char *)"/home/barant/testkeys/certs/pbxserver.key";
51 
52  };
53 
54 }
55 
56 #endif
Definition: EPoll.h:31
+
1 #ifndef TLSServerSocket_h__
2 #define TLSServerSocket_h__
3 
4 #include "Socket.h"
5 #include "TCPServerSocket.h"
6 #include "Command.h"
7 #include "Session.h"
8 #include "IPAddress.h"
9 #include "Service.h"
10 
11 namespace core {
12 
19 
21 
22  public:
23 
32 
33  TLSServerSocket(EPoll &ePoll, Service service, IPAddress address);
34 
38 
40 
41 // SSL_CTX *ctx;
42 
43  protected:
44  Session * getSocketAccept() override;
45 
46  private:
47  void tlsServerInit();
48 
49  char *sip_cacert = (char *)"/home/barant/testkeys/certs/pbxca.crt";
50  char *sip_cert = (char *)"/home/barant/testkeys/certs/pbxserver.crt";
51  char *sip_key = (char *)"/home/barant/testkeys/certs/pbxserver.key";
52 
53  };
54 
55 }
56 
57 #endif
Definition: EPoll.h:31
Definition: Command.cpp:4
Definition: Session.h:22
-
TLSServerSocket(EPoll &ePoll, std::string url, short int port)
Definition: TLSServerSocket.cpp:19
-
Service * getService() override
Definition: TLSServerSocket.cpp:67
+
Definition: IPAddress.h:9
Definition: Service.h:20
~TLSServerSocket()
Definition: TLSServerSocket.cpp:43
Session * getSocketAccept() override
Definition: TLSServerSocket.cpp:62
Definition: TCPServerSocket.h:22
-
Definition: TLSServerSocket.h:18
+
TLSServerSocket(EPoll &ePoll, Service service, IPAddress address)
Definition: TLSServerSocket.cpp:19
+
Definition: TLSServerSocket.h:20
-
1 #ifndef __TLSService_h__
2 #define __TLSService_h__
3 
4 #include "includes"
5 #include "Service.h"
6 #include "TLSServerSocket.h"
7 
8 namespace core {
9 
10  class TLSService : public Service {
11 
12  public:
14  SSL_CTX *ctx;
15 
16 
17  };
18 
19 }
20 
21 #endif
Definition: TLSService.h:10
+
1 #ifndef __TLSService_h__
2 #define __TLSService_h__
3 
4 #include "includes"
5 #include "Service.h"
6 #include "TLSServerSocket.h"
7 
8 namespace core {
9 
10  class TLSService : public Service {
11 
12  public:
14  SSL_CTX *ctx;
15 
16 
17  };
18 
19 }
20 
21 #endif
Definition: TLSService.h:10
Definition: Command.cpp:4
+
TCPServerSocket * server
Definition: Service.h:49
Definition: Service.h:20
-
TCPServerSocket & server
Definition: Service.h:47
-
Definition: TLSServerSocket.h:18
+
Definition: TLSServerSocket.h:20
- - + + @@ -112,8 +112,8 @@ void  - - + + @@ -172,11 +172,6 @@ Protected Member Functions - - - - @@ -200,9 +195,9 @@ void < - - + + diff --git a/docs/html/classcore_1_1_i_p_address-members.html b/docs/html/classcore_1_1_i_p_address-members.html index 81e7f45..922abda 100644 --- a/docs/html/classcore_1_1_i_p_address-members.html +++ b/docs/html/classcore_1_1_i_p_address-members.html @@ -69,15 +69,18 @@ $(function() {

This is the complete list of members for core::IPAddress, including all inherited members.

Public Member Functions

ConsoleServer (EPoll &ePoll, std::string url, short int port)
 
ConsoleServer (EPoll &ePoll, Service service, IPAddress address)
 
void sendToConnectedConsoles (std::string out)
 
 Output the consoles array to the console.
 
- Public Member Functions inherited from core::TCPServerSocket
 TCPServerSocket (EPoll &ePoll, std::string url, short int port)
 
 TCPServerSocket (EPoll &ePoll, Service service, IPAddress address)
 
 ~TCPServerSocket ()
 
- Public Member Functions inherited from core::TCPSocket
SessiongetSocketAccept () override
 
- Protected Member Functions inherited from core::TCPServerSocket
-virtual void init ()
 
virtual ServicegetService ()
 
void onDataReceived (std::string data) override
 
int processCommand (std::string command, Session *session) override
shutdown ()

Additional Inherited Members

- Public Attributes inherited from core::TCPServerSocket
-Serviceservice
 
+Serviceservice
 
- Public Attributes inherited from core::TCPSocket
IPAddress ipAddress
- + - - - - + + + + + + +
address (defined in core::IPAddress)core::IPAddress
addr (defined in core::IPAddress)core::IPAddress
addressLength (defined in core::IPAddress)core::IPAddress
getClientAddress()core::IPAddress
getClientAddressAndPort()core::IPAddress
getClientPort()core::IPAddress
IPAddress() (defined in core::IPAddress)core::IPAddress
name (defined in core::Object)core::Object
tag (defined in core::Object)core::Object
~IPAddress() (defined in core::IPAddress)core::IPAddress
getPointer() (defined in core::IPAddress)core::IPAddress
IPAddress() (defined in core::IPAddress)core::IPAddress
IPAddress(std::string address) (defined in core::IPAddress)core::IPAddress
IPAddress(std::string address, int port) (defined in core::IPAddress)core::IPAddress
name (defined in core::Object)core::Object
tag (defined in core::Object)core::Object
~IPAddress() (defined in core::IPAddress)core::IPAddress