summaryrefslogtreecommitdiffstats
path: root/src/Client
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client')
-rw-r--r--src/Client/Authenticators/ChallengeResponseAuthenticator.cpp18
-rw-r--r--src/Client/Authenticators/ChallengeResponseAuthenticator.h2
-rw-r--r--src/Client/Authenticators/PasswordAuthenticator.cpp16
-rw-r--r--src/Client/Authenticators/PasswordAuthenticator.h2
-rw-r--r--src/Client/CommandParser.cpp2
-rw-r--r--src/Client/CommandParser.h2
-rw-r--r--src/Client/InformationManager.cpp8
-rw-r--r--src/Client/InformationManager.h4
-rw-r--r--src/Client/Requests/DaemonCommandRequest.cpp2
-rw-r--r--src/Client/Requests/DaemonFSInfoRequest.cpp2
-rw-r--r--src/Client/Requests/DaemonStatusRequest.cpp2
-rw-r--r--src/Client/SystemCommands.cpp16
-rw-r--r--src/Client/SystemCommands.h6
13 files changed, 41 insertions, 41 deletions
diff --git a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
index 33e5ccd..4aadb63 100644
--- a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
+++ b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
@@ -28,7 +28,7 @@ namespace Client {
namespace Authenticators {
void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("Authenticate");
packet.set("method", "Challenge-Response");
packet.set("subMethod", hash);
@@ -38,7 +38,7 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::sendRequest()
sendPacket(packet);
}
-void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlData> packet) {
if(packet->getType() == "Error") {
signalFinished(Core::Exception(packet->get<const std::string&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
packet->get<long>("SubCode"), packet->get<long>("SubSubCode")));
@@ -51,7 +51,7 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(
return; // TODO Logging
}
- Common::XmlPacket ret;
+ Common::XmlData ret;
ret.setType("Authenticate");
ret.set("method", "Challenge-Response");
ret.set("subMethod", hash);
@@ -88,20 +88,20 @@ void ChallengeResponseAuthenticator::authenticate(Common::Application *applicati
application->getRequestManager()->sendRequest(con, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
- const Common::XmlPacket::List *methods = result.first->getList("methods");
+ const Common::XmlData::List *methods = result.first->getList("methods");
- for(Common::XmlPacket::List::const_iterator method = methods->begin(); method != methods->end(); ++method) {
+ for(Common::XmlData::List::const_iterator method = methods->begin(); method != methods->end(); ++method) {
if(method->get<const std::string&>("name") != "Challenge-Response")
continue;
- const Common::XmlPacket::List *subMethods = method->getList("subMethods");
+ const Common::XmlData::List *subMethods = method->getList("subMethods");
- for(Common::XmlPacket::List::const_iterator subMethod = subMethods->begin(); subMethod != subMethods->end(); ++subMethod) {
+ for(Common::XmlData::List::const_iterator subMethod = subMethods->begin(); subMethod != subMethods->end(); ++subMethod) {
if(Common::Hash::isHashSupported(subMethod->get<const std::string&>("name"))) {
hash = subMethod->get<const std::string&>("name");
break;
@@ -122,7 +122,7 @@ void ChallengeResponseAuthenticator::authenticate(Common::Application *applicati
application->getRequestManager()->sendRequest(con, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
diff --git a/src/Client/Authenticators/ChallengeResponseAuthenticator.h b/src/Client/Authenticators/ChallengeResponseAuthenticator.h
index 61c6f20..3906ba9 100644
--- a/src/Client/Authenticators/ChallengeResponseAuthenticator.h
+++ b/src/Client/Authenticators/ChallengeResponseAuthenticator.h
@@ -41,7 +41,7 @@ class MAD_CLIENT_EXPORT ChallengeResponseAuthenticator {
protected:
virtual void sendRequest();
- virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
public:
ChallengeResponseAuthRequest(Common::Application *application, const std::string &username0, const std::string &password0, const std::string &hash0)
diff --git a/src/Client/Authenticators/PasswordAuthenticator.cpp b/src/Client/Authenticators/PasswordAuthenticator.cpp
index 8887d96..bf2a284 100644
--- a/src/Client/Authenticators/PasswordAuthenticator.cpp
+++ b/src/Client/Authenticators/PasswordAuthenticator.cpp
@@ -28,7 +28,7 @@ namespace Client {
namespace Authenticators {
void PasswordAuthenticator::PasswordAuthRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("Authenticate");
packet.set("method", "Password");
packet.set("subMethod", hash);
@@ -43,7 +43,7 @@ void PasswordAuthenticator::PasswordAuthRequest::sendRequest() {
sendPacket(packet);
}
-void PasswordAuthenticator::PasswordAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+void PasswordAuthenticator::PasswordAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlData> packet) {
if(packet->getType() == "Error") {
signalFinished(Core::Exception(packet->get<const std::string&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
packet->get<long>("SubCode"), packet->get<long>("SubSubCode")));
@@ -66,20 +66,20 @@ void PasswordAuthenticator::authenticate(Common::Application *application, Commo
application->getRequestManager()->sendRequest(con, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
- const Common::XmlPacket::List *methods = result.first->getList("methods");
+ const Common::XmlData::List *methods = result.first->getList("methods");
- for(Common::XmlPacket::List::const_iterator method = methods->begin(); method != methods->end(); ++method) {
+ for(Common::XmlData::List::const_iterator method = methods->begin(); method != methods->end(); ++method) {
if(method->get<const std::string&>("name") != "Password")
continue;
- const Common::XmlPacket::List *subMethods = method->getList("subMethods");
+ const Common::XmlData::List *subMethods = method->getList("subMethods");
- for(Common::XmlPacket::List::const_iterator subMethod = subMethods->begin(); subMethod != subMethods->end(); ++subMethod) {
+ for(Common::XmlData::List::const_iterator subMethod = subMethods->begin(); subMethod != subMethods->end(); ++subMethod) {
if(Common::Hash::isHashSupported(subMethod->get<const std::string&>("name"))) {
hash = subMethod->get<const std::string&>("name");
break;
@@ -100,7 +100,7 @@ void PasswordAuthenticator::authenticate(Common::Application *application, Commo
application->getRequestManager()->sendRequest(con, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second)
throw result.second;
diff --git a/src/Client/Authenticators/PasswordAuthenticator.h b/src/Client/Authenticators/PasswordAuthenticator.h
index d7b2fbc..70ab3f2 100644
--- a/src/Client/Authenticators/PasswordAuthenticator.h
+++ b/src/Client/Authenticators/PasswordAuthenticator.h
@@ -39,7 +39,7 @@ class MAD_CLIENT_EXPORT PasswordAuthenticator {
protected:
virtual void sendRequest();
- virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
public:
PasswordAuthRequest(Common::Application *application, const std::string &username0, const std::string &password0, const std::string &hash0)
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index ed0f47e..d93b432 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -202,7 +202,7 @@ void CommandParser::exitCommand(const std::vector<std::string> &/*args*/) {
application->getRequestManager()->sendRequest(connection, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(result.second)
std::cerr << "An error occurred during your request: " << result.second.what() << "." << std::endl;
diff --git a/src/Client/CommandParser.h b/src/Client/CommandParser.h
index ca168f3..8077a30 100644
--- a/src/Client/CommandParser.h
+++ b/src/Client/CommandParser.h
@@ -23,7 +23,7 @@
#include "export.h"
#include <Common/HostInfo.h>
-#include <Common/XmlPacket.h>
+#include <Common/XmlData.h>
#include <boost/function.hpp>
#include <boost/smart_ptr.hpp>
diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp
index bcdb4a9..0021d49 100644
--- a/src/Client/InformationManager.cpp
+++ b/src/Client/InformationManager.cpp
@@ -27,7 +27,7 @@
namespace Mad {
namespace Client {
-void InformationManager::DaemonStateUpdateRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret) {
+void InformationManager::DaemonStateUpdateRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret) {
if(!getConnection()->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
@@ -69,19 +69,19 @@ void InformationManager::updateDaemonList(Common::Connection *con) {
updating = true;
}
-void InformationManager::daemonListRequestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error) {
+void InformationManager::daemonListRequestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error) {
boost::lock_guard<boost::mutex> lock(mutex);
if(!packet || error) {
application->logf(Core::Logger::LOG_CRITICAL, "Host list request failed: %s", error.what());
}
else {
- const Common::XmlPacket::List *list = packet->getList("hosts");
+ const Common::XmlData::List *list = packet->getList("hosts");
daemons.clear();
if(list) {
- for(Common::XmlPacket::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) {
+ for(Common::XmlData::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) {
Common::HostInfo info;
info.setName(entry->get<const std::string&>("name"));
info.setIP(entry->get<const std::string&>("address"));
diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h
index 5f68bc2..dcb0212 100644
--- a/src/Client/InformationManager.h
+++ b/src/Client/InformationManager.h
@@ -43,7 +43,7 @@ class MAD_CLIENT_EXPORT InformationManager : private boost::noncopyable {
private:
class MAD_CLIENT_EXPORT DaemonStateUpdateRequestHandler : public Common::RequestHandlers::SimpleRequestHandler {
private:
- void handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret);
+ void handleRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret);
public:
DaemonStateUpdateRequestHandler(Common::Application *application)
@@ -63,7 +63,7 @@ class MAD_CLIENT_EXPORT InformationManager : private boost::noncopyable {
bool updating;
- void daemonListRequestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error);
+ void daemonListRequestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error);
InformationManager(Application *application0);
~InformationManager();
diff --git a/src/Client/Requests/DaemonCommandRequest.cpp b/src/Client/Requests/DaemonCommandRequest.cpp
index e2066e2..12f91e0 100644
--- a/src/Client/Requests/DaemonCommandRequest.cpp
+++ b/src/Client/Requests/DaemonCommandRequest.cpp
@@ -24,7 +24,7 @@ namespace Client {
namespace Requests {
void DaemonCommandRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("DaemonCommand");
packet.set("command", reboot ? "reboot" : "shutdown");
packet.set("daemon", daemon);
diff --git a/src/Client/Requests/DaemonFSInfoRequest.cpp b/src/Client/Requests/DaemonFSInfoRequest.cpp
index b7ea81c..8e4c2d7 100644
--- a/src/Client/Requests/DaemonFSInfoRequest.cpp
+++ b/src/Client/Requests/DaemonFSInfoRequest.cpp
@@ -24,7 +24,7 @@ namespace Client {
namespace Requests {
void DaemonFSInfoRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("DaemonFSInfo");
packet.set("daemon", daemon);
diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp
index 6de92cb..8986c7e 100644
--- a/src/Client/Requests/DaemonStatusRequest.cpp
+++ b/src/Client/Requests/DaemonStatusRequest.cpp
@@ -24,7 +24,7 @@ namespace Client {
namespace Requests {
void DaemonStatusRequest::sendRequest() {
- Common::XmlPacket packet;
+ Common::XmlData packet;
packet.setType("GetDaemonStatus");
packet.set("daemon", daemon);
diff --git a/src/Client/SystemCommands.cpp b/src/Client/SystemCommands.cpp
index f1bcbbd..ff14cc5 100644
--- a/src/Client/SystemCommands.cpp
+++ b/src/Client/SystemCommands.cpp
@@ -35,15 +35,15 @@
namespace Mad {
namespace Client {
-void SystemCommands::printFSInfo(boost::shared_ptr<const Common::XmlPacket> &packet) {
+void SystemCommands::printFSInfo(boost::shared_ptr<const Common::XmlData> &packet) {
const std::string units[] = {
"kB", "MB", "GB", "TB", ""
};
- const Common::XmlPacket::List *list = packet->getList("filesystems");
+ const Common::XmlData::List *list = packet->getList("filesystems");
if(list) {
- for(Common::XmlPacket::List::const_iterator fs = list->begin(); fs != list->end(); ++fs) {
+ for(Common::XmlData::List::const_iterator fs = list->begin(); fs != list->end(); ++fs) {
unsigned usedUnit = 0, totalUnit = 0;
float used = fs->get<float>("usedSize");
@@ -86,7 +86,7 @@ void SystemCommands::printFSInfo(boost::shared_ptr<const Common::XmlPacket> &pac
std::printf("\n");
}
-void SystemCommands::printHostStatus(boost::shared_ptr<const Common::XmlPacket> &packet) {
+void SystemCommands::printHostStatus(boost::shared_ptr<const Common::XmlData> &packet) {
unsigned long uptime = packet->get<unsigned long>("uptime");
if(uptime) {
@@ -165,7 +165,7 @@ void SystemCommands::fsinfoCommand(CommandParser *commandParser, const std::vect
commandParser->application->getRequestManager()->sendRequest(commandParser->connection, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second) {
std::cerr << "An error occurred during your request: " << result.second.what() << "." << std::endl;
@@ -202,7 +202,7 @@ void SystemCommands::rebootCommand(CommandParser *commandParser, const std::vect
(*request)->wait();
for(std::vector<boost::shared_ptr<Requests::DaemonCommandRequest> >::iterator request = requests.begin(); request != requests.end(); ++request) {
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = (*request)->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = (*request)->getResult();
if(result.second)
std::cerr << "An error occurred during your request: " << result.second.what() << "." << std::endl;
@@ -231,7 +231,7 @@ void SystemCommands::shutdownCommand(CommandParser *commandParser, const std::ve
(*request)->wait();
for(std::vector<boost::shared_ptr<Requests::DaemonCommandRequest> >::iterator request = requests.begin(); request != requests.end(); ++request) {
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = (*request)->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = (*request)->getResult();
if(result.second)
std::cerr << "An error occurred during your request: " << result.second.what() << "." << std::endl;
@@ -254,7 +254,7 @@ void SystemCommands::statusCommand(CommandParser *commandParser, const std::vect
commandParser->application->getRequestManager()->sendRequest(commandParser->connection, request);
request->wait();
- std::pair<boost::shared_ptr<const Common::XmlPacket>, Core::Exception> result = request->getResult();
+ std::pair<boost::shared_ptr<const Common::XmlData>, Core::Exception> result = request->getResult();
if(!result.first || result.second) {
std::cerr << "An error occurred during your request: " << result.second.what() << "." << std::endl;
diff --git a/src/Client/SystemCommands.h b/src/Client/SystemCommands.h
index 74b1a62..ba8c361 100644
--- a/src/Client/SystemCommands.h
+++ b/src/Client/SystemCommands.h
@@ -22,7 +22,7 @@
#include "export.h"
-#include <Common/XmlPacket.h>
+#include <Common/XmlData.h>
#include <vector>
@@ -37,8 +37,8 @@ class MAD_CLIENT_EXPORT SystemCommands {
private:
SystemCommands();
- static void printFSInfo(boost::shared_ptr<const Common::XmlPacket> &packet);
- static void printHostStatus(boost::shared_ptr<const Common::XmlPacket> &packet);
+ static void printFSInfo(boost::shared_ptr<const Common::XmlData> &packet);
+ static void printHostStatus(boost::shared_ptr<const Common::XmlData> &packet);
public:
static void fsinfoCommand(CommandParser *commandParser, const std::vector<std::string> &args);