diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-04 00:24:42 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-04 00:24:42 +0200 |
commit | 1eb9f4df776adc5dc5cf74a587288199bbf8b703 (patch) | |
tree | 42c3950b6d69c65f859db0a4d290c5408597a7bd | |
parent | 197582bcf7458cafb571fde7d37ef4415d0d8f4a (diff) | |
download | mad-1eb9f4df776adc5dc5cf74a587288199bbf8b703.tar mad-1eb9f4df776adc5dc5cf74a587288199bbf8b703.zip |
Renamed: XmlPacket -> XmlData
50 files changed, 256 insertions, 256 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); diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp index 00bd378..1b528ab 100644 --- a/src/Common/Backends/NetworkUserBackend.cpp +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -29,7 +29,7 @@ namespace Backends { const std::string NetworkUserBackend::name("NetworkUserBackend"); void NetworkUserBackend::SimpleUserRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(type); if(!timestamp.is_not_a_date_time()) @@ -39,7 +39,7 @@ void NetworkUserBackend::SimpleUserRequest::sendRequest() { } void NetworkUserBackend::IdUserRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(type); packet.set(idType, id); @@ -50,7 +50,7 @@ void NetworkUserBackend::IdUserRequest::sendRequest() { } void NetworkUserBackend::NameUserRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(type); packet.set("name", name); @@ -61,7 +61,7 @@ void NetworkUserBackend::NameUserRequest::sendRequest() { } void NetworkUserBackend::UserAddRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(check ? "CheckUserInfo" : "AddUser"); packet.set("uid", userInfo.getUid()); @@ -73,7 +73,7 @@ void NetworkUserBackend::UserAddRequest::sendRequest() { } void NetworkUserBackend::UserUpdateRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType("UpdateUser"); packet.set("origUid", uid); @@ -86,7 +86,7 @@ void NetworkUserBackend::UserUpdateRequest::sendRequest() { } void NetworkUserBackend::GroupAddRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(check ? "CheckGroupInfo" : "AddGroup"); packet.set("gid", groupInfo.getGid()); @@ -96,7 +96,7 @@ void NetworkUserBackend::GroupAddRequest::sendRequest() { } void NetworkUserBackend::GroupUpdateRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType("UpdateGroup"); packet.set("origGid", gid); @@ -107,7 +107,7 @@ void NetworkUserBackend::GroupUpdateRequest::sendRequest() { } void NetworkUserBackend::UserGroupRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(type); packet.set("uid", uid); packet.set("gid", gid); @@ -116,7 +116,7 @@ void NetworkUserBackend::UserGroupRequest::sendRequest() { } void NetworkUserBackend::PasswordRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType("SetPassword"); packet.set("uid", uid); packet.set("password", password); @@ -132,7 +132,7 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend:: request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -143,11 +143,11 @@ boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend:: catch(...) {} } - const XmlPacket::List *users = result.first->getList("users"); + const XmlData::List *users = result.first->getList("users"); if(users) { boost::shared_ptr<std::map<unsigned long, UserInfo> > userList(new std::map<unsigned long, UserInfo>); - for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) { + for(XmlData::List::const_iterator user = users->begin(); user != users->end(); ++user) { UserInfo userInfo(user->get<unsigned long>("uid"), user->get<const std::string&>("username")); userInfo.setGid(user->get<unsigned long>("gid")); userInfo.setFullName(user->get<const std::string&>("fullName")); @@ -168,7 +168,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -200,7 +200,7 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const st application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -232,7 +232,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -243,12 +243,12 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro catch(...) {} } - const XmlPacket::List *groups = result.first->getList("groups"); + const XmlData::List *groups = result.first->getList("groups"); if(groups) { boost::shared_ptr<std::set<unsigned long> > groupList(new std::set<unsigned long>); - for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group) + for(XmlData::List::const_iterator group = groups->begin(); group != groups->end(); ++group) groupList->insert(group->get<unsigned long>("gid")); return groupList; @@ -264,7 +264,7 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend: application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -275,11 +275,11 @@ boost::shared_ptr<const std::map<unsigned long, GroupInfo> > NetworkUserBackend: catch(...) {} } - const XmlPacket::List *groups = result.first->getList("groups"); + const XmlData::List *groups = result.first->getList("groups"); if(groups) { boost::shared_ptr<std::map<unsigned long, GroupInfo> > groupList(new std::map<unsigned long, GroupInfo>); - for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group) { + for(XmlData::List::const_iterator group = groups->begin(); group != groups->end(); ++group) { GroupInfo groupInfo(group->get<unsigned long>("gid"), group->get<const std::string&>("name")); groupList->insert(std::make_pair(groupInfo.getGid(), groupInfo)); } @@ -297,7 +297,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -323,7 +323,7 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -349,7 +349,7 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -360,11 +360,11 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs catch(...) {} } - const XmlPacket::List *users = result.first->getList("users"); + const XmlData::List *users = result.first->getList("users"); if(users) { boost::shared_ptr<std::set<unsigned long> > userList(new std::set<unsigned long>); - for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) { + for(XmlData::List::const_iterator user = users->begin(); user != users->end(); ++user) { userList->insert(user->get<unsigned long>("uid")); } @@ -381,7 +381,7 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; @@ -392,11 +392,11 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse catch(...) {} } - const XmlPacket::List *list = result.first->getList("userGroupList"); + const XmlData::List *list = result.first->getList("userGroupList"); if(list) { boost::shared_ptr<std::multimap<unsigned long, unsigned long> > ret(new std::multimap<unsigned long, unsigned long>); - for(XmlPacket::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) + for(XmlData::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) ret->insert(std::make_pair(entry->get<unsigned long>("uid"), entry->get<unsigned long>("gid"))); return ret; @@ -413,7 +413,7 @@ void NetworkUserBackend::checkUserInfo(const UserInfo &userInfo) throw(Core::Exc application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -425,7 +425,7 @@ void NetworkUserBackend::addUser(const UserInfo &userInfo) throw(Core::Exception application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -437,7 +437,7 @@ void NetworkUserBackend::updateUser(unsigned long uid, const Common::UserInfo &u application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -449,7 +449,7 @@ void NetworkUserBackend::deleteUser(unsigned long uid) throw(Core::Exception) { application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -462,7 +462,7 @@ void NetworkUserBackend::checkGroupInfo(const GroupInfo &groupInfo) throw(Core:: application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -474,7 +474,7 @@ void NetworkUserBackend::addGroup(const GroupInfo &groupInfo) throw(Core::Except application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -486,7 +486,7 @@ void NetworkUserBackend::updateGroup(unsigned long gid, const GroupInfo &groupIn application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -498,7 +498,7 @@ void NetworkUserBackend::deleteGroup(unsigned long gid) throw(Core::Exception) { application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -511,7 +511,7 @@ void NetworkUserBackend::addUserToGroup(unsigned long uid, unsigned long gid) th application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -523,7 +523,7 @@ void NetworkUserBackend::deleteUserFromGroup(unsigned long uid, unsigned long gi application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } @@ -536,7 +536,7 @@ void NetworkUserBackend::setPassword(unsigned long uid, const std::string &passw application->getRequestManager()->sendRequest(connection, request); request->wait(); - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> result = request->getResult(); if(!result.first || result.second) throw result.second; } diff --git a/src/Common/CMakeLists.txt b/src/Common/CMakeLists.txt index a92648b..493081d 100644 --- a/src/Common/CMakeLists.txt +++ b/src/Common/CMakeLists.txt @@ -42,6 +42,6 @@ mad_library(Common UserCache.cpp UserCache.h UserInfo.h UserManager.cpp UserManager.h - XmlPacket.cpp XmlPacket.h + XmlData.cpp XmlData.h ) target_link_libraries(Common Net Core modules ${LIBXML2_LIBRARIES} ${MHASH_LIBRARY} ${DL_LIBRARY}) diff --git a/src/Common/Connection.cpp b/src/Common/Connection.cpp index b2bb835..c8b2bb1 100644 --- a/src/Common/Connection.cpp +++ b/src/Common/Connection.cpp @@ -18,17 +18,17 @@ */ #include "Connection.h" -#include "XmlPacket.h" +#include "XmlData.h" namespace Mad { namespace Common { void Connection::receive(boost::shared_ptr<Net::Packet> packet) { - signalReceive.emit(boost::shared_ptr<XmlPacket>(new XmlPacket(*packet)), packet->getRequestId()); + signalReceive.emit(boost::shared_ptr<XmlData>(new XmlData(*packet)), packet->getRequestId()); } -bool Connection::sendPacket(const XmlPacket &packet, boost::uint16_t requestId) { - return send(packet.encode(requestId)); +bool Connection::sendPacket(const XmlData &packet, boost::uint16_t requestId) { + return send(packet.toPacket(requestId)); } } diff --git a/src/Common/Connection.h b/src/Common/Connection.h index 2a04de0..b19e0b9 100644 --- a/src/Common/Connection.h +++ b/src/Common/Connection.h @@ -35,11 +35,11 @@ class Packet; namespace Common { -class XmlPacket; +class XmlData; class MAD_COMMON_EXPORT Connection : private boost::noncopyable { private: - Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, boost::uint16_t> signalReceive; + Core::Signals::Signal2<boost::shared_ptr<const XmlData>, boost::uint16_t> signalReceive; protected: Connection(Core::Application *application) : signalReceive(application) {} @@ -51,9 +51,9 @@ class MAD_COMMON_EXPORT Connection : private boost::noncopyable { public: virtual ~Connection() {} - bool sendPacket(const XmlPacket &packet, boost::uint16_t requestId); + bool sendPacket(const XmlData &packet, boost::uint16_t requestId); - Core::Signals::Connection connectSignalReceive(const Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, boost::uint16_t>::slot_type &slot) { + Core::Signals::Connection connectSignalReceive(const Core::Signals::Signal2<boost::shared_ptr<const XmlData>, boost::uint16_t>::slot_type &slot) { return signalReceive.connect(slot); } void disconnectSignalReceive(const Core::Signals::Connection &con) { diff --git a/src/Common/Request.cpp b/src/Common/Request.cpp index 9325d46..0edfcfd 100644 --- a/src/Common/Request.cpp +++ b/src/Common/Request.cpp @@ -22,7 +22,7 @@ namespace Mad { namespace Common { -void Request::handlePacket(boost::shared_ptr<const XmlPacket> packet) { +void Request::handlePacket(boost::shared_ptr<const 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"))); diff --git a/src/Common/Request.h b/src/Common/Request.h index 268a196..d46e1b7 100644 --- a/src/Common/Request.h +++ b/src/Common/Request.h @@ -43,15 +43,15 @@ class MAD_COMMON_EXPORT Request : public RequestHandler { boost::condition_variable finishCond; bool isFinished; - boost::shared_ptr<const XmlPacket> packet; + boost::shared_ptr<const XmlData> packet; Core::Exception exception; - Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, Core::Exception> finished; + Core::Signals::Signal2<boost::shared_ptr<const XmlData>, Core::Exception> finished; protected: Request(Application *application) : RequestHandler(application), isFinished(false), finished(application) {} - void signalFinished(boost::shared_ptr<const XmlPacket> pkt, Core::Exception exp) { + void signalFinished(boost::shared_ptr<const XmlData> pkt, Core::Exception exp) { { boost::lock_guard<boost::mutex> lock(mutex); @@ -66,23 +66,23 @@ class MAD_COMMON_EXPORT Request : public RequestHandler { RequestHandler::signalFinished(); } - void signalFinished(boost::shared_ptr<const XmlPacket> packet) { + void signalFinished(boost::shared_ptr<const XmlData> packet) { signalFinished(packet, Core::Exception()); } void signalFinished(Core::Exception exp) { - signalFinished(boost::shared_ptr<const XmlPacket>(), exp); + signalFinished(boost::shared_ptr<const XmlData>(), exp); } void signalFinished() { - signalFinished(boost::shared_ptr<const XmlPacket>(), Core::Exception()); + signalFinished(boost::shared_ptr<const XmlData>(), Core::Exception()); } virtual void sendRequest() = 0; - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const XmlData> packet); public: - Core::Signals::Connection connectSignalFinished(const Core::Signals::Signal2<boost::shared_ptr<const XmlPacket>, Core::Exception>::slot_type &slot) { + Core::Signals::Connection connectSignalFinished(const Core::Signals::Signal2<boost::shared_ptr<const XmlData>, Core::Exception>::slot_type &slot) { return finished.connect(slot); } void disconnectSignalFinished(const Core::Signals::Connection &con) { @@ -96,11 +96,11 @@ class MAD_COMMON_EXPORT Request : public RequestHandler { finishCond.wait(lock); } - std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> getResult() { + std::pair<boost::shared_ptr<const XmlData>, Core::Exception> getResult() { boost::lock_guard<boost::mutex> lock(mutex); if(!isFinished) - return std::make_pair(boost::shared_ptr<const XmlPacket>(), Core::Exception(Core::Exception::NOT_FINISHED)); + return std::make_pair(boost::shared_ptr<const XmlData>(), Core::Exception(Core::Exception::NOT_FINISHED)); else return std::make_pair(packet, exception); } diff --git a/src/Common/RequestHandler.cpp b/src/Common/RequestHandler.cpp index 3469448..50c8f11 100644 --- a/src/Common/RequestHandler.cpp +++ b/src/Common/RequestHandler.cpp @@ -29,7 +29,7 @@ Connection* RequestHandler::getConnection() const { return getRequestManager()->requestMap.getRequestInfo(this).first; } -void RequestHandler::sendPacket(const XmlPacket &packet) { +void RequestHandler::sendPacket(const XmlData &packet) { std::pair<Connection*, boost::uint16_t> requestInfo = getRequestManager()->requestMap.getRequestInfo(this); if(!requestInfo.first) diff --git a/src/Common/RequestHandler.h b/src/Common/RequestHandler.h index 6d15c09..6fcbd3a 100644 --- a/src/Common/RequestHandler.h +++ b/src/Common/RequestHandler.h @@ -24,7 +24,7 @@ #include "Application.h" #include "Connection.h" -#include "XmlPacket.h" +#include "XmlData.h" #include <Core/Signals.h> @@ -55,9 +55,9 @@ class MAD_COMMON_EXPORT RequestHandler : private boost::noncopyable { Connection* getConnection() const; - void sendPacket(const XmlPacket &packet); + void sendPacket(const XmlData &packet); - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet) = 0; + virtual void handlePacket(boost::shared_ptr<const XmlData> packet) = 0; public: virtual ~RequestHandler() {} diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp index d6b3449..90c976c 100644 --- a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp +++ b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp @@ -24,11 +24,11 @@ namespace Mad { namespace Common { namespace RequestHandlers { -void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) { +void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) { if(packet->getType() != "Disconnect") { getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet."); - XmlPacket ret; + XmlData ret; ret.setType("Error"); ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET); @@ -38,7 +38,7 @@ void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> p return; } - XmlPacket ret; + XmlData ret; ret.setType("OK"); sendPacket(ret); diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.h b/src/Common/RequestHandlers/DisconnectRequestHandler.h index f4bc827..f3a1fce 100644 --- a/src/Common/RequestHandlers/DisconnectRequestHandler.h +++ b/src/Common/RequestHandlers/DisconnectRequestHandler.h @@ -30,7 +30,7 @@ namespace RequestHandlers { class MAD_COMMON_EXPORT DisconnectRequestHandler : public RequestHandler { protected: - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const XmlData> packet); public: DisconnectRequestHandler(Application *application) : RequestHandler(application) {} diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp index a416af4..af4bf50 100644 --- a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp +++ b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp @@ -24,7 +24,7 @@ namespace Mad { namespace Common { namespace RequestHandlers { -void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret) { +void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret) { if(!getConnection()->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -32,10 +32,10 @@ void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack getApplication()->getSystemManager()->getFSInfo(&fsInfo); ret->setType("OK"); - XmlPacket::List *list = ret->createList("filesystems"); + XmlData::List *list = ret->createList("filesystems"); for(std::vector<SystemManager::FSInfo>::const_iterator fs = fsInfo.begin(); fs != fsInfo.end(); ++fs) { - XmlPacket::List::iterator entry = list->addEntry(); + XmlData::List::iterator entry = list->addEntry(); entry->set("name", fs->fsName); entry->set("mountedOn", fs->mountedOn); diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.h b/src/Common/RequestHandlers/FSInfoRequestHandler.h index 17c1d8e..745eaae 100644 --- a/src/Common/RequestHandlers/FSInfoRequestHandler.h +++ b/src/Common/RequestHandlers/FSInfoRequestHandler.h @@ -30,7 +30,7 @@ namespace RequestHandlers { class MAD_COMMON_EXPORT FSInfoRequestHandler : public 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: FSInfoRequestHandler(Application *application) : SimpleRequestHandler(application, "FSInfo", boost::bind(&FSInfoRequestHandler::handleRequest, this, _1, _2)) {} diff --git a/src/Common/RequestHandlers/SimpleRequestHandler.cpp b/src/Common/RequestHandlers/SimpleRequestHandler.cpp index 33dfd5a..86edca6 100644 --- a/src/Common/RequestHandlers/SimpleRequestHandler.cpp +++ b/src/Common/RequestHandlers/SimpleRequestHandler.cpp @@ -25,11 +25,11 @@ namespace Mad { namespace Common { namespace RequestHandlers { -void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) { +void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) { if(packet->getType() != type) { getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet."); - XmlPacket ret; + XmlData ret; ret.setType("Error"); ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET); @@ -39,7 +39,7 @@ void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packe return; } - XmlPacket ret; + XmlData ret; try { handler(packet, &ret); diff --git a/src/Common/RequestHandlers/SimpleRequestHandler.h b/src/Common/RequestHandlers/SimpleRequestHandler.h index 3cf0f52..85cbd4c 100644 --- a/src/Common/RequestHandlers/SimpleRequestHandler.h +++ b/src/Common/RequestHandlers/SimpleRequestHandler.h @@ -31,12 +31,12 @@ namespace RequestHandlers { class MAD_COMMON_EXPORT SimpleRequestHandler : public RequestHandler { private: std::string type; - boost::function2<void, boost::shared_ptr<const XmlPacket>, XmlPacket*> handler; + boost::function2<void, boost::shared_ptr<const XmlData>, XmlData*> handler; protected: - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const XmlData> packet); - SimpleRequestHandler(Application *application, const std::string &type0, const boost::function2<void, boost::shared_ptr<const XmlPacket>, XmlPacket*> &handler0) + SimpleRequestHandler(Application *application, const std::string &type0, const boost::function2<void, boost::shared_ptr<const XmlData>, XmlData*> &handler0) : RequestHandler(application), type(type0), handler(handler0) {} }; diff --git a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp index 4d6a0e4..a7debc3 100644 --- a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp +++ b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp @@ -26,11 +26,11 @@ namespace Mad { namespace Common { namespace RequestHandlers { -void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packet) { +void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ptr<const XmlData> packet) { if(packet->getType() != type) { getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet."); - XmlPacket ret; + XmlData ret; ret.setType("Error"); ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET); @@ -40,7 +40,7 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ return; } - XmlPacket ret; + XmlData ret; try { handler(packet, &ret, getConnection()); @@ -58,7 +58,7 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_ } boost::shared_ptr<RequestHandler> SimpleRequestHandlerGroup::createRequestHandler(Application *application, const std::string &type) { - std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> >::iterator handler = handlers.find(type); + std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> >::iterator handler = handlers.find(type); if(handler == handlers.end()) return boost::shared_ptr<RequestHandler>(); diff --git a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h index 0a702f8..2022705 100644 --- a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h +++ b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.h @@ -33,21 +33,21 @@ class MAD_COMMON_EXPORT SimpleRequestHandlerGroup : public RequestHandlerGroup { class MAD_COMMON_EXPORT GroupRequestHandler : public RequestHandler { private: std::string type; - boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> handler; + boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> handler; protected: - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const XmlData> packet); public: - GroupRequestHandler(Application *application, const std::string &type0, const boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> &handler0) + GroupRequestHandler(Application *application, const std::string &type0, const boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> &handler0) : RequestHandler(application), type(type0), handler(handler0) {} }; std::set<std::string> types; - std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> > handlers; + std::map<std::string, boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> > handlers; protected: - void registerHandler(const std::string &type, const boost::function3<void, boost::shared_ptr<const XmlPacket>, XmlPacket*, Connection*> &handler) { + void registerHandler(const std::string &type, const boost::function3<void, boost::shared_ptr<const XmlData>, XmlData*, Connection*> &handler) { types.insert(type); handlers.insert(std::make_pair(type, handler)); } diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp index e5d87da..20b49e0 100644 --- a/src/Common/RequestHandlers/StatusRequestHandler.cpp +++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp @@ -24,7 +24,7 @@ namespace Mad { namespace Common { namespace RequestHandlers { -void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret) { +void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret) { if(!getConnection()->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); diff --git a/src/Common/RequestHandlers/StatusRequestHandler.h b/src/Common/RequestHandlers/StatusRequestHandler.h index 4e79da8..e5301fa 100644 --- a/src/Common/RequestHandlers/StatusRequestHandler.h +++ b/src/Common/RequestHandlers/StatusRequestHandler.h @@ -30,7 +30,7 @@ namespace RequestHandlers { class MAD_COMMON_EXPORT StatusRequestHandler : public 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: StatusRequestHandler(Application *application) : SimpleRequestHandler(application, "GetStatus", boost::bind(&StatusRequestHandler::handleRequest, this, _1, _2)) {} diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 82ecd00..12134e0 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -86,7 +86,7 @@ std::pair<Connection*, boost::uint16_t> RequestManager::RequestMap::getRequestIn } -void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<const XmlPacket> packet, boost::uint16_t requestId) { +void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<const XmlData> packet, boost::uint16_t requestId) { boost::upgrade_lock<boost::shared_mutex> lock(mutex); boost::shared_ptr<RequestHandler> request = requestMap.findRequest(connection, requestId); @@ -126,7 +126,7 @@ void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr<co lock.unlock(); - XmlPacket ret; + XmlData ret; ret.setType("Error"); ret.set("ErrorCode", Core::Exception::NOT_IMPLEMENTED); diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index 3b16ec6..4704a0f 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -102,7 +102,7 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable { return lastRequestId+=2; } - void receiveHandler(Connection *connection, boost::shared_ptr<const XmlPacket> packet, boost::uint16_t requestId); + void receiveHandler(Connection *connection, boost::shared_ptr<const XmlData> packet, boost::uint16_t requestId); void handleRequestFinished(Connection *con, boost::uint16_t requestId) { boost::lock_guard<boost::shared_mutex> lock(mutex); diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp index 523ef2a..c2b7b71 100644 --- a/src/Common/Requests/DisconnectRequest.cpp +++ b/src/Common/Requests/DisconnectRequest.cpp @@ -24,13 +24,13 @@ namespace Common { namespace Requests { void DisconnectRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType("Disconnect"); sendPacket(packet); } -void DisconnectRequest::handlePacket(boost::shared_ptr<const XmlPacket> packet) { +void DisconnectRequest::handlePacket(boost::shared_ptr<const 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"))); diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h index a92c7e7..a905a56 100644 --- a/src/Common/Requests/DisconnectRequest.h +++ b/src/Common/Requests/DisconnectRequest.h @@ -31,7 +31,7 @@ namespace Requests { class MAD_COMMON_EXPORT DisconnectRequest : public Request { protected: virtual void sendRequest(); - virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const XmlData> packet); public: DisconnectRequest(Application *application) : Request(application) {} diff --git a/src/Common/Requests/IdentifyRequest.cpp b/src/Common/Requests/IdentifyRequest.cpp index fc31c3f..98868ef 100644 --- a/src/Common/Requests/IdentifyRequest.cpp +++ b/src/Common/Requests/IdentifyRequest.cpp @@ -24,7 +24,7 @@ namespace Common { namespace Requests { void IdentifyRequest::sendRequest() { - Common::XmlPacket packet; + Common::XmlData packet; packet.setType("Identify"); if(!hostname.empty()) diff --git a/src/Common/Requests/SimpleRequest.cpp b/src/Common/Requests/SimpleRequest.cpp index a16e1d4..452b6da 100644 --- a/src/Common/Requests/SimpleRequest.cpp +++ b/src/Common/Requests/SimpleRequest.cpp @@ -24,7 +24,7 @@ namespace Common { namespace Requests { void SimpleRequest::sendRequest() { - XmlPacket packet; + XmlData packet; packet.setType(type); sendPacket(packet); diff --git a/src/Common/XmlPacket.cpp b/src/Common/XmlData.cpp index ff8ca6a..d3c948b 100644 --- a/src/Common/XmlPacket.cpp +++ b/src/Common/XmlData.cpp @@ -1,5 +1,5 @@ /* - * XmlProcessor.cpp + * XmlData.cpp * * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de> * @@ -17,7 +17,7 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "XmlPacket.h" +#include "XmlData.h" #include "Base64Encoder.h" #include <cstdlib> #include <cstring> @@ -27,7 +27,7 @@ namespace Mad { namespace Common { -void XmlPacket::Element::updateStr() { +void XmlData::Element::updateStr() { std::string typeStr; if(type == NONE) { @@ -86,7 +86,7 @@ void XmlPacket::Element::updateStr() { xmlSetProp(elementNode, (xmlChar*)"type", (xmlChar*)typeStr.c_str()); } -XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) { +XmlData::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) { if(!node) return; @@ -168,7 +168,7 @@ XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) { updateStr(); } -XmlPacket::Entry::Entry(xmlNodePtr node) : entryNode(node) { +XmlData::Entry::Entry(xmlNodePtr node) : entryNode(node) { if(!node) return; @@ -190,7 +190,7 @@ XmlPacket::Entry::Entry(xmlNodePtr node) : entryNode(node) { template <> -std::string XmlPacket::Entry::get<std::string>(const std::string &name) const { +std::string XmlData::Entry::get<std::string>(const std::string &name) const { Element *element = getElement(name); if(!element) return std::string(); @@ -199,7 +199,7 @@ std::string XmlPacket::Entry::get<std::string>(const std::string &name) const { } template <> -const std::string& XmlPacket::Entry::get<const std::string&>(const std::string &name) const { +const std::string& XmlData::Entry::get<const std::string&>(const std::string &name) const { static std::string empty; Element *element = getElement(name); @@ -210,7 +210,7 @@ const std::string& XmlPacket::Entry::get<const std::string&>(const std::string & } template <> -std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(const std::string &name) const { +std::vector<boost::uint8_t> XmlData::Entry::get<std::vector<unsigned char> >(const std::string &name) const { Element *element = getElement(name); if(!element) return std::vector<boost::uint8_t>(); @@ -224,7 +224,7 @@ std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(c } template <> -const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const { +const std::vector<boost::uint8_t>& XmlData::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const { static std::vector<boost::uint8_t> empty; Element *element = getElement(name); @@ -239,7 +239,7 @@ const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsig } } -XmlPacket::List::List(xmlNodePtr node) : elementNode(node) { +XmlData::List::List(xmlNodePtr node) : elementNode(node) { for(xmlNodePtr entry = node->children; entry != 0; entry = entry->next) { if(entry->type != XML_ELEMENT_NODE || xmlStrcmp(entry->name, (xmlChar*)"entry")) continue; @@ -248,40 +248,40 @@ XmlPacket::List::List(xmlNodePtr node) : elementNode(node) { } } -XmlPacket::XmlPacket() { +XmlData::XmlData() { doc = xmlNewDoc((xmlChar*)"1.0"); - packetNode = xmlNewNode(0, (xmlChar*)"packet"); - xmlDocSetRootElement(doc, packetNode); + rootNode = xmlNewNode(0, (xmlChar*)"mad"); + xmlDocSetRootElement(doc, rootNode); - entry = new Entry(packetNode); + entry = new Entry(rootNode); } -XmlPacket::XmlPacket(const XmlPacket &o) { +XmlData::XmlData(const XmlData &o) { doc = xmlCopyDoc(o.doc, 1); - packetNode = xmlDocGetRootElement(doc); - entry = new Entry(packetNode); + rootNode = xmlDocGetRootElement(doc); + entry = new Entry(rootNode); } -XmlPacket::XmlPacket(const Net::Packet &packet) { +XmlData::XmlData(const Net::Packet &packet) { doc = xmlParseMemory((const char*)packet.getData(), packet.getLength()); - packetNode = xmlDocGetRootElement(doc); - entry = new Entry(packetNode); + rootNode = xmlDocGetRootElement(doc); + entry = new Entry(rootNode); } -XmlPacket& XmlPacket::operator=(const XmlPacket &o) { +XmlData& XmlData::operator=(const XmlData &o) { delete entry; xmlFreeDoc(doc); doc = xmlCopyDoc(o.doc, 1); - packetNode = xmlDocGetRootElement(doc); - entry = new Entry(packetNode); + rootNode = xmlDocGetRootElement(doc); + entry = new Entry(rootNode); return *this; } -std::string XmlPacket::getType() const { - xmlChar *type = xmlGetProp(packetNode, (xmlChar*)"type"); +std::string XmlData::getType() const { + xmlChar *type = xmlGetProp(rootNode, (xmlChar*)"type"); std::string ret(type ? (char*)type : ""); @@ -290,11 +290,11 @@ std::string XmlPacket::getType() const { return ret; } -void XmlPacket::setType(const std::string &type) { - xmlSetProp(packetNode, (xmlChar*)"type", (xmlChar*)type.c_str()); +void XmlData::setType(const std::string &type) { + xmlSetProp(rootNode, (xmlChar*)"type", (xmlChar*)type.c_str()); } -Net::Packet XmlPacket::encode(boost::uint16_t requestId) const { +Net::Packet XmlData::toPacket(boost::uint16_t requestId) const { xmlChar *buf; int length; diff --git a/src/Common/XmlPacket.h b/src/Common/XmlData.h index 1902f82..216b0f1 100644 --- a/src/Common/XmlPacket.h +++ b/src/Common/XmlData.h @@ -1,5 +1,5 @@ /* - * XmlProcessor.h + * XmlData.h * * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de> * @@ -17,8 +17,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MAD_COMMON_XMLPACKET_H_ -#define MAD_COMMON_XMLPACKET_H_ +#ifndef MAD_COMMON_XMLDATA_H_ +#define MAD_COMMON_XMLDATA_H_ #include "export.h" @@ -42,14 +42,14 @@ namespace Mad { namespace Common { -class MAD_COMMON_EXPORT XmlPacket { +class MAD_COMMON_EXPORT XmlData { public: class Entry; class List; private: xmlDocPtr doc; - xmlNodePtr packetNode; + xmlNodePtr rootNode; Entry *entry; class MAD_COMMON_EXPORT Element : private boost::noncopyable { @@ -135,7 +135,7 @@ class MAD_COMMON_EXPORT XmlPacket { class MAD_COMMON_EXPORT Entry : private boost::noncopyable { private: friend class List; - friend class XmlPacket; + friend class XmlData; xmlNodePtr entryNode; @@ -437,13 +437,13 @@ class MAD_COMMON_EXPORT XmlPacket { } }; - XmlPacket(); - XmlPacket(const XmlPacket &o); - XmlPacket(const Net::Packet &packet); + XmlData(); + XmlData(const XmlData &o); + XmlData(const Net::Packet &packet); - XmlPacket& operator=(const XmlPacket &o); + XmlData& operator=(const XmlData &o); - virtual ~XmlPacket() { + virtual ~XmlData() { delete entry; xmlFreeDoc(doc); @@ -478,16 +478,16 @@ class MAD_COMMON_EXPORT XmlPacket { entry->unset(name); } - Net::Packet encode(boost::uint16_t requestId) const; + Net::Packet toPacket(boost::uint16_t requestId) const; }; -template <> MAD_COMMON_EXPORT std::string XmlPacket::Entry::get<std::string>(const std::string &name) const; -template <> MAD_COMMON_EXPORT const std::string& XmlPacket::Entry::get<const std::string&>(const std::string &name) const; +template <> MAD_COMMON_EXPORT std::string XmlData::Entry::get<std::string>(const std::string &name) const; +template <> MAD_COMMON_EXPORT const std::string& XmlData::Entry::get<const std::string&>(const std::string &name) const; -template <> MAD_COMMON_EXPORT std::vector<boost::uint8_t> XmlPacket::Entry::get<std::vector<unsigned char> >(const std::string &name) const; -template <> MAD_COMMON_EXPORT const std::vector<boost::uint8_t>& XmlPacket::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const; +template <> MAD_COMMON_EXPORT std::vector<boost::uint8_t> XmlData::Entry::get<std::vector<unsigned char> >(const std::string &name) const; +template <> MAD_COMMON_EXPORT const std::vector<boost::uint8_t>& XmlData::Entry::get<const std::vector<unsigned char>&>(const std::string &name) const; } } -#endif /* MAD_COMMON_XMLPACKET_H_ */ +#endif /* MAD_COMMON_XMLDATA_H_ */ diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp index 6c245f9..e3d34e5 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp @@ -24,7 +24,7 @@ namespace Mad { namespace Daemon { namespace RequestHandlers { -void CommandRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret) { +void CommandRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret) { if(!getConnection()->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.h b/src/Daemon/RequestHandlers/CommandRequestHandler.h index 188b3d4..2e6addd 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.h +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.h @@ -30,7 +30,7 @@ namespace RequestHandlers { class MAD_DAEMON_EXPORT CommandRequestHandler : 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: CommandRequestHandler(Common::Application *application) diff --git a/src/Daemon/Requests/LogRequest.cpp b/src/Daemon/Requests/LogRequest.cpp index 9266420..0282649 100644 --- a/src/Daemon/Requests/LogRequest.cpp +++ b/src/Daemon/Requests/LogRequest.cpp @@ -26,7 +26,7 @@ namespace Daemon { namespace Requests { void LogRequest::sendRequest() { - Common::XmlPacket packet; + Common::XmlData packet; packet.setType("Log"); diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp index af48d65..1348541 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp @@ -31,31 +31,31 @@ namespace Mad { namespace Server { namespace RequestHandlers { -void ConnectionRequestHandlerGroup::handleAuthMethodRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret, +void ConnectionRequestHandlerGroup::handleAuthMethodRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret, Common::Connection* /*connection*/) { ret->setType("OK"); - Common::XmlPacket::List *list = ret->createList("methods"); + Common::XmlData::List *list = ret->createList("methods"); std::set<std::string> methods = application->getAuthManager()->getMethods(); for(std::set<std::string>::iterator method = methods.begin(); method != methods.end(); ++method) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", *method); - Common::XmlPacket::List *subList = entry->createList("subMethods"); + Common::XmlData::List *subList = entry->createList("subMethods"); std::vector<std::string> subMethods = application->getAuthManager()->getSubMethods(*method); for(std::vector<std::string>::iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) { - Common::XmlPacket::List::iterator subEntry = subList->addEntry(); + Common::XmlData::List::iterator subEntry = subList->addEntry(); subEntry->set("name", *subMethod); } } } -void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection) { +void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { std::vector<boost::uint8_t> response; boost::shared_ptr<const Common::AuthContext> authContext = application->getConnectionManager()->authenticateConnection(connection, @@ -72,18 +72,18 @@ void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr<const Co ret->setType("Continue"); } -void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<const Common::XmlPacket> /*packet*/, Common::XmlPacket *ret, +void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); ret->setType("OK"); - Common::XmlPacket::List *list = ret->createList("hosts"); + Common::XmlData::List *list = ret->createList("hosts"); std::vector<Common::HostInfo> daemons = application->getConnectionManager()->getDaemonList(); for(std::vector<Common::HostInfo>::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", daemon->getName()); entry->set("address", daemon->getIP()); @@ -91,13 +91,13 @@ void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<co } } -void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection) { +void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { application->getConnectionManager()->identifyDaemonConnection(connection, packet->get<const std::string&>("hostname")); ret->setType("OK"); } -void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection) { +void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { // TODO Require authentication boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h index f3d2138..7b46f22 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h @@ -35,11 +35,11 @@ class MAD_SERVER_EXPORT ConnectionRequestHandlerGroup : public Common::RequestHa private: Application *application; - void handleAuthMethodRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleAuthRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleDaemonListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleIdentifyRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleLogRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleAuthMethodRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleAuthRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleDaemonListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleIdentifyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleLogRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); public: ConnectionRequestHandlerGroup(Application *application0); diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp index 499e7b6..e258b89 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp @@ -30,11 +30,11 @@ namespace Mad { namespace Server { namespace RequestHandlers { -void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) { +void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlData> packet) { if(packet->getType() != type) { getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet."); - Common::XmlPacket ret; + Common::XmlData ret; ret.setType("Error"); ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET); @@ -64,7 +64,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared getRequestManager()->sendRequest(daemonCon.get(), request); } catch(Core::Exception &e) { - Common::XmlPacket ret; + Common::XmlData ret; ret.setType("Error"); ret.set("ErrorCode", e.getErrorCode()); ret.set("SubCode", e.getSubCode()); @@ -76,9 +76,9 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared } } -void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error) { +void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error) { if(error) { - Common::XmlPacket ret; + Common::XmlData ret; ret.setType("Error"); ret.set("ErrorCode", error.getErrorCode()); ret.set("SubCode", error.getSubCode()); diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h index 8312709..48d8e2c 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h @@ -37,10 +37,10 @@ class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandle private: std::string type; - void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error); + void requestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error); protected: - virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet); + virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet); public: DaemonRequestHandler(Common::Application *application, const std::string &type0) diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index d5f97a9..1d99c2e 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -29,7 +29,7 @@ namespace Mad { namespace Server { namespace RequestHandlers { -void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -52,10 +52,10 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); if(users) { - Common::XmlPacket::List *list = ret->createList("users"); + Common::XmlData::List *list = ret->createList("users"); for(std::map<unsigned long, Common::UserInfo>::const_iterator user = users->begin(); user != users->end(); ++user) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("uid", user->second.getUid()); entry->set("gid", user->second.getGid()); @@ -65,7 +65,7 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm } } -void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -101,7 +101,7 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm } } -void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -124,17 +124,17 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); if(groups) { - Common::XmlPacket::List *list = ret->createList("groups"); + Common::XmlData::List *list = ret->createList("groups"); for(std::set<unsigned long>::const_iterator group = groups->begin(); group != groups->end(); ++group) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("gid", *group); } } } -void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -157,10 +157,10 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); if(groups) { - Common::XmlPacket::List *list = ret->createList("groups"); + Common::XmlData::List *list = ret->createList("groups"); for(std::map<unsigned long, Common::GroupInfo>::const_iterator group = groups->begin(); group != groups->end(); ++group) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("gid", group->second.getGid()); entry->set("name", group->second.getName()); @@ -168,7 +168,7 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com } } -void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -202,7 +202,7 @@ void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Com } } -void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -224,16 +224,16 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const if(!timestamp.is_not_a_date_time()) ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); - Common::XmlPacket::List *list = ret->createList("users"); + Common::XmlData::List *list = ret->createList("users"); for(std::set<unsigned long>::const_iterator user = users->begin(); user != users->end(); ++user) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("uid", *user); } } -void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -256,10 +256,10 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); if(userGroups) { - Common::XmlPacket::List *list = ret->createList("userGroupList"); + Common::XmlData::List *list = ret->createList("userGroupList"); for(std::multimap<unsigned long, unsigned long>::const_iterator userGroup = userGroups->begin(); userGroup != userGroups->end(); ++userGroup) { - Common::XmlPacket::List::iterator entry = list->addEntry(); + Common::XmlData::List::iterator entry = list->addEntry(); entry->set("uid", userGroup->first); entry->set("gid", userGroup->second); @@ -268,7 +268,7 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c } -void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -282,7 +282,7 @@ void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const ret->setType("OK"); } -void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -296,7 +296,7 @@ void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Commo ret->setType("OK"); } -void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -310,7 +310,7 @@ void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Co ret->setType("OK"); } -void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -321,7 +321,7 @@ void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptr<const Co } -void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -331,7 +331,7 @@ void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<cons ret->setType("OK"); } -void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -341,7 +341,7 @@ void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Comm ret->setType("OK"); } -void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -352,7 +352,7 @@ void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const C ret->setType("OK"); } -void UserRequestHandlerGroup::handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -363,7 +363,7 @@ void UserRequestHandlerGroup::handleGroupDeleteRequest(boost::shared_ptr<const C } -void UserRequestHandlerGroup::handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -373,7 +373,7 @@ void UserRequestHandlerGroup::handleAddUserToGroupRequest(boost::shared_ptr<cons ret->setType("OK"); } -void UserRequestHandlerGroup::handleDeleteUserFromGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handleDeleteUserFromGroupRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -383,7 +383,7 @@ void UserRequestHandlerGroup::handleDeleteUserFromGroupRequest(boost::shared_ptr ret->setType("OK"); } -void UserRequestHandlerGroup::handlePasswordSetRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, +void UserRequestHandlerGroup::handlePasswordSetRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.h b/src/Server/RequestHandlers/UserRequestHandlerGroup.h index aed585f..d4326e1 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.h @@ -35,30 +35,30 @@ class MAD_SERVER_EXPORT UserRequestHandlerGroup : public Common::RequestHandlers private: Application *application; - void handleUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleUserInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserInfoRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handleGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleGroupInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleGroupUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleGroupInfoRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleGroupUserListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handleFullUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleFullUserGroupListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handleUserInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleUserAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleUserUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleUserDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserInfoCheckRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserAddRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserUpdateRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserDeleteRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleGroupAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleGroupAddRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); - void handleDeleteUserFromGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleDeleteUserFromGroupRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); - void handlePasswordSetRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handlePasswordSetRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); public: UserRequestHandlerGroup(Application *application0); diff --git a/src/Server/Requests/CommandRequest.cpp b/src/Server/Requests/CommandRequest.cpp index 2a84840..51e7b1d 100644 --- a/src/Server/Requests/CommandRequest.cpp +++ b/src/Server/Requests/CommandRequest.cpp @@ -24,7 +24,7 @@ namespace Server { namespace Requests { void CommandRequest::sendRequest() { - Common::XmlPacket packet; + Common::XmlData packet; packet.setType("Command"); packet.set("command", reboot ? "reboot" : "shutdown"); diff --git a/src/Server/Requests/DaemonStateUpdateRequest.cpp b/src/Server/Requests/DaemonStateUpdateRequest.cpp index 730b490..8ed1eed 100644 --- a/src/Server/Requests/DaemonStateUpdateRequest.cpp +++ b/src/Server/Requests/DaemonStateUpdateRequest.cpp @@ -24,7 +24,7 @@ namespace Server { namespace Requests { void DaemonStateUpdateRequest::sendRequest() { - Common::XmlPacket packet; + Common::XmlData packet; packet.setType("UpdateHostState"); packet.set("name", name); |