--- /dev/null
+# vim: set noexpandtab tabstop=4 shiftwidth=4:
+#----------------------------------------------------------------------------
+# PlaQui
+#----------------------------------------------------------------------------
+# This file is part of PlaQui.
+#
+# PlaQui is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along
+# with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#----------------------------------------------------------------------------
+# Creado: sáb oct 18 21:24:06 ART 2003
+# Autores: Leandro Lucarella <llucare@fi.uba.ar>
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+
+# Opciones para el compilador.
+CXXFLAGS=-ansi -pedantic -Wall -g
+LDFLAGS=-lsocket++
+
+TARGETS=connection.o controlclient.o controlserver.o receiver.o transmitter.o \
+ server.o
+
+# Regla por defecto.
+all: $(TARGETS)
+
+runnable_h=runnable.h
+
+connection_h=$(runnable_h) connection.h
+connection.o: $(connection_h)
+
+controlclient_h=$(connection_h) controlclient.h
+controlclient.o: $(controlclient_h)
+
+controlserver_h=$(connection_h) controlserver.h
+controlserver.o: $(controlserver_h)
+
+receiver_h=$(connection_h) receiver.h
+receiver.o: $(receiver_h)
+
+transmitter_h=$(connection_h) transmitter.h
+transmitter.o: $(transmitter_h)
+
+clean:
+ rm -f $(TARGETS) *.o
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "connection.h"
+#include <socket++/sockinet.h>
+
+using namespace Plaqui;
+
+Connection::Connection(const sockinetbuf& sb):
+ socket(sb) {
+}
+
+Connection::Connection(sockbuf::type type):
+ socket(type) {
+}
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_CONNECTION_H
+#define PLAQUI_CONNECTION_H
+
+#include "runnable.h"
+#include <socket++/sockinet.h>
+
+namespace Plaqui {
+
+ /// Conexión.
+ class Connection: public Runnable {
+
+ protected:
+
+ /// Socket a usar en la conexión.
+ iosockinet socket;
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~Connection(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param socket Socket a usar en la conexión.
+ */
+ Connection(const sockinetbuf& sb);
+
+ /**
+ * Constructor.
+ *
+ * \param type Tipo de socket a usar.
+ */
+ Connection(sockbuf::type type);
+
+ };
+
+}
+
+#endif // PLAQUI_CONNECTION_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "controlclient.h"
+
+using namespace Plaqui;
+
+ControlClient::ControlClient(std::string host, int port):
+ Connection(sockbuf::sock_stream) {
+ socket->connect(host.c_str(), port);
+}
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_CONTROLCLIENT_H
+#define PLAQUI_CONTROLCLIENT_H
+
+#include "connection.h"
+#include <string>
+
+namespace Plaqui {
+
+ /// Conexión para enviar comandos de control a una planta.
+ class ControlClient: public Connection {
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~ControlClient(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param host Host al cual conectarse para enviar comandos de
+ * control.
+ * \param port Puerto al cual conectarse.
+ */
+ ControlClient(std::string host = "localhost", int port = 7522);
+
+ };
+
+}
+
+#endif // PLAQUI_CONTROLCLIENT_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "controlserver.h"
+
+using namespace Plaqui;
+
+//ControlServer::ControlServer(const iosockinet& socket) {
+//}
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_CONTROLSERVER_H
+#define PLAQUI_CONTROLSERVER_H
+
+#include "connection.h"
+#include <socket++/sockinet.h>
+
+namespace Plaqui {
+
+ /// Conexión para recibir comandos de control para una planta.
+ class ControlServer: public Connection {
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~ControlServer(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param socket Socket a usar para recibir comandos.
+ */
+ ControlServer(const sockinetbuf& socket): Connection(socket) {}
+
+ };
+
+}
+
+
+#endif // PLAQUI_CONTROLSERVER_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "receiver.h"
+
+/*
+Receiver::Receiver(int port, std::string host): Connection(sockbuf::dgram) {
+ socket->bind(port);
+}
+*/
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_RECEIVER_H
+#define PLAQUI_RECEIVER_H
+
+#include "connection.h"
+#include <socket++/sockinet.h>
+#include <string>
+
+namespace Plaqui {
+
+ /// Conexión para recibir el estado de una planta.
+ class Receiver: public Connection {
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~Receiver(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param port Puerto por el cual recibir estado de la planta.
+ * \param host Host del cual recibir el estado de la planta.
+ */
+ Receiver(int port = 7528 /*, std::string host = "localhost"*/):
+ Connection(sockbuf::sock_dgram) { socket->bind(port); }
+
+ };
+
+}
+
+#endif // PLAQUI_RECEIVER_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 20:55:08 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_RUNNABLE_H
+#define PLAQUI_RUNNABLE_H
+
+namespace Plaqui {
+
+ /// ealizauna tarea (generalmente en un thread).
+ class Runnable {
+
+ public:
+
+ /// Realiza la tarea.
+ virtual void run(void) = 0;
+
+ };
+
+}
+
+#endif // PLAQUI_RUNNABLE_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "server.h"
+
+using namespace Plaqui;
+
+Server::Server(int port):
+ socket(sockbuf::sock_stream) {
+#warning Not implemented!
+ // TODO
+}
+
+bool Server::start_transmission(std::string host, int port) {
+#warning Not implemented!
+ // TODO
+ return false;
+}
+
+bool Server::stop_transmission(std::string host, int port) {
+#warning Not implemented!
+ // TODO
+ return false;
+}
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_SERVER_H
+#define PLAQUI_SERVER_H
+
+#include "controlserver.h"
+#include "transmitter.h"
+#include <socket++/sockinet.h>
+#include <string>
+#include <list>
+
+namespace Plaqui {
+
+ /**
+ * Servidor de plantas químicas.
+ * Maneja muchas conexiones, de control o de transmisión.
+ */
+ class Server: public Runnable {
+
+ private:
+
+ /// Lista de conexiones de control.
+ typedef std::list<ControlServer*> ControllerList;
+
+ /// Lista de conexiones de control.
+ typedef std::list<Transmitter*> TransmitterList;
+
+ /// Socket para escuchar conexiones.
+ sockbuf socket;
+
+ /// Conexiones de control.
+ ControllerList controllers;
+
+ /// Transmisiones del estado de las plantas.
+ TransmitterList transmissions;
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~Server(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param port Puerto en el cual escuchar.
+ */
+ Server(int port = 7522);
+
+ /**
+ * Comienza la transimisión del estado de una planta.
+ *
+ * \param host Host al cual se quiere transmitir.
+ * \param port Puerto al cual transmitir.
+ *
+ * \return true si se pudo empezar a transmitir, false si no.
+ *
+ * \todo Ver si es necesario que devuelva algo y si devuelve ver si
+ * no sería mejor que dé más información (si no se pudo abrir
+ * o si ya estaba abierto por ejemplo.
+ */
+ bool start_transmission(std::string host = "localhost",
+ int port = 7528);
+
+ /**
+ * Finaliza la transimisión del estado de una planta.
+ *
+ * \param host Host al cual se quiere dejar de transmitir.
+ * \param port Puerto al cual dejar de transmitir.
+ *
+ * \return true si se pudo empezar a transmitir, false si no.
+ *
+ * \todo Ver si es necesario que devuelva algo y si devuelve ver si
+ * no sería mejor que dé más información (si no se pudo abrir
+ * o si ya estaba abierto por ejemplo.
+ */
+ bool stop_transmission(std::string host = "localhost",
+ int port = 7528);
+
+ };
+
+}
+
+#endif // PLAQUI_SERVER_H
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#include "transmitter.h"
+#include <socket++/sockinet.h>
+#include <string>
+
+using namespace Plaqui;
+
+Transmitter::Transmitter(std::string host, int port):
+ Connection(sockbuf::sock_dgram) {
+#warning Not implemented!
+ socket->connect(host.c_str(), port);
+}
+
--- /dev/null
+// vim: set noexpandtab tabstop=4 shiftwidth=4:
+//----------------------------------------------------------------------------
+// PlaQui
+//----------------------------------------------------------------------------
+// This file is part of PlaQui.
+//
+// PlaQui is free software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the Free Software
+// Foundation; either version 2 of the License, or (at your option) any later
+// version.
+//
+// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+// details.
+//
+// You should have received a copy of the GNU General Public License along
+// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple
+// Place, Suite 330, Boston, MA 02111-1307 USA
+//----------------------------------------------------------------------------
+// Creado: Sat Oct 18 18:18:36 2003
+// Autores: Leandro Lucarella <llucare@fi.uba.ar>
+//----------------------------------------------------------------------------
+//
+// $Id$
+//
+
+#ifndef PLAQUI_TRANSMITTER_H
+#define PLAQUI_TRANSMITTER_H
+
+#include "connection.h"
+#include <string>
+
+namespace Plaqui {
+
+ /// Conexión para transmitir el estado de una planta.
+ class Transmitter: public Connection {
+
+ public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~Transmitter(void) {}
+
+ /**
+ * Constructor.
+ *
+ * \param host Host al cual transmitir.
+ * \param port Puerto al cual transmitir.
+ */
+ Transmitter(std::string host = "localhost", int port = 7528);
+
+ };
+
+}
+
+#endif // PLAQUI_TRANSMITTER_H