From 454cfccd51e2b9ad453fe79df04360fcd6eeb742 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 6 Jun 2009 15:01:07 +0200 Subject: User-RequestHandler zur UserRequestHandlerGroup zusammengefasst --- src/Client/CMakeLists.txt | 5 +- src/Client/Requests/CMakeLists.txt | 5 +- src/Common/CMakeLists.txt | 27 +++- src/Common/RequestHandlerGroup.h | 46 ++++++ src/Common/RequestHandlers/CMakeLists.txt | 4 +- src/Common/RequestManager.cpp | 25 ++-- src/Common/RequestManager.h | 50 +++++-- src/Common/Requests/CMakeLists.txt | 11 +- src/Daemon/CMakeLists.txt | 6 +- src/Daemon/RequestHandlers/CMakeLists.txt | 2 +- src/Daemon/Requests/CMakeLists.txt | 2 +- src/Net/CMakeLists.txt | 16 ++- src/Server/CMakeLists.txt | 6 +- src/Server/ConnectionManager.cpp | 22 +-- src/Server/ConnectionManager.h | 2 + src/Server/RequestHandlers/CMakeLists.txt | 14 +- .../RequestHandlers/GroupListRequestHandler.cpp | 77 ---------- .../RequestHandlers/GroupListRequestHandler.h | 38 ----- .../GroupUserListRequestHandler.cpp | 74 ---------- .../RequestHandlers/GroupUserListRequestHandler.h | 38 ----- .../UserGroupListRequestHandler.cpp | 74 ---------- .../RequestHandlers/UserGroupListRequestHandler.h | 38 ----- .../RequestHandlers/UserInfoRequestHandler.cpp | 71 ---------- .../RequestHandlers/UserInfoRequestHandler.h | 38 ----- .../RequestHandlers/UserListRequestHandler.cpp | 77 ---------- .../RequestHandlers/UserListRequestHandler.h | 38 ----- .../RequestHandlers/UserRequestHandlerGroup.cpp | 156 +++++++++++++++++++++ .../RequestHandlers/UserRequestHandlerGroup.h | 69 +++++++++ src/Server/Requests/CMakeLists.txt | 5 +- src/modules/FileLogger/CMakeLists.txt | 2 +- src/modules/SystemBackendPosix/CMakeLists.txt | 2 +- src/modules/SystemBackendProc/CMakeLists.txt | 2 +- src/modules/UserBackendMysql/CMakeLists.txt | 2 +- 33 files changed, 416 insertions(+), 628 deletions(-) create mode 100644 src/Common/RequestHandlerGroup.h delete mode 100644 src/Server/RequestHandlers/GroupListRequestHandler.cpp delete mode 100644 src/Server/RequestHandlers/GroupListRequestHandler.h delete mode 100644 src/Server/RequestHandlers/GroupUserListRequestHandler.cpp delete mode 100644 src/Server/RequestHandlers/GroupUserListRequestHandler.h delete mode 100644 src/Server/RequestHandlers/UserGroupListRequestHandler.cpp delete mode 100644 src/Server/RequestHandlers/UserGroupListRequestHandler.h delete mode 100644 src/Server/RequestHandlers/UserInfoRequestHandler.cpp delete mode 100644 src/Server/RequestHandlers/UserInfoRequestHandler.h delete mode 100644 src/Server/RequestHandlers/UserListRequestHandler.cpp delete mode 100644 src/Server/RequestHandlers/UserListRequestHandler.h create mode 100644 src/Server/RequestHandlers/UserRequestHandlerGroup.cpp create mode 100644 src/Server/RequestHandlers/UserRequestHandlerGroup.h diff --git a/src/Client/CMakeLists.txt b/src/Client/CMakeLists.txt index 00b72c5..e86a839 100644 --- a/src/Client/CMakeLists.txt +++ b/src/Client/CMakeLists.txt @@ -2,5 +2,8 @@ add_subdirectory(Requests) include_directories(${INCLUDES}) -add_library(Client CommandParser.cpp InformationManager.cpp) +add_library(Client + CommandParser.cpp CommandParser.h + InformationManager.cpp InformationManager.h +) target_link_libraries(Client ClientRequests Common) diff --git a/src/Client/Requests/CMakeLists.txt b/src/Client/Requests/CMakeLists.txt index ef8b275..86acaf5 100644 --- a/src/Client/Requests/CMakeLists.txt +++ b/src/Client/Requests/CMakeLists.txt @@ -1,5 +1,8 @@ include_directories(${INCLUDES}) add_library(ClientRequests STATIC - DaemonCommandRequest.cpp DaemonFSInfoRequest.cpp DaemonStatusRequest.cpp + DaemonCommandRequest.cpp DaemonCommandRequest.h + DaemonFSInfoRequest.cpp DaemonFSInfoRequest.h + DaemonListRequest.h + DaemonStatusRequest.cpp DaemonStatusRequest.h ) diff --git a/src/Common/CMakeLists.txt b/src/Common/CMakeLists.txt index de6dfc7..25c3dee 100644 --- a/src/Common/CMakeLists.txt +++ b/src/Common/CMakeLists.txt @@ -6,9 +6,28 @@ include_directories(${INCLUDES}) link_directories(${LTDL_LIBRARY_DIR}) add_library(Common - Base64Encoder.cpp ClientConnection.cpp ConfigEntry.cpp - ConfigManager.cpp Connection.cpp Initializable.cpp Logger.cpp LogManager.cpp - ModuleManager.cpp Request.cpp RequestHandler.cpp RequestManager.cpp SystemManager.cpp - Tokenizer.cpp XmlPacket.cpp + Base64Encoder.cpp Base64Encoder.h + ClientConnection.cpp ClientConnection.h + ConfigEntry.cpp ConfigEntry.h + ConfigManager.cpp ConfigManager.h + Configurable.h + Connection.cpp Connection.h + Initializable.cpp Initializable.h + GroupInfo.h + HostInfo.h + Logger.cpp Logger.h + LoggerBase.h + LogManager.cpp LogManager.h + ModuleManager.cpp ModuleManager.h + RemoteLogger.h + Request.cpp Request.h + RequestHandler.cpp RequestHandler.h + RequestHandlerGroup.h + RequestManager.cpp RequestManager.h + SystemBackend.h + SystemManager.cpp SystemManager.h + Tokenizer.cpp Tokenizer.h + UserInfo.h + XmlPacket.cpp XmlPacket.h ) target_link_libraries(Common RequestHandlers Requests Net ${LIBXML2_LIBRARIES} ${LTDL_LIBRARIES}) diff --git a/src/Common/RequestHandlerGroup.h b/src/Common/RequestHandlerGroup.h new file mode 100644 index 0000000..c9f57eb --- /dev/null +++ b/src/Common/RequestHandlerGroup.h @@ -0,0 +1,46 @@ +/* + * RequestHandlerGroup.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_COMMON_REQUESTHANDLERGROUP_H_ +#define MAD_COMMON_REQUESTHANDLERGROUP_H_ + +#include "RequestHandler.h" + +#include +#include + +namespace Mad { +namespace Common { + +class RequestHandlerGroup { + protected: + RequestHandlerGroup() {} + + public: + virtual const std::set& getPacketTypes() = 0; + + virtual boost::shared_ptr createRequestHandler(const std::string &type) = 0; + virtual ~RequestHandlerGroup() {} +}; + +} + +} + +#endif /* MAD_COMMON_REQUESTHANDLERGROUP_H_ */ diff --git a/src/Common/RequestHandlers/CMakeLists.txt b/src/Common/RequestHandlers/CMakeLists.txt index f774e14..5788ada 100644 --- a/src/Common/RequestHandlers/CMakeLists.txt +++ b/src/Common/RequestHandlers/CMakeLists.txt @@ -1,6 +1,8 @@ include_directories(${INCLUDES}) add_library(RequestHandlers STATIC - DisconnectRequestHandler.cpp FSInfoRequestHandler.cpp StatusRequestHandler.cpp + DisconnectRequestHandler.cpp DisconnectRequestHandler.h + FSInfoRequestHandler.cpp FSInfoRequestHandler.h + StatusRequestHandler.cpp StatusRequestHandler.h ) target_link_libraries(RequestHandlers Common) diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 3785b3f..b443292 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -108,21 +108,24 @@ void RequestManager::receiveHandler(Connection *connection, boost::shared_ptr >::iterator factoryIt = requestHandlerFactories.find(packet->getType()); - if(factoryIt != requestHandlerFactories.end()) { - { - boost::upgrade_to_unique_lock upgradeLock(lock); + std::map >::iterator rgh = requestHandlerGroups.find(packet->getType()); + if(rgh != requestHandlerGroups.end()) { + request = rgh->second->createRequestHandler(packet->getType()); - request = factoryIt->second->createRequestHandler(); - requestMap.addRequest(connection, requestId, request); - request->connectSignalFinished(boost::bind(&RequestManager::handleRequestFinished, this, connection, requestId)); + if(request) { + { + boost::upgrade_to_unique_lock upgradeLock(lock); - } + requestMap.addRequest(connection, requestId, request); + request->connectSignalFinished(boost::bind(&RequestManager::handleRequestFinished, this, connection, requestId)); - lock.unlock(); - Net::ThreadManager::get()->pushWork(boost::bind(&RequestHandler::handlePacket, request, packet)); + } - return; + lock.unlock(); + Net::ThreadManager::get()->pushWork(boost::bind(&RequestHandler::handlePacket, request, packet)); + + return; + } } lock.unlock(); diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index 07a7c05..e66b0c1 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -21,6 +21,7 @@ #define MAD_COMMON_REQUESTMANAGER_H_ #include "Request.h" +#include "RequestHandlerGroup.h" #include #include @@ -69,18 +70,20 @@ class RequestManager : boost::noncopyable { - class RequestHandlerFactory { - protected: - RequestHandlerFactory() {} + template class RequestHandlerFactory : public RequestHandlerGroup { + private: + std::set types; public: - virtual boost::shared_ptr createRequestHandler() = 0; - virtual ~RequestHandlerFactory() {} - }; + RequestHandlerFactory(const std::string &type) { + types.insert(type); + } - template class SpecificRequestHandlerFactory : public RequestHandlerFactory { - public: - virtual boost::shared_ptr createRequestHandler() { + virtual const std::set& getPacketTypes() { + return types; + } + + virtual boost::shared_ptr createRequestHandler(const std::string &type _UNUSED_PARAMETER_) { return boost::shared_ptr(new T()); } }; @@ -94,7 +97,7 @@ class RequestManager : boost::noncopyable { bool server; boost::uint16_t lastRequestId; - std::map > requestHandlerFactories; + std::map > requestHandlerGroups; boost::uint16_t _getRequestId() { return lastRequestId+=2; @@ -141,14 +144,35 @@ class RequestManager : boost::noncopyable { requestMap.unregisterConnection(connection); } - template void registerPacketType(const std::string &type) { + void registerRequestHandlerGroup(boost::shared_ptr requestHandlerGroup) { boost::lock_guard lock(mutex); - requestHandlerFactories.insert(std::make_pair(type, boost::shared_ptr >(new SpecificRequestHandlerFactory()))); + + const std::set &types = requestHandlerGroup->getPacketTypes(); + for(std::set::const_iterator type = types.begin(); type != types.end(); ++type) + requestHandlerGroups.insert(std::make_pair(*type, requestHandlerGroup)); + } + + void unregisterRequestHandlerGroup(boost::shared_ptr requestHandlerGroup) { + boost::lock_guard lock(mutex); + + const std::set &types = requestHandlerGroup->getPacketTypes(); + for(std::set::const_iterator type = types.begin(); type != types.end(); ++type) { + std::map >::iterator it = requestHandlerGroups.find(*type); + + if(it == requestHandlerGroups.end() || it->second != requestHandlerGroup) + continue; + + requestHandlerGroups.erase(it); + } + } + + template void registerPacketType(const std::string &type) { + registerRequestHandlerGroup(boost::shared_ptr >(new RequestHandlerFactory(type))); } void unregisterPacketType(const std::string &type) { boost::lock_guard lock(mutex); - requestHandlerFactories.erase(type); + requestHandlerGroups.erase(type); } bool sendRequest(Connection *connection, boost::shared_ptr request); diff --git a/src/Common/Requests/CMakeLists.txt b/src/Common/Requests/CMakeLists.txt index ef1d4d9..b6ff90c 100644 --- a/src/Common/Requests/CMakeLists.txt +++ b/src/Common/Requests/CMakeLists.txt @@ -1,6 +1,15 @@ include_directories(${INCLUDES}) add_library(Requests STATIC - DisconnectRequest.cpp GroupUserListRequest.cpp IdentifyRequest.cpp SimpleRequest.cpp UserGroupListRequest.cpp UserInfoRequest.cpp + DisconnectRequest.cpp DisconnectRequest.h + FSInfoRequest.h + GroupListRequest.h + GroupUserListRequest.cpp GroupUserListRequest.h + IdentifyRequest.cpp IdentifyRequest.h + SimpleRequest.cpp SimpleRequest.h + StatusRequest.h + UserGroupListRequest.cpp UserGroupListRequest.h + UserInfoRequest.cpp UserInfoRequest.h + UserListRequest.h ) target_link_libraries(Requests ${KRB5_LIBRARIES}) diff --git a/src/Daemon/CMakeLists.txt b/src/Daemon/CMakeLists.txt index 4f49d48..68c5f5d 100644 --- a/src/Daemon/CMakeLists.txt +++ b/src/Daemon/CMakeLists.txt @@ -3,5 +3,9 @@ add_subdirectory(Requests) include_directories(${INCLUDES}) -add_library(Daemon Daemon.cpp) +add_library(Daemon + Backends/NetworkLogger.h + + Daemon.cpp +) target_link_libraries(Daemon DaemonRequestHandlers DaemonRequests Common) diff --git a/src/Daemon/RequestHandlers/CMakeLists.txt b/src/Daemon/RequestHandlers/CMakeLists.txt index 4794405..21a2fbb 100644 --- a/src/Daemon/RequestHandlers/CMakeLists.txt +++ b/src/Daemon/RequestHandlers/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${INCLUDES}) add_library(DaemonRequestHandlers STATIC - CommandRequestHandler.cpp + CommandRequestHandler.cpp CommandRequestHandler.h ) diff --git a/src/Daemon/Requests/CMakeLists.txt b/src/Daemon/Requests/CMakeLists.txt index 9bb941f..90eb542 100644 --- a/src/Daemon/Requests/CMakeLists.txt +++ b/src/Daemon/Requests/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${INCLUDES}) add_library(DaemonRequests STATIC - LogRequest.cpp + LogRequest.cpp LogRequest.h ) diff --git a/src/Net/CMakeLists.txt b/src/Net/CMakeLists.txt index fae358b..6bf700e 100644 --- a/src/Net/CMakeLists.txt +++ b/src/Net/CMakeLists.txt @@ -2,7 +2,19 @@ include_directories(${INCLUDES}) link_directories(${Boost_LIBRARY_DIRS}) add_library(Net - ClientConnection.cpp Connection.cpp Exception.cpp Listener.cpp - Packet.cpp ThreadManager.cpp + Signals/Connection.h + Signals/GenericSignal.h + Signals/Signal0.h + Signals/Signal1.h + Signals/Signal2.h + Signals/SignalBase.h + Signals/Signals.h + + ClientConnection.cpp ClientConnection.h + Connection.cpp Connection.h + Exception.cpp Exception.h + Listener.cpp Listener.h + Packet.cpp Packet.h + ThreadManager.cpp ThreadManager.h ) target_link_libraries(Net ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES}) diff --git a/src/Server/CMakeLists.txt b/src/Server/CMakeLists.txt index 1c5885f..e38d860 100644 --- a/src/Server/CMakeLists.txt +++ b/src/Server/CMakeLists.txt @@ -3,5 +3,9 @@ add_subdirectory(Requests) include_directories(${INCLUDES}) -add_library(Server ConnectionManager.cpp UserManager.cpp) +add_library(Server + ConnectionManager.cpp ConnectionManager.h + UserBackend.h + UserManager.cpp UserManager.h +) target_link_libraries(Server ServerRequestHandlers ServerRequests Common) diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp index 3743e43..0a60ff4 100644 --- a/src/Server/ConnectionManager.cpp +++ b/src/Server/ConnectionManager.cpp @@ -29,13 +29,9 @@ #include "RequestHandlers/DaemonListRequestHandler.h" #include "RequestHandlers/DaemonStatusRequestHandler.h" //#include "RequestHandlers/GSSAPIAuthRequestHandler.h" -#include "RequestHandlers/GroupListRequestHandler.h" -#include "RequestHandlers/GroupUserListRequestHandler.h" #include "RequestHandlers/IdentifyRequestHandler.h" #include "RequestHandlers/LogRequestHandler.h" -#include "RequestHandlers/UserGroupListRequestHandler.h" -#include "RequestHandlers/UserInfoRequestHandler.h" -#include "RequestHandlers/UserListRequestHandler.h" +#include "RequestHandlers/UserRequestHandlerGroup.h" #include #include @@ -189,6 +185,8 @@ void ConnectionManager::handleDisconnect(boost::shared_ptr con void ConnectionManager::doInit() { Common::RequestManager::get()->setServer(true); + userRequestHandlerGroup.reset(new RequestHandlers::UserRequestHandlerGroup); + //Common::RequestManager::get()->registerPacketType("AuthGSSAPI"); Common::RequestManager::get()->registerPacketType("DaemonCommand"); Common::RequestManager::get()->registerPacketType("DaemonFSInfo"); @@ -197,17 +195,16 @@ void ConnectionManager::doInit() { Common::RequestManager::get()->registerPacketType("GetDaemonStatus"); Common::RequestManager::get()->registerPacketType("Identify"); Common::RequestManager::get()->registerPacketType("ListHosts"); - Common::RequestManager::get()->registerPacketType("GetUserInfo"); - Common::RequestManager::get()->registerPacketType("ListUsers"); - Common::RequestManager::get()->registerPacketType("ListUserGroups"); - Common::RequestManager::get()->registerPacketType("ListGroups"); - Common::RequestManager::get()->registerPacketType("ListGroupUsers"); Common::RequestManager::get()->registerPacketType("Log"); + + Common::RequestManager::get()->registerRequestHandlerGroup(userRequestHandlerGroup); } void ConnectionManager::doDeinit() { connections.clear(); + Common::RequestManager::get()->unregisterRequestHandlerGroup(userRequestHandlerGroup); + //Common::RequestManager::get()->unregisterPacketType("AuthGSSAPI"); Common::RequestManager::get()->unregisterPacketType("DaemonCommand"); Common::RequestManager::get()->unregisterPacketType("DaemonFSInfo"); @@ -216,11 +213,6 @@ void ConnectionManager::doDeinit() { Common::RequestManager::get()->unregisterPacketType("GetDaemonStatus"); Common::RequestManager::get()->unregisterPacketType("Identify"); Common::RequestManager::get()->unregisterPacketType("ListHosts"); - Common::RequestManager::get()->unregisterPacketType("GetUserInfo"); - Common::RequestManager::get()->unregisterPacketType("ListUsers"); - Common::RequestManager::get()->unregisterPacketType("ListUserGroups"); - Common::RequestManager::get()->unregisterPacketType("ListGroups"); - Common::RequestManager::get()->unregisterPacketType("ListGroupUsers"); Common::RequestManager::get()->unregisterPacketType("Log"); } diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h index 92cce11..0c4e76d 100644 --- a/src/Server/ConnectionManager.h +++ b/src/Server/ConnectionManager.h @@ -100,6 +100,8 @@ class ConnectionManager : public Common::Configurable, public Common::Initializa std::map daemonInfo; + boost::shared_ptr userRequestHandlerGroup; + void updateState(Common::HostInfo *hostInfo, Common::HostInfo::State state); ConnectionManager() {} diff --git a/src/Server/RequestHandlers/CMakeLists.txt b/src/Server/RequestHandlers/CMakeLists.txt index fe4e71d..b57b9fe 100644 --- a/src/Server/RequestHandlers/CMakeLists.txt +++ b/src/Server/RequestHandlers/CMakeLists.txt @@ -1,10 +1,12 @@ include_directories(${INCLUDES}) -add_library(ServerRequestHandlers - DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp - DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp - GroupListRequestHandler.cpp GroupUserListRequestHandler.cpp IdentifyRequestHandler.cpp - LogRequestHandler.cpp UserGroupListRequestHandler.cpp UserInfoRequestHandler.cpp - UserListRequestHandler.cpp +add_library(ServerRequestHandlers STATIC + DaemonCommandRequestHandler.cpp DaemonCommandRequestHandler.h + DaemonFSInfoRequestHandler.cpp DaemonFSInfoRequestHandler.h + DaemonListRequestHandler.cpp DaemonListRequestHandler.h + DaemonStatusRequestHandler.cpp DaemonStatusRequestHandler.h + IdentifyRequestHandler.cpp IdentifyRequestHandler.h + LogRequestHandler.cpp LogRequestHandler.h + UserRequestHandlerGroup.cpp UserRequestHandlerGroup.h ) target_link_libraries(ServerRequestHandlers Server ${KRB5_LIBRARIES}) diff --git a/src/Server/RequestHandlers/GroupListRequestHandler.cpp b/src/Server/RequestHandlers/GroupListRequestHandler.cpp deleted file mode 100644 index 453f4c2..0000000 --- a/src/Server/RequestHandlers/GroupListRequestHandler.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * GroupListRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "GroupListRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -void GroupListRequestHandler::handlePacket(boost::shared_ptr packet) { - if(packet->getType() != "ListGroups") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - // TODO Require authentication - - - - Common::XmlPacket ret; - - try { - boost::shared_ptr > info = UserManager::get()->getGroupList(); - - ret.setType("OK"); - ret.addList("groups"); - - for(std::map::iterator group = info->begin(); group != info->end(); ++group) { - ret["groups"].addEntry(); - Common::XmlPacket::Entry &entry = ret["groups"].back(); - - entry.add("gid", group->second.getGid()); - entry.add("name", group->second.getName()); - } - } - catch(Net::Exception e) { - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - } - - sendPacket(ret); - signalFinished(); -} - -} -} -} diff --git a/src/Server/RequestHandlers/GroupListRequestHandler.h b/src/Server/RequestHandlers/GroupListRequestHandler.h deleted file mode 100644 index 8654708..0000000 --- a/src/Server/RequestHandlers/GroupListRequestHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * GroupListRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_GROUPLISTREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_GROUPLISTREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class GroupListRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(boost::shared_ptr packet); -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_GROUPLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp b/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp deleted file mode 100644 index f862e8b..0000000 --- a/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * GroupUserListRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "GroupUserListRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -void GroupUserListRequestHandler::handlePacket(boost::shared_ptr packet) { - if(packet->getType() != "ListGroupUsers") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - // TODO Require authentication - - Common::XmlPacket ret; - - try { - boost::shared_ptr > users = UserManager::get()->getGroupUserList((unsigned long)(*packet)["gid"]); - - ret.setType("OK"); - ret.addList("users"); - - for(std::set::iterator user = users->begin(); user != users->end(); ++user) { - ret["users"].addEntry(); - Common::XmlPacket::Entry &entry = ret["users"].back(); - - entry.add("uid", *user); - } - } - catch(Net::Exception e) { - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - } - - sendPacket(ret); - signalFinished(); -} - -} -} -} diff --git a/src/Server/RequestHandlers/GroupUserListRequestHandler.h b/src/Server/RequestHandlers/GroupUserListRequestHandler.h deleted file mode 100644 index 2220565..0000000 --- a/src/Server/RequestHandlers/GroupUserListRequestHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * GroupUserListRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_GROUPUSERLISTREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_GROUPUSERLISTREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class GroupUserListRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(boost::shared_ptr packet); -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_GROUPUSERLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp b/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp deleted file mode 100644 index f5a3f7e..0000000 --- a/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * UserGroupListRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserGroupListRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -void UserGroupListRequestHandler::handlePacket(boost::shared_ptr packet) { - if(packet->getType() != "ListUserGroups") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - // TODO Require authentication - - Common::XmlPacket ret; - - try { - boost::shared_ptr > groups = UserManager::get()->getUserGroupList((unsigned long)(*packet)["uid"]); - - ret.setType("OK"); - ret.addList("groups"); - - for(std::set::iterator group = groups->begin(); group != groups->end(); ++group) { - ret["groups"].addEntry(); - Common::XmlPacket::Entry &entry = ret["groups"].back(); - - entry.add("gid", *group); - } - } - catch(Net::Exception e) { - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - } - - sendPacket(ret); - signalFinished(); -} - -} -} -} diff --git a/src/Server/RequestHandlers/UserGroupListRequestHandler.h b/src/Server/RequestHandlers/UserGroupListRequestHandler.h deleted file mode 100644 index 35ff2eb..0000000 --- a/src/Server/RequestHandlers/UserGroupListRequestHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * UserGroupListRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_USERGROUPLISTREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_USERGROUPLISTREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class UserGroupListRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(boost::shared_ptr packet); -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_USERGROUPLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp deleted file mode 100644 index e9e0716..0000000 --- a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * UserInfoRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserInfoRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -void UserInfoRequestHandler::handlePacket(boost::shared_ptr packet) { - if(packet->getType() != "GetUserInfo") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - // TODO Require authentication - - Common::XmlPacket ret; - - try { - boost::shared_ptr info = UserManager::get()->getUserInfo((*packet)["uid"]); - - ret.setType("OK"); - - ret.add("uid", info->getUid()); - ret.add("gid", info->getGid()); - ret.add("username", info->getUsername()); - ret.add("fullName", info->getFullName()); - } - catch(Net::Exception e) { - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - } - - sendPacket(ret); - signalFinished(); -} - -} -} -} diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.h b/src/Server/RequestHandlers/UserInfoRequestHandler.h deleted file mode 100644 index af11678..0000000 --- a/src/Server/RequestHandlers/UserInfoRequestHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * UserInfoRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class UserInfoRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(boost::shared_ptr packet); -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp deleted file mode 100644 index 4164f22..0000000 --- a/src/Server/RequestHandlers/UserListRequestHandler.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * UserListRequestHandler.cpp - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserListRequestHandler.h" -#include "../UserManager.h" -#include -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -void UserListRequestHandler::handlePacket(boost::shared_ptr packet) { - if(packet->getType() != "ListUsers") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - // TODO Require authentication - - Common::XmlPacket ret; - - try { - boost::shared_ptr > info = UserManager::get()->getUserList(); - - ret.setType("OK"); - ret.addList("users"); - - for(std::map::iterator user = info->begin(); user != info->end(); ++user) { - ret["users"].addEntry(); - Common::XmlPacket::Entry &entry = ret["users"].back(); - - entry.add("uid", user->second.getUid()); - entry.add("gid", user->second.getGid()); - entry.add("username", user->second.getUsername()); - entry.add("fullName", user->second.getFullName()); - } - } - catch(Net::Exception e) { - ret.setType("Error"); - ret.add("ErrorCode", e.getErrorCode()); - ret.add("SubCode", e.getSubCode()); - ret.add("SubSubCode", e.getSubSubCode()); - ret.add("Where", e.getWhere()); - } - - sendPacket(ret); - signalFinished(); -} - -} -} -} diff --git a/src/Server/RequestHandlers/UserListRequestHandler.h b/src/Server/RequestHandlers/UserListRequestHandler.h deleted file mode 100644 index 36cef00..0000000 --- a/src/Server/RequestHandlers/UserListRequestHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * UserListRequestHandler.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ - -#include - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class UserListRequestHandler : public Common::RequestHandler { - protected: - virtual void handlePacket(boost::shared_ptr packet); -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ */ diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp new file mode 100644 index 0000000..1b6dd3d --- /dev/null +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -0,0 +1,156 @@ +/* + * UserRequestHandlerGroup.cpp + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "UserRequestHandlerGroup.h" + +#include +#include "../UserManager.h" + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +void UserRequestHandlerGroup::RequestHandler::handlePacket(boost::shared_ptr packet) { + if(packet->getType() != type) { + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + + Common::XmlPacket ret; + ret.setType("Error"); + ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); + + sendPacket(ret); + + signalFinished(); + return; + } + + // TODO Require authentication + + Common::XmlPacket ret; + + try { + handler(packet, &ret); + } + catch(Net::Exception e) { + ret.setType("Error"); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); + } + + sendPacket(ret); + signalFinished(); +} + +void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr packet _UNUSED_PARAMETER_, Common::XmlPacket *ret) { + boost::shared_ptr > info = UserManager::get()->getUserList(); + + ret->setType("OK"); + ret->addList("users"); + + for(std::map::iterator user = info->begin(); user != info->end(); ++user) { + (*ret)["users"].addEntry(); + Common::XmlPacket::Entry &entry = (*ret)["users"].back(); + + entry.add("uid", user->second.getUid()); + entry.add("gid", user->second.getGid()); + entry.add("username", user->second.getUsername()); + entry.add("fullName", user->second.getFullName()); + } +} + +void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr packet, Common::XmlPacket *ret) { + boost::shared_ptr info = UserManager::get()->getUserInfo((*packet)["uid"]); + + ret->setType("OK"); + + ret->add("uid", info->getUid()); + ret->add("gid", info->getGid()); + ret->add("username", info->getUsername()); + ret->add("fullName", info->getFullName()); +} + +void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr packet, Common::XmlPacket *ret) { + boost::shared_ptr > groups = UserManager::get()->getUserGroupList((unsigned long)(*packet)["uid"]); + + ret->setType("OK"); + ret->addList("groups"); + + for(std::set::iterator group = groups->begin(); group != groups->end(); ++group) { + (*ret)["groups"].addEntry(); + Common::XmlPacket::Entry &entry = (*ret)["groups"].back(); + + entry.add("gid", *group); + } +} + +void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr packet _UNUSED_PARAMETER_, Common::XmlPacket *ret) { + boost::shared_ptr > info = UserManager::get()->getGroupList(); + + ret->setType("OK"); + ret->addList("groups"); + + for(std::map::iterator group = info->begin(); group != info->end(); ++group) { + (*ret)["groups"].addEntry(); + Common::XmlPacket::Entry &entry = (*ret)["groups"].back(); + + entry.add("gid", group->second.getGid()); + entry.add("name", group->second.getName()); + } +} + +void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr packet, Common::XmlPacket *ret) { + boost::shared_ptr > users = UserManager::get()->getGroupUserList((unsigned long)(*packet)["gid"]); + + ret->setType("OK"); + ret->addList("users"); + + for(std::set::iterator user = users->begin(); user != users->end(); ++user) { + (*ret)["users"].addEntry(); + Common::XmlPacket::Entry &entry = (*ret)["users"].back(); + + entry.add("uid", *user); + } +} + +UserRequestHandlerGroup::UserRequestHandlerGroup() { + registerHandler("ListUsers", &UserRequestHandlerGroup::handleUserListRequest); + registerHandler("GetUserInfo", &UserRequestHandlerGroup::handleUserInfoRequest); + registerHandler("ListUserGroups", &UserRequestHandlerGroup::handleUserGroupListRequest); + registerHandler("ListGroups", &UserRequestHandlerGroup::handleGroupListRequest); + registerHandler("ListGroupUsers", &UserRequestHandlerGroup::handleGroupUserListRequest); +} + +const std::set& UserRequestHandlerGroup::getPacketTypes() { + return types; +} + +boost::shared_ptr UserRequestHandlerGroup::createRequestHandler(const std::string &type) { + std::map, Common::XmlPacket*> >::iterator handler = handlers.find(type); + + if(handler == handlers.end()) + return boost::shared_ptr(); + else + return boost::shared_ptr(new RequestHandler(type, handler->second)); +} + +} +} +} diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.h b/src/Server/RequestHandlers/UserRequestHandlerGroup.h new file mode 100644 index 0000000..c24d502 --- /dev/null +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.h @@ -0,0 +1,69 @@ +/* + * UserRequestHandlerGroup.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_SERVER_REQUESTHANDLERS_USERREQUESTHANDLERGROUP_H_ +#define MAD_SERVER_REQUESTHANDLERS_USERREQUESTHANDLERGROUP_H_ + +#include + +namespace Mad { +namespace Server { +namespace RequestHandlers { + +class UserRequestHandlerGroup : public Common::RequestHandlerGroup { + private: + class RequestHandler : public Common::RequestHandler { + private: + std::string type; + boost::function2, Common::XmlPacket*> handler; + + protected: + virtual void handlePacket(boost::shared_ptr packet); + + public: + RequestHandler(const std::string &type0, const boost::function2, Common::XmlPacket*> &handler0) : type(type0), handler(handler0) {} + }; + + + std::set types; + std::map, Common::XmlPacket*> > handlers; + + void registerHandler(const std::string &type, const boost::function2, Common::XmlPacket*> &handler) { + types.insert(type); + handlers.insert(std::make_pair(type, handler)); + } + + static void handleUserListRequest(boost::shared_ptr packet, Common::XmlPacket *ret); + static void handleUserInfoRequest(boost::shared_ptr packet, Common::XmlPacket *ret); + static void handleUserGroupListRequest(boost::shared_ptr packet, Common::XmlPacket *ret); + static void handleGroupListRequest(boost::shared_ptr packet, Common::XmlPacket *ret); + static void handleGroupUserListRequest(boost::shared_ptr packet, Common::XmlPacket *ret); + + public: + UserRequestHandlerGroup(); + + virtual const std::set& getPacketTypes(); + virtual boost::shared_ptr createRequestHandler(const std::string &type); +}; + +} +} +} + +#endif /* MAD_SERVER_REQUESTHANDLERS_USERREQUESTHANDLERGROUP_H_ */ diff --git a/src/Server/Requests/CMakeLists.txt b/src/Server/Requests/CMakeLists.txt index 5522809..6c5c8c5 100644 --- a/src/Server/Requests/CMakeLists.txt +++ b/src/Server/Requests/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories(${INCLUDES}) -add_library(ServerRequests - CommandRequest.cpp DaemonStateUpdateRequest.cpp +add_library(ServerRequests STATIC + CommandRequest.cpp CommandRequest.h + DaemonStateUpdateRequest.cpp DaemonStateUpdateRequest.h ) diff --git a/src/modules/FileLogger/CMakeLists.txt b/src/modules/FileLogger/CMakeLists.txt index 39459d3..7d90028 100644 --- a/src/modules/FileLogger/CMakeLists.txt +++ b/src/modules/FileLogger/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${INCLUDES}) add_library(FileLogger MODULE - FileLogger.cpp + FileLogger.cpp FileLogger.h ) diff --git a/src/modules/SystemBackendPosix/CMakeLists.txt b/src/modules/SystemBackendPosix/CMakeLists.txt index 02b0ef6..223960b 100644 --- a/src/modules/SystemBackendPosix/CMakeLists.txt +++ b/src/modules/SystemBackendPosix/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${INCLUDES}) add_library(SystemBackendPosix MODULE - SystemBackendPosix.cpp + SystemBackendPosix.cpp SystemBackendPosix.h ) diff --git a/src/modules/SystemBackendProc/CMakeLists.txt b/src/modules/SystemBackendProc/CMakeLists.txt index b524265..ba5642c 100644 --- a/src/modules/SystemBackendProc/CMakeLists.txt +++ b/src/modules/SystemBackendProc/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${INCLUDES}) add_library(SystemBackendProc MODULE - SystemBackendProc.cpp + SystemBackendProc.cpp SystemBackendProc.h ) diff --git a/src/modules/UserBackendMysql/CMakeLists.txt b/src/modules/UserBackendMysql/CMakeLists.txt index 5af1f1d..b185c13 100644 --- a/src/modules/UserBackendMysql/CMakeLists.txt +++ b/src/modules/UserBackendMysql/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories(${INCLUDES} ${MYSQL_INCLUDE_DIR}) add_library(UserBackendMysql MODULE - UserBackendMysql.cpp + UserBackendMysql.cpp UserBackendMysql.h ) target_link_libraries(UserBackendMysql ${MYSQL_LIBRARIES}) \ No newline at end of file -- cgit v1.2.3