X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/65bf2eef7ac487329a3af3cd1c06e7957afc3a6c..2f5c973fdf3f7fb25b13996b66d566c58066f6a0:/Server/src/server.cpp?ds=sidebyside diff --git a/Server/src/server.cpp b/Server/src/server.cpp index bbf41c0..a05285a 100644 --- a/Server/src/server.cpp +++ b/Server/src/server.cpp @@ -25,25 +25,79 @@ // $Id$ // -#include "server.h" +#include "plaqui/server/server.h" +#include "plaqui/server/connection.h" +#include "plaqui/server/controlserver.h" +#include +#ifdef DEBUG +# include "plaqui/server/string.h" +# include +#endif // DEBUG -using namespace Plaqui; +using namespace std; + +namespace PlaQui { + +namespace Server { + +Server::~Server(void) { +#ifdef DEBUG + cerr << __FILE__ << ": destructor." << endl; +#endif // DEBUG +} Server::Server(int port): - socket(sockbuf::sock_stream) { -#warning Not implemented! - // TODO + TCPServer(port) { +#ifdef DEBUG + cerr << __FILE__ << ": port = " << port << endl; +#endif // DEBUG } -bool Server::start_transmission(std::string host, int port) { -#warning Not implemented! +/// \todo Implementar. +bool Server::start_transmission(string host, int port) { +#ifdef DEBUG + cerr << __FILE__ << ": start_transmission(host = " << host + << " | port = " << port << ")" << endl; +#endif // DEBUG // TODO return false; } + +Connection* Server::new_connection( + const sockbuf::sockdesc& sd) { +#ifdef DEBUG + cerr << __FILE__ << ": new_connection(sd = " << sd.sock << ")" + << endl; +#endif // DEBUG + ControlServer* connection = new ControlServer(sd); + // TODO verificar si el new se hace bien? no creo. + connection->signal_command_received().connect( + SigC::slot_class(*this, &Server::on_control_command_received)); + // TODO: + return connection; +} -bool Server::stop_transmission(std::string host, int port) { -#warning Not implemented! +/// \todo Implementar. +bool Server::stop_transmission(string host, int port) { +#ifdef DEBUG + cerr << __FILE__ << ": stop_transmission(host = " << host + << " | port = " << port << ")" << endl; +#endif // DEBUG // TODO return false; } +/// \todo Implementar. +void Server::on_control_command_received(const Command& command) { +#ifdef DEBUG + cerr << __FILE__ << ": on_control_command_received(target = " + << command.get_target() << ", command = " << command.get_command() + << ", args = [" << String::join(command.get_args(), ", ") << "])" + << endl; +#endif // DEBUG +} + +} // namespace Server + +} // namespace PlaQui +