X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/751302dd67ffdeb0dfe72c4d2a7a2d58303cf5f3..6bffb655ac989fe4f115763270f84175bf24e4bb:/Server/include/plaqui/server/tcpserver.h diff --git a/Server/include/plaqui/server/tcpserver.h b/Server/include/plaqui/server/tcpserver.h index 0290629..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,16 +44,33 @@ namespace Server { */ class TCPServer: public Runnable { - // Tipos. + // Constantes. private: /// Cantidad máxima de conexiones pendientes. - static const unsigned MAX_PENDING_CONNECTIONS; + static const unsigned MAX_PENDING_CONNECTIONS = 10; + + // Tipos. + + private: /// 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: @@ -60,6 +78,9 @@ namespace Server { /// Socket para escuchar conexiones. sockinetbuf socket; + /// Mutex para las conexiones. + Glib::Mutex connections_mutex; + /// Conexiones de control. ConnectionList connections; @@ -104,6 +125,11 @@ namespace Server { */ void on_connection_finished(Connection* connection); + /** + * Obtiene una lista conexiones de control abiertas. + */ + ConnectionInfoList get_connected(void); + }; }