]> 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 e66be38c1ee985eaeec8211b3d50c03a2df1ed82..1179fdc2b9ae3524519238a088d5b63f646ca3f7 100644 (file)
@@ -31,6 +31,7 @@
 #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>
@@ -53,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.
 
@@ -63,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.
 
@@ -79,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:
 
                        /**
@@ -122,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(const Command& command);
+                       void on_control_command_received(const Command& command,
+                                       ControlServer* controlserver);
 
        };