diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-05-18 19:53:51 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-05-18 19:53:51 +0200 |
commit | fc3c50063f659584b2145addab8236a479a031b7 (patch) | |
tree | 0aa7057cb9fa7523ace98e0776d46609de58954e /src | |
parent | a3e566c4d3631076e29f3651554603184b6351a7 (diff) | |
download | mad-fc3c50063f659584b2145addab8236a479a031b7.tar mad-fc3c50063f659584b2145addab8236a479a031b7.zip |
Von sigc++ auf boost-signals migriert
Diffstat (limited to 'src')
69 files changed, 267 insertions, 265 deletions
diff --git a/src/Client/CommandManager.h b/src/Client/CommandManager.h index f1689b1..7635542 100644 --- a/src/Client/CommandManager.h +++ b/src/Client/CommandManager.h @@ -20,7 +20,7 @@ #ifndef MAD_CLIENT_COMMANDMANAGER_H_ #define MAD_CLIENT_COMMANDMANAGER_H_ -#include <sigc++/signal.h> +#include <boost/signal.hpp> namespace Mad { @@ -39,7 +39,7 @@ class CommandManager { unsigned int activeRequests; - sigc::signal<void> finished; + boost::signal0<void> finished; bool disconnect; @@ -71,7 +71,7 @@ class CommandManager { bool requestsActive() {return (activeRequests > 0);} bool willDisconnect() {return disconnect;} - sigc::signal<void> signalFinished() const {return finished;} + boost::signal0<void>& signalFinished() {return finished;} }; } diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 1b40046..78b3570 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -33,7 +33,8 @@ #include <iostream> #include <cstdio> -#include <sigc++/bind.h> + +#include <boost/bind.hpp> namespace Mad { namespace Client { @@ -111,9 +112,9 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std:: void CommandParser::fsinfoCommand(const std::vector<std::string> &args) { if(args.size() == 1) - Common::RequestManager::get()->sendRequest<Common::Requests::FSInfoRequest>(connection, sigc::mem_fun(CommandManager::get(), &CommandManager::fsInfoRequestFinished)); + Common::RequestManager::get()->sendRequest<Common::Requests::FSInfoRequest>(connection, boost::bind(&CommandManager::fsInfoRequestFinished, CommandManager::get(), _1)); else if(args.size() == 2) - Common::RequestManager::get()->sendRequest<Requests::DaemonFSInfoRequest>(connection, sigc::mem_fun(CommandManager::get(), &CommandManager::daemonFSInfoRequestFinished), args[1]); + Common::RequestManager::get()->sendRequest<Requests::DaemonFSInfoRequest>(connection, boost::bind(&CommandManager::daemonFSInfoRequestFinished, CommandManager::get(), _1), args[1]); else { Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str()); printUsage("fsinfo"); @@ -215,7 +216,7 @@ void CommandParser::rebootCommand(const std::vector<std::string> &args) { for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) { Common::RequestManager::get()->sendRequest<Requests::DaemonCommandRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished), host->first, true + boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1), host->first, true ); ++CommandManager::get()->activeRequests; @@ -233,7 +234,7 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) { for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) { Common::RequestManager::get()->sendRequest<Requests::DaemonCommandRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished), host->first, false + boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1), host->first, false ); ++CommandManager::get()->activeRequests; @@ -243,10 +244,10 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) { void CommandParser::statusCommand(const std::vector<std::string> &args) { if(args.size() == 1) Common::RequestManager::get()->sendRequest<Common::Requests::StatusRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished)); + boost::bind(&CommandManager::statusRequestFinished, CommandManager::get(), _1)); else if(args.size() == 2) Common::RequestManager::get()->sendRequest<Requests::DaemonStatusRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished), args[1]); + boost::bind(&CommandManager::daemonStatusRequestFinished, CommandManager::get(), _1), args[1]); else { Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str()); printUsage("status"); @@ -279,21 +280,21 @@ void CommandParser::userInfoCommand(const std::vector<std::string> &args) { ++CommandManager::get()->activeRequests; Common::RequestManager::get()->sendRequest<Common::Requests::UserInfoRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::userInfoRequestFinished), uid); + boost::bind(&CommandManager::userInfoRequestFinished, CommandManager::get(), _1), uid); } void CommandParser::listUsersCommand(const std::vector<std::string>&) { ++CommandManager::get()->activeRequests; Common::RequestManager::get()->sendRequest<Common::Requests::UserListRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished)); + boost::bind(&CommandManager::userListRequestFinished, CommandManager::get(), _1)); } void CommandParser::exitCommand(const std::vector<std::string>&) { ++CommandManager::get()->activeRequests; Common::RequestManager::get()->sendRequest<Common::Requests::DisconnectRequest>(connection, - sigc::mem_fun(CommandManager::get(), &CommandManager::disconnectRequestFinished)); + boost::bind(&CommandManager::disconnectRequestFinished, CommandManager::get(), _1)); } bool CommandParser::parse(const std::string &cmd) { diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp index 6c36495..f1627f4 100644 --- a/src/Client/InformationManager.cpp +++ b/src/Client/InformationManager.cpp @@ -39,7 +39,7 @@ void InformationManager::DaemonStateUpdateRequestHandler::handlePacket(const Com sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -55,7 +55,7 @@ void InformationManager::DaemonStateUpdateRequestHandler::handlePacket(const Com ret.setType("OK"); sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } @@ -72,7 +72,7 @@ void InformationManager::updateDaemonList(Common::Connection *con) { return; Common::RequestManager::get()->sendRequest<Requests::DaemonListRequest>(con, - sigc::mem_fun(this, &InformationManager::daemonListRequestFinished)); + boost::bind(&InformationManager::daemonListRequestFinished, this, _1)); updating = true; } diff --git a/src/Client/Makefile.in b/src/Client/Makefile.in index 94a059f..29cec75 100644 --- a/src/Client/Makefile.in +++ b/src/Client/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -93,6 +94,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -224,8 +226,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Client/Requests/Makefile.in b/src/Client/Requests/Makefile.in index 820cb4d..01665de 100644 --- a/src/Client/Requests/Makefile.in +++ b/src/Client/Requests/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -83,6 +84,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -214,8 +216,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Common/ActionManager.cpp b/src/Common/ActionManager.cpp index 166001a..fc3c034 100644 --- a/src/Common/ActionManager.cpp +++ b/src/Common/ActionManager.cpp @@ -23,8 +23,6 @@ #include <fcntl.h> #include <signal.h> -#include <sigc++/adaptors/hide.h> - namespace Mad { namespace Common { @@ -39,7 +37,7 @@ void ActionManager::doInit() { fcntl(notifyPipe[0], F_SETFL, fcntl(notifyPipe[0], F_GETFL) | O_NONBLOCK); fcntl(notifyPipe[1], F_SETFL, fcntl(notifyPipe[1], F_GETFL) | O_NONBLOCK); - Net::FdManager::get()->registerFd(notifyPipe[0], sigc::hide(sigc::mem_fun(this, &ActionManager::run)), POLLIN); + Net::FdManager::get()->registerFd(notifyPipe[0], boost::bind(&ActionManager::run, this), POLLIN); } void ActionManager::doDeinit() { @@ -65,7 +63,7 @@ void ActionManager::run() { return; } - sigc::slot<void> action = actions.front(); + boost::function0<void> action = actions.front(); actions.pop(); sigprocmask(SIG_SETMASK, &oldset, 0); @@ -74,7 +72,7 @@ void ActionManager::run() { } } -void ActionManager::add(const sigc::slot<void> &action) { +void ActionManager::add(const boost::function0<void> &action) { sigset_t set, oldset; sigfillset(&set); sigprocmask(SIG_SETMASK, &set, &oldset); diff --git a/src/Common/ActionManager.h b/src/Common/ActionManager.h index e47652e..5d3dc15 100644 --- a/src/Common/ActionManager.h +++ b/src/Common/ActionManager.h @@ -25,14 +25,14 @@ #include <queue> #include <unistd.h> -#include <sigc++/slot.h> +#include <boost/function.hpp> namespace Mad { namespace Common { class ActionManager : public Initializable { private: - std::queue<sigc::slot<void> > actions; + std::queue<boost::function0<void> > actions; int notifyPipe[2]; static ActionManager actionManager; @@ -45,7 +45,7 @@ class ActionManager : public Initializable { public: void run(); - void add(const sigc::slot<void> &action); + void add(const boost::function0<void> &action); static ActionManager *get() { if(!actionManager.isInitialized()) diff --git a/src/Common/Base64Encoder.cpp b/src/Common/Base64Encoder.cpp index 9607ec9..a2795d6 100644 --- a/src/Common/Base64Encoder.cpp +++ b/src/Common/Base64Encoder.cpp @@ -189,18 +189,18 @@ std::vector<boost::uint8_t> Base64Encoder::decode(const std::string &data) { boost::uint8_t *ptr = buf.get(); for(size_t in = 0; in < data.length()-1; in += 4) { - if(b64[data[in]] >= 64 || b64[data[in+1]] >= 64) + if(b64[(size_t)data[in]] >= 64 || b64[(size_t)data[in+1]] >= 64) break; - *ptr++ = (b64[data[in]] << 2) + (b64[data[in+1]] >> 4); - if(in >= data.length()-2 || b64[data[in+2]] >= 64) + *ptr++ = (b64[(size_t)data[in]] << 2) + (b64[(size_t)data[in+1]] >> 4); + if(in >= data.length()-2 || b64[(size_t)data[in+2]] >= 64) break; - *ptr++ = (b64[data[in+1]] << 4) + (b64[data[in+2]] >> 2); - if(in >= data.length()-3 || b64[data[in+3]] >= 64) + *ptr++ = (b64[(size_t)data[in+1]] << 4) + (b64[(size_t)data[in+2]] >> 2); + if(in >= data.length()-3 || b64[(size_t)data[in+3]] >= 64) break; - *ptr++ = (b64[data[in+2]] << 6) + b64[data[in+3]]; + *ptr++ = (b64[(size_t)data[in+2]] << 6) + b64[(size_t)data[in+3]]; } return std::vector<boost::uint8_t>(buf.get(), ptr); diff --git a/src/Common/ClientConnection.cpp b/src/Common/ClientConnection.cpp index 7b33fb2..381f822 100644 --- a/src/Common/ClientConnection.cpp +++ b/src/Common/ClientConnection.cpp @@ -26,7 +26,7 @@ namespace Mad { namespace Common { ClientConnection::ClientConnection() : connection(new Net::ClientConnection) { - connection->signalReceive().connect(sigc::mem_fun(this, &ClientConnection::receive)); + connection->signalReceive().connect(boost::bind(&ClientConnection::receive, this, _1)); } bool ClientConnection::send(const Net::Packet &packet) { diff --git a/src/Common/Connection.cpp b/src/Common/Connection.cpp index 510731f..f476a68 100644 --- a/src/Common/Connection.cpp +++ b/src/Common/Connection.cpp @@ -20,8 +20,6 @@ #include "Connection.h" #include "XmlPacket.h" -#include <sigc++/bind.h> - namespace Mad { namespace Common { diff --git a/src/Common/Connection.h b/src/Common/Connection.h index 860c044..ea90c4c 100644 --- a/src/Common/Connection.h +++ b/src/Common/Connection.h @@ -23,7 +23,7 @@ #include <stdint.h> #include <sys/types.h> -#include <sigc++/signal.h> +#include <boost/signal.hpp> namespace Mad { @@ -39,7 +39,7 @@ class Connection { private: bool authenticated; - sigc::signal<void, const XmlPacket&, uint16_t> signal; + boost::signal2<void, const XmlPacket&, uint16_t> signal; // Prevent shallow copy Connection(const Connection &o); @@ -57,7 +57,7 @@ class Connection { bool sendPacket(const XmlPacket &packet, uint16_t requestId); - sigc::signal<void, const XmlPacket&, uint16_t> signalReceive() const { + boost::signal2<void, const XmlPacket&, uint16_t>& signalReceive() { return signal; } diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in index ef3993d..8b66f20 100644 --- a/src/Common/Makefile.in +++ b/src/Common/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -97,6 +98,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -228,8 +230,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Common/Request.h b/src/Common/Request.h index 7ab2816..3979e0c 100644 --- a/src/Common/Request.h +++ b/src/Common/Request.h @@ -24,7 +24,8 @@ #include <Net/Exception.h> #include <memory> -#include <sigc++/adaptors/hide.h> + +#include <boost/bind.hpp> namespace Mad { namespace Common { @@ -33,19 +34,19 @@ class Request : public RequestHandler { private: friend class RequestManager; - sigc::signal<void,const Request&> finished; + boost::signal1<void, const Request&> finished; std::auto_ptr<XmlPacket> res; Net::Exception exp; public: - typedef sigc::slot<void,const Request&> slot_type; + typedef boost::function1<void, const Request&> slot_type; protected: Request(Connection *connection, uint16_t requestId, slot_type slot) : RequestHandler(connection, requestId), exp(Net::Exception::NOT_FINISHED) { finished.connect(slot); - finished.connect(sigc::hide(signalFinished().make_slot())); + finished.connect(boost::bind((void(boost::signal0<void>::*)())&boost::signal0<void>::operator(), &signalFinished())); } void finish(std::auto_ptr<XmlPacket> result) {res = result; finished(*this);} diff --git a/src/Common/RequestHandler.h b/src/Common/RequestHandler.h index e3ac19f..9c50345 100644 --- a/src/Common/RequestHandler.h +++ b/src/Common/RequestHandler.h @@ -23,7 +23,6 @@ #include "Connection.h" #include "XmlPacket.h" -#include <sigc++/signal.h> #include <stdint.h> namespace Mad { @@ -34,7 +33,7 @@ class RequestManager; class RequestHandler { private: - sigc::signal<void> finished; + boost::signal0<void> finished; Connection *connection; uint16_t requestId; @@ -46,7 +45,7 @@ class RequestHandler { protected: RequestHandler(Connection *connection0, uint16_t requestId0) : connection(connection0), requestId(requestId0) {} - sigc::signal<void> signalFinished() {return finished;} + boost::signal0<void>& signalFinished() {return finished;} Connection* getConnection() const { return connection; diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp index fa2ad88..163aa75 100644 --- a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp +++ b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp @@ -35,7 +35,7 @@ void DisconnectRequestHandler::handlePacket(const XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -47,7 +47,7 @@ void DisconnectRequestHandler::handlePacket(const XmlPacket &packet) { getConnection()->disconnect(); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp index fc98730..ed70a8b 100644 --- a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp +++ b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp @@ -21,6 +21,8 @@ #include <Net/Exception.h> #include "../Logger.h" +#include <boost/bind.hpp> + namespace Mad { namespace Common { namespace RequestHandlers { @@ -35,20 +37,20 @@ void FSInfoRequestHandler::handlePacket(const XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } // TODO Require authentication - if(!SystemManager::get()->getFSInfo(sigc::mem_fun(this, &FSInfoRequestHandler::fsInfoHandler))) { + if(!SystemManager::get()->getFSInfo(boost::bind(&FSInfoRequestHandler::fsInfoHandler, this, _1))) { XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } @@ -69,7 +71,7 @@ void FSInfoRequestHandler::fsInfoHandler(const std::vector<SystemManager::FSInfo } sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Common/RequestHandlers/Makefile.in b/src/Common/RequestHandlers/Makefile.in index e5cce2c..22ff596 100644 --- a/src/Common/RequestHandlers/Makefile.in +++ b/src/Common/RequestHandlers/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -83,6 +84,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -214,8 +216,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp index 0cfe025..0c13bd9 100644 --- a/src/Common/RequestHandlers/StatusRequestHandler.cpp +++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp @@ -22,6 +22,8 @@ #include "../SystemBackend.h" #include "../Logger.h" +#include <boost/bind.hpp> + namespace Mad { namespace Common { namespace RequestHandlers { @@ -36,17 +38,17 @@ void StatusRequestHandler::handlePacket(const XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } // TODO Require authentication - if(!SystemManager::get()->getUptimeInfo(sigc::mem_fun(this, &StatusRequestHandler::uptimeHandler))) + if(!SystemManager::get()->getUptimeInfo(boost::bind(&StatusRequestHandler::uptimeHandler, this, _1, _2))) needUptime = false; - if(!SystemManager::get()->getMemoryInfo(sigc::mem_fun(this, &StatusRequestHandler::memoryHandler))) + if(!SystemManager::get()->getMemoryInfo(boost::bind(&StatusRequestHandler::memoryHandler, this, _1, _2, _3, _4))) needMemory = false; - if(!SystemManager::get()->getLoadInfo(sigc::mem_fun(this, &StatusRequestHandler::loadHandler))) + if(!SystemManager::get()->getLoadInfo(boost::bind(&StatusRequestHandler::loadHandler, this, _1, _2, _3, _4, _5))) needLoad = false; send(); @@ -76,7 +78,7 @@ void StatusRequestHandler::send() { sent = true; - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 08be0a9..c36bd76 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -21,8 +21,7 @@ #include "RequestHandlers/DisconnectRequestHandler.h" #include "Logger.h" -#include <sigc++/bind.h> -#include <sigc++/retype_return.h> +#include <boost/bind.hpp> namespace Mad { namespace Common { @@ -39,7 +38,7 @@ bool RequestManager::RequestMap::addRequest(uint16_t id, RequestHandler *info) { if(!insert(std::make_pair(id, info)).second) return false; - info->signalFinished().connect(sigc::hide_return(sigc::bind(sigc::mem_fun(this, &RequestManager::RequestMap::deleteRequest), id))); + info->signalFinished().connect(boost::bind(&RequestManager::RequestMap::deleteRequest, this, id)); return true; } @@ -121,7 +120,7 @@ RequestManager::RequestMap* RequestManager::getUnusedRequestId(Connection *conne void RequestManager::registerConnection(Connection *connection) { requestMaps.insert(std::make_pair(connection, new RequestMap())); - connection->signalReceive().connect(sigc::bind<0>(sigc::mem_fun(this, &RequestManager::receiveHandler), connection)); + connection->signalReceive().connect(boost::bind(&RequestManager::receiveHandler, this, connection, _1, _2)); } void RequestManager::unregisterConnection(Connection *connection) { diff --git a/src/Common/Requests/Makefile.in b/src/Common/Requests/Makefile.in index c809e3c..b36e5b8 100644 --- a/src/Common/Requests/Makefile.in +++ b/src/Common/Requests/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -83,6 +84,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -214,8 +216,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Common/SystemBackend.h b/src/Common/SystemBackend.h index 9c3eaa2..ed553c2 100644 --- a/src/Common/SystemBackend.h +++ b/src/Common/SystemBackend.h @@ -31,27 +31,27 @@ class SystemBackend { protected: friend class SystemManager; - virtual bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback _UNUSED_PARAMETER_) { + virtual bool getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback _UNUSED_PARAMETER_) { + virtual bool getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback _UNUSED_PARAMETER_) { + virtual bool getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool getFSInfo(const sigc::slot<void, const std::vector<SystemManager::FSInfo>& > &callback _UNUSED_PARAMETER_) { + virtual bool getFSInfo(const boost::function1<void, const std::vector<SystemManager::FSInfo>& > &callback _UNUSED_PARAMETER_) { return false; } - virtual bool shutdown(const sigc::slot<void> &callback _UNUSED_PARAMETER_) { + virtual bool shutdown(const boost::function0<void> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool reboot(const sigc::slot<void> &callback _UNUSED_PARAMETER_) { + virtual bool reboot(const boost::function0<void> &callback _UNUSED_PARAMETER_) { return false; } diff --git a/src/Common/SystemManager.cpp b/src/Common/SystemManager.cpp index a037bd6..4a549b7 100644 --- a/src/Common/SystemManager.cpp +++ b/src/Common/SystemManager.cpp @@ -34,7 +34,7 @@ bool SystemManager::Compare::operator() (const SystemBackend *b1, const SystemBa } -bool SystemManager::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) { +bool SystemManager::getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getUptimeInfo(callback)) return true; @@ -43,7 +43,7 @@ bool SystemManager::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned return false; } -bool SystemManager::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) { +bool SystemManager::getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getMemoryInfo(callback)) return true; @@ -52,7 +52,7 @@ bool SystemManager::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned return false; } -bool SystemManager::getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) { +bool SystemManager::getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getLoadInfo(callback)) return true; @@ -61,7 +61,7 @@ bool SystemManager::getLoadInfo(const sigc::slot<void, unsigned long, unsigned l return false; } -bool SystemManager::getFSInfo(const sigc::slot<void, const std::vector<FSInfo>& > &callback) { +bool SystemManager::getFSInfo(const boost::function1<void, const std::vector<FSInfo>& > &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getFSInfo(callback)) return true; @@ -70,7 +70,7 @@ bool SystemManager::getFSInfo(const sigc::slot<void, const std::vector<FSInfo>& return false; } -bool SystemManager::shutdown(const sigc::slot<void> &callback) { +bool SystemManager::shutdown(const boost::function0<void> &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->shutdown(callback)) return true; @@ -79,7 +79,7 @@ bool SystemManager::shutdown(const sigc::slot<void> &callback) { return false; } -bool SystemManager::reboot(const sigc::slot<void> &callback) { +bool SystemManager::reboot(const boost::function0<void> &callback) { for(std::set<SystemBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->reboot(callback)) return true; diff --git a/src/Common/SystemManager.h b/src/Common/SystemManager.h index 5de7180..20d3c05 100644 --- a/src/Common/SystemManager.h +++ b/src/Common/SystemManager.h @@ -24,7 +24,7 @@ #include <string> #include <vector> -#include <sigc++/slot.h> +#include <boost/function.hpp> namespace Mad { namespace Common { @@ -62,14 +62,14 @@ class SystemManager { backends.erase(backend); } - bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback); - bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback); - bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback); + bool getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback); + bool getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback); + bool getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback); - bool getFSInfo(const sigc::slot<void, const std::vector<FSInfo>& > &callback); + bool getFSInfo(const boost::function1<void, const std::vector<FSInfo>& > &callback); - bool shutdown(const sigc::slot<void> &callback); - bool reboot(const sigc::slot<void> &callback); + bool shutdown(const boost::function0<void> &callback); + bool reboot(const boost::function0<void> &callback); static SystemManager *get() { return &systemManager; diff --git a/src/Daemon/Backends/Makefile.in b/src/Daemon/Backends/Makefile.in index 31017c9..0500e0c 100644 --- a/src/Daemon/Backends/Makefile.in +++ b/src/Daemon/Backends/Makefile.in @@ -38,6 +38,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -65,6 +66,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -196,8 +198,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h index 492fd87..a6b6c21 100644 --- a/src/Daemon/Backends/NetworkLogger.h +++ b/src/Daemon/Backends/NetworkLogger.h @@ -32,9 +32,11 @@ class NetworkLogger : public Common::Logger { private: Common::Connection *connection; + void requestFinished(const Common::Request&) {} + protected: virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) { - Common::RequestManager::get()->sendRequest<Requests::LogRequest>(connection, Common::Request::slot_type(), + Common::RequestManager::get()->sendRequest<Requests::LogRequest>(connection, boost::bind(&NetworkLogger::requestFinished, this, _1), category, level, messageTimestamp, message); } diff --git a/src/Daemon/Makefile.in b/src/Daemon/Makefile.in index a9faebf..4a1ef14 100644 --- a/src/Daemon/Makefile.in +++ b/src/Daemon/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -91,6 +92,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -222,8 +224,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp index 939f1f0..f7f21de 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp @@ -22,6 +22,8 @@ #include <Common/Logger.h> #include <Common/SystemManager.h> +#include <boost/bind.hpp> + namespace Mad { namespace Daemon { namespace RequestHandlers { @@ -36,7 +38,7 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -46,11 +48,11 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { std::string command = packet["command"]; if(command == "reboot") { - if(Common::SystemManager::get()->shutdown(sigc::mem_fun(this, &CommandRequestHandler::sendReply))) + if(Common::SystemManager::get()->shutdown(boost::bind(&CommandRequestHandler::sendReply, this))) return; } else { - if(Common::SystemManager::get()->reboot(sigc::mem_fun(this, &CommandRequestHandler::sendReply))) + if(Common::SystemManager::get()->reboot(boost::bind(&CommandRequestHandler::sendReply, this))) return; } @@ -60,7 +62,7 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } void CommandRequestHandler::sendReply() { @@ -69,7 +71,7 @@ void CommandRequestHandler::sendReply() { sendPacket(packet); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Daemon/RequestHandlers/Makefile.in b/src/Daemon/RequestHandlers/Makefile.in index 3de4cbe..8b34d1a 100644 --- a/src/Daemon/RequestHandlers/Makefile.in +++ b/src/Daemon/RequestHandlers/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -82,6 +83,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -213,8 +215,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Daemon/Requests/Makefile.in b/src/Daemon/Requests/Makefile.in index 0f16855..1492ca6 100644 --- a/src/Daemon/Requests/Makefile.in +++ b/src/Daemon/Requests/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -82,6 +83,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -213,8 +215,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Makefile.am b/src/Makefile.am index 3b9607f..7e16736 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,14 +21,14 @@ bin_PROGRAMS = mad madc mad-server mad_SOURCES = mad.cpp mad_LDADD = Daemon/libdaemon.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) @LIBLTDL@ $(daemon_modules) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) @LIBLTDL@ $(daemon_modules) mad_LDFLAGS = -export-dynamic madc_SOURCES = madc.cpp madc_LDADD = Client/libclient.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) mad_server_SOURCES = mad-server.cpp mad_server_LDADD = Server/libserver.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(server_modules) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(server_modules) mad_server_LDFLAGS = -export-dynamic diff --git a/src/Makefile.in b/src/Makefile.in index a6e80f2..e0b62dd 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -43,6 +43,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -127,6 +128,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -258,8 +260,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ @@ -274,16 +274,16 @@ server_modules = -dlpreopen modules/FileLogger.la $(am__append_2) \ $(am__append_4) $(am__append_5) mad_SOURCES = mad.cpp mad_LDADD = Daemon/libdaemon.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) @LIBLTDL@ $(daemon_modules) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) @LIBLTDL@ $(daemon_modules) mad_LDFLAGS = -export-dynamic madc_SOURCES = madc.cpp madc_LDADD = Client/libclient.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) mad_server_SOURCES = mad-server.cpp mad_server_LDADD = Server/libserver.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(server_modules) + $(BOOST_SIGNALS_LIB) $(libxml2_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(server_modules) mad_server_LDFLAGS = -export-dynamic all: all-recursive diff --git a/src/Net/ClientConnection.cpp b/src/Net/ClientConnection.cpp index 688dbc7..087d95f 100644 --- a/src/Net/ClientConnection.cpp +++ b/src/Net/ClientConnection.cpp @@ -54,7 +54,7 @@ void ClientConnection::connectionHeader() { ConnectionHeader header = {'M', 'A', 'D', daemon ? 'D' : 'C', 0, 1, 1, 1}; rawSend((uint8_t*)&header, sizeof(header)); - rawReceive(sizeof(ConnectionHeader), sigc::mem_fun(this, &ClientConnection::connectionHeaderReceiveHandler)); + rawReceive(sizeof(ConnectionHeader), boost::bind(&ClientConnection::connectionHeaderReceiveHandler, this, _1, _2)); } void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exception) { @@ -104,7 +104,7 @@ void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exc gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t)sock); - FdManager::get()->registerFd(sock, sigc::mem_fun(this, &ClientConnection::sendReceive)); + FdManager::get()->registerFd(sock, boost::bind(&ClientConnection::sendReceive, this, _1)); state = CONNECT; diff --git a/src/Net/Connection.cpp b/src/Net/Connection.cpp index cf675c9..4e5029f 100644 --- a/src/Net/Connection.cpp +++ b/src/Net/Connection.cpp @@ -25,7 +25,7 @@ #include <cstring> #include <sys/socket.h> -#include <sigc++/bind.h> +#include <boost/bind.hpp> namespace Mad { namespace Net { @@ -125,12 +125,12 @@ void Connection::enterReceiveLoop() { return; if(_isConnecting()) - ThreadManager::get()->pushWork(sigc::mem_fun(connectedSignal, &sigc::signal<void>::emit)); + ThreadManager::get()->pushWork(boost::bind((void (boost::signal0<void>::*)())&boost::signal0<void>::operator(), &connectedSignal)); state = PACKET_HEADER; lock.unlock(); - rawReceive(sizeof(Packet::Data), sigc::mem_fun(this, &Connection::packetHeaderReceiveHandler)); + rawReceive(sizeof(Packet::Data), boost::bind(&Connection::packetHeaderReceiveHandler, this, _1, _2)); } void Connection::packetHeaderReceiveHandler(const void *data, unsigned long length) { @@ -146,13 +146,13 @@ void Connection::packetHeaderReceiveHandler(const void *data, unsigned long leng header = *(const Packet::Data*)data; if(header.length == 0) { - ThreadManager::get()->pushWork(sigc::bind(sigc::mem_fun(receiveSignal, &sigc::signal<void,const Packet&>::emit), Packet(ntohs(header.requestId)))); + ThreadManager::get()->pushWork(boost::bind((void (boost::signal1<void, const Packet&>::*)(const Packet&))&boost::signal1<void, const Packet&>::operator(), &receiveSignal, Packet(ntohs(header.requestId)))); enterReceiveLoop(); } else { state = PACKET_DATA; - rawReceive(ntohs(header.length), sigc::mem_fun(this, &Connection::packetDataReceiveHandler)); + rawReceive(ntohs(header.length), boost::bind(&Connection::packetDataReceiveHandler, this, _1, _2)); } } @@ -166,7 +166,7 @@ void Connection::packetDataReceiveHandler(const void *data, unsigned long length return; } - ThreadManager::get()->pushWork(sigc::bind(sigc::mem_fun(receiveSignal, &sigc::signal<void,const Packet&>::emit), Packet(ntohs(header.requestId), data, length))); + ThreadManager::get()->pushWork(boost::bind((void (boost::signal1<void, const Packet&>::*)(const Packet&))&boost::signal1<void, const Packet&>::operator(), &receiveSignal, Packet(ntohs(header.requestId), data, length))); enterReceiveLoop(); } @@ -213,7 +213,7 @@ void Connection::doReceive() { } bool Connection::rawReceive(unsigned long length, - const sigc::slot<void,const void*,unsigned long> ¬ify) + const boost::function2<void,const void*,unsigned long> ¬ify) { if(!isConnected()) return false; @@ -271,7 +271,7 @@ bool Connection::rawSend(const uint8_t *data, unsigned long length) { if(!isConnected()) return false; - Transmission trans = {length, 0, new uint8_t[length], sigc::slot<void,const void*,unsigned long>()}; + Transmission trans = {length, 0, new uint8_t[length], boost::function2<void,const void*,unsigned long>()}; std::memcpy(trans.data, data, length); sendLock.lock(); @@ -350,7 +350,7 @@ void Connection::doDisconnect() { gnutls_deinit(session); - ThreadManager::get()->pushWork(sigc::mem_fun(disconnectedSignal, &sigc::signal<void>::emit)); + ThreadManager::get()->pushWork(boost::bind((void (boost::signal0<void>::*)())&boost::signal0<void>::operator(), &disconnectedSignal)); state = DISCONNECTED; } diff --git a/src/Net/Connection.h b/src/Net/Connection.h index 1a3e72b..a0b95ea 100644 --- a/src/Net/Connection.h +++ b/src/Net/Connection.h @@ -27,9 +27,9 @@ #include <queue> #include <string> #include <gnutls/gnutls.h> -#include <sigc++/signal.h> #include <poll.h> +#include <boost/signal.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/shared_mutex.hpp> @@ -61,7 +61,7 @@ class Connection { uint8_t *data; - sigc::slot<void,const void*,unsigned long> notify; + boost::function2<void,const void*,unsigned long> notify; }; boost::mutex receiveLock; @@ -72,9 +72,9 @@ class Connection { Packet::Data header; - sigc::signal<void,const Packet&> receiveSignal; - sigc::signal<void> connectedSignal; - sigc::signal<void> disconnectedSignal; + boost::signal1<void,const Packet&> receiveSignal; + boost::signal0<void> connectedSignal; + boost::signal0<void> disconnectedSignal; void doHandshake(); @@ -129,7 +129,7 @@ class Connection { virtual void connectionHeader() = 0; - bool rawReceive(unsigned long length, const sigc::slot<void,const void*,unsigned long> ¬ify); + bool rawReceive(unsigned long length, const boost::function2<void,const void*,unsigned long> ¬ify); bool rawSend(const uint8_t *data, unsigned long length); void enterReceiveLoop(); @@ -190,9 +190,9 @@ class Connection { bool send(const Packet &packet); - sigc::signal<void,const Packet&> signalReceive() const {return receiveSignal;} - sigc::signal<void> signalConnected() const {return connectedSignal;} - sigc::signal<void> signalDisconnected() const {return disconnectedSignal;} + boost::signal1<void,const Packet&>& signalReceive() {return receiveSignal;} + boost::signal0<void>& signalConnected() {return connectedSignal;} + boost::signal0<void>& signalDisconnected() {return disconnectedSignal;} }; } diff --git a/src/Net/FdManager.cpp b/src/Net/FdManager.cpp index c7abe73..d8faef4 100644 --- a/src/Net/FdManager.cpp +++ b/src/Net/FdManager.cpp @@ -24,9 +24,6 @@ #include <unistd.h> #include <sys/fcntl.h> -#include <sigc++/adaptors/hide.h> -#include <sigc++/bind.h> - namespace Mad { namespace Net { @@ -43,7 +40,7 @@ FdManager::FdManager() : running(false) { flags = fcntl(interruptPipe[1], F_GETFL, 0); fcntl(interruptPipe[1], F_SETFL, flags | O_NONBLOCK); - registerFd(interruptPipe[0], sigc::hide(sigc::mem_fun(this, &FdManager::readInterrupt)), POLLIN); + registerFd(interruptPipe[0], boost::bind(&FdManager::readInterrupt, this), POLLIN); } FdManager::~FdManager() { @@ -54,7 +51,7 @@ FdManager::~FdManager() { } -bool FdManager::registerFd(int fd, const sigc::slot<void, short> &handler, short events) { +bool FdManager::registerFd(int fd, const boost::function1<void, short> &handler, short events) { struct pollfd pollfd = {fd, events, 0}; boost::lock(handlerLock, eventLock); @@ -149,11 +146,11 @@ void FdManager::ioThread() { if(poll(fdarray, count, -1) > 0) { handlerLock.lock_shared(); - std::queue<sigc::slot<void> > calls; + std::queue<boost::function0<void> > calls; for(size_t n = 0; n < count; ++n) { if(fdarray[n].revents) - calls.push(sigc::bind(handlers[fdarray[n].fd], fdarray[n].revents)); + calls.push(boost::bind(handlers[fdarray[n].fd], fdarray[n].revents)); } handlerLock.unlock_shared(); diff --git a/src/Net/FdManager.h b/src/Net/FdManager.h index 406110d..1cb95bc 100644 --- a/src/Net/FdManager.h +++ b/src/Net/FdManager.h @@ -22,8 +22,8 @@ #include <map> #include <poll.h> -#include <sigc++/signal.h> +#include <boost/function.hpp> #include <boost/thread/shared_mutex.hpp> namespace Mad { @@ -41,7 +41,7 @@ class FdManager { bool running; std::map<int, struct pollfd> pollfds; - std::map<int, sigc::slot<void, short> > handlers; + std::map<int, boost::function1<void, short> > handlers; int interruptPipe[2]; @@ -64,7 +64,7 @@ class FdManager { static FdManager *get() {return &fdManager;} - bool registerFd(int fd, const sigc::slot<void, short> &handler, short events = 0); + bool registerFd(int fd, const boost::function1<void, short> &handler, short events = 0); bool unregisterFd(int fd); bool setFdEvents(int fd, short events); diff --git a/src/Net/Listener.cpp b/src/Net/Listener.cpp index 5bcc353..11cbaf5 100644 --- a/src/Net/Listener.cpp +++ b/src/Net/Listener.cpp @@ -27,8 +27,6 @@ #include <cstring> #include <fcntl.h> -#include <sigc++/bind.h> - namespace Mad { namespace Net { @@ -40,8 +38,8 @@ void Listener::acceptHandler(int) { while((sd = accept(sock, (struct sockaddr*)&sa, &addrlen)) >= 0) { ServerConnection *con = new ServerConnection(sd, IPAddress(sa), dh_params, x905CertFile, x905KeyFile); - sigc::connection con1 = con->signalConnected().connect(sigc::bind(sigc::mem_fun(this, &Listener::connectHandler), con)); - sigc::connection con2 = con->signalDisconnected().connect(sigc::bind(sigc::mem_fun(this, &Listener::disconnectHandler), con)); + boost::signals::connection con1 = con->signalConnected().connect(boost::bind(&Listener::connectHandler, this, con)); + boost::signals::connection con2 = con->signalDisconnected().connect(boost::bind(&Listener::disconnectHandler, this, con)); connections.insert(std::make_pair(con, std::make_pair(con1, con2))); @@ -51,7 +49,7 @@ void Listener::acceptHandler(int) { void Listener::connectHandler(ServerConnection *con) { - std::map<ServerConnection*, std::pair<sigc::connection, sigc::connection> >::iterator it = connections.find(con); + std::map<ServerConnection*, std::pair<boost::signals::connection, boost::signals::connection> >::iterator it = connections.find(con); if(it == connections.end()) return; @@ -65,7 +63,7 @@ void Listener::connectHandler(ServerConnection *con) { } void Listener::disconnectHandler(ServerConnection *con) { - std::map<ServerConnection*, std::pair<sigc::connection, sigc::connection> >::iterator it = connections.find(con); + std::map<ServerConnection*, std::pair<boost::signals::connection, boost::signals::connection> >::iterator it = connections.find(con); if(it == connections.end()) return; @@ -112,11 +110,11 @@ Listener::Listener(const std::string &x905CertFile0, const std::string &x905KeyF throw Exception("listen()", Exception::INTERNAL_ERRNO, errno); } - FdManager::get()->registerFd(sock, sigc::mem_fun(this, &Listener::acceptHandler), POLLIN); + FdManager::get()->registerFd(sock, boost::bind(&Listener::acceptHandler, this, _1), POLLIN); } Listener::~Listener() { - for(std::map<ServerConnection*,std::pair<sigc::connection, sigc::connection> >::iterator con = connections.begin(); con != connections.end(); ++con) { + for(std::map<ServerConnection*,std::pair<boost::signals::connection, boost::signals::connection> >::iterator con = connections.begin(); con != connections.end(); ++con) { con->first->disconnect(); delete con->first; } diff --git a/src/Net/Listener.h b/src/Net/Listener.h index 3805403..26dffab 100644 --- a/src/Net/Listener.h +++ b/src/Net/Listener.h @@ -26,7 +26,7 @@ #include <map> #include <string> -#include <sigc++/connection.h> +#include <boost/signal.hpp> namespace Mad { namespace Net { @@ -42,9 +42,9 @@ class Listener { gnutls_dh_params_t dh_params; - std::map<ServerConnection*, std::pair<sigc::connection, sigc::connection> > connections; + std::map<ServerConnection*, std::pair<boost::signals::connection, boost::signals::connection> > connections; - sigc::signal<void, ServerConnection*> signal; + boost::signal1<void, ServerConnection*> signal; void acceptHandler(int); @@ -59,7 +59,7 @@ class Listener { Listener(const std::string &x905CertFile0, const std::string &x905KeyFile0, const IPAddress &address0 = IPAddress()) throw(Exception); virtual ~Listener(); - sigc::signal<void, ServerConnection*> signalNewConnection() const {return signal;} + boost::signal1<void, ServerConnection*>& signalNewConnection() {return signal;} }; } diff --git a/src/Net/Makefile.in b/src/Net/Makefile.in index c51039d..36b924e 100644 --- a/src/Net/Makefile.in +++ b/src/Net/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -88,6 +89,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -219,8 +221,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Net/ServerConnection.cpp b/src/Net/ServerConnection.cpp index c415cb3..1f01ce5 100644 --- a/src/Net/ServerConnection.cpp +++ b/src/Net/ServerConnection.cpp @@ -77,7 +77,7 @@ ServerConnection::ServerConnection(int sock0, const IPAddress &address, gnutls_d gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t)sock); - FdManager::get()->registerFd(sock, sigc::mem_fun(this, &ServerConnection::sendReceive)); + FdManager::get()->registerFd(sock, boost::bind(&ServerConnection::sendReceive, this, _1)); state = CONNECT; diff --git a/src/Net/ServerConnection.h b/src/Net/ServerConnection.h index 0870143..d52cd7c 100644 --- a/src/Net/ServerConnection.h +++ b/src/Net/ServerConnection.h @@ -44,7 +44,7 @@ class ServerConnection : public Connection { ServerConnection(int sock0, const IPAddress &address, gnutls_dh_params_t dh_params, const std::string &x905certFile, const std::string &x905keyFile); virtual void connectionHeader() { - rawReceive(sizeof(ConnectionHeader), sigc::mem_fun(this, &ServerConnection::connectionHeaderReceiveHandler)); + rawReceive(sizeof(ConnectionHeader), boost::bind(&ServerConnection::connectionHeaderReceiveHandler, this, _1, _2)); } public: diff --git a/src/Net/ThreadManager.cpp b/src/Net/ThreadManager.cpp index b1f4d4b..71a754e 100644 --- a/src/Net/ThreadManager.cpp +++ b/src/Net/ThreadManager.cpp @@ -24,8 +24,6 @@ #include <Common/LogManager.h> #include <fcntl.h> -#include <sigc++/bind.h> -#include <sigc++/hide.h> namespace Mad { namespace Net { @@ -50,7 +48,7 @@ void ThreadManager::workerFunc() { return; } - sigc::slot<void> nextWork = work.front(); + boost::function0<void> nextWork = work.front(); work.pop(); lock2.unlock(); @@ -85,7 +83,7 @@ void ThreadManager::detach() { threadLock.unlock(); } -void ThreadManager::pushWork(const sigc::slot<void> &newWork) { +void ThreadManager::pushWork(const boost::function0<void> &newWork) { workLock.lock(); work.push(newWork); workLock.unlock(); diff --git a/src/Net/ThreadManager.h b/src/Net/ThreadManager.h index 9394329..fd903af 100644 --- a/src/Net/ThreadManager.h +++ b/src/Net/ThreadManager.h @@ -26,8 +26,8 @@ #include <queue> #include <set> -#include <sigc++/slot.h> +#include <boost/function.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/locks.hpp> @@ -48,7 +48,7 @@ class ThreadManager : public Common::Initializable { boost::mutex workLock; boost::condition_variable workCond; - std::queue<sigc::slot<void> > work; + std::queue<boost::function0<void> > work; static ThreadManager threadManager; @@ -81,7 +81,7 @@ class ThreadManager : public Common::Initializable { void detach(); - void pushWork(const sigc::slot<void> &newWork); + void pushWork(const boost::function0<void> &newWork); static ThreadManager* get() { return &threadManager; diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp index 99f5680..6ef918a 100644 --- a/src/Server/ConnectionManager.cpp +++ b/src/Server/ConnectionManager.cpp @@ -41,8 +41,6 @@ #include <unistd.h> #include <algorithm> -#include <sigc++/bind.h> - namespace Mad { namespace Server { @@ -54,7 +52,7 @@ bool ConnectionManager::Connection::send(const Net::Packet &packet) { ConnectionManager::Connection::Connection(Net::ServerConnection *connection0) : connection(connection0), type(connection0->isDaemonConnection() ? DAEMON : CLIENT), hostInfo(0) { - connection->signalReceive().connect(sigc::mem_fun(this, &Connection::receive)); + connection->signalReceive().connect(boost::bind(&Connection::receive, this, _1)); } ConnectionManager::Connection::~Connection() { @@ -90,7 +88,7 @@ void ConnectionManager::updateState(Common::HostInfo *hostInfo, Common::HostInfo for(std::set<Connection*>::iterator con = connections.begin(); con != connections.end(); ++con) { if((*con)->getConnectionType() == Connection::CLIENT) - Common::RequestManager::get()->sendRequest<Requests::DaemonStateUpdateRequest>(*con, Common::Request::slot_type(), hostInfo->getName(), state); + Common::RequestManager::get()->sendRequest<Requests::DaemonStateUpdateRequest>(*con, boost::bind(&ConnectionManager::updateStateFinished, this, _1), hostInfo->getName(), state); } } @@ -150,7 +148,7 @@ void ConnectionManager::configFinished() { if(listenerAddresses.empty()) { try { Net::Listener *listener = new Net::Listener(x509CertFile, x509KeyFile); - listener->signalNewConnection().connect(sigc::mem_fun(this, &ConnectionManager::newConnectionHandler)); + listener->signalNewConnection().connect(boost::bind(&ConnectionManager::newConnectionHandler, this, _1)); listeners.push_back(listener); } catch(Net::Exception &e) { @@ -161,7 +159,7 @@ void ConnectionManager::configFinished() { for(std::vector<Net::IPAddress>::const_iterator address = listenerAddresses.begin(); address != listenerAddresses.end(); ++address) { try { Net::Listener *listener = new Net::Listener(x509CertFile, x509KeyFile, *address); - listener->signalNewConnection().connect(sigc::mem_fun(this, &ConnectionManager::newConnectionHandler)); + listener->signalNewConnection().connect(boost::bind(&ConnectionManager::newConnectionHandler, this, _1)); listeners.push_back(listener); } catch(Net::Exception &e) { @@ -173,7 +171,7 @@ void ConnectionManager::configFinished() { void ConnectionManager::newConnectionHandler(Net::ServerConnection *con) { Connection *connection = new Connection(con); - con->signalDisconnected().connect(sigc::bind(sigc::mem_fun(this, &ConnectionManager::disconnectHandler), connection)); + con->signalDisconnected().connect(boost::bind(&ConnectionManager::disconnectHandler, this, connection)); connections.insert(connection); Common::RequestManager::get()->registerConnection(connection); diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h index 691d51f..7d97edc 100644 --- a/src/Server/ConnectionManager.h +++ b/src/Server/ConnectionManager.h @@ -101,6 +101,9 @@ class ConnectionManager : public Common::Configurable, public Common::Initializa ConnectionManager& operator=(const ConnectionManager &o); void updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state); + void updateStateFinished(const Common::Request&) { + // TODO Error handling (updateStateFinished) + } ConnectionManager() {} diff --git a/src/Server/Makefile.in b/src/Server/Makefile.in index 66a02a0..7389540 100644 --- a/src/Server/Makefile.in +++ b/src/Server/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -93,6 +94,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -224,8 +226,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp index 314aa97..17a7e5d 100644 --- a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp @@ -37,7 +37,7 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -48,7 +48,7 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) try { Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); Common::RequestManager::get()->sendRequest<Requests::CommandRequest>(daemonCon, - sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished), command == "reboot"); + boost::bind(&DaemonCommandRequestHandler::requestFinished, this, _1), command == "reboot"); } catch(Net::Exception &e) { Common::XmlPacket ret; @@ -77,7 +77,7 @@ void DaemonCommandRequestHandler::requestFinished(const Common::Request &request sendPacket(ret); } - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp index eadc0d5..df57a94 100644 --- a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp @@ -37,7 +37,7 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -46,7 +46,7 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { try { Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); Common::RequestManager::get()->sendRequest<Common::Requests::FSInfoRequest>(daemonCon, - sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)); + boost::bind(&DaemonFSInfoRequestHandler::requestFinished, this, _1)); } catch(Net::Exception &e) { Common::XmlPacket ret; @@ -75,7 +75,7 @@ void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) sendPacket(ret); } - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp index 2b21a29..541148d 100644 --- a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp @@ -35,7 +35,7 @@ void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -57,7 +57,7 @@ void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp index 9e21127..3d99c57 100644 --- a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -37,7 +37,7 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -48,7 +48,7 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { try { Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); Common::RequestManager::get()->sendRequest<Common::Requests::StatusRequest>(daemonCon, - sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)); + boost::bind(&DaemonStatusRequestHandler::requestFinished, this, _1)); } catch(Net::Exception &e) { Common::XmlPacket ret; @@ -77,7 +77,7 @@ void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) sendPacket(ret); } - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp index 5272d7a..ade8329 100644 --- a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp +++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp @@ -39,7 +39,7 @@ void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -118,7 +118,7 @@ void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { if(majStat != GSS_S_COMPLETE) return; - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp index ac8bb42..f69b3f5 100644 --- a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp @@ -36,7 +36,7 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -59,7 +59,7 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); } - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp index 557a97c..f4547e4 100644 --- a/src/Server/RequestHandlers/LogRequestHandler.cpp +++ b/src/Server/RequestHandlers/LogRequestHandler.cpp @@ -36,7 +36,7 @@ void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } @@ -55,7 +55,7 @@ void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/Makefile.in b/src/Server/RequestHandlers/Makefile.in index 4d0d9ce..3ee761b 100644 --- a/src/Server/RequestHandlers/Makefile.in +++ b/src/Server/RequestHandlers/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -86,6 +87,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -217,8 +219,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp index 39fa63e..740c2a9 100644 --- a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp @@ -22,6 +22,8 @@ #include <Net/Exception.h> #include <Common/Logger.h> +#include <boost/bind.hpp> + namespace Mad { namespace Server { namespace RequestHandlers { @@ -36,19 +38,19 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } // TODO Require authentication - if(!UserManager::get()->getUserInfo(packet["uid"], sigc::mem_fun(this, &UserInfoRequestHandler::userInfoHandler))) { + if(!UserManager::get()->getUserInfo(packet["uid"], boost::bind(&UserInfoRequestHandler::userInfoHandler, this, _1))) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } @@ -62,7 +64,7 @@ void UserInfoRequestHandler::userInfoHandler(const Common::UserInfo &info) { ret.add("fullName", info.getFullName()); sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp index 66f67bd..cd05c12 100644 --- a/src/Server/RequestHandlers/UserListRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp @@ -22,6 +22,8 @@ #include <Net/Exception.h> #include <Common/Logger.h> +#include <boost/bind.hpp> + namespace Mad { namespace Server { namespace RequestHandlers { @@ -36,19 +38,19 @@ void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) { sendPacket(ret); - signalFinished().emit(); + signalFinished()(); return; } // TODO Require authentication - if(!UserManager::get()->getUserList(sigc::mem_fun(this, &UserListRequestHandler::userListHandler))) { + if(!UserManager::get()->getUserList(boost::bind(&UserListRequestHandler::userListHandler, this, _1))) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } @@ -68,7 +70,7 @@ void UserListRequestHandler::userListHandler(const std::map<unsigned long, Commo } sendPacket(ret); - signalFinished().emit(); + signalFinished()(); } } diff --git a/src/Server/Requests/Makefile.in b/src/Server/Requests/Makefile.in index 428400d..1fbdd8f 100644 --- a/src/Server/Requests/Makefile.in +++ b/src/Server/Requests/Makefile.in @@ -39,6 +39,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -83,6 +84,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -214,8 +216,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/Server/UserBackend.h b/src/Server/UserBackend.h index cf88095..6aac7bc 100644 --- a/src/Server/UserBackend.h +++ b/src/Server/UserBackend.h @@ -27,7 +27,7 @@ #include <map> #include <string> -#include <sigc++/signal.h> +#include <boost/signal.hpp> namespace Mad { @@ -41,19 +41,19 @@ class UserBackend { UserBackend() {} - virtual bool getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback _UNUSED_PARAMETER_) { + virtual bool getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback _UNUSED_PARAMETER_) { return false; } - virtual bool getUserInfo(unsigned long uid _UNUSED_PARAMETER_, const sigc::slot<void, const Common::UserInfo&> &callback _UNUSED_PARAMETER_) { + virtual bool getUserInfo(unsigned long uid _UNUSED_PARAMETER_, const boost::function1<void, const Common::UserInfo&> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string&, const sigc::slot<void, bool> &callback _UNUSED_PARAMETER_) { + virtual bool setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string&, const boost::function1<void, bool> &callback _UNUSED_PARAMETER_) { return false; } - virtual bool addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_, const sigc::slot<void, bool> &callback _UNUSED_PARAMETER_) { + virtual bool addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_, const boost::function1<void, bool> &callback _UNUSED_PARAMETER_) { return false; } diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp index 2f58b7a..d763a8b 100644 --- a/src/Server/UserManager.cpp +++ b/src/Server/UserManager.cpp @@ -34,7 +34,7 @@ bool UserManager::Compare::operator() (const UserBackend *b1, const UserBackend } -bool UserManager::getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback) { +bool UserManager::getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback) { for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getUserList(callback)) return true; @@ -43,7 +43,7 @@ bool UserManager::getUserList(const sigc::slot<void, const std::map<unsigned lon return false; } -bool UserManager::getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) { +bool UserManager::getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback) { for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->getUserInfo(uid, callback)) return true; @@ -52,7 +52,7 @@ bool UserManager::getUserInfo(unsigned long uid, const sigc::slot<void, const Co return false; } -bool UserManager::setPassword(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback) { +bool UserManager::setPassword(unsigned long uid, const std::string &password, const boost::function1<void, bool> &callback) { for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->setPassword(uid, password, callback)) return true; @@ -61,7 +61,7 @@ bool UserManager::setPassword(unsigned long uid, const std::string &password, co return false; } -bool UserManager::addUser(const Common::UserInfo &userInfo, const sigc::slot<void, bool> &callback) { +bool UserManager::addUser(const Common::UserInfo &userInfo, const boost::function1<void, bool> &callback) { for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { if((*backend)->addUser(userInfo, callback)) return true; diff --git a/src/Server/UserManager.h b/src/Server/UserManager.h index 3c4097b..d0e7074 100644 --- a/src/Server/UserManager.h +++ b/src/Server/UserManager.h @@ -25,7 +25,7 @@ #include <map> #include <set> -#include <sigc++/slot.h> +#include <boost/function.hpp> namespace Mad { namespace Server { @@ -54,12 +54,12 @@ class UserManager { } - bool getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback); - bool getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback); + bool getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback); + bool getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback); - bool setPassword(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback); + bool setPassword(unsigned long uid, const std::string &password, const boost::function1<void, bool> &callback); - bool addUser(const Common::UserInfo &userInfo, const sigc::slot<void, bool> &callback); + bool addUser(const Common::UserInfo &userInfo, const boost::function1<void, bool> &callback); static UserManager *get() { diff --git a/src/mad.cpp b/src/mad.cpp index 1a504f6..035c0be 100644 --- a/src/mad.cpp +++ b/src/mad.cpp @@ -71,7 +71,7 @@ int main() { //char hostname[256]; //gethostname(hostname, sizeof(hostname)); //Common::RequestManager::get()->sendRequest<Daemon::Requests::IdentifyRequest>(connection, sigc::ptr_fun(requestFinished), hostname); - Common::RequestManager::get()->sendRequest<Daemon::Requests::IdentifyRequest>(connection, sigc::ptr_fun(requestFinished), "test"); + Common::RequestManager::get()->sendRequest<Daemon::Requests::IdentifyRequest>(connection, &requestFinished, "test"); while(connection->isConnected()) usleep(100000); diff --git a/src/madc.cpp b/src/madc.cpp index 04f55b2..106617c 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -103,9 +103,9 @@ int main(int argc, char *argv[]) { std::cerr << " done." << std::endl << std::endl; Client::CommandParser::get()->setConnection(connection); - Client::CommandManager::get()->signalFinished().connect(sigc::ptr_fun(activateReadline)); + Client::CommandManager::get()->signalFinished().connect(&activateReadline); - Net::FdManager::get()->registerFd(STDIN_FILENO, sigc::ptr_fun(charHandler)); + Net::FdManager::get()->registerFd(STDIN_FILENO,&charHandler); activateReadline(); diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 077c7bb..8dc9810 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -42,6 +42,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \ $(top_srcdir)/m4/ax_boost_base.m4 \ + $(top_srcdir)/m4/ax_boost_signals.m4 \ $(top_srcdir)/m4/ax_boost_thread.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -68,8 +69,7 @@ FileLogger_la_OBJECTS = $(am_FileLogger_la_OBJECTS) FileLogger_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(FileLogger_la_LDFLAGS) $(LDFLAGS) -o $@ -am__DEPENDENCIES_1 = -SystemBackendPosix_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +SystemBackendPosix_la_DEPENDENCIES = am_SystemBackendPosix_la_OBJECTS = SystemBackendPosix.lo SystemBackendPosix_la_OBJECTS = $(am_SystemBackendPosix_la_OBJECTS) SystemBackendPosix_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ @@ -83,6 +83,7 @@ SystemBackendProc_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(SystemBackendProc_la_LDFLAGS) $(LDFLAGS) -o $@ @SYSTEMBACKEND_PROC_TRUE@am_SystemBackendProc_la_rpath = +am__DEPENDENCIES_1 = UserBackendMysql_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_UserBackendMysql_la_OBJECTS = UserBackendMysql.lo @@ -123,6 +124,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ +BOOST_SIGNALS_LIB = @BOOST_SIGNALS_LIB@ BOOST_THREAD_LIB = @BOOST_THREAD_LIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -254,8 +256,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sigc_CFLAGS = @sigc_CFLAGS@ -sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ diff --git a/src/modules/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix.cpp index 21e5c75..4969c6d 100644 --- a/src/modules/SystemBackendPosix.cpp +++ b/src/modules/SystemBackendPosix.cpp @@ -33,8 +33,6 @@ #include <sys/wait.h> #include <unistd.h> -#include <sigc++/bind.h> - #define init SystemBackendPosix_LTX_init #define deinit SystemBackendPosix_LTX_deinit @@ -43,8 +41,8 @@ namespace Modules { SystemBackendPosix *SystemBackendPosix::backend = 0; -std::map<pid_t, sigc::slot<void, int> > SystemBackendPosix::processes; -std::map<pid_t, sigc::slot<void, int, const std::string&> > SystemBackendPosix::processesWithOutput; +std::map<pid_t, boost::function1<void, int> > SystemBackendPosix::processes; +std::map<pid_t, boost::function2<void, int, const std::string&> > SystemBackendPosix::processesWithOutput; std::map<pid_t, int> SystemBackendPosix::processesWOHandles; std::map<pid_t, std::string > SystemBackendPosix::processesWOOutput; @@ -70,7 +68,7 @@ SystemBackendPosix::~SystemBackendPosix() { } -void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) { +void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) { std::vector<Common::SystemManager::FSInfo> ret; std::istringstream stream(output); std::string str; @@ -99,14 +97,14 @@ void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const si callback(ret); } -bool SystemBackendPosix::getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) { +bool SystemBackendPosix::getFSInfo(const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) { std::vector<std::string> argv; argv.push_back("/bin/df"); argv.push_back("-P"); argv.push_back("-k"); - return execWithOutput(sigc::bind(sigc::mem_fun(this, &SystemBackendPosix::fsInfoCallback), callback), "/bin/df", argv); + return execWithOutput(boost::bind(&SystemBackendPosix::fsInfoCallback, this, _1, _2, callback), "/bin/df", argv); } @@ -115,14 +113,14 @@ void SystemBackendPosix::childHandler(int) { pid_t pid; while((pid = waitpid(-1, &status, WNOHANG)) > 0) { - std::map<pid_t, sigc::slot<void, int> >::iterator it = processes.find(pid); + std::map<pid_t, boost::function1<void, int> >::iterator it = processes.find(pid); if(it != processes.end()) { - Common::ActionManager::get()->add(sigc::bind(it->second, status)); + Common::ActionManager::get()->add(boost::bind(it->second, status)); processes.erase(it); } else { - std::map<pid_t, sigc::slot<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid); + std::map<pid_t, boost::function2<void, int, const std::string&> >::iterator it2 = processesWithOutput.find(pid); if(it2 != processesWithOutput.end()) { char buffer[1024]; @@ -133,10 +131,10 @@ void SystemBackendPosix::childHandler(int) { while((n = read(handle, buffer, sizeof(buffer))) > 0) output += std::string(buffer, n); - Net::FdManager::get()->unregisterFd(handle); - close(handle); + //Net::FdManager::get()->unregisterFd(handle); + //close(handle); - Common::ActionManager::get()->add(sigc::bind(it2->second, status, output)); + //Common::ActionManager::get()->add(boost::bind(it2->second, status, output)); processesWithOutput.erase(it2); processesWOHandles.erase(pid); processesWOOutput.erase(pid); @@ -218,7 +216,7 @@ void SystemBackendPosix::destroyArgs(std::pair<char**, char**> args) { } } -bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) { +bool SystemBackendPosix::exec(const boost::function1<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) { pid_t pid; std::pair<char**, char**> args = makeArgs(filename, argv, env); @@ -239,7 +237,7 @@ bool SystemBackendPosix::exec(const sigc::slot<void, int> &resultHandler, const return ret; } -bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) { +bool SystemBackendPosix::execWithOutput(const boost::function2<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv, const std::vector<std::string> &env) { pid_t pid; std::pair<char**, char**> args = makeArgs(filename, argv, env); @@ -268,7 +266,7 @@ bool SystemBackendPosix::execWithOutput(const sigc::slot<void, int, const std::s processesWOHandles.insert(std::make_pair(pid, pipeHandles[0])); processesWOOutput.insert(std::make_pair(pid, std::string())); - Net::FdManager::get()->registerFd(pipeHandles[0], sigc::bind(sigc::ptr_fun(&SystemBackendPosix::outputHandler), pid), POLLIN); + Net::FdManager::get()->registerFd(pipeHandles[0], boost::bind(&SystemBackendPosix::outputHandler, _1, pid), POLLIN); } dup2(saveStdout, STDOUT_FILENO); // restore old stdout diff --git a/src/modules/SystemBackendPosix.h b/src/modules/SystemBackendPosix.h index b12af6b..6d9b65f 100644 --- a/src/modules/SystemBackendPosix.h +++ b/src/modules/SystemBackendPosix.h @@ -27,18 +27,20 @@ #include <vector> #include <sys/types.h> -#include <sigc++/slot.h> -#include <sigc++/adaptors/hide.h> + +#include <boost/bind.hpp> namespace Mad { namespace Modules { +// TODO SystemBackendPosix doesn't work !!! + class SystemBackendPosix : private Common::SystemBackend { private: static SystemBackendPosix *backend; - static std::map<pid_t, sigc::slot<void, int> > processes; + static std::map<pid_t, boost::function1<void, int> > processes; - static std::map<pid_t, sigc::slot<void, int, const std::string&> > processesWithOutput; + static std::map<pid_t, boost::function2<void, int, const std::string&> > processesWithOutput; static std::map<pid_t, int> processesWOHandles; static std::map<pid_t, std::string > processesWOOutput; @@ -55,13 +57,13 @@ class SystemBackendPosix : private Common::SystemBackend { setChildHandler(); } - void fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback); + void fsInfoCallback(int, const std::string &output, const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback); protected: - virtual bool getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback); + virtual bool getFSInfo(const boost::function1<void, const std::vector<Common::SystemManager::FSInfo>& > &callback); - virtual bool shutdown(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/halt");} - virtual bool reboot(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/reboot");} + virtual bool shutdown(const boost::function0<void> &callback) {return exec(boost::bind(callback), "/sbin/halt");} + virtual bool reboot(const boost::function0<void> &callback) {return exec(boost::bind(callback), "/sbin/reboot");} public: ~SystemBackendPosix(); @@ -83,10 +85,10 @@ class SystemBackendPosix : private Common::SystemBackend { backend = 0; } - static bool exec(const sigc::slot<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(), + static bool exec(const boost::function1<void, int> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(), const std::vector<std::string> &env = std::vector<std::string>()); - static bool execWithOutput(const sigc::slot<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(), + static bool execWithOutput(const boost::function2<void, int, const std::string&> &resultHandler, const std::string &filename, const std::vector<std::string> &argv = std::vector<std::string>(), const std::vector<std::string> &env = std::vector<std::string>()); }; diff --git a/src/modules/SystemBackendProc.cpp b/src/modules/SystemBackendProc.cpp index 501f779..68f9cec 100644 --- a/src/modules/SystemBackendProc.cpp +++ b/src/modules/SystemBackendProc.cpp @@ -24,7 +24,7 @@ #include <cstdio> #include <cstring> -#include <sigc++/bind.h> +#include <boost/bind.hpp> #define init SystemBackendProc_LTX_init #define deinit SystemBackendProc_LTX_deinit @@ -34,7 +34,7 @@ namespace Modules { SystemBackendProc *SystemBackendProc::backend = 0; -bool SystemBackendProc::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) { +bool SystemBackendProc::getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback) { unsigned long uptime = 0, idleTime = 0; uptimeFile.seekg(0, std::ios::beg); @@ -53,12 +53,12 @@ bool SystemBackendProc::getUptimeInfo(const sigc::slot<void, unsigned long, unsi if(uptimeFile.good()) idleTime = (unsigned long)f; - Common::ActionManager::get()->add(sigc::bind(callback, uptime, idleTime)); + Common::ActionManager::get()->add(boost::bind(callback, uptime, idleTime)); return true; } -bool SystemBackendProc::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) { +bool SystemBackendProc::getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) { unsigned long totalMem = 0, freeMem = 0, totalSwap = 0, freeSwap = 0; meminfoFile.seekg(0, std::ios::beg); @@ -90,12 +90,12 @@ bool SystemBackendProc::getMemoryInfo(const sigc::slot<void, unsigned long, unsi break; } - Common::ActionManager::get()->add(sigc::bind(callback, totalMem, freeMem, totalSwap, freeSwap)); + Common::ActionManager::get()->add(boost::bind(callback, totalMem, freeMem, totalSwap, freeSwap)); return true; } -bool SystemBackendProc::getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) { +bool SystemBackendProc::getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback) { unsigned long currentLoad = 0, nProcesses = 0; float loadAvg1 = 0, loadAvg5 = 0, loadAvg15 = 0; @@ -112,7 +112,7 @@ bool SystemBackendProc::getLoadInfo(const sigc::slot<void, unsigned long, unsign std::sscanf(line.c_str(), "%f %f %f %lu/%lu", &loadAvg1, &loadAvg5, &loadAvg15, ¤tLoad, &nProcesses); - Common::ActionManager::get()->add(sigc::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15)); + Common::ActionManager::get()->add(boost::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15)); return true; } diff --git a/src/modules/SystemBackendProc.h b/src/modules/SystemBackendProc.h index 7174551..bf19e22 100644 --- a/src/modules/SystemBackendProc.h +++ b/src/modules/SystemBackendProc.h @@ -38,9 +38,9 @@ class SystemBackendProc : private Common::SystemBackend { SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {} protected: - virtual bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback); - virtual bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback); - virtual bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback); + virtual bool getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback); + virtual bool getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback); + virtual bool getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback); public: static void registerBackend() { diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp index daea626..da5126a 100644 --- a/src/modules/UserBackendMysql.cpp +++ b/src/modules/UserBackendMysql.cpp @@ -27,7 +27,7 @@ #include <sstream> -#include <sigc++/bind.h> +#include <boost/bind.hpp> #include <pcrecpp.h> #define init UserBackendMysql_LTX_init @@ -135,7 +135,7 @@ void UserBackendMysql::configFinished() { } -bool UserBackendMysql::getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback) { +bool UserBackendMysql::getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback) { mysql_ping(mysql); mysql_real_query(mysql, queryListUsers.c_str(), queryListUsers.length()); @@ -155,12 +155,12 @@ bool UserBackendMysql::getUserList(const sigc::slot<void, const std::map<unsigne users.insert(std::make_pair(user.getUid(), user)); } - Common::ActionManager::get()->add(sigc::bind(callback, users)); + Common::ActionManager::get()->add(boost::bind(callback, users)); return true; } -bool UserBackendMysql::getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) { +bool UserBackendMysql::getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback) { mysql_ping(mysql); std::string query = queryUserById; @@ -186,12 +186,12 @@ bool UserBackendMysql::getUserInfo(unsigned long uid, const sigc::slot<void, con user.setGid(strtoul(row[1], 0, 10)); user.setFullName(row[3]); - Common::ActionManager::get()->add(sigc::bind(callback, user)); + Common::ActionManager::get()->add(boost::bind(callback, user)); while((row = mysql_fetch_row(result)) != 0) {} } else { - Common::ActionManager::get()->add(sigc::bind(callback, Common::UserInfo())); + Common::ActionManager::get()->add(boost::bind(callback, Common::UserInfo())); } return true; diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h index ddd4252..2e4f1ff 100644 --- a/src/modules/UserBackendMysql.h +++ b/src/modules/UserBackendMysql.h @@ -50,8 +50,8 @@ class UserBackendMysql : private Server::UserBackend, private Common::Configurab virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool); virtual void configFinished(); - virtual bool getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback); - virtual bool getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback); + virtual bool getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback); + virtual bool getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback); public: virtual ~UserBackendMysql() { |