diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-03-04 23:14:34 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-03-04 23:14:34 +0100 |
commit | de5fa3867791bf4bf84a52de8cd09821f9ce28ab (patch) | |
tree | c343a7fcdeabe9f982c968d5241d672c351942a7 | |
parent | c316a3115bf790fb623f0765dd6b04f781af5b51 (diff) | |
download | mad-de5fa3867791bf4bf84a52de8cd09821f9ce28ab.tar mad-de5fa3867791bf4bf84a52de8cd09821f9ce28ab.zip |
XmlRequest{,Handler} in Request{,Handler} umbenannt
42 files changed, 171 insertions, 171 deletions
diff --git a/src/Client/CommandManager.cpp b/src/Client/CommandManager.cpp index bcb3429..3bfc3a6 100644 --- a/src/Client/CommandManager.cpp +++ b/src/Client/CommandManager.cpp @@ -20,7 +20,7 @@ #include "CommandManager.h" #include <Common/HostInfo.h> #include <Common/Logger.h> -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <cmath> #include <iostream> @@ -136,7 +136,7 @@ void CommandManager::printHostStatus(const Common::XmlPacket &packet) { } -void CommandManager::daemonCommandRequestFinished(const Common::XmlRequest &request) { +void CommandManager::daemonCommandRequestFinished(const Common::Request &request) { try { request.getResult(); } @@ -147,7 +147,7 @@ void CommandManager::daemonCommandRequestFinished(const Common::XmlRequest &requ requestFinished(); } -void CommandManager::daemonFSInfoRequestFinished(const Common::XmlRequest &request) { +void CommandManager::daemonFSInfoRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); std::cout << "Host file system usage:" << std::endl; @@ -160,7 +160,7 @@ void CommandManager::daemonFSInfoRequestFinished(const Common::XmlRequest &reque requestFinished(); } -void CommandManager::daemonStatusRequestFinished(const Common::XmlRequest &request) { +void CommandManager::daemonStatusRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); std::cout << "Host status:" << std::endl; @@ -173,7 +173,7 @@ void CommandManager::daemonStatusRequestFinished(const Common::XmlRequest &reque requestFinished(); } -void CommandManager::disconnectRequestFinished(const Common::XmlRequest &request) { +void CommandManager::disconnectRequestFinished(const Common::Request &request) { try { request.getResult(); disconnect = true; @@ -185,7 +185,7 @@ void CommandManager::disconnectRequestFinished(const Common::XmlRequest &request requestFinished(); } -void CommandManager::fsInfoRequestFinished(const Common::XmlRequest &request) { +void CommandManager::fsInfoRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); std::cout << "Server file system usage:" << std::endl; @@ -198,7 +198,7 @@ void CommandManager::fsInfoRequestFinished(const Common::XmlRequest &request) { requestFinished(); } -void CommandManager::statusRequestFinished(const Common::XmlRequest &request) { +void CommandManager::statusRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); std::cout << "Server status:" << std::endl; @@ -211,7 +211,7 @@ void CommandManager::statusRequestFinished(const Common::XmlRequest &request) { requestFinished(); } -void CommandManager::userListRequestFinished(const Common::XmlRequest &request) { +void CommandManager::userListRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); diff --git a/src/Client/CommandManager.h b/src/Client/CommandManager.h index a49cda7..1c6e5fc 100644 --- a/src/Client/CommandManager.h +++ b/src/Client/CommandManager.h @@ -26,7 +26,7 @@ namespace Mad { namespace Common { class XmlPacket; -class XmlRequest; +class Request; } namespace Client { @@ -52,13 +52,13 @@ class CommandManager { void printFSInfo(const Common::XmlPacket &packet); void printHostStatus(const Common::XmlPacket &packet); - void daemonCommandRequestFinished(const Common::XmlRequest &request); - void daemonFSInfoRequestFinished(const Common::XmlRequest &request); - void daemonStatusRequestFinished(const Common::XmlRequest &request); - void disconnectRequestFinished(const Common::XmlRequest &request); - void fsInfoRequestFinished(const Common::XmlRequest &request); - void statusRequestFinished(const Common::XmlRequest &request); - void userListRequestFinished(const Common::XmlRequest &request); + void daemonCommandRequestFinished(const Common::Request &request); + void daemonFSInfoRequestFinished(const Common::Request &request); + void daemonStatusRequestFinished(const Common::Request &request); + void disconnectRequestFinished(const Common::Request &request); + void fsInfoRequestFinished(const Common::Request &request); + void statusRequestFinished(const Common::Request &request); + void userListRequestFinished(const Common::Request &request); CommandManager() : activeRequests(0), disconnect(false) {} diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 526f434..27aac78 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -110,9 +110,9 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std:: void CommandParser::fsinfoCommand(const std::vector<std::string> &args) { if(args.size() == 1) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Common::Requests::FSInfoRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::fsInfoRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Common::Requests::FSInfoRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::fsInfoRequestFinished)))); else if(args.size() == 2) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Requests::DaemonFSInfoRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonFSInfoRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Requests::DaemonFSInfoRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonFSInfoRequestFinished)))); else { Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str()); printUsage("fsinfo"); @@ -213,7 +213,7 @@ void CommandParser::rebootCommand(const std::vector<std::string> &args) { std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true); for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) { - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>( + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>( new Requests::DaemonCommandRequest(host->first, true, sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished)) )); @@ -231,7 +231,7 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) { std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true); for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) { - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>( + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>( new Requests::DaemonCommandRequest(host->first, false, sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished)) )); @@ -241,9 +241,9 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) { void CommandParser::statusCommand(const std::vector<std::string> &args) { if(args.size() == 1) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished)))); else if(args.size() == 2) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished)))); else { Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str()); printUsage("status"); @@ -256,13 +256,13 @@ void CommandParser::statusCommand(const std::vector<std::string> &args) { void CommandParser::listUsersCommand(const std::vector<std::string>&) { ++CommandManager::get()->activeRequests; - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Common::Requests::UserListRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Common::Requests::UserListRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished)))); } void CommandParser::exitCommand(const std::vector<std::string>&) { ++CommandManager::get()->activeRequests; - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Common::Requests::DisconnectRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::disconnectRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Common::Requests::DisconnectRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::disconnectRequestFinished)))); } bool CommandParser::parse(const std::string &cmd) { diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp index 616e09b..cafe2fa 100644 --- a/src/Client/InformationManager.cpp +++ b/src/Client/InformationManager.cpp @@ -72,7 +72,7 @@ void InformationManager::updateDaemonList(Net::Connection *con) { return; Common::RequestManager::get()->sendRequest(con, - std::auto_ptr<Common::XmlRequest>( + std::auto_ptr<Common::Request>( new Requests::DaemonListRequest(sigc::mem_fun(this, &InformationManager::daemonListRequestFinished)) ) ); @@ -80,7 +80,7 @@ void InformationManager::updateDaemonList(Net::Connection *con) { updating = true; } -void InformationManager::daemonListRequestFinished(const Common::XmlRequest &request) { +void InformationManager::daemonListRequestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h index 890622c..566eaf6 100644 --- a/src/Client/InformationManager.h +++ b/src/Client/InformationManager.h @@ -25,7 +25,7 @@ #include <Common/HostInfo.h> #include <Common/Initializable.h> -#include <Common/XmlRequest.h> +#include <Common/Request.h> namespace Mad { @@ -42,7 +42,7 @@ namespace Client { class InformationManager : public Common::Initializable { private: - class DaemonStateUpdateRequestHandler : public Common::XmlRequestHandler { + class DaemonStateUpdateRequestHandler : public Common::RequestHandler { protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const Common::XmlPacket &packet); @@ -62,7 +62,7 @@ class InformationManager : public Common::Initializable { InformationManager() : updating(false) {} - void daemonListRequestFinished(const Common::XmlRequest &request); + void daemonListRequestFinished(const Common::Request &request); protected: virtual void doInit(); diff --git a/src/Client/Requests/DaemonCommandRequest.h b/src/Client/Requests/DaemonCommandRequest.h index 8575123..13a6da6 100644 --- a/src/Client/Requests/DaemonCommandRequest.h +++ b/src/Client/Requests/DaemonCommandRequest.h @@ -20,14 +20,14 @@ #ifndef MAD_CLIENT_REQUEST_DAEMONCOMMANDREQUEST_H_ #define MAD_CLIENT_REQUEST_DAEMONCOMMANDREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <string> namespace Mad { namespace Client { namespace Requests { -class DaemonCommandRequest : public Common::XmlRequest { +class DaemonCommandRequest : public Common::Request { private: std::string daemon; bool reboot; @@ -37,7 +37,7 @@ class DaemonCommandRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonCommandRequest(const std::string &daemon0, bool reboot0, slot_type slot) : Common::XmlRequest(slot), daemon(daemon0), reboot(reboot0) {} + DaemonCommandRequest(const std::string &daemon0, bool reboot0, slot_type slot) : Common::Request(slot), daemon(daemon0), reboot(reboot0) {} }; } diff --git a/src/Client/Requests/DaemonFSInfoRequest.h b/src/Client/Requests/DaemonFSInfoRequest.h index 48a201f..a42d85a 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.h +++ b/src/Client/Requests/DaemonFSInfoRequest.h @@ -20,7 +20,7 @@ #ifndef MAD_CLIENT_REQUESTS_DAEMONFSINFOREQUEST_H_ #define MAD_CLIENT_REQUESTS_DAEMONFSINFOREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <string> @@ -28,7 +28,7 @@ namespace Mad { namespace Client { namespace Requests { -class DaemonFSInfoRequest : public Common::XmlRequest { +class DaemonFSInfoRequest : public Common::Request { private: std::string daemon; @@ -37,7 +37,7 @@ class DaemonFSInfoRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonFSInfoRequest(const std::string &daemon0, slot_type slot) : Common::XmlRequest(slot), daemon(daemon0) {} + DaemonFSInfoRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} }; } diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h index ca37dbd..3b561d2 100644 --- a/src/Client/Requests/DaemonListRequest.h +++ b/src/Client/Requests/DaemonListRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ #define MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> namespace Mad { namespace Client { namespace Requests { -class DaemonListRequest : public Common::XmlRequest { +class DaemonListRequest : public Common::Request { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonListRequest(slot_type slot) : Common::XmlRequest(slot) {} + DaemonListRequest(slot_type slot) : Common::Request(slot) {} }; } diff --git a/src/Client/Requests/DaemonStatusRequest.h b/src/Client/Requests/DaemonStatusRequest.h index b0982e6..2ccc9b2 100644 --- a/src/Client/Requests/DaemonStatusRequest.h +++ b/src/Client/Requests/DaemonStatusRequest.h @@ -20,7 +20,7 @@ #ifndef MAD_CLIENT_REQUESTS_DAEMONSTATUSREQUEST_H_ #define MAD_CLIENT_REQUESTS_DAEMONSTATUSREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <string> @@ -28,7 +28,7 @@ namespace Mad { namespace Client { namespace Requests { -class DaemonStatusRequest : public Common::XmlRequest { +class DaemonStatusRequest : public Common::Request { private: std::string daemon; @@ -37,7 +37,7 @@ class DaemonStatusRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::XmlRequest(slot), daemon(daemon0) {} + DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} }; } diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am index 79bc0b1..e1c22b9 100644 --- a/src/Common/Makefile.am +++ b/src/Common/Makefile.am @@ -8,5 +8,5 @@ libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandler noinst_HEADERS = ActionManager.h ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h \ Initializable.h Logger.h LoggerBase.h LogManager.h ModuleManager.h \ - RemoteLogger.h RequestManager.h \ - SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequest.h XmlRequestHandler.h + RemoteLogger.h Request.h RequestHandler.h RequestManager.h \ + SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in index 1f7bca5..d70edc7 100644 --- a/src/Common/Makefile.in +++ b/src/Common/Makefile.in @@ -245,8 +245,8 @@ libcommon_la_SOURCES = ActionManager.cpp ConfigEntry.cpp ConfigManager.cpp Excep libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la ../../lib/libgnu.la noinst_HEADERS = ActionManager.h ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h \ Initializable.h Logger.h LoggerBase.h LogManager.h ModuleManager.h \ - RemoteLogger.h RequestManager.h \ - SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequest.h XmlRequestHandler.h + RemoteLogger.h Request.h RequestHandler.h RequestManager.h \ + SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h all: all-recursive diff --git a/src/Common/XmlRequest.h b/src/Common/Request.h index 66635c2..b0e6777 100644 --- a/src/Common/XmlRequest.h +++ b/src/Common/Request.h @@ -21,7 +21,7 @@ #define MAD_COMMON_XMLREQUEST_H_ #include "XmlPacket.h" -#include "XmlRequestHandler.h" +#include "RequestHandler.h" #include "Exception.h" #include <memory> @@ -30,20 +30,20 @@ namespace Mad { namespace Common { -class XmlRequest : public XmlRequestHandler { +class Request : public RequestHandler { private: friend class RequestManager; - sigc::signal<void,const XmlRequest&> finished; + sigc::signal<void,const Request&> finished; std::auto_ptr<XmlPacket> res; Exception exp; public: - typedef sigc::slot<void,const XmlRequest&> slot_type; + typedef sigc::slot<void,const Request&> slot_type; protected: - XmlRequest(slot_type slot) : exp(Exception::NOT_FINISHED) { + Request(slot_type slot) : exp(Exception::NOT_FINISHED) { finished.connect(slot); finished.connect(sigc::hide(signalFinished().make_slot())); } diff --git a/src/Common/XmlRequestHandler.h b/src/Common/RequestHandler.h index 30438b7..b909e81 100644 --- a/src/Common/XmlRequestHandler.h +++ b/src/Common/RequestHandler.h @@ -34,23 +34,23 @@ namespace Common { class RequestManager; class XmlPacket; -class XmlRequestHandler { +class RequestHandler { private: sigc::signal<void> finished; // Prevent shallow copy - XmlRequestHandler(const XmlRequestHandler &o); - XmlRequestHandler& operator=(const XmlRequestHandler &o); + RequestHandler(const RequestHandler &o); + RequestHandler& operator=(const RequestHandler &o); protected: - XmlRequestHandler() {} + RequestHandler() {} sigc::signal<void> signalFinished() {return finished;} virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const XmlPacket &packet) = 0; public: - virtual ~XmlRequestHandler() {} + virtual ~RequestHandler() {} friend class RequestManager; }; diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.h b/src/Common/RequestHandlers/DisconnectRequestHandler.h index 23d07dc..7544fd8 100644 --- a/src/Common/RequestHandlers/DisconnectRequestHandler.h +++ b/src/Common/RequestHandlers/DisconnectRequestHandler.h @@ -20,13 +20,13 @@ #ifndef MAD_COMMON_REQUESTHANDLERS_DISCONNECTREQUESTHANDLER_H_ #define MAD_COMMON_REQUESTHANDLERS_DISCONNECTREQUESTHANDLER_H_ -#include "../XmlRequestHandler.h" +#include "../RequestHandler.h" namespace Mad { namespace Common { namespace RequestHandlers { -class DisconnectRequestHandler : public XmlRequestHandler { +class DisconnectRequestHandler : public RequestHandler { protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const XmlPacket &packet); diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.h b/src/Common/RequestHandlers/FSInfoRequestHandler.h index 32e7a08..a9ee120 100644 --- a/src/Common/RequestHandlers/FSInfoRequestHandler.h +++ b/src/Common/RequestHandlers/FSInfoRequestHandler.h @@ -20,7 +20,7 @@ #ifndef MAD_COMMON_REQUESTHANDLERS_FSINFOREQUESTHANDLER_H_ #define MAD_COMMON_REQUESTHANDLERS_FSINFOREQUESTHANDLER_H_ -#include "../XmlRequestHandler.h" +#include "../RequestHandler.h" #include "../SystemBackend.h" #include <stdint.h> @@ -29,7 +29,7 @@ namespace Mad { namespace Common { namespace RequestHandlers { -class FSInfoRequestHandler : public XmlRequestHandler { +class FSInfoRequestHandler : public RequestHandler { private: Net::Connection *connection; uint16_t requestId; diff --git a/src/Common/RequestHandlers/StatusRequestHandler.h b/src/Common/RequestHandlers/StatusRequestHandler.h index 0b53db0..ce7ae6d 100644 --- a/src/Common/RequestHandlers/StatusRequestHandler.h +++ b/src/Common/RequestHandlers/StatusRequestHandler.h @@ -20,14 +20,14 @@ #ifndef MAD_COMMON_REQUESTHANDLERS_STATUSREQUESTHANDLER_H_ #define MAD_COMMON_REQUESTHANDLERS_STATUSREQUESTHANDLER_H_ -#include "../XmlRequestHandler.h" +#include "../RequestHandler.h" #include <stdint.h> namespace Mad { namespace Common { namespace RequestHandlers { -class StatusRequestHandler : public XmlRequestHandler { +class StatusRequestHandler : public RequestHandler { private: Net::Connection *connection; uint16_t rid; diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index de4f2ca..ac1909b 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -18,7 +18,7 @@ */ #include "RequestManager.h" -#include "XmlRequest.h" +#include "Request.h" #include "XmlPacket.h" #include "RequestHandlers/DisconnectRequestHandler.h" #include "Logger.h" @@ -32,21 +32,21 @@ namespace Common { RequestManager RequestManager::requestManager; -RequestManager::XmlRequestMap::~XmlRequestMap() { +RequestManager::RequestMap::~RequestMap() { for(iterator it = begin(); it != end(); ++it) delete it->second; } -bool RequestManager::XmlRequestMap::addRequest(uint16_t id, XmlRequestHandler *info) { +bool RequestManager::RequestMap::addRequest(uint16_t id, RequestHandler *info) { if(!insert(std::make_pair(id, info)).second) return false; - info->signalFinished().connect(sigc::hide_return(sigc::bind(sigc::mem_fun(this, &RequestManager::XmlRequestMap::deleteRequest), id))); + info->signalFinished().connect(sigc::hide_return(sigc::bind(sigc::mem_fun(this, &RequestManager::RequestMap::deleteRequest), id))); return true; } -XmlRequestHandler* RequestManager::XmlRequestMap::findRequest(uint16_t id) { +RequestHandler* RequestManager::RequestMap::findRequest(uint16_t id) { iterator it = find(id); if(it == end()) return 0; @@ -54,7 +54,7 @@ XmlRequestHandler* RequestManager::XmlRequestMap::findRequest(uint16_t id) { return it->second; } -bool RequestManager::XmlRequestMap::deleteRequest(uint16_t id) { +bool RequestManager::RequestMap::deleteRequest(uint16_t id) { iterator it = find(id); if(it == end()) return false; @@ -69,27 +69,27 @@ bool RequestManager::XmlRequestMap::deleteRequest(uint16_t id) { void RequestManager::receiveHandler(Net::Connection *connection, const Net::Packet &packet) { XmlPacket xmlPacket(packet); - std::map<Net::Connection*,XmlRequestMap*>::iterator it = xmlRequestMaps.find(connection); - if(it == xmlRequestMaps.end()) { + std::map<Net::Connection*,RequestMap*>::iterator it = requestMaps.find(connection); + if(it == requestMaps.end()) { // TODO: Error Logger::log(Logger::ERROR, "Received a packet from an unregistered connection."); return; } - XmlRequestMap *xmlRequestMap = it->second; - XmlRequestHandler *xmlRequest = xmlRequestMap->findRequest(packet.getRequestId()); + RequestMap *requestMap = it->second; + RequestHandler *request = requestMap->findRequest(packet.getRequestId()); - if(xmlRequest) { - xmlRequest->handlePacket(connection, packet.getRequestId(), xmlPacket); + if(request) { + request->handlePacket(connection, packet.getRequestId(), xmlPacket); return; } - std::map<std::string,XmlRequestHandlerFactory*>::iterator factoryIt = xmlRequestHandlerFactories.find(xmlPacket.getType()); - if(factoryIt != xmlRequestHandlerFactories.end()) { - xmlRequest = factoryIt->second->createRequestHandler(); - xmlRequestMap->addRequest(packet.getRequestId(), xmlRequest); - xmlRequest->handlePacket(connection, packet.getRequestId(), xmlPacket); + std::map<std::string,RequestHandlerFactory*>::iterator factoryIt = requestHandlerFactories.find(xmlPacket.getType()); + if(factoryIt != requestHandlerFactories.end()) { + request = factoryIt->second->createRequestHandler(); + requestMap->addRequest(packet.getRequestId(), request); + request->handlePacket(connection, packet.getRequestId(), xmlPacket); return; } @@ -103,15 +103,15 @@ void RequestManager::receiveHandler(Net::Connection *connection, const Net::Pack connection->send(ret.encode(requestId)); } -bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequest> request) { - std::map<Net::Connection*,XmlRequestMap*>::iterator it = xmlRequestMaps.find(connection); +bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<Request> request) { + std::map<Net::Connection*,RequestMap*>::iterator it = requestMaps.find(connection); - if(it == xmlRequestMaps.end()) { + if(it == requestMaps.end()) { Logger::log(Logger::CRITICAL, "Trying to send a request over an unregistered connecion."); return false; } - XmlRequestMap *requestMap = it->second; + RequestMap *requestMap = it->second; uint16_t id; do { @@ -126,29 +126,29 @@ bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<XmlR } void RequestManager::registerConnection(Net::Connection *connection) { - xmlRequestMaps.insert(std::make_pair(connection, new XmlRequestMap())); + requestMaps.insert(std::make_pair(connection, new RequestMap())); connection->signalReceive().connect(sigc::mem_fun(this, &RequestManager::receiveHandler)); } void RequestManager::unregisterConnection(Net::Connection *connection) { - std::map<Net::Connection*,XmlRequestMap*>::iterator it = xmlRequestMaps.find(connection); + std::map<Net::Connection*,RequestMap*>::iterator it = requestMaps.find(connection); - if(it != xmlRequestMaps.end()) { + if(it != requestMaps.end()) { delete it->second; - xmlRequestMaps.erase(it); + requestMaps.erase(it); } } void RequestManager::unregisterPacketType(const std::string &type) { - std::map<std::string,XmlRequestHandlerFactory*>::iterator it = xmlRequestHandlerFactories.find(type); + std::map<std::string,RequestHandlerFactory*>::iterator it = requestHandlerFactories.find(type); - if(it == xmlRequestHandlerFactories.end()) + if(it == requestHandlerFactories.end()) return; delete it->second; - xmlRequestHandlerFactories.erase(it); + requestHandlerFactories.erase(it); } RequestManager::RequestManager() : core(false), requestId(-1) { @@ -158,10 +158,10 @@ RequestManager::RequestManager() : core(false), requestId(-1) { RequestManager::~RequestManager() { unregisterPacketType("Disconnect"); - for(std::map<Net::Connection*,XmlRequestMap*>::iterator it = xmlRequestMaps.begin(); it != xmlRequestMaps.end(); ++it) + for(std::map<Net::Connection*,RequestMap*>::iterator it = requestMaps.begin(); it != requestMaps.end(); ++it) delete it->second; - for(std::map<std::string,XmlRequestHandlerFactory*>::iterator it = xmlRequestHandlerFactories.begin(); it != xmlRequestHandlerFactories.end(); ++it) + for(std::map<std::string,RequestHandlerFactory*>::iterator it = requestHandlerFactories.begin(); it != requestHandlerFactories.end(); ++it) delete it->second; } diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index 8a3d151..ee4f4d1 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -28,49 +28,49 @@ namespace Mad { namespace Common { -class XmlRequest; -class XmlRequestHandler; +class Request; +class RequestHandler; class RequestManager { private: - class XmlRequestMap : private std::map<uint16_t,XmlRequestHandler*> { + class RequestMap : private std::map<uint16_t,RequestHandler*> { private: // Prevent shallow copy - XmlRequestMap(const XmlRequestMap &o); - XmlRequestMap& operator=(const XmlRequestMap &o); + RequestMap(const RequestMap &o); + RequestMap& operator=(const RequestMap &o); public: - XmlRequestMap() {} - ~XmlRequestMap(); + RequestMap() {} + ~RequestMap(); - bool addRequest(uint16_t id, XmlRequestHandler *info); - XmlRequestHandler* findRequest(uint16_t id); + bool addRequest(uint16_t id, RequestHandler *info); + RequestHandler* findRequest(uint16_t id); bool deleteRequest(uint16_t id); }; - class XmlRequestHandlerFactory { + class RequestHandlerFactory { protected: - XmlRequestHandlerFactory() {} + RequestHandlerFactory() {} public: - virtual XmlRequestHandler* createRequestHandler() = 0; - virtual ~XmlRequestHandlerFactory() {} + virtual RequestHandler* createRequestHandler() = 0; + virtual ~RequestHandlerFactory() {} }; - template<class T> class SpecificXmlRequestHandlerFactory : public XmlRequestHandlerFactory { + template<class T> class SpecificRequestHandlerFactory : public RequestHandlerFactory { public: - virtual XmlRequestHandler* createRequestHandler() { + virtual RequestHandler* createRequestHandler() { return new T(); } }; static RequestManager requestManager; - std::map<Net::Connection*,XmlRequestMap*> xmlRequestMaps; + std::map<Net::Connection*,RequestMap*> requestMaps; bool core; uint16_t requestId; - std::map<std::string,XmlRequestHandlerFactory*> xmlRequestHandlerFactories; + std::map<std::string,RequestHandlerFactory*> requestHandlerFactories; uint16_t getRequestId() { return requestId+=2; @@ -103,12 +103,12 @@ class RequestManager { void unregisterConnection(Net::Connection *connection); template <class T> void registerPacketType(const std::string &type) { - xmlRequestHandlerFactories.insert(std::make_pair(type, new SpecificXmlRequestHandlerFactory<T>())); + requestHandlerFactories.insert(std::make_pair(type, new SpecificRequestHandlerFactory<T>())); } void unregisterPacketType(const std::string &type); - bool sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequest> request); + bool sendRequest(Net::Connection *connection, std::auto_ptr<Request> request); virtual ~RequestManager(); }; diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h index 4f2cdf5..af7cca5 100644 --- a/src/Common/Requests/DisconnectRequest.h +++ b/src/Common/Requests/DisconnectRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_DISCONNECTREQUEST_H_ #define MAD_COMMON_REQUESTS_DISCONNECTREQUEST_H_ -#include "../XmlRequest.h" +#include "../Request.h" namespace Mad { namespace Common { namespace Requests { -class DisconnectRequest : public XmlRequest { +class DisconnectRequest : public Request { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); virtual void handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet); public: - DisconnectRequest(slot_type slot) : XmlRequest(slot) {} + DisconnectRequest(slot_type slot) : Request(slot) {} }; } diff --git a/src/Common/Requests/FSInfoRequest.h b/src/Common/Requests/FSInfoRequest.h index 9a6ba14..39759ab 100644 --- a/src/Common/Requests/FSInfoRequest.h +++ b/src/Common/Requests/FSInfoRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_FSINFOREQUEST_H_ #define MAD_COMMON_REQUESTS_FSINFOREQUEST_H_ -#include "../XmlRequest.h" +#include "../Request.h" namespace Mad { namespace Common { namespace Requests { -class FSInfoRequest : public XmlRequest { +class FSInfoRequest : public Request { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - FSInfoRequest(slot_type slot) : XmlRequest(slot) {} + FSInfoRequest(slot_type slot) : Request(slot) {} }; } diff --git a/src/Common/Requests/GSSAPIAuthRequest.h b/src/Common/Requests/GSSAPIAuthRequest.h index d9f5c9c..ca6195b 100644 --- a/src/Common/Requests/GSSAPIAuthRequest.h +++ b/src/Common/Requests/GSSAPIAuthRequest.h @@ -20,7 +20,7 @@ #ifndef MAD_COMMON_REQUESTS_GSSAPIAUTHREQUEST_H_ #define MAD_COMMON_REQUESTS_GSSAPIAUTHREQUEST_H_ -#include "../XmlRequest.h" +#include "../Request.h" #include <string> #include <gssapi/gssapi.h> @@ -30,7 +30,7 @@ namespace Requests { // TODO Logging & error handling! -class GSSAPIAuthRequest : public XmlRequest { +class GSSAPIAuthRequest : public Request { private: std::string serviceName; gss_name_t gssServiceName; @@ -43,7 +43,7 @@ class GSSAPIAuthRequest : public XmlRequest { public: GSSAPIAuthRequest(const std::string &serviceName0, slot_type slot) - : XmlRequest(slot), serviceName(serviceName0), gssServiceName(GSS_C_NO_NAME), gssContext(GSS_C_NO_CONTEXT), gssContinue(true) {} + : Request(slot), serviceName(serviceName0), gssServiceName(GSS_C_NO_NAME), gssContext(GSS_C_NO_CONTEXT), gssContinue(true) {} virtual ~GSSAPIAuthRequest(); }; diff --git a/src/Common/Requests/StatusRequest.h b/src/Common/Requests/StatusRequest.h index e9c8a4c..eb24305 100644 --- a/src/Common/Requests/StatusRequest.h +++ b/src/Common/Requests/StatusRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_STATUSREQUEST_H_ #define MAD_COMMON_REQUESTS_STATUSREQUEST_H_ -#include "../XmlRequest.h" +#include "../Request.h" namespace Mad { namespace Common { namespace Requests { -class StatusRequest : public XmlRequest { +class StatusRequest : public Request { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); virtual void handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet); public: - StatusRequest(slot_type slot) : XmlRequest(slot) {} + StatusRequest(slot_type slot) : Request(slot) {} }; } diff --git a/src/Common/Requests/UserListRequest.h b/src/Common/Requests/UserListRequest.h index 9702a42..bcd9578 100644 --- a/src/Common/Requests/UserListRequest.h +++ b/src/Common/Requests/UserListRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_USERLISTREQUEST_H_ #define MAD_COMMON_REQUESTS_USERLISTREQUEST_H_ -#include "../XmlRequest.h" +#include "../Request.h" namespace Mad { namespace Common { namespace Requests { -class UserListRequest : public XmlRequest { +class UserListRequest : public Request { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); virtual void handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet); public: - UserListRequest(slot_type slot) : XmlRequest(slot) {} + UserListRequest(slot_type slot) : Request(slot) {} }; } diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index f70f640..a6d80d0 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -50,7 +50,7 @@ void ConnectionManager::updateState(const std::string &name, Common::HostInfo::S daemonInfo[name].setState(state); for(std::list<Net::ServerConnection*>::iterator con = clientConnections.begin(); con != clientConnections.end(); ++con) { - Common::RequestManager::get()->sendRequest(*con, std::auto_ptr<Common::XmlRequest>( + Common::RequestManager::get()->sendRequest(*con, std::auto_ptr<Common::Request>( new Requests::DaemonStateUpdateRequest(name, state) )); } diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp index 97a1bdc..1bfe3e4 100644 --- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp +++ b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp @@ -49,7 +49,7 @@ void DaemonCommandRequestHandler::handlePacket(Net::Connection *connection, uint try { Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::XmlRequest>( + Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::Request>( new Requests::CommandRequest(command == "reboot", sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished)) )); } @@ -65,7 +65,7 @@ void DaemonCommandRequestHandler::handlePacket(Net::Connection *connection, uint } } -void DaemonCommandRequestHandler::requestFinished(const Common::XmlRequest &request) { +void DaemonCommandRequestHandler::requestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.h b/src/Core/RequestHandlers/DaemonCommandRequestHandler.h index 9570528..4ab7a3f 100644 --- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.h +++ b/src/Core/RequestHandlers/DaemonCommandRequestHandler.h @@ -20,20 +20,20 @@ #ifndef MAD_CORE_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> -#include <Common/XmlRequest.h> +#include <Common/RequestHandler.h> +#include <Common/Request.h> #include <stdint.h> namespace Mad { namespace Core { namespace RequestHandlers { -class DaemonCommandRequestHandler : public Common::XmlRequestHandler { +class DaemonCommandRequestHandler : public Common::RequestHandler { private: Net::Connection *con; uint16_t requestId; - void requestFinished(const Common::XmlRequest &request); + void requestFinished(const Common::Request &request); protected: virtual void handlePacket(Net::Connection *connection, uint16_t rid, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp index c0e4b9f..b9dc030 100644 --- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp +++ b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp @@ -48,7 +48,7 @@ void DaemonFSInfoRequestHandler::handlePacket(Net::Connection *connection, uint1 try { Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]); - Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::XmlRequest>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)))); + Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::Request>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished)))); } catch(Common::Exception &e) { Common::XmlPacket ret; @@ -62,7 +62,7 @@ void DaemonFSInfoRequestHandler::handlePacket(Net::Connection *connection, uint1 } } -void DaemonFSInfoRequestHandler::requestFinished(const Common::XmlRequest &request) { +void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); con->send(packet.encode(requestId)); diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h index 68b8760..820ef69 100644 --- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h +++ b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.h @@ -20,8 +20,8 @@ #ifndef MAD_CORE_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> -#include <Common/XmlRequest.h> +#include <Common/RequestHandler.h> +#include <Common/Request.h> #include <stdint.h> namespace Mad { @@ -35,12 +35,12 @@ class FSInfoPacket; namespace Core { namespace RequestHandlers { -class DaemonFSInfoRequestHandler : public Common::XmlRequestHandler { +class DaemonFSInfoRequestHandler : public Common::RequestHandler { private: Net::Connection *con; uint16_t requestId; - void requestFinished(const Common::XmlRequest &request); + void requestFinished(const Common::Request &request); protected: virtual void handlePacket(Net::Connection *connection, uint16_t rid, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.h b/src/Core/RequestHandlers/DaemonListRequestHandler.h index 6fe2517..26c46f8 100644 --- a/src/Core/RequestHandlers/DaemonListRequestHandler.h +++ b/src/Core/RequestHandlers/DaemonListRequestHandler.h @@ -20,13 +20,13 @@ #ifndef MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> namespace Mad { namespace Core { namespace RequestHandlers { -class DaemonListRequestHandler : public Common::XmlRequestHandler { +class DaemonListRequestHandler : public Common::RequestHandler { protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp index 11c9eb9..35daae4 100644 --- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp +++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -50,7 +50,7 @@ void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, uint1 try { Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName); - Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::XmlRequest>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)))); + Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::Request>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished)))); } catch(Common::Exception &e) { Common::XmlPacket ret; @@ -64,7 +64,7 @@ void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, uint1 } } -void DaemonStatusRequestHandler::requestFinished(const Common::XmlRequest &request) { +void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) { try { const Common::XmlPacket &packet = request.getResult(); con->send(packet.encode(rid)); diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h b/src/Core/RequestHandlers/DaemonStatusRequestHandler.h index 30b2ae1..92dac2f 100644 --- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.h +++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.h @@ -20,8 +20,8 @@ #ifndef MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> -#include <Common/XmlRequest.h> +#include <Common/RequestHandler.h> +#include <Common/Request.h> #include <stdint.h> namespace Mad { @@ -35,12 +35,12 @@ class HostStatusPacket; namespace Core { namespace RequestHandlers { -class DaemonStatusRequestHandler : public Common::XmlRequestHandler { +class DaemonStatusRequestHandler : public Common::RequestHandler { private: Net::Connection *con; uint16_t rid; - void requestFinished(const Common::XmlRequest &request); + void requestFinished(const Common::Request &request); protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h index 7f8ce3b..7f29804 100644 --- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h +++ b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h @@ -20,14 +20,14 @@ #ifndef MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> #include <gssapi/gssapi.h> namespace Mad { namespace Core { namespace RequestHandlers { -class GSSAPIAuthRequestHandler : public Common::XmlRequestHandler { +class GSSAPIAuthRequestHandler : public Common::RequestHandler { private: gss_ctx_id_t gssContext; diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.h b/src/Core/RequestHandlers/IdentifyRequestHandler.h index 877ebf2..7bc5d7c 100644 --- a/src/Core/RequestHandlers/IdentifyRequestHandler.h +++ b/src/Core/RequestHandlers/IdentifyRequestHandler.h @@ -20,13 +20,13 @@ #ifndef MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> namespace Mad { namespace Core { namespace RequestHandlers { -class IdentifyRequestHandler : public Common::XmlRequestHandler { +class IdentifyRequestHandler : public Common::RequestHandler { protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/LogRequestHandler.h b/src/Core/RequestHandlers/LogRequestHandler.h index 1c84248..4a0f9cb 100644 --- a/src/Core/RequestHandlers/LogRequestHandler.h +++ b/src/Core/RequestHandlers/LogRequestHandler.h @@ -20,13 +20,13 @@ #ifndef MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> namespace Mad { namespace Core { namespace RequestHandlers { -class LogRequestHandler : public Common::XmlRequestHandler { +class LogRequestHandler : public Common::RequestHandler { protected: virtual void handlePacket(Net::Connection *connection, uint16_t requestId, const Common::XmlPacket &packet); diff --git a/src/Core/RequestHandlers/UserListRequestHandler.h b/src/Core/RequestHandlers/UserListRequestHandler.h index 7739809..a9c8ac6 100644 --- a/src/Core/RequestHandlers/UserListRequestHandler.h +++ b/src/Core/RequestHandlers/UserListRequestHandler.h @@ -20,7 +20,7 @@ #ifndef MAD_CORE_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ #define MAD_CORE_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> #include <Common/UserInfo.h> #include <map> @@ -30,7 +30,7 @@ namespace Mad { namespace Core { namespace RequestHandlers { -class UserListRequestHandler : public Common::XmlRequestHandler { +class UserListRequestHandler : public Common::RequestHandler { private: Net::Connection *connection; uint16_t rid; diff --git a/src/Core/Requests/CommandRequest.h b/src/Core/Requests/CommandRequest.h index 534fcef..9c6c70d 100644 --- a/src/Core/Requests/CommandRequest.h +++ b/src/Core/Requests/CommandRequest.h @@ -20,13 +20,13 @@ #ifndef MAD_CORE_REQUESTS_COMMANDREQUEST_H_ #define MAD_CORE_REQUESTS_COMMANDREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> namespace Mad { namespace Core { namespace Requests { -class CommandRequest : public Common::XmlRequest { +class CommandRequest : public Common::Request { private: bool reboot; @@ -35,7 +35,7 @@ class CommandRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - CommandRequest(bool reboot0, slot_type slot) : Common::XmlRequest(slot), reboot(reboot0) {} + CommandRequest(bool reboot0, slot_type slot) : Common::Request(slot), reboot(reboot0) {} }; } diff --git a/src/Core/Requests/DaemonStateUpdateRequest.h b/src/Core/Requests/DaemonStateUpdateRequest.h index 84c23e8..f1466b2 100644 --- a/src/Core/Requests/DaemonStateUpdateRequest.h +++ b/src/Core/Requests/DaemonStateUpdateRequest.h @@ -20,14 +20,14 @@ #ifndef MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ #define MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <Common/HostInfo.h> namespace Mad { namespace Core { namespace Requests { -class DaemonStateUpdateRequest : public Common::XmlRequest { +class DaemonStateUpdateRequest : public Common::Request { private: std::string name; Common::HostInfo::State state; @@ -37,7 +37,7 @@ class DaemonStateUpdateRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonStateUpdateRequest(const std::string &name0, Common::HostInfo::State state0) : Common::XmlRequest(slot_type()), name(name0), state(state0) {} + DaemonStateUpdateRequest(const std::string &name0, Common::HostInfo::State state0) : Common::Request(slot_type()), name(name0), state(state0) {} }; } diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h index a07fd59..857d27c 100644 --- a/src/Daemon/Backends/NetworkLogger.h +++ b/src/Daemon/Backends/NetworkLogger.h @@ -37,7 +37,7 @@ class NetworkLogger : public Common::Logger { protected: virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) { Common::RequestManager::get()->sendRequest(connection, - std::auto_ptr<Common::XmlRequest>(new Requests::LogRequest(category, level, messageTimestamp, message, Requests::LogRequest::slot_type())) + std::auto_ptr<Common::Request>(new Requests::LogRequest(category, level, messageTimestamp, message, Requests::LogRequest::slot_type())) ); } diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.h b/src/Daemon/RequestHandlers/CommandRequestHandler.h index 86391f2..408dbcf 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.h +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.h @@ -20,14 +20,14 @@ #ifndef MAD_DAEMON_REQUESTHANDLERS_COMMANDREQUESTHANDLER_H_ #define MAD_DAEMON_REQUESTHANDLERS_COMMANDREQUESTHANDLER_H_ -#include <Common/XmlRequestHandler.h> +#include <Common/RequestHandler.h> #include <stdint.h> namespace Mad { namespace Daemon { namespace RequestHandlers { -class CommandRequestHandler : public Common::XmlRequestHandler { +class CommandRequestHandler : public Common::RequestHandler { private: void sendReply(Net::Connection *connection, uint16_t requestId); diff --git a/src/Daemon/Requests/IdentifyRequest.h b/src/Daemon/Requests/IdentifyRequest.h index c3ab821..5009374 100644 --- a/src/Daemon/Requests/IdentifyRequest.h +++ b/src/Daemon/Requests/IdentifyRequest.h @@ -20,14 +20,14 @@ #ifndef MAD_DAEMON_REQUESTS_IDENTIFYREQUEST_H_ #define MAD_DAEMON_REQUESTS_IDENTIFYREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <string> namespace Mad { namespace Daemon { namespace Requests { -class IdentifyRequest : public Common::XmlRequest { +class IdentifyRequest : public Common::Request { private: std::string hostname; @@ -36,7 +36,7 @@ class IdentifyRequest : public Common::XmlRequest { virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - IdentifyRequest(const std::string &hostname0, slot_type slot) : Common::XmlRequest(slot), hostname(hostname0) {} + IdentifyRequest(const std::string &hostname0, slot_type slot) : Common::Request(slot), hostname(hostname0) {} }; } diff --git a/src/Daemon/Requests/LogRequest.h b/src/Daemon/Requests/LogRequest.h index 2a03ce3..1045a2f 100644 --- a/src/Daemon/Requests/LogRequest.h +++ b/src/Daemon/Requests/LogRequest.h @@ -20,7 +20,7 @@ #ifndef MAD_DAEMON_REQUESTS_LOGREQUEST_H_ #define MAD_DAEMON_REQUESTS_LOGREQUEST_H_ -#include <Common/XmlRequest.h> +#include <Common/Request.h> #include <Common/Logger.h> #include <ctime> @@ -28,7 +28,7 @@ namespace Mad { namespace Daemon { namespace Requests { -class LogRequest : public Common::XmlRequest { +class LogRequest : public Common::Request { private: Common::Logger::MessageCategory category; Common::Logger::MessageLevel level; @@ -41,7 +41,7 @@ class LogRequest : public Common::XmlRequest { public: LogRequest(Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, time_t messageTimestamp0, const std::string &message0, slot_type slot) - : Common::XmlRequest(slot), category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {} + : Common::Request(slot), category(category0), level(level0), messageTimestamp(messageTimestamp0), message(message0) {} }; } diff --git a/src/mad.cpp b/src/mad.cpp index bc218f6..3dfe379 100644 --- a/src/mad.cpp +++ b/src/mad.cpp @@ -36,7 +36,7 @@ using namespace Mad; -static void requestFinished(const Common::XmlRequest&) { +static void requestFinished(const Common::Request&) { Common::Logger::log("Identified."); } @@ -70,7 +70,7 @@ int main() { //char hostname[256]; //gethostname(hostname, sizeof(hostname)); //Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished)))); - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::XmlRequest>(new Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::Request>(new Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished)))); while(connection->isConnected()) Net::FdManager::get()->run(); |