diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-02-28 19:09:43 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-02-28 19:09:43 +0100 |
commit | 46c110f7a14e4b5d0e8bd27259f7744ae8a36382 (patch) | |
tree | 94693ecffb8f1c553c12ea3a30920b2008e27b11 /src/Client/Requests | |
parent | 8f85624a76934b14e0ba0f49413f471f8f4aa4f1 (diff) | |
download | mad-46c110f7a14e4b5d0e8bd27259f7744ae8a36382.tar mad-46c110f7a14e4b5d0e8bd27259f7744ae8a36382.zip |
DaemonListRequest und DaemonStateUpdateRequest benutzen jetzt XML
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) {} }; } |