From 8f098fc3070f791302ec1f497588fab6ed409980 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 16 Mar 2009 19:13:42 +0100 Subject: Request- und RequestHandler-Interfaces vereinfacht --- src/Client/Requests/DaemonCommandRequest.cpp | 6 ++---- src/Client/Requests/DaemonCommandRequest.h | 7 ++++--- src/Client/Requests/DaemonFSInfoRequest.cpp | 5 ++--- src/Client/Requests/DaemonFSInfoRequest.h | 5 +++-- src/Client/Requests/DaemonListRequest.h | 3 ++- src/Client/Requests/DaemonStatusRequest.cpp | 5 ++--- src/Client/Requests/DaemonStatusRequest.h | 5 +++-- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/Client/Requests') diff --git a/src/Client/Requests/DaemonCommandRequest.cpp b/src/Client/Requests/DaemonCommandRequest.cpp index 7b444cd..45a346b 100644 --- a/src/Client/Requests/DaemonCommandRequest.cpp +++ b/src/Client/Requests/DaemonCommandRequest.cpp @@ -18,20 +18,18 @@ */ #include "DaemonCommandRequest.h" -#include -#include namespace Mad { namespace Client { namespace Requests { -void DaemonCommandRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { +void DaemonCommandRequest::sendRequest() { Common::XmlPacket packet; packet.setType("DaemonCommand"); packet.add("command", reboot ? "reboot" : "shutdown"); packet.add("daemon", daemon); - connection->send(packet.encode(requestId)); + sendPacket(packet); } } diff --git a/src/Client/Requests/DaemonCommandRequest.h b/src/Client/Requests/DaemonCommandRequest.h index fa1e436..4e9e2d1 100644 --- a/src/Client/Requests/DaemonCommandRequest.h +++ b/src/Client/Requests/DaemonCommandRequest.h @@ -20,7 +20,7 @@ #ifndef MAD_CLIENT_REQUEST_DAEMONCOMMANDREQUEST_H_ #define MAD_CLIENT_REQUEST_DAEMONCOMMANDREQUEST_H_ -#include +#include #include namespace Mad { @@ -33,10 +33,11 @@ class DaemonCommandRequest : public Common::Request { bool reboot; protected: - virtual void sendRequest(Net::Connection *connection, uint16_t requestId); + virtual void sendRequest(); public: - DaemonCommandRequest(const std::string &daemon0, bool reboot0, slot_type slot) : Common::Request(slot), daemon(daemon0), reboot(reboot0) {} + DaemonCommandRequest(Net::Connection *connection, uint16_t requestId, slot_type slot, const std::string &daemon0, bool reboot0) + : Common::Request(connection, requestId, slot), daemon(daemon0), reboot(reboot0) {} }; } diff --git a/src/Client/Requests/DaemonFSInfoRequest.cpp b/src/Client/Requests/DaemonFSInfoRequest.cpp index acd1179..5d77850 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.cpp +++ b/src/Client/Requests/DaemonFSInfoRequest.cpp @@ -18,18 +18,17 @@ */ #include "DaemonFSInfoRequest.h" -#include namespace Mad { namespace Client { namespace Requests { -void DaemonFSInfoRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { +void DaemonFSInfoRequest::sendRequest() { Common::XmlPacket packet; packet.setType("DaemonFSInfo"); packet.add("daemon", daemon); - connection->send(packet.encode(requestId)); + sendPacket(packet); } } diff --git a/src/Client/Requests/DaemonFSInfoRequest.h b/src/Client/Requests/DaemonFSInfoRequest.h index ac29a8b..2e6a68f 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.h +++ b/src/Client/Requests/DaemonFSInfoRequest.h @@ -33,10 +33,11 @@ class DaemonFSInfoRequest : public Common::Request { std::string daemon; protected: - virtual void sendRequest(Net::Connection *connection, uint16_t requestId); + virtual void sendRequest(); public: - DaemonFSInfoRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} + DaemonFSInfoRequest(Net::Connection *connection, uint16_t requestId, slot_type slot, const std::string &daemon0) + : Common::Request(connection, requestId, slot), daemon(daemon0) {} }; } diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h index 2387387..017d355 100644 --- a/src/Client/Requests/DaemonListRequest.h +++ b/src/Client/Requests/DaemonListRequest.h @@ -28,7 +28,8 @@ namespace Requests { class DaemonListRequest : public Common::Requests::SimpleRequest { public: - DaemonListRequest(slot_type slot) : SimpleRequest("ListHosts", slot) {} + DaemonListRequest(Net::Connection *connection, uint16_t requestId, slot_type slot) + : SimpleRequest(connection, requestId, slot, "ListHosts") {} }; } diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp index 7611d30..9f0a9a0 100644 --- a/src/Client/Requests/DaemonStatusRequest.cpp +++ b/src/Client/Requests/DaemonStatusRequest.cpp @@ -18,18 +18,17 @@ */ #include "DaemonStatusRequest.h" -#include namespace Mad { namespace Client { namespace Requests { -void DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { +void DaemonStatusRequest::sendRequest() { Common::XmlPacket packet; packet.setType("GetDaemonStatus"); packet.add("daemonName", daemon); - connection->send(packet.encode(requestId)); + sendPacket(packet); } } diff --git a/src/Client/Requests/DaemonStatusRequest.h b/src/Client/Requests/DaemonStatusRequest.h index bf8b7bf..83cba67 100644 --- a/src/Client/Requests/DaemonStatusRequest.h +++ b/src/Client/Requests/DaemonStatusRequest.h @@ -33,10 +33,11 @@ class DaemonStatusRequest : public Common::Request { std::string daemon; protected: - virtual void sendRequest(Net::Connection *connection, uint16_t requestId); + virtual void sendRequest(); public: - DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} + DaemonStatusRequest(Net::Connection *connection, uint16_t requestId, slot_type slot, const std::string &daemon0) + : Common::Request(connection, requestId, slot), daemon(daemon0) {} }; } -- cgit v1.2.3