summaryrefslogtreecommitdiffstats
path: root/src/Core/Requests
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-02-28 19:09:43 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-02-28 19:09:43 +0100
commit46c110f7a14e4b5d0e8bd27259f7744ae8a36382 (patch)
tree94693ecffb8f1c553c12ea3a30920b2008e27b11 /src/Core/Requests
parent8f85624a76934b14e0ba0f49413f471f8f4aa4f1 (diff)
downloadmad-46c110f7a14e4b5d0e8bd27259f7744ae8a36382.tar
mad-46c110f7a14e4b5d0e8bd27259f7744ae8a36382.zip
DaemonListRequest und DaemonStateUpdateRequest benutzen jetzt XML
Diffstat (limited to 'src/Core/Requests')
-rw-r--r--src/Core/Requests/DaemonStateUpdateRequest.cpp14
-rw-r--r--src/Core/Requests/DaemonStateUpdateRequest.h8
2 files changed, 13 insertions, 9 deletions
diff --git a/src/Core/Requests/DaemonStateUpdateRequest.cpp b/src/Core/Requests/DaemonStateUpdateRequest.cpp
index 00e0bdf..c00468e 100644
--- a/src/Core/Requests/DaemonStateUpdateRequest.cpp
+++ b/src/Core/Requests/DaemonStateUpdateRequest.cpp
@@ -19,23 +19,27 @@
#include "DaemonStateUpdateRequest.h"
#include <Net/Connection.h>
-#include <Net/Packets/HostStatePacket.h>
namespace Mad {
namespace Core {
namespace Requests {
void DaemonStateUpdateRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
- connection->send(Net::Packets::HostStatePacket(Net::Packet::DAEMON_STATE_UPDATE, requestId, name, state));
+ Common::XmlPacket packet;
+
+ packet.setType("UpdateHostState");
+ packet.add("name", name);
+ packet.add("state", state);
+ connection->send(packet.encode(requestId));
}
-void DaemonStateUpdateRequest::handlePacket(Net::Connection*, const Net::Packet &packet) {
- if(packet.getType() != Net::Packet::OK) {
+void DaemonStateUpdateRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) {
+ if(packet.getType() != "OK") {
finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET));
return; // TODO Logging
}
- finish();
+ finish(packet);
}
}
diff --git a/src/Core/Requests/DaemonStateUpdateRequest.h b/src/Core/Requests/DaemonStateUpdateRequest.h
index 9a1c8f0..84c23e8 100644
--- a/src/Core/Requests/DaemonStateUpdateRequest.h
+++ b/src/Core/Requests/DaemonStateUpdateRequest.h
@@ -20,24 +20,24 @@
#ifndef MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_
#define MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_
-#include <Common/Request.h>
+#include <Common/XmlRequest.h>
#include <Common/HostInfo.h>
namespace Mad {
namespace Core {
namespace Requests {
-class DaemonStateUpdateRequest : public Common::Request<> {
+class DaemonStateUpdateRequest : public Common::XmlRequest {
private:
std::string name;
Common::HostInfo::State state;
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:
- DaemonStateUpdateRequest(const std::string &name0, Common::HostInfo::State state0) : Common::Request<>(slot_type()), name(name0), state(state0) {}
+ DaemonStateUpdateRequest(const std::string &name0, Common::HostInfo::State state0) : Common::XmlRequest(slot_type()), name(name0), state(state0) {}
};
}