summaryrefslogtreecommitdiffstats
path: root/src/Daemon/Requests
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-03-01 00:51:00 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-03-01 00:51:00 +0100
commit63907817cb057f497f03a28016d408885cbe41ea (patch)
treea9ad6b0b19bff7722b21375137ba6e53c8869c91 /src/Daemon/Requests
parent46c110f7a14e4b5d0e8bd27259f7744ae8a36382 (diff)
downloadmad-63907817cb057f497f03a28016d408885cbe41ea.tar
mad-63907817cb057f497f03a28016d408885cbe41ea.zip
Alle uebrigen Requests ausser GSSAPIAuthRequest in XmlRequests umgewandelt
Diffstat (limited to 'src/Daemon/Requests')
-rw-r--r--src/Daemon/Requests/IdentifyRequest.cpp13
-rw-r--r--src/Daemon/Requests/IdentifyRequest.h8
2 files changed, 13 insertions, 8 deletions
diff --git a/src/Daemon/Requests/IdentifyRequest.cpp b/src/Daemon/Requests/IdentifyRequest.cpp
index e8b6082..6334f00 100644
--- a/src/Daemon/Requests/IdentifyRequest.cpp
+++ b/src/Daemon/Requests/IdentifyRequest.cpp
@@ -19,22 +19,27 @@
#include "IdentifyRequest.h"
#include <Net/Connection.h>
+#include <Common/XmlPacket.h>
namespace Mad {
namespace Daemon {
namespace Requests {
void IdentifyRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
- connection->send(Net::Packet(Net::Packet::IDENTIFY, requestId, hostname.c_str(), hostname.length()));
+ Common::XmlPacket packet;
+ packet.setType("Identify");
+ packet.add("hostname", hostname);
+
+ connection->send(packet.encode(requestId));
}
-void IdentifyRequest::handlePacket(Net::Connection*, const Net::Packet &packet) {
- if(packet.getType() != Net::Packet::OK) {
+void IdentifyRequest::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/Daemon/Requests/IdentifyRequest.h b/src/Daemon/Requests/IdentifyRequest.h
index c728461..c3ab821 100644
--- a/src/Daemon/Requests/IdentifyRequest.h
+++ b/src/Daemon/Requests/IdentifyRequest.h
@@ -20,23 +20,23 @@
#ifndef MAD_DAEMON_REQUESTS_IDENTIFYREQUEST_H_
#define MAD_DAEMON_REQUESTS_IDENTIFYREQUEST_H_
-#include <Common/Request.h>
+#include <Common/XmlRequest.h>
#include <string>
namespace Mad {
namespace Daemon {
namespace Requests {
-class IdentifyRequest : public Common::Request<> {
+class IdentifyRequest : public Common::XmlRequest {
private:
std::string hostname;
protected:
virtual void sendRequest(Net::Connection *connection, uint16_t requestId);
- virtual void handlePacket(Net::Connection*, const Net::Packet &packet);
+ virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet);
public:
- IdentifyRequest(const std::string &hostname0, slot_type slot) : Common::Request<>(slot), hostname(hostname0) {}
+ IdentifyRequest(const std::string &hostname0, slot_type slot) : Common::XmlRequest(slot), hostname(hostname0) {}
};
}