X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/43203fc1132e402ab5751167ed64196f10f5dedf..6bffb655ac989fe4f115763270f84175bf24e4bb:/Server/include/plaqui/server/tcpserver.h diff --git a/Server/include/plaqui/server/tcpserver.h b/Server/include/plaqui/server/tcpserver.h index b379844..1cd344f 100644 --- a/Server/include/plaqui/server/tcpserver.h +++ b/Server/include/plaqui/server/tcpserver.h @@ -28,11 +28,11 @@ #ifndef PLAQUI_TCPSERVER_H #define PLAQUI_TCPSERVER_H -#include "plaqui/server/controlserver.h" -#include "plaqui/server/transmitter.h" +#include "plaqui/server/runnable.h" +#include "plaqui/server/connection.h" #include -#include #include +#include namespace PlaQui { @@ -44,12 +44,32 @@ namespace Server { */ class TCPServer: public Runnable { + // Constantes. + + private: + + /// Cantidad máxima de conexiones pendientes. + static const unsigned MAX_PENDING_CONNECTIONS = 10; + // Tipos. private: /// Lista de conexiones de control. - typedef std::list ConnectionList; + typedef std::list ConnectionList; + + public: + + /// Información sobre una conexión de contro. + struct ConnectionInfo { + /// Host. + std::string host; + /// Port. + unsigned port; + }; + + /// Lista de información de conexiones de control. + typedef std::vector ConnectionInfoList; // Atributos. @@ -58,6 +78,9 @@ namespace Server { /// Socket para escuchar conexiones. sockinetbuf socket; + /// Mutex para las conexiones. + Glib::Mutex connections_mutex; + /// Conexiones de control. ConnectionList connections; @@ -86,7 +109,7 @@ namespace Server { /** * Destructor. */ - virtual ~TCPServer(void) {} + virtual ~TCPServer(void); /** * Constructor. @@ -102,6 +125,11 @@ namespace Server { */ void on_connection_finished(Connection* connection); + /** + * Obtiene una lista conexiones de control abiertas. + */ + ConnectionInfoList get_connected(void); + }; }