From 46c110f7a14e4b5d0e8bd27259f7744ae8a36382 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Feb 2009 19:09:43 +0100 Subject: DaemonListRequest und DaemonStateUpdateRequest benutzen jetzt XML --- src/Client/Requests/DaemonListRequest.cpp | 11 +++++++---- src/Client/Requests/DaemonListRequest.h | 9 ++++----- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/Client/Requests') diff --git a/src/Client/Requests/DaemonListRequest.cpp b/src/Client/Requests/DaemonListRequest.cpp index 690aaea..ec80828 100644 --- a/src/Client/Requests/DaemonListRequest.cpp +++ b/src/Client/Requests/DaemonListRequest.cpp @@ -25,16 +25,19 @@ namespace Client { namespace Requests { void DaemonListRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packet(Net::Packet::LIST_DAEMONS, requestId)); + Common::XmlPacket packet; + + packet.setType("ListHosts"); + connection->send(packet.encode(requestId)); } -void DaemonListRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) { +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(Net::Packets::HostListPacket(packet)); + finish(packet); } } diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h index fbf0e70..ca37dbd 100644 --- a/src/Client/Requests/DaemonListRequest.h +++ b/src/Client/Requests/DaemonListRequest.h @@ -20,20 +20,19 @@ #ifndef MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ #define MAD_CLIENT_REQUEST_DAEMONLISTREQUEST_H_ -#include -#include +#include namespace Mad { namespace Client { namespace Requests { -class DaemonListRequest : public Common::Request { +class DaemonListRequest : public Common::XmlRequest { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); - virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); + virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - DaemonListRequest(slot_type slot) : Common::Request(slot) {} + DaemonListRequest(slot_type slot) : Common::XmlRequest(slot) {} }; } -- cgit v1.2.3