X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/00cffd5f7c35a915c09d55e6292775e9e01bdeec..34fb46485db0fb44f8dcc532866d988f8e54caa2:/Server/include/plaqui/server/tcpserver.h?ds=sidebyside diff --git a/Server/include/plaqui/server/tcpserver.h b/Server/include/plaqui/server/tcpserver.h index b3ecfa6..1cd344f 100644 --- a/Server/include/plaqui/server/tcpserver.h +++ b/Server/include/plaqui/server/tcpserver.h @@ -32,6 +32,7 @@ #include "plaqui/server/connection.h" #include #include +#include namespace PlaQui { @@ -43,6 +44,13 @@ namespace Server { */ class TCPServer: public Runnable { + // Constantes. + + private: + + /// Cantidad máxima de conexiones pendientes. + static const unsigned MAX_PENDING_CONNECTIONS = 10; + // Tipos. private: @@ -50,6 +58,19 @@ namespace Server { /// Lista de conexiones de control. 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. private: @@ -57,6 +78,9 @@ namespace Server { /// Socket para escuchar conexiones. sockinetbuf socket; + /// Mutex para las conexiones. + Glib::Mutex connections_mutex; + /// Conexiones de control. ConnectionList connections; @@ -101,6 +125,11 @@ namespace Server { */ void on_connection_finished(Connection* connection); + /** + * Obtiene una lista conexiones de control abiertas. + */ + ConnectionInfoList get_connected(void); + }; }