]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/server.h
- Se mejora el manejo de errores (excepciones) en los tests (y en algunas otras
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / server.h
index 3776cc72e9462dd1e6a2fd569b9b247efa68d016..1179fdc2b9ae3524519238a088d5b63f646ca3f7 100644 (file)
@@ -31,6 +31,8 @@
 #include "plaqui/server/tcpserver.h"
 #include "plaqui/server/controlserver.h"
 #include "plaqui/server/transmitter.h"
+#include "plaqui/server/plant.h"
+#include "plaqui/server/command.h"
 #include <socket++/sockinet.h>
 #include <string>
 #include <list>
@@ -52,8 +54,8 @@ namespace Server {
                        /// Lista de conexiones de control.
                        typedef std::list<Transmitter*> TransmitterList;
 
-                       // TODO:
-                       // typedef std::list<Plant*> PlantList;
+                       /// Lista de plantas químicas.
+                       typedef std::list<Plant*> PlantList;
 
                // Atributos.
 
@@ -62,8 +64,14 @@ namespace Server {
                        /// Transmisiones del estado de las plantas.
                        TransmitterList transmissions;
 
-                       // TODO:
-                       // PlantList plants;
+                       /// Mutex para las transmisiones.
+                       Glib::Mutex transmissions_mutex;
+
+                       // Plantas disponibles en el servidor.
+                       PlantList plants;
+
+                       /// Mutex para las plantas.
+                       Glib::Mutex plants_mutex;
 
                // Métodos.
 
@@ -78,6 +86,21 @@ namespace Server {
                         */
                        virtual Connection* new_connection(const sockbuf::sockdesc& sd);
 
+                       /**
+                        * Maneja el comando server/status.
+                        */
+                       HTTPResponse* cmd_server_status(void) const;
+
+                       /**
+                        * Maneja el comando connection/list.
+                        */
+                       HTTPResponse* cmd_connection_list(void);
+
+                       /**
+                        * Maneja el comando connection/stop.
+                        */
+                       HTTPResponse* cmd_connection_stop(const Command& command);
+
                public:
 
                        /**
@@ -121,10 +144,9 @@ namespace Server {
 
                        /**
                         * Maneja los comandos recibidos por las conexiones.
-                        *
-                        * \todo Hacer un tipo Command abstracto o algo así.
                         */
-                       void on_control_command_received(void* command);
+                       void on_control_command_received(const Command& command,
+                                       ControlServer* controlserver);
 
        };