diff options
Diffstat (limited to 'src/Client/Requests')
-rw-r--r-- | src/Client/Requests/DaemonListRequest.cpp | 11 | ||||
-rw-r--r-- | src/Client/Requests/DaemonListRequest.h | 9 |
2 files changed, 11 insertions, 9 deletions
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 <Common/Request.h> -#include <Net/Packets/HostListPacket.h> +#include <Common/XmlRequest.h> namespace Mad { namespace Client { namespace Requests { -class DaemonListRequest : public Common::Request<Net::Packets::HostListPacket> { +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<Net::Packets::HostListPacket>(slot) {} + DaemonListRequest(slot_type slot) : Common::XmlRequest(slot) {} }; } |