diff options
Diffstat (limited to 'src/Client')
-rw-r--r-- | src/Client/Requests/DaemonCommandRequest.cpp | 13 | ||||
-rw-r--r-- | src/Client/Requests/DaemonCommandRequest.h | 3 | ||||
-rw-r--r-- | src/Client/Requests/DaemonFSInfoRequest.cpp | 13 | ||||
-rw-r--r-- | src/Client/Requests/DaemonFSInfoRequest.h | 1 | ||||
-rw-r--r-- | src/Client/Requests/DaemonListRequest.cpp | 45 | ||||
-rw-r--r-- | src/Client/Requests/DaemonListRequest.h | 12 | ||||
-rw-r--r-- | src/Client/Requests/DaemonStatusRequest.cpp | 9 | ||||
-rw-r--r-- | src/Client/Requests/DaemonStatusRequest.h | 1 | ||||
-rw-r--r-- | src/Client/Requests/Makefile.am | 2 | ||||
-rw-r--r-- | src/Client/Requests/Makefile.in | 6 |
10 files changed, 8 insertions, 97 deletions
diff --git a/src/Client/Requests/DaemonCommandRequest.cpp b/src/Client/Requests/DaemonCommandRequest.cpp index 6e82c60..7b444cd 100644 --- a/src/Client/Requests/DaemonCommandRequest.cpp +++ b/src/Client/Requests/DaemonCommandRequest.cpp @@ -34,19 +34,6 @@ void DaemonCommandRequest::sendRequest(Net::Connection *connection, uint16_t req connection->send(packet.encode(requestId)); } -void DaemonCommandRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { - if(packet.getType() == "Error") { - finishWithError(Common::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"])); - return; - } - else if(packet.getType() != "OK") { - finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); - return; // TODO Logging - } - - finish(packet); -} - } } } diff --git a/src/Client/Requests/DaemonCommandRequest.h b/src/Client/Requests/DaemonCommandRequest.h index 13a6da6..fa1e436 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 <Common/Request.h> +#include <Common/Requests/SimpleRequest.h> #include <string> namespace Mad { @@ -34,7 +34,6 @@ class DaemonCommandRequest : 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: DaemonCommandRequest(const std::string &daemon0, bool reboot0, slot_type slot) : Common::Request(slot), daemon(daemon0), reboot(reboot0) {} diff --git a/src/Client/Requests/DaemonFSInfoRequest.cpp b/src/Client/Requests/DaemonFSInfoRequest.cpp index 919a8f8..acd1179 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.cpp +++ b/src/Client/Requests/DaemonFSInfoRequest.cpp @@ -32,19 +32,6 @@ void DaemonFSInfoRequest::sendRequest(Net::Connection *connection, uint16_t requ connection->send(packet.encode(requestId)); } -void DaemonFSInfoRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { - if(packet.getType() == "Error") { - finishWithError(Common::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"])); - return; - } - else if(packet.getType() != "OK") { - finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); - return; // TODO Logging - } - - finish(packet); -} - } } } diff --git a/src/Client/Requests/DaemonFSInfoRequest.h b/src/Client/Requests/DaemonFSInfoRequest.h index a42d85a..ac29a8b 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.h +++ b/src/Client/Requests/DaemonFSInfoRequest.h @@ -34,7 +34,6 @@ class DaemonFSInfoRequest : 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: DaemonFSInfoRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} diff --git a/src/Client/Requests/DaemonListRequest.cpp b/src/Client/Requests/DaemonListRequest.cpp deleted file mode 100644 index ec80828..0000000 --- a/src/Client/Requests/DaemonListRequest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * DaemonListRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#include "DaemonListRequest.h" -#include <Net/Connection.h> - -namespace Mad { -namespace Client { -namespace Requests { - -void DaemonListRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - Common::XmlPacket packet; - - packet.setType("ListHosts"); - connection->send(packet.encode(requestId)); -} - -void DaemonListRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { - if(packet.getType() != "OK") { - finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); - return; // TODO Logging - } - - finish(packet); -} - -} -} -} diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h index 3b561d2..a09894e 100644 --- a/src/Client/Requests/DaemonListRequest.h +++ b/src/Client/Requests/DaemonListRequest.h @@ -20,19 +20,15 @@ #ifndef MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ #define MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ -#include <Common/Request.h> +#include <Common/Requests/SimpleRequest.h> namespace Mad { namespace Client { namespace Requests { -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::Request(slot) {} +class DaemonListRequest : public Common::Requests::SimpleRequest { + public: + DaemonListRequest(slot_type slot) : SimpleRequest("ListDaemons", slot) {} }; } diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp index f088fcc..7611d30 100644 --- a/src/Client/Requests/DaemonStatusRequest.cpp +++ b/src/Client/Requests/DaemonStatusRequest.cpp @@ -32,15 +32,6 @@ void DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requ connection->send(packet.encode(requestId)); } -void DaemonStatusRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { - if(packet.getType() != "OK") { - finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); - return; // TODO Logging - } - - finish(packet); -} - } } } diff --git a/src/Client/Requests/DaemonStatusRequest.h b/src/Client/Requests/DaemonStatusRequest.h index 2ccc9b2..bf8b7bf 100644 --- a/src/Client/Requests/DaemonStatusRequest.h +++ b/src/Client/Requests/DaemonStatusRequest.h @@ -34,7 +34,6 @@ class DaemonStatusRequest : 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: DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::Request(slot), daemon(daemon0) {} diff --git a/src/Client/Requests/Makefile.am b/src/Client/Requests/Makefile.am index a96b265..fe09d38 100644 --- a/src/Client/Requests/Makefile.am +++ b/src/Client/Requests/Makefile.am @@ -1,4 +1,4 @@ noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = DaemonCommandRequest.cpp DaemonFSInfoRequest.cpp DaemonListRequest.cpp DaemonStatusRequest.cpp +librequests_la_SOURCES = DaemonCommandRequest.cpp DaemonFSInfoRequest.cpp DaemonStatusRequest.cpp noinst_HEADERS = DaemonCommandRequest.h DaemonFSInfoRequest.h DaemonListRequest.h DaemonStatusRequest.h diff --git a/src/Client/Requests/Makefile.in b/src/Client/Requests/Makefile.in index 6558799..0e70532 100644 --- a/src/Client/Requests/Makefile.in +++ b/src/Client/Requests/Makefile.in @@ -53,8 +53,7 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librequests_la_LIBADD = am_librequests_la_OBJECTS = DaemonCommandRequest.lo \ - DaemonFSInfoRequest.lo DaemonListRequest.lo \ - DaemonStatusRequest.lo + DaemonFSInfoRequest.lo DaemonStatusRequest.lo librequests_la_OBJECTS = $(am_librequests_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -225,7 +224,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = DaemonCommandRequest.cpp DaemonFSInfoRequest.cpp DaemonListRequest.cpp DaemonStatusRequest.cpp +librequests_la_SOURCES = DaemonCommandRequest.cpp DaemonFSInfoRequest.cpp DaemonStatusRequest.cpp noinst_HEADERS = DaemonCommandRequest.h DaemonFSInfoRequest.h DaemonListRequest.h DaemonStatusRequest.h all: all-am @@ -280,7 +279,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonCommandRequest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonFSInfoRequest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonListRequest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequest.Plo@am__quote@ .cpp.o: |