From 7c8a134b082e1224a6ece26cefdf939753088e2c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 29 Apr 2009 19:57:50 +0200 Subject: Core in Server umbenannt --- .hgignore | 2 +- configure | 8 +- configure.ac | 6 +- src/Common/RequestManager.cpp | 2 +- src/Common/RequestManager.h | 10 +- src/Core/ConnectionManager.cpp | 310 ---------- src/Core/ConnectionManager.h | 131 ----- src/Core/Makefile.am | 8 - src/Core/Makefile.in | 644 --------------------- .../DaemonCommandRequestHandler.cpp | 84 --- .../RequestHandlers/DaemonCommandRequestHandler.h | 47 -- .../RequestHandlers/DaemonFSInfoRequestHandler.cpp | 83 --- .../RequestHandlers/DaemonFSInfoRequestHandler.h | 47 -- .../RequestHandlers/DaemonListRequestHandler.cpp | 65 --- .../RequestHandlers/DaemonListRequestHandler.h | 42 -- .../RequestHandlers/DaemonStatusRequestHandler.cpp | 85 --- .../RequestHandlers/DaemonStatusRequestHandler.h | 47 -- .../RequestHandlers/GSSAPIAuthRequestHandler.cpp | 134 ----- .../RequestHandlers/GSSAPIAuthRequestHandler.h | 48 -- .../RequestHandlers/IdentifyRequestHandler.cpp | 67 --- src/Core/RequestHandlers/IdentifyRequestHandler.h | 42 -- src/Core/RequestHandlers/LogRequestHandler.cpp | 63 -- src/Core/RequestHandlers/LogRequestHandler.h | 42 -- src/Core/RequestHandlers/Makefile.am | 6 - src/Core/RequestHandlers/Makefile.in | 542 ----------------- .../RequestHandlers/UserInfoRequestHandler.cpp | 70 --- src/Core/RequestHandlers/UserInfoRequestHandler.h | 48 -- .../RequestHandlers/UserListRequestHandler.cpp | 76 --- src/Core/RequestHandlers/UserListRequestHandler.h | 48 -- src/Core/Requests/CommandRequest.cpp | 36 -- src/Core/Requests/CommandRequest.h | 45 -- src/Core/Requests/DaemonStateUpdateRequest.cpp | 37 -- src/Core/Requests/DaemonStateUpdateRequest.h | 47 -- src/Core/Requests/Makefile.am | 4 - src/Core/Requests/Makefile.in | 528 ----------------- src/Core/UserBackend.h | 71 --- src/Core/UserManager.cpp | 74 --- src/Core/UserManager.h | 73 --- src/Makefile.am | 34 +- src/Makefile.in | 40 +- src/Server/ConnectionManager.cpp | 310 ++++++++++ src/Server/ConnectionManager.h | 131 +++++ src/Server/Makefile.am | 8 + src/Server/Makefile.in | 644 +++++++++++++++++++++ .../DaemonCommandRequestHandler.cpp | 85 +++ .../RequestHandlers/DaemonCommandRequestHandler.h | 47 ++ .../RequestHandlers/DaemonFSInfoRequestHandler.cpp | 83 +++ .../RequestHandlers/DaemonFSInfoRequestHandler.h | 47 ++ .../RequestHandlers/DaemonListRequestHandler.cpp | 65 +++ .../RequestHandlers/DaemonListRequestHandler.h | 42 ++ .../RequestHandlers/DaemonStatusRequestHandler.cpp | 85 +++ .../RequestHandlers/DaemonStatusRequestHandler.h | 47 ++ .../RequestHandlers/GSSAPIAuthRequestHandler.cpp | 134 +++++ .../RequestHandlers/GSSAPIAuthRequestHandler.h | 48 ++ .../RequestHandlers/IdentifyRequestHandler.cpp | 67 +++ .../RequestHandlers/IdentifyRequestHandler.h | 42 ++ src/Server/RequestHandlers/LogRequestHandler.cpp | 63 ++ src/Server/RequestHandlers/LogRequestHandler.h | 42 ++ src/Server/RequestHandlers/Makefile.am | 6 + src/Server/RequestHandlers/Makefile.in | 542 +++++++++++++++++ .../RequestHandlers/UserInfoRequestHandler.cpp | 70 +++ .../RequestHandlers/UserInfoRequestHandler.h | 48 ++ .../RequestHandlers/UserListRequestHandler.cpp | 76 +++ .../RequestHandlers/UserListRequestHandler.h | 48 ++ src/Server/Requests/CommandRequest.cpp | 36 ++ src/Server/Requests/CommandRequest.h | 45 ++ src/Server/Requests/DaemonStateUpdateRequest.cpp | 37 ++ src/Server/Requests/DaemonStateUpdateRequest.h | 47 ++ src/Server/Requests/Makefile.am | 4 + src/Server/Requests/Makefile.in | 528 +++++++++++++++++ src/Server/UserBackend.h | 71 +++ src/Server/UserManager.cpp | 74 +++ src/Server/UserManager.h | 73 +++ src/mad-core.conf | 32 - src/mad-core.cpp | 57 -- src/mad-server.conf | 32 + src/mad-server.cpp | 57 ++ src/modules/UserBackendMysql.cpp | 4 +- src/modules/UserBackendMysql.h | 6 +- 79 files changed, 3840 insertions(+), 3839 deletions(-) delete mode 100644 src/Core/ConnectionManager.cpp delete mode 100644 src/Core/ConnectionManager.h delete mode 100644 src/Core/Makefile.am delete mode 100644 src/Core/Makefile.in delete mode 100644 src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/DaemonCommandRequestHandler.h delete mode 100644 src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h delete mode 100644 src/Core/RequestHandlers/DaemonListRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/DaemonListRequestHandler.h delete mode 100644 src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/DaemonStatusRequestHandler.h delete mode 100644 src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h delete mode 100644 src/Core/RequestHandlers/IdentifyRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/IdentifyRequestHandler.h delete mode 100644 src/Core/RequestHandlers/LogRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/LogRequestHandler.h delete mode 100644 src/Core/RequestHandlers/Makefile.am delete mode 100644 src/Core/RequestHandlers/Makefile.in delete mode 100644 src/Core/RequestHandlers/UserInfoRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/UserInfoRequestHandler.h delete mode 100644 src/Core/RequestHandlers/UserListRequestHandler.cpp delete mode 100644 src/Core/RequestHandlers/UserListRequestHandler.h delete mode 100644 src/Core/Requests/CommandRequest.cpp delete mode 100644 src/Core/Requests/CommandRequest.h delete mode 100644 src/Core/Requests/DaemonStateUpdateRequest.cpp delete mode 100644 src/Core/Requests/DaemonStateUpdateRequest.h delete mode 100644 src/Core/Requests/Makefile.am delete mode 100644 src/Core/Requests/Makefile.in delete mode 100644 src/Core/UserBackend.h delete mode 100644 src/Core/UserManager.cpp delete mode 100644 src/Core/UserManager.h create mode 100644 src/Server/ConnectionManager.cpp create mode 100644 src/Server/ConnectionManager.h create mode 100644 src/Server/Makefile.am create mode 100644 src/Server/Makefile.in create mode 100644 src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/DaemonCommandRequestHandler.h create mode 100644 src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h create mode 100644 src/Server/RequestHandlers/DaemonListRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/DaemonListRequestHandler.h create mode 100644 src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/DaemonStatusRequestHandler.h create mode 100644 src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h create mode 100644 src/Server/RequestHandlers/IdentifyRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/IdentifyRequestHandler.h create mode 100644 src/Server/RequestHandlers/LogRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/LogRequestHandler.h create mode 100644 src/Server/RequestHandlers/Makefile.am create mode 100644 src/Server/RequestHandlers/Makefile.in create mode 100644 src/Server/RequestHandlers/UserInfoRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/UserInfoRequestHandler.h create mode 100644 src/Server/RequestHandlers/UserListRequestHandler.cpp create mode 100644 src/Server/RequestHandlers/UserListRequestHandler.h create mode 100644 src/Server/Requests/CommandRequest.cpp create mode 100644 src/Server/Requests/CommandRequest.h create mode 100644 src/Server/Requests/DaemonStateUpdateRequest.cpp create mode 100644 src/Server/Requests/DaemonStateUpdateRequest.h create mode 100644 src/Server/Requests/Makefile.am create mode 100644 src/Server/Requests/Makefile.in create mode 100644 src/Server/UserBackend.h create mode 100644 src/Server/UserManager.cpp create mode 100644 src/Server/UserManager.h delete mode 100644 src/mad-core.conf delete mode 100644 src/mad-core.cpp create mode 100644 src/mad-server.conf create mode 100644 src/mad-server.cpp diff --git a/.hgignore b/.hgignore index dc63acf..86033f6 100644 --- a/.hgignore +++ b/.hgignore @@ -39,7 +39,7 @@ syntax: regexp syntax: regexp ^configure\.lineno$ -^src/mad-core\.log$ +^src/mad-server\.log$ syntax: regexp ^lib/time\.h$ diff --git a/configure b/configure index 457c951..1b4a11c 100755 --- a/configure +++ b/configure @@ -26803,7 +26803,7 @@ fi -ac_config_files="$ac_config_files Makefile lib/Makefile libltdl/Makefile src/Makefile src/Client/Makefile src/Client/Requests/Makefile src/Common/Makefile src/Common/Requests/Makefile src/Common/RequestHandlers/Makefile src/Core/Makefile src/Core/Requests/Makefile src/Core/RequestHandlers/Makefile src/Daemon/Makefile src/Daemon/Backends/Makefile src/Daemon/Requests/Makefile src/Daemon/RequestHandlers/Makefile src/Net/Makefile src/modules/Makefile" +ac_config_files="$ac_config_files Makefile lib/Makefile libltdl/Makefile src/Makefile src/Client/Makefile src/Client/Requests/Makefile src/Common/Makefile src/Common/Requests/Makefile src/Common/RequestHandlers/Makefile src/Daemon/Makefile src/Daemon/Backends/Makefile src/Daemon/Requests/Makefile src/Daemon/RequestHandlers/Makefile src/Net/Makefile src/Server/Makefile src/Server/Requests/Makefile src/Server/RequestHandlers/Makefile src/modules/Makefile" cat >confcache <<\_ACEOF @@ -27905,14 +27905,14 @@ do "src/Common/Makefile") CONFIG_FILES="$CONFIG_FILES src/Common/Makefile" ;; "src/Common/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Common/Requests/Makefile" ;; "src/Common/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Common/RequestHandlers/Makefile" ;; - "src/Core/Makefile") CONFIG_FILES="$CONFIG_FILES src/Core/Makefile" ;; - "src/Core/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Core/Requests/Makefile" ;; - "src/Core/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Core/RequestHandlers/Makefile" ;; "src/Daemon/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Makefile" ;; "src/Daemon/Backends/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Backends/Makefile" ;; "src/Daemon/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Requests/Makefile" ;; "src/Daemon/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/RequestHandlers/Makefile" ;; "src/Net/Makefile") CONFIG_FILES="$CONFIG_FILES src/Net/Makefile" ;; + "src/Server/Makefile") CONFIG_FILES="$CONFIG_FILES src/Server/Makefile" ;; + "src/Server/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Server/Requests/Makefile" ;; + "src/Server/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Server/RequestHandlers/Makefile" ;; "src/modules/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 diff --git a/configure.ac b/configure.ac index 9f8573e..fe6363d 100644 --- a/configure.ac +++ b/configure.ac @@ -107,14 +107,14 @@ AC_CONFIG_FILES([ src/Common/Makefile src/Common/Requests/Makefile src/Common/RequestHandlers/Makefile - src/Core/Makefile - src/Core/Requests/Makefile - src/Core/RequestHandlers/Makefile src/Daemon/Makefile src/Daemon/Backends/Makefile src/Daemon/Requests/Makefile src/Daemon/RequestHandlers/Makefile src/Net/Makefile + src/Server/Makefile + src/Server/Requests/Makefile + src/Server/RequestHandlers/Makefile src/modules/Makefile ]) diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 75f07cf..1edf778 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -144,7 +144,7 @@ void RequestManager::unregisterPacketType(const std::string &type) { requestHandlerFactories.erase(it); } -RequestManager::RequestManager() : core(false), lastRequestId(-1) { +RequestManager::RequestManager() : server(false), lastRequestId(-1) { registerPacketType("Disconnect"); } diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index c94200f..e9ce189 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -72,7 +72,7 @@ class RequestManager { static RequestManager requestManager; std::map requestMaps; - bool core; + bool server; uint16_t lastRequestId; std::map requestHandlerFactories; @@ -98,11 +98,11 @@ class RequestManager { return &requestManager; } - bool isCore() const {return core;} - void setCore(bool newCore) { - core = newCore; + bool isServer() const {return server;} + void setServer(bool newServer) { + server = newServer; - if(core) + if(server) lastRequestId &= ~0x01; else lastRequestId |= 0x01; diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp deleted file mode 100644 index 4f8f90d..0000000 --- a/src/Core/ConnectionManager.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* - * ConnectionManager.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "ConnectionManager.h" -#include -#include -#include -#include -#include -#include "Requests/DaemonStateUpdateRequest.h" -#include "RequestHandlers/DaemonCommandRequestHandler.h" -#include "RequestHandlers/DaemonFSInfoRequestHandler.h" -#include "RequestHandlers/DaemonListRequestHandler.h" -#include "RequestHandlers/DaemonStatusRequestHandler.h" -#include "RequestHandlers/GSSAPIAuthRequestHandler.h" -#include "RequestHandlers/IdentifyRequestHandler.h" -#include "RequestHandlers/LogRequestHandler.h" -#include "RequestHandlers/UserInfoRequestHandler.h" -#include "RequestHandlers/UserListRequestHandler.h" -#include -#include -#include -#include - -#include -#include - -namespace Mad { -namespace Core { - -ConnectionManager ConnectionManager::connectionManager; - -bool ConnectionManager::Connection::send(const Net::Packet &packet) { - return connection->send(packet); -} - -ConnectionManager::Connection::Connection(Net::ServerConnection *connection0, ConnectionType type0) -: connection(connection0), type(type0), hostInfo(0) { - connection->signalReceive().connect(sigc::mem_fun(this, &Connection::receive)); -} - -ConnectionManager::Connection::~Connection() { - delete connection; -} - -bool ConnectionManager::Connection::isConnected() const { - return connection->isConnected(); -} - -bool ConnectionManager::Connection::disconnect() { - connection->disconnect(); - - return true; -} - -void* ConnectionManager::Connection::getCertificate(size_t *size) const { - const gnutls_datum_t *cert = connection->getCertificate(); - - *size = cert->size; - return cert->data; -} - -void* ConnectionManager::Connection::getPeerCertificate(size_t *size) const { - const gnutls_datum_t *cert = connection->getPeerCertificate(); - - *size = cert->size; - return cert->data; -} - -void ConnectionManager::updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state) { - hostInfo->setState(state); - - for(std::list::iterator con = connections.begin(); con != connections.end(); ++con) { - if((*con)->getConnectionType() == Connection::CLIENT) - Common::RequestManager::get()->sendRequest(*con, Common::Request::slot_type(), hostInfo->getName(), state); - } -} - -bool ConnectionManager::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) { - if(handled) - return false; - - if(entry[0].getKey().matches("Listen") && entry[1].empty()) { - try { - listenerAddresses.push_back(Net::IPAddress(entry[0][0])); - } - catch(Common::Exception &e) { - // TODO Log error - } - - return true; - } - else if(entry[0].getKey().matches("X509TrustFile") && entry[1].empty()) { - x509TrustFile = entry[0][0]; - - return true; - } - else if(entry[0].getKey().matches("X509CrlFile") && entry[1].empty()) { - x509CrlFile = entry[0][0]; - - return true; - } - else if(entry[0].getKey().matches("X509CertFile") && entry[1].empty()) { - x509CertFile = entry[0][0]; - - return true; - } - else if(entry[0].getKey().matches("X509KeyFile") && entry[1].empty()) { - x509KeyFile = entry[0][0]; - - return true; - } - else if(entry[0].getKey().matches("Daemon")) { - if(entry[0].getSize() == 1) { - if(entry[1].empty()) { - daemonInfo.insert(std::make_pair(entry[0][0], Common::HostInfo(entry[0][0]))); - - return true; - } - else if(entry[1].getKey().matches("IpAddress") && entry[2].empty()) { - daemonInfo[entry[0][0]].setIP(entry[1][0]); - - return true; - } - } - } - - return false; -} - -void ConnectionManager::configFinished() { - if(listenerAddresses.empty()) { - try { - listeners.push_back(new Net::Listener(x509CertFile, x509KeyFile)); - } - catch(Common::Exception &e) { - // TODO Log error - } - } - else { - for(std::vector::const_iterator address = listenerAddresses.begin(); address != listenerAddresses.end(); ++address) { - try { - listeners.push_back(new Net::Listener(x509CertFile, x509KeyFile, *address)); - } - catch(Common::Exception &e) { - // TODO Log error - } - } - } -} - -void ConnectionManager::doInit() { - Common::RequestManager::get()->setCore(true); - - Net::Connection::init(); - - Common::RequestManager::get()->registerPacketType("AuthGSSAPI"); - Common::RequestManager::get()->registerPacketType("DaemonCommand"); - Common::RequestManager::get()->registerPacketType("DaemonFSInfo"); - Common::RequestManager::get()->registerPacketType("FSInfo"); - Common::RequestManager::get()->registerPacketType("GetStatus"); - Common::RequestManager::get()->registerPacketType("GetDaemonStatus"); - Common::RequestManager::get()->registerPacketType("Identify"); - Common::RequestManager::get()->registerPacketType("ListHosts"); - Common::RequestManager::get()->registerPacketType("GetUserInfo"); - Common::RequestManager::get()->registerPacketType("ListUsers"); - Common::RequestManager::get()->registerPacketType("Log"); -} - -void ConnectionManager::doDeinit() { - for(std::list::iterator con = connections.begin(); con != connections.end(); ++con) - delete *con; - - - Common::RequestManager::get()->unregisterPacketType("AuthGSSAPI"); - Common::RequestManager::get()->unregisterPacketType("DaemonCommand"); - Common::RequestManager::get()->unregisterPacketType("DaemonFSInfo"); - Common::RequestManager::get()->unregisterPacketType("FSInfo"); - Common::RequestManager::get()->unregisterPacketType("GetStatus"); - Common::RequestManager::get()->unregisterPacketType("GetDaemonStatus"); - Common::RequestManager::get()->unregisterPacketType("Identify"); - Common::RequestManager::get()->unregisterPacketType("ListHosts"); - Common::RequestManager::get()->unregisterPacketType("GetUserInfo"); - Common::RequestManager::get()->unregisterPacketType("ListUsers"); - Common::RequestManager::get()->unregisterPacketType("Log"); - - Net::Connection::deinit(); -} - -void ConnectionManager::run() { - // TODO Logging - - Net::FdManager::get()->run(); - - for(std::list::iterator con = connections.begin(); con != connections.end();) { - if(!(*con)->isConnected()) { - if((*con)->isIdentified()) - updateState((*con)->getHostInfo(), Common::HostInfo::INACTIVE); - - Common::RequestManager::get()->unregisterConnection(*con); - delete *con; - connections.erase(con++); - } - else - ++con; - } - - for(std::list::iterator listener = listeners.begin(); listener != listeners.end(); ++listener) { - Net::ServerConnection *con; - - while((con = (*listener)->getConnection()) != 0) { - Connection *connection = new Connection(con, - con->isDaemonConnection() ? Connection::DAEMON : Connection::CLIENT); - connections.push_back(connection); - Common::RequestManager::get()->registerConnection(connection); - } - } -} - -Common::Connection* ConnectionManager::getDaemonConnection(const std::string &name) const throw (Common::Exception&) { - const Common::HostInfo *hostInfo; - - try { - hostInfo = &daemonInfo.at(name); - } - catch(std::out_of_range&) { - throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); - } - - if(hostInfo->getState() != Common::HostInfo::INACTIVE) { - for(std::list::const_iterator it = connections.begin(); it != connections.end(); ++it) { - if((*it)->getHostInfo() == hostInfo) { - return *it; - } - } - } - - throw(Common::Exception::NOT_AVAILABLE); -} - -std::string ConnectionManager::getDaemonName(const Common::Connection *con) const throw (Common::Exception&) { - const Connection *connection = dynamic_cast(con); - - if(connection) { - if(connection->isIdentified()) { - return connection->getHostInfo()->getName(); - } - } - - throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); -} - -void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Common::Exception&) { - // TODO Logging - - Connection *connection = dynamic_cast(con); - - if(!connection || (connection->getConnectionType() != Connection::DAEMON)) - throw Common::Exception(Common::Exception::INVALID_ACTION); - - if(connection->isIdentified()) - throw Common::Exception(Common::Exception::ALREADY_IDENTIFIED); - - if(daemonInfo.count(name) == 0) - throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); - - Common::HostInfo *hostInfo = &daemonInfo[name]; - - if(hostInfo->getState() != Common::HostInfo::INACTIVE) { - try { - getDaemonConnection(name)->disconnect(); - Common::Logger::log(Common::Logger::WARNING, "Disconnecting old connection."); - } - catch(Common::Exception&) {} - } - - connection->identify(hostInfo); - updateState(hostInfo, Common::HostInfo::RUNNING); - - Common::Logger::logf("Identified as '%s'.", name.c_str()); -} - -std::vector ConnectionManager::getDaemonList() const { - std::vector ret; - - for(std::map::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) { - ret.push_back(daemon->second); - } - - return ret; -} - -} -} diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h deleted file mode 100644 index 75395ad..0000000 --- a/src/Core/ConnectionManager.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * ConnectionManager.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_CONNECTIONMANAGER_H_ -#define MAD_CORE_CONNECTIONMANAGER_H_ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -namespace Mad { - -namespace Net { -class Listener; -class ServerConnection; -class Packet; -} - -namespace Core { - -class ConnectionManager : public Common::Configurable, public Common::Initializable { - private: - class Connection : public Common::Connection { - public: - enum ConnectionType { - DAEMON, CLIENT - }; - - private: - Net::ServerConnection *connection; - ConnectionType type; - Common::HostInfo *hostInfo; - - protected: - virtual bool send(const Net::Packet &packet); - - public: - Connection(Net::ServerConnection *connection0, ConnectionType type0); - virtual ~Connection(); - - bool isConnected() const; - - virtual bool disconnect(); - virtual void* getCertificate(size_t *size) const; - virtual void* getPeerCertificate(size_t *size) const; - - ConnectionType getConnectionType() const { - return type; - } - - Common::HostInfo *getHostInfo() const { - return hostInfo; - } - - bool isIdentified() const { - return hostInfo; - } - - void identify(Common::HostInfo *info) { - hostInfo = info; - } - }; - - static ConnectionManager connectionManager; - - std::string x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile; - - std::vector listenerAddresses; - std::list listeners; - - std::list connections; - - std::map daemonInfo; - - // Prevent shallow copy - ConnectionManager(const ConnectionManager &o); - ConnectionManager& operator=(const ConnectionManager &o); - - void updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state); - - ConnectionManager() {} - - protected: - virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool handled); - virtual void configFinished(); - - virtual void doInit(); - virtual void doDeinit(); - - public: - static ConnectionManager* get() { - return &connectionManager; - } - - void run(); - - Common::Connection* getDaemonConnection(const std::string &name) const throw (Common::Exception&); - std::string getDaemonName(const Common::Connection *con) const throw (Common::Exception&); - - void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Common::Exception&); - std::vector getDaemonList() const; -}; - -} -} - -#endif /*MAD_CORE_CONNECTIONMANAGER_H_*/ diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am deleted file mode 100644 index a5e780b..0000000 --- a/src/Core/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -SUBDIRS = Requests RequestHandlers - -noinst_LTLIBRARIES = libcore.la - -libcore_la_SOURCES = ConnectionManager.cpp UserManager.cpp -libcore_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la - -noinst_HEADERS = ConnectionManager.h UserBackend.h UserManager.h diff --git a/src/Core/Makefile.in b/src/Core/Makefile.in deleted file mode 100644 index bdeb29a..0000000 --- a/src/Core/Makefile.in +++ /dev/null @@ -1,644 +0,0 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Core -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ - $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ - $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ - $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 \ - $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ - $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ - $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ - $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libcore_la_DEPENDENCIES = Requests/librequests.la \ - RequestHandlers/librequesthandlers.la -am_libcore_la_OBJECTS = ConnectionManager.lo UserManager.lo -libcore_la_OBJECTS = $(am_libcore_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libcore_la_SOURCES) -DIST_SOURCES = $(libcore_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -HEADERS = $(noinst_HEADERS) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -ARGZ_H = @ARGZ_H@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ -EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ -ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ -ENOLINK_VALUE = @ENOLINK_VALUE@ -EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ -EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ -ERRNO_H = @ERRNO_H@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -GSSAPI_LIBS = @GSSAPI_LIBS@ -GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ -GnuTLS_LIBS = @GnuTLS_LIBS@ -HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ -HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ -HAVE__BOOL = @HAVE__BOOL@ -INCLTDL = @INCLTDL@ -INCLUDE_NEXT = @INCLUDE_NEXT@ -INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBADD_DL = @LIBADD_DL@ -LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ -LIBADD_DLOPEN = @LIBADD_DLOPEN@ -LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ -LIBLTDL = @LIBLTDL@ -LIBMULTITHREAD = @LIBMULTITHREAD@ -LIBOBJS = @LIBOBJS@ -LIBPTH = @LIBPTH@ -LIBPTH_PREFIX = @LIBPTH_PREFIX@ -LIBS = @LIBS@ -LIBTHREAD = @LIBTHREAD@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTDLDEPS = @LTDLDEPS@ -LTDLINCL = @LTDLINCL@ -LTDLOPEN = @LTDLOPEN@ -LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ -LTLIBOBJS = @LTLIBOBJS@ -LTLIBPTH = @LTLIBPTH@ -LTLIBTHREAD = @LTLIBTHREAD@ -LT_CONFIG_H = @LT_CONFIG_H@ -LT_DLLOADERS = @LT_DLLOADERS@ -LT_DLPREOPEN = @LT_DLPREOPEN@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MYSQL_CFLAGS = @MYSQL_CFLAGS@ -MYSQL_CONFIG = @MYSQL_CONFIG@ -MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ -MYSQL_VERSION = @MYSQL_VERSION@ -NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ -NEXT_TIME_H = @NEXT_TIME_H@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ -REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ -REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ -REPLACE_STRPTIME = @REPLACE_STRPTIME@ -REPLACE_TIMEGM = @REPLACE_TIMEGM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -SYS_TIME_H = @SYS_TIME_H@ -SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gl_LIBOBJS = @gl_LIBOBJS@ -gl_LTLIBOBJS = @gl_LTLIBOBJS@ -gltests_LIBOBJS = @gltests_LIBOBJS@ -gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ -have_df = @have_df@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libxml2_CFLAGS = @libxml2_CFLAGS@ -libxml2_LIBS = @libxml2_LIBS@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -ltdl_LIBOBJS = @ltdl_LIBOBJS@ -ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ -pcrecpp_LIBS = @pcrecpp_LIBS@ -pdfdir = @pdfdir@ -prefix = @prefix@ -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@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = Requests RequestHandlers -noinst_LTLIBRARIES = libcore.la -libcore_la_SOURCES = ConnectionManager.cpp UserManager.cpp -libcore_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la -noinst_HEADERS = ConnectionManager.h UserBackend.h UserManager.h -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Core/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Core/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libcore.la: $(libcore_la_OBJECTS) $(libcore_la_DEPENDENCIES) - $(CXXLINK) $(libcore_la_OBJECTS) $(libcore_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConnectionManager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserManager.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp deleted file mode 100644 index 0e316bc..0000000 --- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * DaemonCommandRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "DaemonCommandRequestHandler.h" -#include "../ConnectionManager.h" -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "DaemonCommand") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - std::string command = packet["command"]; - - try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, - sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished), command == "reboot"); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } -} - -void DaemonCommandRequestHandler::requestFinished(const Common::Request &request) { - try { - sendPacket(request.getResult()); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.h b/src/Core/RequestHandlers/DaemonCommandRequestHandler.h deleted file mode 100644 index aab9539..0000000 --- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * DaemonCommandRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ - -#include -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class DaemonCommandRequestHandler : public Common::RequestHandler { - private: - void requestFinished(const Common::Request &request); - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - DaemonCommandRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp deleted file mode 100644 index 547611c..0000000 --- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * DaemonFSInfoRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "DaemonFSInfoRequestHandler.h" -#include "../ConnectionManager.h" -#include -#include - - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "DaemonFSInfo") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, - sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } -} - -void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) { - try { - sendPacket(request.getResult()); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h deleted file mode 100644 index 66800d8..0000000 --- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * DaemonFSInfoRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ - -#include -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class DaemonFSInfoRequestHandler : public Common::RequestHandler { - private: - void requestFinished(const Common::Request &request); - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - DaemonFSInfoRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp deleted file mode 100644 index 84d3207..0000000 --- a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * DaemonListRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "DaemonListRequestHandler.h" -#include "../ConnectionManager.h" -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "ListHosts") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - Common::XmlPacket ret; - ret.setType("OK"); - ret.addList("hosts"); - - std::vector daemons = ConnectionManager::get()->getDaemonList(); - - for(std::vector::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) { - ret["hosts"].addEntry(); - - ret["hosts"].back().add("name", daemon->getName()); - ret["hosts"].back().add("address", daemon->getIP()); - ret["hosts"].back().add("state", daemon->getState()); - } - - sendPacket(ret); - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.h b/src/Core/RequestHandlers/DaemonListRequestHandler.h deleted file mode 100644 index a469603..0000000 --- a/src/Core/RequestHandlers/DaemonListRequestHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * DaemonListRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class DaemonListRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - DaemonListRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp deleted file mode 100644 index a84307b..0000000 --- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * DaemonStatusRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "DaemonStatusRequestHandler.h" -#include "../ConnectionManager.h" -#include -#include - - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "GetDaemonStatus") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - std::string daemonName = packet["daemonName"]; - - try { - Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); - Common::RequestManager::get()->sendRequest(daemonCon, - sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } -} - -void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) { - try { - sendPacket(request.getResult()); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h b/src/Core/RequestHandlers/DaemonStatusRequestHandler.h deleted file mode 100644 index 5ef6089..0000000 --- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * DaemonStatusRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ - -#include -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class DaemonStatusRequestHandler : public Common::RequestHandler { - private: - void requestFinished(const Common::Request &request); - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - DaemonStatusRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp deleted file mode 100644 index 7c2b482..0000000 --- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * GSSAPIAuthRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "GSSAPIAuthRequestHandler.h" -#include -#include -#include - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -// TODO Error handling - -void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "AuthGSSAPI") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - OM_uint32 majStat, minStat; - gss_buffer_desc recvBuffer, sendBuffer; - - // Needs error handling! - - if(gssContinue) { - const void *pkgData; - packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); - - recvBuffer.value = std::malloc(recvBuffer.length); - std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); - - majStat = gss_accept_sec_context(&minStat, &gssContext, GSS_C_NO_CREDENTIAL, &recvBuffer, GSS_C_NO_CHANNEL_BINDINGS, 0, 0, &sendBuffer, 0, 0, 0); - - std::free(recvBuffer.value); - - if(majStat == GSS_S_COMPLETE) { - Common::Logger::log(Common::Logger::VERBOSE, "GSS context established."); - gssContinue = false; - } - else if(majStat != GSS_S_CONTINUE_NEEDED) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - Common::XmlPacket ret; - ret.setType("AuthGSSAPI"); - ret.addBinary("authToken", sendBuffer.value, sendBuffer.length); - - if(!sendPacket(ret)) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - gss_release_buffer(&minStat, &sendBuffer); - } - else if(!sentSignature) { - if(!packet["binary"].isEmpty()) - return; - - /*const gnutls_datum_t *cert = getConnection()->getCertificate(); - - recvBuffer.length = cert->size; - recvBuffer.value = cert->data;*/ - - recvBuffer.value = getConnection()->getCertificate(&recvBuffer.length); - - majStat = gss_get_mic(&minStat, gssContext, GSS_C_QOP_DEFAULT, &recvBuffer, &sendBuffer); - - if(majStat != GSS_S_COMPLETE) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - Common::XmlPacket ret; - ret.setType("AuthGSSAPI"); - ret.addBinary("certMic", sendBuffer.value, sendBuffer.length); - - if(!sendPacket(ret)) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - gss_release_buffer(&minStat, &sendBuffer); - - sentSignature = true; - } - else { - const void *pkgData; - packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); - - recvBuffer.value = std::malloc(recvBuffer.length); - std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); - - majStat = gss_process_context_token(&minStat, gssContext, &recvBuffer); - - std::free(recvBuffer.value); - - if(majStat != GSS_S_COMPLETE) - return; - - signalFinished().emit(); - } -} - -} -} -} diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h deleted file mode 100644 index dd4d564..0000000 --- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * GSSAPIAuthRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ - -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class GSSAPIAuthRequestHandler : public Common::RequestHandler { - private: - gss_ctx_id_t gssContext; - - bool gssContinue, sentSignature; - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - GSSAPIAuthRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId), gssContext(GSS_C_NO_CONTEXT), gssContinue(true), sentSignature(false) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp deleted file mode 100644 index 235569c..0000000 --- a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * IdentifyRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "IdentifyRequestHandler.h" -#include "../ConnectionManager.h" -#include - - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "Identify") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - try { - ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]); - - Common::XmlPacket ret; - ret.setType("OK"); - sendPacket(ret); - } - catch(Common::Exception &e) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - - sendPacket(ret); - } - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.h b/src/Core/RequestHandlers/IdentifyRequestHandler.h deleted file mode 100644 index 016f777..0000000 --- a/src/Core/RequestHandlers/IdentifyRequestHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * IdentifyRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class IdentifyRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - IdentifyRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/LogRequestHandler.cpp b/src/Core/RequestHandlers/LogRequestHandler.cpp deleted file mode 100644 index aeec7da..0000000 --- a/src/Core/RequestHandlers/LogRequestHandler.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * LogRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "LogRequestHandler.h" -#include -#include -#include "../ConnectionManager.h" - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "Log") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - try { - Common::LogManager::get()->log(packet["category"], packet["level"], packet["timestamp"], packet["message"], - ConnectionManager::get()->getDaemonName(getConnection())); - } - catch(Common::Exception &e) { - Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); - } - - Common::XmlPacket ret; - ret.setType("OK"); - - sendPacket(ret); - - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/LogRequestHandler.h b/src/Core/RequestHandlers/LogRequestHandler.h deleted file mode 100644 index c391346..0000000 --- a/src/Core/RequestHandlers/LogRequestHandler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * LogRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class LogRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - LogRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/Makefile.am b/src/Core/RequestHandlers/Makefile.am deleted file mode 100644 index 036f936..0000000 --- a/src/Core/RequestHandlers/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_LTLIBRARIES = librequesthandlers.la -librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \ - GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp - -noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \ - GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h diff --git a/src/Core/RequestHandlers/Makefile.in b/src/Core/RequestHandlers/Makefile.in deleted file mode 100644 index c8ecb9c..0000000 --- a/src/Core/RequestHandlers/Makefile.in +++ /dev/null @@ -1,542 +0,0 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Core/RequestHandlers -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ - $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ - $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ - $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 \ - $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ - $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ - $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ - $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -librequesthandlers_la_LIBADD = -am_librequesthandlers_la_OBJECTS = DaemonCommandRequestHandler.lo \ - DaemonFSInfoRequestHandler.lo DaemonListRequestHandler.lo \ - DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \ - IdentifyRequestHandler.lo LogRequestHandler.lo \ - UserInfoRequestHandler.lo UserListRequestHandler.lo -librequesthandlers_la_OBJECTS = $(am_librequesthandlers_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(librequesthandlers_la_SOURCES) -DIST_SOURCES = $(librequesthandlers_la_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -ARGZ_H = @ARGZ_H@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ -EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ -ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ -ENOLINK_VALUE = @ENOLINK_VALUE@ -EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ -EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ -ERRNO_H = @ERRNO_H@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -GSSAPI_LIBS = @GSSAPI_LIBS@ -GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ -GnuTLS_LIBS = @GnuTLS_LIBS@ -HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ -HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ -HAVE__BOOL = @HAVE__BOOL@ -INCLTDL = @INCLTDL@ -INCLUDE_NEXT = @INCLUDE_NEXT@ -INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBADD_DL = @LIBADD_DL@ -LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ -LIBADD_DLOPEN = @LIBADD_DLOPEN@ -LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ -LIBLTDL = @LIBLTDL@ -LIBMULTITHREAD = @LIBMULTITHREAD@ -LIBOBJS = @LIBOBJS@ -LIBPTH = @LIBPTH@ -LIBPTH_PREFIX = @LIBPTH_PREFIX@ -LIBS = @LIBS@ -LIBTHREAD = @LIBTHREAD@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTDLDEPS = @LTDLDEPS@ -LTDLINCL = @LTDLINCL@ -LTDLOPEN = @LTDLOPEN@ -LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ -LTLIBOBJS = @LTLIBOBJS@ -LTLIBPTH = @LTLIBPTH@ -LTLIBTHREAD = @LTLIBTHREAD@ -LT_CONFIG_H = @LT_CONFIG_H@ -LT_DLLOADERS = @LT_DLLOADERS@ -LT_DLPREOPEN = @LT_DLPREOPEN@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MYSQL_CFLAGS = @MYSQL_CFLAGS@ -MYSQL_CONFIG = @MYSQL_CONFIG@ -MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ -MYSQL_VERSION = @MYSQL_VERSION@ -NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ -NEXT_TIME_H = @NEXT_TIME_H@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ -REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ -REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ -REPLACE_STRPTIME = @REPLACE_STRPTIME@ -REPLACE_TIMEGM = @REPLACE_TIMEGM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -SYS_TIME_H = @SYS_TIME_H@ -SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gl_LIBOBJS = @gl_LIBOBJS@ -gl_LTLIBOBJS = @gl_LTLIBOBJS@ -gltests_LIBOBJS = @gltests_LIBOBJS@ -gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ -have_df = @have_df@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libxml2_CFLAGS = @libxml2_CFLAGS@ -libxml2_LIBS = @libxml2_LIBS@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -ltdl_LIBOBJS = @ltdl_LIBOBJS@ -ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ -pcrecpp_LIBS = @pcrecpp_LIBS@ -pdfdir = @pdfdir@ -prefix = @prefix@ -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@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = librequesthandlers.la -librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \ - GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp - -noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \ - GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Core/RequestHandlers/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Core/RequestHandlers/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -librequesthandlers.la: $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_DEPENDENCIES) - $(CXXLINK) $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonCommandRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonFSInfoRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonListRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GSSAPIAuthRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdentifyRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserInfoRequestHandler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserListRequestHandler.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/Core/RequestHandlers/UserInfoRequestHandler.cpp b/src/Core/RequestHandlers/UserInfoRequestHandler.cpp deleted file mode 100644 index 68356f8..0000000 --- a/src/Core/RequestHandlers/UserInfoRequestHandler.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * UserInfoRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserInfoRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "GetUserInfo") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - if(!UserManager::get()->getUserInfo(packet["uid"], sigc::mem_fun(this, &UserInfoRequestHandler::userInfoHandler))) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); - - sendPacket(ret); - signalFinished().emit(); - } -} - -void UserInfoRequestHandler::userInfoHandler(const Common::UserInfo &info) { - Common::XmlPacket ret; - ret.setType("OK"); - - ret.add("uid", info.getUid()); - ret.add("gid", info.getGid()); - ret.add("username", info.getUsername()); - ret.add("fullName", info.getFullName()); - - sendPacket(ret); - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/UserInfoRequestHandler.h b/src/Core/RequestHandlers/UserInfoRequestHandler.h deleted file mode 100644 index b3103d4..0000000 --- a/src/Core/RequestHandlers/UserInfoRequestHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * UserInfoRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ - -#include -#include - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class UserInfoRequestHandler : public Common::RequestHandler { - private: - void userInfoHandler(const Common::UserInfo &info); - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - UserInfoRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/UserListRequestHandler.cpp b/src/Core/RequestHandlers/UserListRequestHandler.cpp deleted file mode 100644 index 8a61cbd..0000000 --- a/src/Core/RequestHandlers/UserListRequestHandler.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * UserListRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserListRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "ListUsers") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished().emit(); - return; - } - - // TODO Require authentication - - if(!UserManager::get()->getUserList(sigc::mem_fun(this, &UserListRequestHandler::userListHandler))) { - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); - - sendPacket(ret); - signalFinished().emit(); - } -} - -void UserListRequestHandler::userListHandler(const std::map &info) { - Common::XmlPacket ret; - ret.setType("OK"); - ret.addList("users"); - - for(std::map::const_iterator user = info.begin(); user != info.end(); ++user) { - ret["users"].addEntry(); - Common::XmlPacket::Entry &entry = ret["users"].back(); - - entry.add("uid", user->second.getUid()); - entry.add("gid", user->second.getGid()); - entry.add("username", user->second.getUsername()); - entry.add("fullName", user->second.getFullName()); - } - - sendPacket(ret); - signalFinished().emit(); -} - -} -} -} diff --git a/src/Core/RequestHandlers/UserListRequestHandler.h b/src/Core/RequestHandlers/UserListRequestHandler.h deleted file mode 100644 index e31da67..0000000 --- a/src/Core/RequestHandlers/UserListRequestHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * UserListRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ - -#include -#include - -#include - -namespace Mad { -namespace Core { -namespace RequestHandlers { - -class UserListRequestHandler : public Common::RequestHandler { - private: - void userListHandler(const std::map &info); - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - UserListRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ */ diff --git a/src/Core/Requests/CommandRequest.cpp b/src/Core/Requests/CommandRequest.cpp deleted file mode 100644 index 78bb650..0000000 --- a/src/Core/Requests/CommandRequest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CommandRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "CommandRequest.h" - -namespace Mad { -namespace Core { -namespace Requests { - -void CommandRequest::sendRequest() { - Common::XmlPacket packet; - packet.setType("Command"); - packet.add("command", reboot ? "reboot" : "shutdown"); - - sendPacket(packet); -} - -} -} -} diff --git a/src/Core/Requests/CommandRequest.h b/src/Core/Requests/CommandRequest.h deleted file mode 100644 index 2e4d1de..0000000 --- a/src/Core/Requests/CommandRequest.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CommandRequest.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTS_COMMANDREQUEST_H_ -#define MAD_CORE_REQUESTS_COMMANDREQUEST_H_ - -#include - -namespace Mad { -namespace Core { -namespace Requests { - -class CommandRequest : public Common::Request { - private: - bool reboot; - - protected: - virtual void sendRequest(); - - public: - CommandRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, bool reboot0) - : Common::Request(connection, requestId, slot), reboot(reboot0) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTS_COMMANDREQUEST_H_ */ diff --git a/src/Core/Requests/DaemonStateUpdateRequest.cpp b/src/Core/Requests/DaemonStateUpdateRequest.cpp deleted file mode 100644 index c8a813b..0000000 --- a/src/Core/Requests/DaemonStateUpdateRequest.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * DaemonStateUpdateRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "DaemonStateUpdateRequest.h" - -namespace Mad { -namespace Core { -namespace Requests { - -void DaemonStateUpdateRequest::sendRequest() { - Common::XmlPacket packet; - - packet.setType("UpdateHostState"); - packet.add("name", name); - packet.add("state", state); - sendPacket(packet); -} - -} -} -} diff --git a/src/Core/Requests/DaemonStateUpdateRequest.h b/src/Core/Requests/DaemonStateUpdateRequest.h deleted file mode 100644 index a1a8bb3..0000000 --- a/src/Core/Requests/DaemonStateUpdateRequest.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * DaemonStateUpdateRequest.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ -#define MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ - -#include -#include - -namespace Mad { -namespace Core { -namespace Requests { - -class DaemonStateUpdateRequest : public Common::Request { - private: - std::string name; - Common::HostInfo::State state; - - protected: - virtual void sendRequest(); - - public: - DaemonStateUpdateRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, const std::string &name0, Common::HostInfo::State state0) - : Common::Request(connection, requestId, slot), name(name0), state(state0) {} -}; - -} -} -} - -#endif /* MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ */ diff --git a/src/Core/Requests/Makefile.am b/src/Core/Requests/Makefile.am deleted file mode 100644 index f101b84..0000000 --- a/src/Core/Requests/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp - -noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h diff --git a/src/Core/Requests/Makefile.in b/src/Core/Requests/Makefile.in deleted file mode 100644 index f0a6168..0000000 --- a/src/Core/Requests/Makefile.in +++ /dev/null @@ -1,528 +0,0 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Core/Requests -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ - $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ - $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ - $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 \ - $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 \ - $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ - $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ - $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ - $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -librequests_la_LIBADD = -am_librequests_la_OBJECTS = CommandRequest.lo \ - DaemonStateUpdateRequest.lo -librequests_la_OBJECTS = $(am_librequests_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(librequests_la_SOURCES) -DIST_SOURCES = $(librequests_la_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -ARGZ_H = @ARGZ_H@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ -EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ -ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ -ENOLINK_VALUE = @ENOLINK_VALUE@ -EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ -EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ -ERRNO_H = @ERRNO_H@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -GSSAPI_LIBS = @GSSAPI_LIBS@ -GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ -GnuTLS_LIBS = @GnuTLS_LIBS@ -HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ -HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ -HAVE__BOOL = @HAVE__BOOL@ -INCLTDL = @INCLTDL@ -INCLUDE_NEXT = @INCLUDE_NEXT@ -INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBADD_DL = @LIBADD_DL@ -LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ -LIBADD_DLOPEN = @LIBADD_DLOPEN@ -LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ -LIBLTDL = @LIBLTDL@ -LIBMULTITHREAD = @LIBMULTITHREAD@ -LIBOBJS = @LIBOBJS@ -LIBPTH = @LIBPTH@ -LIBPTH_PREFIX = @LIBPTH_PREFIX@ -LIBS = @LIBS@ -LIBTHREAD = @LIBTHREAD@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTDLDEPS = @LTDLDEPS@ -LTDLINCL = @LTDLINCL@ -LTDLOPEN = @LTDLOPEN@ -LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ -LTLIBOBJS = @LTLIBOBJS@ -LTLIBPTH = @LTLIBPTH@ -LTLIBTHREAD = @LTLIBTHREAD@ -LT_CONFIG_H = @LT_CONFIG_H@ -LT_DLLOADERS = @LT_DLLOADERS@ -LT_DLPREOPEN = @LT_DLPREOPEN@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MYSQL_CFLAGS = @MYSQL_CFLAGS@ -MYSQL_CONFIG = @MYSQL_CONFIG@ -MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ -MYSQL_VERSION = @MYSQL_VERSION@ -NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ -NEXT_TIME_H = @NEXT_TIME_H@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ -REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ -REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ -REPLACE_STRPTIME = @REPLACE_STRPTIME@ -REPLACE_TIMEGM = @REPLACE_TIMEGM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STDBOOL_H = @STDBOOL_H@ -STRIP = @STRIP@ -SYS_TIME_H = @SYS_TIME_H@ -SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gl_LIBOBJS = @gl_LIBOBJS@ -gl_LTLIBOBJS = @gl_LTLIBOBJS@ -gltests_LIBOBJS = @gltests_LIBOBJS@ -gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ -have_df = @have_df@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libxml2_CFLAGS = @libxml2_CFLAGS@ -libxml2_LIBS = @libxml2_LIBS@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -ltdl_LIBOBJS = @ltdl_LIBOBJS@ -ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ -pcrecpp_LIBS = @pcrecpp_LIBS@ -pdfdir = @pdfdir@ -prefix = @prefix@ -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@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp -noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Core/Requests/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Core/Requests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -librequests.la: $(librequests_la_OBJECTS) $(librequests_la_DEPENDENCIES) - $(CXXLINK) $(librequests_la_OBJECTS) $(librequests_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CommandRequest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStateUpdateRequest.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/Core/UserBackend.h b/src/Core/UserBackend.h deleted file mode 100644 index 415f6bf..0000000 --- a/src/Core/UserBackend.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * UserBackend.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_USERBACKEND_H_ -#define MAD_CORE_USERBACKEND_H_ - -#include - -#include - -#include -#include - -#include - - -namespace Mad { -namespace Core { - -class UserManager; - -class UserBackend { - protected: - friend class UserManager; - - UserBackend() {} - - virtual bool getUserList(const sigc::slot& > &callback _UNUSED_PARAMETER_) { - return false; - } - - virtual bool getUserInfo(unsigned long uid _UNUSED_PARAMETER_, const sigc::slot &callback _UNUSED_PARAMETER_) { - return false; - } - - virtual bool setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string&, const sigc::slot &callback _UNUSED_PARAMETER_) { - return false; - } - - virtual bool addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_, const sigc::slot &callback _UNUSED_PARAMETER_) { - return false; - } - - virtual int getPriority() const { - return 0; - } - - public: - virtual ~UserBackend() {} -}; - -} -} - -#endif /* MAD_CORE_USERBACKEND_H_ */ diff --git a/src/Core/UserManager.cpp b/src/Core/UserManager.cpp deleted file mode 100644 index d560586..0000000 --- a/src/Core/UserManager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * UserManager.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserManager.h" -#include "UserBackend.h" - -namespace Mad { -namespace Core { - -UserManager UserManager::userManager; - - -bool UserManager::Compare::operator() (const UserBackend *b1, const UserBackend *b2) { - if(b1->getPriority() == b2->getPriority()) - return (b1 > b2); - else - return (b1->getPriority() > b2->getPriority()); -} - - -bool UserManager::getUserList(const sigc::slot& > &callback) { - for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getUserList(callback)) - return true; - } - - return false; -} - -bool UserManager::getUserInfo(unsigned long uid, const sigc::slot &callback) { - for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->getUserInfo(uid, callback)) - return true; - } - - return false; -} - -bool UserManager::setPassword(unsigned long uid, const std::string &password, const sigc::slot &callback) { - for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->setPassword(uid, password, callback)) - return true; - } - - return false; -} - -bool UserManager::addUser(const Common::UserInfo &userInfo, const sigc::slot &callback) { - for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - if((*backend)->addUser(userInfo, callback)) - return true; - } - - return false; -} - -} -} diff --git a/src/Core/UserManager.h b/src/Core/UserManager.h deleted file mode 100644 index a925bbe..0000000 --- a/src/Core/UserManager.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * UserManager.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_CORE_USERMANAGER_H_ -#define MAD_CORE_USERMANAGER_H_ - -#include - -#include -#include - -#include - -namespace Mad { -namespace Core { - -class UserBackend; - -class UserManager { - private: - struct Compare { - bool operator() (const UserBackend *b1, const UserBackend *b2); - }; - - static UserManager userManager; - - std::set backends; - - UserManager() {} - - public: - void registerBackend(UserBackend *backend) { - backends.insert(backend); - } - - void unregisterBackend(UserBackend *backend) { - backends.erase(backend); - } - - - bool getUserList(const sigc::slot& > &callback); - bool getUserInfo(unsigned long uid, const sigc::slot &callback); - - bool setPassword(unsigned long uid, const std::string &password, const sigc::slot &callback); - - bool addUser(const Common::UserInfo &userInfo, const sigc::slot &callback); - - - static UserManager *get() { - return &userManager; - } -}; - -} -} - -#endif /* MAD_CORE_USERMANAGER_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am index 9b1a9a2..3b9607f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,34 +1,34 @@ -SUBDIRS = Common Client Core Daemon Net modules +SUBDIRS = Common Client Server Daemon Net modules daemon_modules = -dlpreopen modules/FileLogger.la -core_modules = -dlpreopen modules/FileLogger.la +server_modules = -dlpreopen modules/FileLogger.la if SYSTEMBACKEND_POSIX daemon_modules += -dlpreopen modules/SystemBackendPosix.la -core_modules += -dlpreopen modules/SystemBackendPosix.la +server_modules += -dlpreopen modules/SystemBackendPosix.la endif if SYSTEMBACKEND_PROC daemon_modules += -dlpreopen modules/SystemBackendProc.la -core_modules += -dlpreopen modules/SystemBackendProc.la +server_modules += -dlpreopen modules/SystemBackendProc.la endif if USERBACKEND_MYSQL -core_modules += -dlopen modules/UserBackendMysql.la +server_modules += -dlopen modules/UserBackendMysql.la endif -bin_PROGRAMS = mad madc mad-core +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) -mad_LDFLAGS = -export-dynamic +mad_SOURCES = mad.cpp +mad_LDADD = Daemon/libdaemon.la Common/libcommon.la Net/libnet.la \ + $(libxml2_LIBS) $(sigc_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) +madc_SOURCES = madc.cpp +madc_LDADD = Client/libclient.la Common/libcommon.la Net/libnet.la \ + $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) -mad_core_SOURCES = mad-core.cpp -mad_core_LDADD = Core/libcore.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(core_modules) -mad_core_LDFLAGS = -export-dynamic +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) +mad_server_LDFLAGS = -export-dynamic diff --git a/src/Makefile.in b/src/Makefile.in index 315b096..c431af6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -37,7 +37,7 @@ host_triplet = @host@ @SYSTEMBACKEND_PROC_TRUE@am__append_3 = -dlpreopen modules/SystemBackendProc.la @SYSTEMBACKEND_PROC_TRUE@am__append_4 = -dlpreopen modules/SystemBackendProc.la @USERBACKEND_MYSQL_TRUE@am__append_5 = -dlopen modules/UserBackendMysql.la -bin_PROGRAMS = mad$(EXEEXT) madc$(EXEEXT) mad-core$(EXEEXT) +bin_PROGRAMS = mad$(EXEEXT) madc$(EXEEXT) mad-server$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -80,19 +80,19 @@ mad_DEPENDENCIES = Daemon/libdaemon.la Common/libcommon.la \ mad_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(mad_LDFLAGS) \ $(LDFLAGS) -o $@ -am_mad_core_OBJECTS = mad-core.$(OBJEXT) -mad_core_OBJECTS = $(am_mad_core_OBJECTS) +am_mad_server_OBJECTS = mad-server.$(OBJEXT) +mad_server_OBJECTS = $(am_mad_server_OBJECTS) @USERBACKEND_MYSQL_TRUE@am__DEPENDENCIES_5 = \ @USERBACKEND_MYSQL_TRUE@ modules/UserBackendMysql.la am__DEPENDENCIES_6 = modules/FileLogger.la $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_5) -mad_core_DEPENDENCIES = Core/libcore.la Common/libcommon.la \ +mad_server_DEPENDENCIES = Server/libserver.la Common/libcommon.la \ Net/libnet.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_6) -mad_core_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ +mad_server_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(mad_core_LDFLAGS) $(LDFLAGS) -o $@ + $(CXXFLAGS) $(mad_server_LDFLAGS) $(LDFLAGS) -o $@ am_madc_OBJECTS = madc.$(OBJEXT) madc_OBJECTS = $(am_madc_OBJECTS) madc_DEPENDENCIES = Client/libclient.la Common/libcommon.la \ @@ -110,8 +110,8 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(mad_SOURCES) $(mad_core_SOURCES) $(madc_SOURCES) -DIST_SOURCES = $(mad_SOURCES) $(mad_core_SOURCES) $(madc_SOURCES) +SOURCES = $(mad_SOURCES) $(mad_server_SOURCES) $(madc_SOURCES) +DIST_SOURCES = $(mad_SOURCES) $(mad_server_SOURCES) $(madc_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -308,25 +308,25 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = Common Client Core Daemon Net modules +SUBDIRS = Common Client Server Daemon Net modules daemon_modules = -dlpreopen modules/FileLogger.la $(am__append_1) \ $(am__append_3) -core_modules = -dlpreopen modules/FileLogger.la $(am__append_2) \ +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) + $(libxml2_LIBS) $(sigc_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) + $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(READLINE_LIBS) -mad_core_SOURCES = mad-core.cpp -mad_core_LDADD = Core/libcore.la Common/libcommon.la Net/libnet.la \ - $(libxml2_LIBS) $(sigc_LIBS) $(GnuTLS_LIBS) $(GSSAPI_LIBS) @LIBLTDL@ $(core_modules) +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) -mad_core_LDFLAGS = -export-dynamic +mad_server_LDFLAGS = -export-dynamic all: all-recursive .SUFFIXES: @@ -391,9 +391,9 @@ clean-binPROGRAMS: mad$(EXEEXT): $(mad_OBJECTS) $(mad_DEPENDENCIES) @rm -f mad$(EXEEXT) $(mad_LINK) $(mad_OBJECTS) $(mad_LDADD) $(LIBS) -mad-core$(EXEEXT): $(mad_core_OBJECTS) $(mad_core_DEPENDENCIES) - @rm -f mad-core$(EXEEXT) - $(mad_core_LINK) $(mad_core_OBJECTS) $(mad_core_LDADD) $(LIBS) +mad-server$(EXEEXT): $(mad_server_OBJECTS) $(mad_server_DEPENDENCIES) + @rm -f mad-server$(EXEEXT) + $(mad_server_LINK) $(mad_server_OBJECTS) $(mad_server_LDADD) $(LIBS) madc$(EXEEXT): $(madc_OBJECTS) $(madc_DEPENDENCIES) @rm -f madc$(EXEEXT) $(CXXLINK) $(madc_OBJECTS) $(madc_LDADD) $(LIBS) @@ -404,7 +404,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mad-core.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mad-server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mad.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/madc.Po@am__quote@ diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp new file mode 100644 index 0000000..279304c --- /dev/null +++ b/src/Server/ConnectionManager.cpp @@ -0,0 +1,310 @@ +/* + * ConnectionManager.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ConnectionManager.h" +#include +#include +#include +#include +#include +#include "Requests/DaemonStateUpdateRequest.h" +#include "RequestHandlers/DaemonCommandRequestHandler.h" +#include "RequestHandlers/DaemonFSInfoRequestHandler.h" +#include "RequestHandlers/DaemonListRequestHandler.h" +#include "RequestHandlers/DaemonStatusRequestHandler.h" +#include "RequestHandlers/GSSAPIAuthRequestHandler.h" +#include "RequestHandlers/IdentifyRequestHandler.h" +#include "RequestHandlers/LogRequestHandler.h" +#include "RequestHandlers/UserInfoRequestHandler.h" +#include "RequestHandlers/UserListRequestHandler.h" +#include +#include +#include +#include + +#include +#include + +namespace Mad { +namespace Server { + +ConnectionManager ConnectionManager::connectionManager; + +bool ConnectionManager::Connection::send(const Net::Packet &packet) { + return connection->send(packet); +} + +ConnectionManager::Connection::Connection(Net::ServerConnection *connection0, ConnectionType type0) +: connection(connection0), type(type0), hostInfo(0) { + connection->signalReceive().connect(sigc::mem_fun(this, &Connection::receive)); +} + +ConnectionManager::Connection::~Connection() { + delete connection; +} + +bool ConnectionManager::Connection::isConnected() const { + return connection->isConnected(); +} + +bool ConnectionManager::Connection::disconnect() { + connection->disconnect(); + + return true; +} + +void* ConnectionManager::Connection::getCertificate(size_t *size) const { + const gnutls_datum_t *cert = connection->getCertificate(); + + *size = cert->size; + return cert->data; +} + +void* ConnectionManager::Connection::getPeerCertificate(size_t *size) const { + const gnutls_datum_t *cert = connection->getPeerCertificate(); + + *size = cert->size; + return cert->data; +} + +void ConnectionManager::updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state) { + hostInfo->setState(state); + + for(std::list::iterator con = connections.begin(); con != connections.end(); ++con) { + if((*con)->getConnectionType() == Connection::CLIENT) + Common::RequestManager::get()->sendRequest(*con, Common::Request::slot_type(), hostInfo->getName(), state); + } +} + +bool ConnectionManager::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) { + if(handled) + return false; + + if(entry[0].getKey().matches("Listen") && entry[1].empty()) { + try { + listenerAddresses.push_back(Net::IPAddress(entry[0][0])); + } + catch(Common::Exception &e) { + // TODO Log error + } + + return true; + } + else if(entry[0].getKey().matches("X509TrustFile") && entry[1].empty()) { + x509TrustFile = entry[0][0]; + + return true; + } + else if(entry[0].getKey().matches("X509CrlFile") && entry[1].empty()) { + x509CrlFile = entry[0][0]; + + return true; + } + else if(entry[0].getKey().matches("X509CertFile") && entry[1].empty()) { + x509CertFile = entry[0][0]; + + return true; + } + else if(entry[0].getKey().matches("X509KeyFile") && entry[1].empty()) { + x509KeyFile = entry[0][0]; + + return true; + } + else if(entry[0].getKey().matches("Daemon")) { + if(entry[0].getSize() == 1) { + if(entry[1].empty()) { + daemonInfo.insert(std::make_pair(entry[0][0], Common::HostInfo(entry[0][0]))); + + return true; + } + else if(entry[1].getKey().matches("IpAddress") && entry[2].empty()) { + daemonInfo[entry[0][0]].setIP(entry[1][0]); + + return true; + } + } + } + + return false; +} + +void ConnectionManager::configFinished() { + if(listenerAddresses.empty()) { + try { + listeners.push_back(new Net::Listener(x509CertFile, x509KeyFile)); + } + catch(Common::Exception &e) { + // TODO Log error + } + } + else { + for(std::vector::const_iterator address = listenerAddresses.begin(); address != listenerAddresses.end(); ++address) { + try { + listeners.push_back(new Net::Listener(x509CertFile, x509KeyFile, *address)); + } + catch(Common::Exception &e) { + // TODO Log error + } + } + } +} + +void ConnectionManager::doInit() { + Common::RequestManager::get()->setServer(true); + + Net::Connection::init(); + + Common::RequestManager::get()->registerPacketType("AuthGSSAPI"); + Common::RequestManager::get()->registerPacketType("DaemonCommand"); + Common::RequestManager::get()->registerPacketType("DaemonFSInfo"); + Common::RequestManager::get()->registerPacketType("FSInfo"); + Common::RequestManager::get()->registerPacketType("GetStatus"); + Common::RequestManager::get()->registerPacketType("GetDaemonStatus"); + Common::RequestManager::get()->registerPacketType("Identify"); + Common::RequestManager::get()->registerPacketType("ListHosts"); + Common::RequestManager::get()->registerPacketType("GetUserInfo"); + Common::RequestManager::get()->registerPacketType("ListUsers"); + Common::RequestManager::get()->registerPacketType("Log"); +} + +void ConnectionManager::doDeinit() { + for(std::list::iterator con = connections.begin(); con != connections.end(); ++con) + delete *con; + + + Common::RequestManager::get()->unregisterPacketType("AuthGSSAPI"); + Common::RequestManager::get()->unregisterPacketType("DaemonCommand"); + Common::RequestManager::get()->unregisterPacketType("DaemonFSInfo"); + Common::RequestManager::get()->unregisterPacketType("FSInfo"); + Common::RequestManager::get()->unregisterPacketType("GetStatus"); + Common::RequestManager::get()->unregisterPacketType("GetDaemonStatus"); + Common::RequestManager::get()->unregisterPacketType("Identify"); + Common::RequestManager::get()->unregisterPacketType("ListHosts"); + Common::RequestManager::get()->unregisterPacketType("GetUserInfo"); + Common::RequestManager::get()->unregisterPacketType("ListUsers"); + Common::RequestManager::get()->unregisterPacketType("Log"); + + Net::Connection::deinit(); +} + +void ConnectionManager::run() { + // TODO Logging + + Net::FdManager::get()->run(); + + for(std::list::iterator con = connections.begin(); con != connections.end();) { + if(!(*con)->isConnected()) { + if((*con)->isIdentified()) + updateState((*con)->getHostInfo(), Common::HostInfo::INACTIVE); + + Common::RequestManager::get()->unregisterConnection(*con); + delete *con; + connections.erase(con++); + } + else + ++con; + } + + for(std::list::iterator listener = listeners.begin(); listener != listeners.end(); ++listener) { + Net::ServerConnection *con; + + while((con = (*listener)->getConnection()) != 0) { + Connection *connection = new Connection(con, + con->isDaemonConnection() ? Connection::DAEMON : Connection::CLIENT); + connections.push_back(connection); + Common::RequestManager::get()->registerConnection(connection); + } + } +} + +Common::Connection* ConnectionManager::getDaemonConnection(const std::string &name) const throw (Common::Exception&) { + const Common::HostInfo *hostInfo; + + try { + hostInfo = &daemonInfo.at(name); + } + catch(std::out_of_range&) { + throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); + } + + if(hostInfo->getState() != Common::HostInfo::INACTIVE) { + for(std::list::const_iterator it = connections.begin(); it != connections.end(); ++it) { + if((*it)->getHostInfo() == hostInfo) { + return *it; + } + } + } + + throw(Common::Exception::NOT_AVAILABLE); +} + +std::string ConnectionManager::getDaemonName(const Common::Connection *con) const throw (Common::Exception&) { + const Connection *connection = dynamic_cast(con); + + if(connection) { + if(connection->isIdentified()) { + return connection->getHostInfo()->getName(); + } + } + + throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); +} + +void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Common::Exception&) { + // TODO Logging + + Connection *connection = dynamic_cast(con); + + if(!connection || (connection->getConnectionType() != Connection::DAEMON)) + throw Common::Exception(Common::Exception::INVALID_ACTION); + + if(connection->isIdentified()) + throw Common::Exception(Common::Exception::ALREADY_IDENTIFIED); + + if(daemonInfo.count(name) == 0) + throw Common::Exception(Common::Exception::UNKNOWN_DAEMON); + + Common::HostInfo *hostInfo = &daemonInfo[name]; + + if(hostInfo->getState() != Common::HostInfo::INACTIVE) { + try { + getDaemonConnection(name)->disconnect(); + Common::Logger::log(Common::Logger::WARNING, "Disconnecting old connection."); + } + catch(Common::Exception&) {} + } + + connection->identify(hostInfo); + updateState(hostInfo, Common::HostInfo::RUNNING); + + Common::Logger::logf("Identified as '%s'.", name.c_str()); +} + +std::vector ConnectionManager::getDaemonList() const { + std::vector ret; + + for(std::map::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) { + ret.push_back(daemon->second); + } + + return ret; +} + +} +} diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h new file mode 100644 index 0000000..5072897 --- /dev/null +++ b/src/Server/ConnectionManager.h @@ -0,0 +1,131 @@ +/* + * ConnectionManager.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_CONNECTIONMANAGER_H_ +#define MAD_SERVER_CONNECTIONMANAGER_H_ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace Mad { + +namespace Net { +class Listener; +class ServerConnection; +class Packet; +} + +namespace Server { + +class ConnectionManager : public Common::Configurable, public Common::Initializable { + private: + class Connection : public Common::Connection { + public: + enum ConnectionType { + DAEMON, CLIENT + }; + + private: + Net::ServerConnection *connection; + ConnectionType type; + Common::HostInfo *hostInfo; + + protected: + virtual bool send(const Net::Packet &packet); + + public: + Connection(Net::ServerConnection *connection0, ConnectionType type0); + virtual ~Connection(); + + bool isConnected() const; + + virtual bool disconnect(); + virtual void* getCertificate(size_t *size) const; + virtual void* getPeerCertificate(size_t *size) const; + + ConnectionType getConnectionType() const { + return type; + } + + Common::HostInfo *getHostInfo() const { + return hostInfo; + } + + bool isIdentified() const { + return hostInfo; + } + + void identify(Common::HostInfo *info) { + hostInfo = info; + } + }; + + static ConnectionManager connectionManager; + + std::string x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile; + + std::vector listenerAddresses; + std::list listeners; + + std::list connections; + + std::map daemonInfo; + + // Prevent shallow copy + ConnectionManager(const ConnectionManager &o); + ConnectionManager& operator=(const ConnectionManager &o); + + void updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state); + + ConnectionManager() {} + + protected: + virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool handled); + virtual void configFinished(); + + virtual void doInit(); + virtual void doDeinit(); + + public: + static ConnectionManager* get() { + return &connectionManager; + } + + void run(); + + Common::Connection* getDaemonConnection(const std::string &name) const throw (Common::Exception&); + std::string getDaemonName(const Common::Connection *con) const throw (Common::Exception&); + + void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Common::Exception&); + std::vector getDaemonList() const; +}; + +} +} + +#endif /*MAD_SERVER_CONNECTIONMANAGER_H_*/ diff --git a/src/Server/Makefile.am b/src/Server/Makefile.am new file mode 100644 index 0000000..cd6a409 --- /dev/null +++ b/src/Server/Makefile.am @@ -0,0 +1,8 @@ +SUBDIRS = Requests RequestHandlers + +noinst_LTLIBRARIES = libserver.la + +libserver_la_SOURCES = ConnectionManager.cpp UserManager.cpp +libserver_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la + +noinst_HEADERS = ConnectionManager.h UserBackend.h UserManager.h diff --git a/src/Server/Makefile.in b/src/Server/Makefile.in new file mode 100644 index 0000000..6e94f54 --- /dev/null +++ b/src/Server/Makefile.in @@ -0,0 +1,644 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Server +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ + $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ + $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ + $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ + $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ + $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ + $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libserver_la_DEPENDENCIES = Requests/librequests.la \ + RequestHandlers/librequesthandlers.la +am_libserver_la_OBJECTS = ConnectionManager.lo UserManager.lo +libserver_la_OBJECTS = $(am_libserver_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libserver_la_SOURCES) +DIST_SOURCES = $(libserver_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARGZ_H = @ARGZ_H@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ +GnuTLS_LIBS = @GnuTLS_LIBS@ +HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ +HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ +HAVE__BOOL = @HAVE__BOOL@ +INCLTDL = @INCLTDL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBADD_DL = @LIBADD_DL@ +LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ +LIBADD_DLOPEN = @LIBADD_DLOPEN@ +LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ +LIBLTDL = @LIBLTDL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ +LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTDLDEPS = @LTDLDEPS@ +LTDLINCL = @LTDLINCL@ +LTDLOPEN = @LTDLOPEN@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ +LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ +LT_CONFIG_H = @LT_CONFIG_H@ +LT_DLLOADERS = @LT_DLLOADERS@ +LT_DLPREOPEN = @LT_DLPREOPEN@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_CONFIG = @MYSQL_CONFIG@ +MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ +MYSQL_VERSION = @MYSQL_VERSION@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_TIME_H = @NEXT_TIME_H@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ +REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ +REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ +REPLACE_STRPTIME = @REPLACE_STRPTIME@ +REPLACE_TIMEGM = @REPLACE_TIMEGM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STDBOOL_H = @STDBOOL_H@ +STRIP = @STRIP@ +SYS_TIME_H = @SYS_TIME_H@ +SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +have_df = @have_df@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libxml2_CFLAGS = @libxml2_CFLAGS@ +libxml2_LIBS = @libxml2_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +ltdl_LIBOBJS = @ltdl_LIBOBJS@ +ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ +pcrecpp_LIBS = @pcrecpp_LIBS@ +pdfdir = @pdfdir@ +prefix = @prefix@ +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@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = Requests RequestHandlers +noinst_LTLIBRARIES = libserver.la +libserver_la_SOURCES = ConnectionManager.cpp UserManager.cpp +libserver_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la +noinst_HEADERS = ConnectionManager.h UserBackend.h UserManager.h +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Server/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Server/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libserver.la: $(libserver_la_OBJECTS) $(libserver_la_DEPENDENCIES) + $(CXXLINK) $(libserver_la_OBJECTS) $(libserver_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConnectionManager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserManager.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp new file mode 100644 index 0000000..7c1efb9 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp @@ -0,0 +1,85 @@ +/* + * DaemonCommandRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DaemonCommandRequestHandler.h" +#include "../ConnectionManager.h" +#include "../Requests/CommandRequest.h" + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "DaemonCommand") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + std::string command = packet["command"]; + + try { + Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); + Common::RequestManager::get()->sendRequest(daemonCon, + sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished), command == "reboot"); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } +} + +void DaemonCommandRequestHandler::requestFinished(const Common::Request &request) { + try { + sendPacket(request.getResult()); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.h b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h new file mode 100644 index 0000000..6bd1278 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h @@ -0,0 +1,47 @@ +/* + * DaemonCommandRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ + +#include +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class DaemonCommandRequestHandler : public Common::RequestHandler { + private: + void requestFinished(const Common::Request &request); + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + DaemonCommandRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp new file mode 100644 index 0000000..9ccca40 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp @@ -0,0 +1,83 @@ +/* + * DaemonFSInfoRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DaemonFSInfoRequestHandler.h" +#include "../ConnectionManager.h" +#include +#include + + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "DaemonFSInfo") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + try { + Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); + Common::RequestManager::get()->sendRequest(daemonCon, + sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } +} + +void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) { + try { + sendPacket(request.getResult()); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h new file mode 100644 index 0000000..3352f11 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h @@ -0,0 +1,47 @@ +/* + * DaemonFSInfoRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ + +#include +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class DaemonFSInfoRequestHandler : public Common::RequestHandler { + private: + void requestFinished(const Common::Request &request); + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + DaemonFSInfoRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp new file mode 100644 index 0000000..c4b4143 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp @@ -0,0 +1,65 @@ +/* + * DaemonListRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DaemonListRequestHandler.h" +#include "../ConnectionManager.h" +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "ListHosts") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + Common::XmlPacket ret; + ret.setType("OK"); + ret.addList("hosts"); + + std::vector daemons = ConnectionManager::get()->getDaemonList(); + + for(std::vector::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) { + ret["hosts"].addEntry(); + + ret["hosts"].back().add("name", daemon->getName()); + ret["hosts"].back().add("address", daemon->getIP()); + ret["hosts"].back().add("state", daemon->getState()); + } + + sendPacket(ret); + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.h b/src/Server/RequestHandlers/DaemonListRequestHandler.h new file mode 100644 index 0000000..8726962 --- /dev/null +++ b/src/Server/RequestHandlers/DaemonListRequestHandler.h @@ -0,0 +1,42 @@ +/* + * DaemonListRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class DaemonListRequestHandler : public Common::RequestHandler { + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + DaemonListRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp new file mode 100644 index 0000000..07e0c4c --- /dev/null +++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -0,0 +1,85 @@ +/* + * DaemonStatusRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DaemonStatusRequestHandler.h" +#include "../ConnectionManager.h" +#include +#include + + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "GetDaemonStatus") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + std::string daemonName = packet["daemonName"]; + + try { + Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); + Common::RequestManager::get()->sendRequest(daemonCon, + sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } +} + +void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) { + try { + sendPacket(request.getResult()); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.h b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h new file mode 100644 index 0000000..8e61ada --- /dev/null +++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h @@ -0,0 +1,47 @@ +/* + * DaemonStatusRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ + +#include +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class DaemonStatusRequestHandler : public Common::RequestHandler { + private: + void requestFinished(const Common::Request &request); + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + DaemonStatusRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp new file mode 100644 index 0000000..c665843 --- /dev/null +++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp @@ -0,0 +1,134 @@ +/* + * GSSAPIAuthRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "GSSAPIAuthRequestHandler.h" +#include +#include +#include + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +// TODO Error handling + +void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "AuthGSSAPI") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + OM_uint32 majStat, minStat; + gss_buffer_desc recvBuffer, sendBuffer; + + // Needs error handling! + + if(gssContinue) { + const void *pkgData; + packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); + + recvBuffer.value = std::malloc(recvBuffer.length); + std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); + + majStat = gss_accept_sec_context(&minStat, &gssContext, GSS_C_NO_CREDENTIAL, &recvBuffer, GSS_C_NO_CHANNEL_BINDINGS, 0, 0, &sendBuffer, 0, 0, 0); + + std::free(recvBuffer.value); + + if(majStat == GSS_S_COMPLETE) { + Common::Logger::log(Common::Logger::VERBOSE, "GSS context established."); + gssContinue = false; + } + else if(majStat != GSS_S_CONTINUE_NEEDED) { + gss_release_buffer(&minStat, &sendBuffer); + return; + } + + Common::XmlPacket ret; + ret.setType("AuthGSSAPI"); + ret.addBinary("authToken", sendBuffer.value, sendBuffer.length); + + if(!sendPacket(ret)) { + gss_release_buffer(&minStat, &sendBuffer); + return; + } + + gss_release_buffer(&minStat, &sendBuffer); + } + else if(!sentSignature) { + if(!packet["binary"].isEmpty()) + return; + + /*const gnutls_datum_t *cert = getConnection()->getCertificate(); + + recvBuffer.length = cert->size; + recvBuffer.value = cert->data;*/ + + recvBuffer.value = getConnection()->getCertificate(&recvBuffer.length); + + majStat = gss_get_mic(&minStat, gssContext, GSS_C_QOP_DEFAULT, &recvBuffer, &sendBuffer); + + if(majStat != GSS_S_COMPLETE) { + gss_release_buffer(&minStat, &sendBuffer); + return; + } + + Common::XmlPacket ret; + ret.setType("AuthGSSAPI"); + ret.addBinary("certMic", sendBuffer.value, sendBuffer.length); + + if(!sendPacket(ret)) { + gss_release_buffer(&minStat, &sendBuffer); + return; + } + + gss_release_buffer(&minStat, &sendBuffer); + + sentSignature = true; + } + else { + const void *pkgData; + packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); + + recvBuffer.value = std::malloc(recvBuffer.length); + std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); + + majStat = gss_process_context_token(&minStat, gssContext, &recvBuffer); + + std::free(recvBuffer.value); + + if(majStat != GSS_S_COMPLETE) + return; + + signalFinished().emit(); + } +} + +} +} +} diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h new file mode 100644 index 0000000..2c5191c --- /dev/null +++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h @@ -0,0 +1,48 @@ +/* + * GSSAPIAuthRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ + +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class GSSAPIAuthRequestHandler : public Common::RequestHandler { + private: + gss_ctx_id_t gssContext; + + bool gssContinue, sentSignature; + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + GSSAPIAuthRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId), gssContext(GSS_C_NO_CONTEXT), gssContinue(true), sentSignature(false) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp new file mode 100644 index 0000000..9db9411 --- /dev/null +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp @@ -0,0 +1,67 @@ +/* + * IdentifyRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "IdentifyRequestHandler.h" +#include "../ConnectionManager.h" +#include + + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "Identify") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + try { + ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]); + + Common::XmlPacket ret; + ret.setType("OK"); + sendPacket(ret); + } + catch(Common::Exception &e) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + + sendPacket(ret); + } + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.h b/src/Server/RequestHandlers/IdentifyRequestHandler.h new file mode 100644 index 0000000..322bbab --- /dev/null +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.h @@ -0,0 +1,42 @@ +/* + * IdentifyRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class IdentifyRequestHandler : public Common::RequestHandler { + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + IdentifyRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp new file mode 100644 index 0000000..ae64921 --- /dev/null +++ b/src/Server/RequestHandlers/LogRequestHandler.cpp @@ -0,0 +1,63 @@ +/* + * LogRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "LogRequestHandler.h" +#include +#include +#include "../ConnectionManager.h" + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "Log") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + try { + Common::LogManager::get()->log(packet["category"], packet["level"], packet["timestamp"], packet["message"], + ConnectionManager::get()->getDaemonName(getConnection())); + } + catch(Common::Exception &e) { + Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); + } + + Common::XmlPacket ret; + ret.setType("OK"); + + sendPacket(ret); + + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/LogRequestHandler.h b/src/Server/RequestHandlers/LogRequestHandler.h new file mode 100644 index 0000000..d18a6d3 --- /dev/null +++ b/src/Server/RequestHandlers/LogRequestHandler.h @@ -0,0 +1,42 @@ +/* + * LogRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class LogRequestHandler : public Common::RequestHandler { + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + LogRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/Makefile.am b/src/Server/RequestHandlers/Makefile.am new file mode 100644 index 0000000..036f936 --- /dev/null +++ b/src/Server/RequestHandlers/Makefile.am @@ -0,0 +1,6 @@ +noinst_LTLIBRARIES = librequesthandlers.la +librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \ + GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp + +noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \ + GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h diff --git a/src/Server/RequestHandlers/Makefile.in b/src/Server/RequestHandlers/Makefile.in new file mode 100644 index 0000000..7f1bfa3 --- /dev/null +++ b/src/Server/RequestHandlers/Makefile.in @@ -0,0 +1,542 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Server/RequestHandlers +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ + $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ + $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ + $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ + $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ + $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ + $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +librequesthandlers_la_LIBADD = +am_librequesthandlers_la_OBJECTS = DaemonCommandRequestHandler.lo \ + DaemonFSInfoRequestHandler.lo DaemonListRequestHandler.lo \ + DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \ + IdentifyRequestHandler.lo LogRequestHandler.lo \ + UserInfoRequestHandler.lo UserListRequestHandler.lo +librequesthandlers_la_OBJECTS = $(am_librequesthandlers_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(librequesthandlers_la_SOURCES) +DIST_SOURCES = $(librequesthandlers_la_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARGZ_H = @ARGZ_H@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ +GnuTLS_LIBS = @GnuTLS_LIBS@ +HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ +HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ +HAVE__BOOL = @HAVE__BOOL@ +INCLTDL = @INCLTDL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBADD_DL = @LIBADD_DL@ +LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ +LIBADD_DLOPEN = @LIBADD_DLOPEN@ +LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ +LIBLTDL = @LIBLTDL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ +LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTDLDEPS = @LTDLDEPS@ +LTDLINCL = @LTDLINCL@ +LTDLOPEN = @LTDLOPEN@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ +LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ +LT_CONFIG_H = @LT_CONFIG_H@ +LT_DLLOADERS = @LT_DLLOADERS@ +LT_DLPREOPEN = @LT_DLPREOPEN@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_CONFIG = @MYSQL_CONFIG@ +MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ +MYSQL_VERSION = @MYSQL_VERSION@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_TIME_H = @NEXT_TIME_H@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ +REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ +REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ +REPLACE_STRPTIME = @REPLACE_STRPTIME@ +REPLACE_TIMEGM = @REPLACE_TIMEGM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STDBOOL_H = @STDBOOL_H@ +STRIP = @STRIP@ +SYS_TIME_H = @SYS_TIME_H@ +SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +have_df = @have_df@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libxml2_CFLAGS = @libxml2_CFLAGS@ +libxml2_LIBS = @libxml2_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +ltdl_LIBOBJS = @ltdl_LIBOBJS@ +ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ +pcrecpp_LIBS = @pcrecpp_LIBS@ +pdfdir = @pdfdir@ +prefix = @prefix@ +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@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = librequesthandlers.la +librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \ + GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp + +noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \ + GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Server/RequestHandlers/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Server/RequestHandlers/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +librequesthandlers.la: $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_DEPENDENCIES) + $(CXXLINK) $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonCommandRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonFSInfoRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonListRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GSSAPIAuthRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdentifyRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserInfoRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserListRequestHandler.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp new file mode 100644 index 0000000..16003a2 --- /dev/null +++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp @@ -0,0 +1,70 @@ +/* + * UserInfoRequestHandler.cpp + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "UserInfoRequestHandler.h" +#include "../UserManager.h" +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "GetUserInfo") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + if(!UserManager::get()->getUserInfo(packet["uid"], sigc::mem_fun(this, &UserInfoRequestHandler::userInfoHandler))) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); + + sendPacket(ret); + signalFinished().emit(); + } +} + +void UserInfoRequestHandler::userInfoHandler(const Common::UserInfo &info) { + Common::XmlPacket ret; + ret.setType("OK"); + + ret.add("uid", info.getUid()); + ret.add("gid", info.getGid()); + ret.add("username", info.getUsername()); + ret.add("fullName", info.getFullName()); + + sendPacket(ret); + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.h b/src/Server/RequestHandlers/UserInfoRequestHandler.h new file mode 100644 index 0000000..5b1d466 --- /dev/null +++ b/src/Server/RequestHandlers/UserInfoRequestHandler.h @@ -0,0 +1,48 @@ +/* + * UserInfoRequestHandler.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ + +#include +#include + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class UserInfoRequestHandler : public Common::RequestHandler { + private: + void userInfoHandler(const Common::UserInfo &info); + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + UserInfoRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp new file mode 100644 index 0000000..696b1d4 --- /dev/null +++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp @@ -0,0 +1,76 @@ +/* + * UserListRequestHandler.cpp + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "UserListRequestHandler.h" +#include "../UserManager.h" +#include +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) { + if(packet.getType() != "ListUsers") { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished().emit(); + return; + } + + // TODO Require authentication + + if(!UserManager::get()->getUserList(sigc::mem_fun(this, &UserListRequestHandler::userListHandler))) { + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED); + + sendPacket(ret); + signalFinished().emit(); + } +} + +void UserListRequestHandler::userListHandler(const std::map &info) { + Common::XmlPacket ret; + ret.setType("OK"); + ret.addList("users"); + + for(std::map::const_iterator user = info.begin(); user != info.end(); ++user) { + ret["users"].addEntry(); + Common::XmlPacket::Entry &entry = ret["users"].back(); + + entry.add("uid", user->second.getUid()); + entry.add("gid", user->second.getGid()); + entry.add("username", user->second.getUsername()); + entry.add("fullName", user->second.getFullName()); + } + + sendPacket(ret); + signalFinished().emit(); +} + +} +} +} diff --git a/src/Server/RequestHandlers/UserListRequestHandler.h b/src/Server/RequestHandlers/UserListRequestHandler.h new file mode 100644 index 0000000..7c85aa0 --- /dev/null +++ b/src/Server/RequestHandlers/UserListRequestHandler.h @@ -0,0 +1,48 @@ +/* + * UserListRequestHandler.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ +#define MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ + +#include +#include + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class UserListRequestHandler : public Common::RequestHandler { + private: + void userListHandler(const std::map &info); + + protected: + virtual void handlePacket(const Common::XmlPacket &packet); + + public: + UserListRequestHandler(Common::Connection *connection, uint16_t requestId) + : RequestHandler(connection, requestId) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/Requests/CommandRequest.cpp b/src/Server/Requests/CommandRequest.cpp new file mode 100644 index 0000000..33f8dc0 --- /dev/null +++ b/src/Server/Requests/CommandRequest.cpp @@ -0,0 +1,36 @@ +/* + * CommandRequest.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "CommandRequest.h" + +namespace Mad { +namespace Server { +namespace Requests { + +void CommandRequest::sendRequest() { + Common::XmlPacket packet; + packet.setType("Command"); + packet.add("command", reboot ? "reboot" : "shutdown"); + + sendPacket(packet); +} + +} +} +} diff --git a/src/Server/Requests/CommandRequest.h b/src/Server/Requests/CommandRequest.h new file mode 100644 index 0000000..feb33be --- /dev/null +++ b/src/Server/Requests/CommandRequest.h @@ -0,0 +1,45 @@ +/* + * CommandRequest.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTS_COMMANDREQUEST_H_ +#define MAD_SERVER_REQUESTS_COMMANDREQUEST_H_ + +#include + +namespace Mad { +namespace Server { +namespace Requests { + +class CommandRequest : public Common::Request { + private: + bool reboot; + + protected: + virtual void sendRequest(); + + public: + CommandRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, bool reboot0) + : Common::Request(connection, requestId, slot), reboot(reboot0) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTS_COMMANDREQUEST_H_ */ diff --git a/src/Server/Requests/DaemonStateUpdateRequest.cpp b/src/Server/Requests/DaemonStateUpdateRequest.cpp new file mode 100644 index 0000000..4bdf003 --- /dev/null +++ b/src/Server/Requests/DaemonStateUpdateRequest.cpp @@ -0,0 +1,37 @@ +/* + * DaemonStateUpdateRequest.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DaemonStateUpdateRequest.h" + +namespace Mad { +namespace Server { +namespace Requests { + +void DaemonStateUpdateRequest::sendRequest() { + Common::XmlPacket packet; + + packet.setType("UpdateHostState"); + packet.add("name", name); + packet.add("state", state); + sendPacket(packet); +} + +} +} +} diff --git a/src/Server/Requests/DaemonStateUpdateRequest.h b/src/Server/Requests/DaemonStateUpdateRequest.h new file mode 100644 index 0000000..6debb06 --- /dev/null +++ b/src/Server/Requests/DaemonStateUpdateRequest.h @@ -0,0 +1,47 @@ +/* + * DaemonStateUpdateRequest.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ +#define MAD_SERVER_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ + +#include +#include + +namespace Mad { +namespace Server { +namespace Requests { + +class DaemonStateUpdateRequest : public Common::Request { + private: + std::string name; + Common::HostInfo::State state; + + protected: + virtual void sendRequest(); + + public: + DaemonStateUpdateRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, const std::string &name0, Common::HostInfo::State state0) + : Common::Request(connection, requestId, slot), name(name0), state(state0) {} +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ */ diff --git a/src/Server/Requests/Makefile.am b/src/Server/Requests/Makefile.am new file mode 100644 index 0000000..f101b84 --- /dev/null +++ b/src/Server/Requests/Makefile.am @@ -0,0 +1,4 @@ +noinst_LTLIBRARIES = librequests.la +librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp + +noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h diff --git a/src/Server/Requests/Makefile.in b/src/Server/Requests/Makefile.in new file mode 100644 index 0000000..4780982 --- /dev/null +++ b/src/Server/Requests/Makefile.in @@ -0,0 +1,528 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Server/Requests +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ + $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \ + $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \ + $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \ + $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \ + $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ + $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +librequests_la_LIBADD = +am_librequests_la_OBJECTS = CommandRequest.lo \ + DaemonStateUpdateRequest.lo +librequests_la_OBJECTS = $(am_librequests_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(librequests_la_SOURCES) +DIST_SOURCES = $(librequests_la_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARGZ_H = @ARGZ_H@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ +GnuTLS_LIBS = @GnuTLS_LIBS@ +HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ +HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ +HAVE__BOOL = @HAVE__BOOL@ +INCLTDL = @INCLTDL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBADD_DL = @LIBADD_DL@ +LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ +LIBADD_DLOPEN = @LIBADD_DLOPEN@ +LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ +LIBLTDL = @LIBLTDL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ +LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTDLDEPS = @LTDLDEPS@ +LTDLINCL = @LTDLINCL@ +LTDLOPEN = @LTDLOPEN@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ +LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ +LT_CONFIG_H = @LT_CONFIG_H@ +LT_DLLOADERS = @LT_DLLOADERS@ +LT_DLPREOPEN = @LT_DLPREOPEN@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_CONFIG = @MYSQL_CONFIG@ +MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ +MYSQL_VERSION = @MYSQL_VERSION@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_TIME_H = @NEXT_TIME_H@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ +REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ +REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ +REPLACE_STRPTIME = @REPLACE_STRPTIME@ +REPLACE_TIMEGM = @REPLACE_TIMEGM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STDBOOL_H = @STDBOOL_H@ +STRIP = @STRIP@ +SYS_TIME_H = @SYS_TIME_H@ +SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +have_df = @have_df@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libxml2_CFLAGS = @libxml2_CFLAGS@ +libxml2_LIBS = @libxml2_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +ltdl_LIBOBJS = @ltdl_LIBOBJS@ +ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pcrecpp_CFLAGS = @pcrecpp_CFLAGS@ +pcrecpp_LIBS = @pcrecpp_LIBS@ +pdfdir = @pdfdir@ +prefix = @prefix@ +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@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = librequests.la +librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp +noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Server/Requests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Server/Requests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +librequests.la: $(librequests_la_OBJECTS) $(librequests_la_DEPENDENCIES) + $(CXXLINK) $(librequests_la_OBJECTS) $(librequests_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CommandRequest.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStateUpdateRequest.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Server/UserBackend.h b/src/Server/UserBackend.h new file mode 100644 index 0000000..cf88095 --- /dev/null +++ b/src/Server/UserBackend.h @@ -0,0 +1,71 @@ +/* + * UserBackend.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_USERBACKEND_H_ +#define MAD_SERVER_USERBACKEND_H_ + +#include + +#include + +#include +#include + +#include + + +namespace Mad { +namespace Server { + +class UserManager; + +class UserBackend { + protected: + friend class UserManager; + + UserBackend() {} + + virtual bool getUserList(const sigc::slot& > &callback _UNUSED_PARAMETER_) { + return false; + } + + virtual bool getUserInfo(unsigned long uid _UNUSED_PARAMETER_, const sigc::slot &callback _UNUSED_PARAMETER_) { + return false; + } + + virtual bool setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string&, const sigc::slot &callback _UNUSED_PARAMETER_) { + return false; + } + + virtual bool addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_, const sigc::slot &callback _UNUSED_PARAMETER_) { + return false; + } + + virtual int getPriority() const { + return 0; + } + + public: + virtual ~UserBackend() {} +}; + +} +} + +#endif /* MAD_SERVER_USERBACKEND_H_ */ diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp new file mode 100644 index 0000000..2f58b7a --- /dev/null +++ b/src/Server/UserManager.cpp @@ -0,0 +1,74 @@ +/* + * UserManager.cpp + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "UserManager.h" +#include "UserBackend.h" + +namespace Mad { +namespace Server { + +UserManager UserManager::userManager; + + +bool UserManager::Compare::operator() (const UserBackend *b1, const UserBackend *b2) { + if(b1->getPriority() == b2->getPriority()) + return (b1 > b2); + else + return (b1->getPriority() > b2->getPriority()); +} + + +bool UserManager::getUserList(const sigc::slot& > &callback) { + for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->getUserList(callback)) + return true; + } + + return false; +} + +bool UserManager::getUserInfo(unsigned long uid, const sigc::slot &callback) { + for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->getUserInfo(uid, callback)) + return true; + } + + return false; +} + +bool UserManager::setPassword(unsigned long uid, const std::string &password, const sigc::slot &callback) { + for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->setPassword(uid, password, callback)) + return true; + } + + return false; +} + +bool UserManager::addUser(const Common::UserInfo &userInfo, const sigc::slot &callback) { + for(std::set::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->addUser(userInfo, callback)) + return true; + } + + return false; +} + +} +} diff --git a/src/Server/UserManager.h b/src/Server/UserManager.h new file mode 100644 index 0000000..3c4097b --- /dev/null +++ b/src/Server/UserManager.h @@ -0,0 +1,73 @@ +/* + * UserManager.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_USERMANAGER_H_ +#define MAD_SERVER_USERMANAGER_H_ + +#include + +#include +#include + +#include + +namespace Mad { +namespace Server { + +class UserBackend; + +class UserManager { + private: + struct Compare { + bool operator() (const UserBackend *b1, const UserBackend *b2); + }; + + static UserManager userManager; + + std::set backends; + + UserManager() {} + + public: + void registerBackend(UserBackend *backend) { + backends.insert(backend); + } + + void unregisterBackend(UserBackend *backend) { + backends.erase(backend); + } + + + bool getUserList(const sigc::slot& > &callback); + bool getUserInfo(unsigned long uid, const sigc::slot &callback); + + bool setPassword(unsigned long uid, const std::string &password, const sigc::slot &callback); + + bool addUser(const Common::UserInfo &userInfo, const sigc::slot &callback); + + + static UserManager *get() { + return &userManager; + } +}; + +} +} + +#endif /* MAD_SERVER_USERMANAGER_H_ */ diff --git a/src/mad-core.conf b/src/mad-core.conf deleted file mode 100644 index 4176307..0000000 --- a/src/mad-core.conf +++ /dev/null @@ -1,32 +0,0 @@ -Logger Console -Logger File "mad-core.log" - - -Listen * - - -X509TrustFile ../Cert/ca-cert.pem -#X509CrlFile ../Cert/crl.pem -X509CertFile ../Cert/cert.pem -X509KeyFile ../Cert/key.pem - -UserBackendMysql { - Username test - Password test - Database test - - Queries { - ListUsers "SELECT id, gid, username, fullname FROM users" - #ListGroups - #ListUserGroups - #ListGroupUsers - UserById "SELECT id, gid, username, fullname FROM users WHERE id = {ID}" - UserByName "SELECT id, gid, username, fullname FROM users WHERE username = {USER}" - #GroupById - #GroupByName - } -} - -Daemon test { - IpAddress 127.0.0.1 -} diff --git a/src/mad-core.cpp b/src/mad-core.cpp deleted file mode 100644 index 5cf65ac..0000000 --- a/src/mad-core.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * mad-core.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "Common/ConfigManager.h" -#include "Common/LogManager.h" -#include "Common/Logger.h" -#include "Common/ModuleManager.h" -#include "Common/ThreadManager.h" -#include "Core/ConnectionManager.h" - -#include - -using namespace Mad; - - -int main() { - sigset_t signals; - - sigemptyset(&signals); - sigaddset(&signals, SIGPIPE); - sigprocmask(SIG_BLOCK, &signals, 0); - - Common::ThreadManager::get()->init(); - Core::ConnectionManager::get()->init(); - - Common::ModuleManager::get()->loadModule("FileLogger"); - Common::ModuleManager::get()->loadModule("SystemBackendPosix"); - Common::ModuleManager::get()->loadModule("SystemBackendProc"); - - Common::ModuleManager::get()->loadModule("UserBackendMysql"); - - Common::ConfigManager::get()->loadFile("mad-core.conf"); - Common::ConfigManager::get()->finish(); - - while(true) - Core::ConnectionManager::get()->run(); - - Common::Initializable::deinit(); - - return 0; -} diff --git a/src/mad-server.conf b/src/mad-server.conf new file mode 100644 index 0000000..bd4672c --- /dev/null +++ b/src/mad-server.conf @@ -0,0 +1,32 @@ +Logger Console +Logger File "mad-server.log" + + +Listen * + + +X509TrustFile ../Cert/ca-cert.pem +#X509CrlFile ../Cert/crl.pem +X509CertFile ../Cert/cert.pem +X509KeyFile ../Cert/key.pem + +UserBackendMysql { + Username test + Password test + Database test + + Queries { + ListUsers "SELECT id, gid, username, fullname FROM users" + #ListGroups + #ListUserGroups + #ListGroupUsers + UserById "SELECT id, gid, username, fullname FROM users WHERE id = {ID}" + UserByName "SELECT id, gid, username, fullname FROM users WHERE username = {USER}" + #GroupById + #GroupByName + } +} + +Daemon test { + IpAddress 127.0.0.1 +} diff --git a/src/mad-server.cpp b/src/mad-server.cpp new file mode 100644 index 0000000..863d1ee --- /dev/null +++ b/src/mad-server.cpp @@ -0,0 +1,57 @@ +/* + * mad-server.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Common/ConfigManager.h" +#include "Common/LogManager.h" +#include "Common/Logger.h" +#include "Common/ModuleManager.h" +#include "Common/ThreadManager.h" +#include "Server/ConnectionManager.h" + +#include + +using namespace Mad; + + +int main() { + sigset_t signals; + + sigemptyset(&signals); + sigaddset(&signals, SIGPIPE); + sigprocmask(SIG_BLOCK, &signals, 0); + + Common::ThreadManager::get()->init(); + Server::ConnectionManager::get()->init(); + + Common::ModuleManager::get()->loadModule("FileLogger"); + Common::ModuleManager::get()->loadModule("SystemBackendPosix"); + Common::ModuleManager::get()->loadModule("SystemBackendProc"); + + Common::ModuleManager::get()->loadModule("UserBackendMysql"); + + Common::ConfigManager::get()->loadFile("mad-server.conf"); + Common::ConfigManager::get()->finish(); + + while(true) + Server::ConnectionManager::get()->run(); + + Common::Initializable::deinit(); + + return 0; +} diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp index 39b0652..daea626 100644 --- a/src/modules/UserBackendMysql.cpp +++ b/src/modules/UserBackendMysql.cpp @@ -131,7 +131,7 @@ void UserBackendMysql::configFinished() { mysql = mysql_init(0); mysql_real_connect(mysql, host.c_str(), username.c_str(), passwd.c_str(), db.c_str(), port, unixSocket.empty() ? 0 : unixSocket.c_str(), 0); - Core::UserManager::get()->registerBackend(backend); + Server::UserManager::get()->registerBackend(backend); } @@ -211,7 +211,7 @@ void UserBackendMysql::unregisterBackend() { return; Common::ConfigManager::get()->unregisterConfigurable(backend); - Core::UserManager::get()->unregisterBackend(backend); + Server::UserManager::get()->unregisterBackend(backend); delete backend; backend = 0; diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h index ac82d67..ddd4252 100644 --- a/src/modules/UserBackendMysql.h +++ b/src/modules/UserBackendMysql.h @@ -20,8 +20,8 @@ #ifndef MAD_MODULES_USERBACKENDMYSQL_H_ #define MAD_MODULES_USERBACKENDMYSQL_H_ -#include -#include +#include +#include #include #include @@ -30,7 +30,7 @@ namespace Mad { namespace Modules { -class UserBackendMysql : private Core::UserBackend, private Common::Configurable { +class UserBackendMysql : private Server::UserBackend, private Common::Configurable { private: static UserBackendMysql *backend; -- cgit v1.2.3