diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-15 04:46:28 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-15 04:46:28 +0200 |
commit | 30bec92571ba23f1f2aa6b12149f6545a4ef0d7e (patch) | |
tree | e823812fc05dfa81a103f386df6be81745e2928e /src/Core/RequestHandlers | |
parent | fbe26b0e48e6f3714900833174fcf42196e86fc8 (diff) | |
download | mad-30bec92571ba23f1f2aa6b12149f6545a4ef0d7e.tar mad-30bec92571ba23f1f2aa6b12149f6545a4ef0d7e.zip |
Hosts k?nnen jetzt aufgelistet werden
Diffstat (limited to 'src/Core/RequestHandlers')
-rw-r--r-- | src/Core/RequestHandlers/CoreStatusRequestHandler.h | 6 | ||||
-rw-r--r-- | src/Core/RequestHandlers/DaemonListRequestHandler.cpp | 54 | ||||
-rw-r--r-- | src/Core/RequestHandlers/DaemonListRequestHandler.h | 40 | ||||
-rw-r--r-- | src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h | 6 | ||||
-rw-r--r-- | src/Core/RequestHandlers/Makefile.am | 4 | ||||
-rw-r--r-- | src/Core/RequestHandlers/Makefile.in | 9 |
6 files changed, 107 insertions, 12 deletions
diff --git a/src/Core/RequestHandlers/CoreStatusRequestHandler.h b/src/Core/RequestHandlers/CoreStatusRequestHandler.h index c6c0da3..c9d3199 100644 --- a/src/Core/RequestHandlers/CoreStatusRequestHandler.h +++ b/src/Core/RequestHandlers/CoreStatusRequestHandler.h @@ -17,8 +17,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MAD_CORE_REQUESTHANDLER_CORESTATUSREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLER_CORESTATUSREQUESTHANDLER_H_ +#ifndef MAD_CORE_REQUESTHANDLERS_CORESTATUSREQUESTHANDLER_H_ +#define MAD_CORE_REQUESTHANDLERS_CORESTATUSREQUESTHANDLER_H_ #include <Common/RequestHandler.h> @@ -37,4 +37,4 @@ class CoreStatusRequestHandler : public Common::RequestHandler { } } -#endif /* MAD_CORE_REQUESTHANDLER_CORESTATUSREQUESTHANDLER_H_ */ +#endif /* MAD_CORE_REQUESTHANDLERS_CORESTATUSREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp new file mode 100644 index 0000000..00ee0ff --- /dev/null +++ b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp @@ -0,0 +1,54 @@ +/* + * DaemonListRequestHandler.cpp + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "DaemonListRequestHandler.h" +#include "../ConnectionManager.h" +#include <Net/Connection.h> +#include <Net/Packets/NameListPacket.h> + +namespace Mad { +namespace Core { +namespace RequestHandlers { + +bool DaemonListRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(isFinished()) + return false; + + if(packet.getType() != Net::Packet::LIST_DAEMONS) + return false; // TODO Logging + + // TODO Require authentication + + std::map<std::string,DaemonInfo> daemons = ConnectionManager::getConnectionManager()->getDaemonList(); + std::vector<std::string> names; + + for(std::map<std::string,DaemonInfo>::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) + names.push_back(daemon->first); + + if(!connection->send(Net::Packets::NameListPacket(Net::Packet::OK, packet.getRequestId(), names))) + return false; + + setFinished(); + + return true; +} + +} +} +} diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.h b/src/Core/RequestHandlers/DaemonListRequestHandler.h new file mode 100644 index 0000000..406d212 --- /dev/null +++ b/src/Core/RequestHandlers/DaemonListRequestHandler.h @@ -0,0 +1,40 @@ +/* + * DaemonListRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ +#define MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ + +#include <Common/RequestHandler.h> + +namespace Mad { +namespace Core { +namespace RequestHandlers { + +class DaemonListRequestHandler : public Common::RequestHandler { + public: + DaemonListRequestHandler() {} + + virtual bool handlePacket(Net::Connection *connection, const Net::Packet &packet); +}; + +} +} +} + +#endif /* MAD_CORE_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h index a88969b..57ea14f 100644 --- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h +++ b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.h @@ -17,8 +17,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MAD_CORE_REQUESTHANDLER_GSSAPIAUTHREQUESTHANDLER_H_ -#define MAD_CORE_REQUESTHANDLER_GSSAPIAUTHREQUESTHANDLER_H_ +#ifndef MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ +#define MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ #include <Common/RequestHandler.h> #include <gssapi/gssapi.h> @@ -43,4 +43,4 @@ class GSSAPIAuthRequestHandler : public Common::RequestHandler { } } -#endif /* MAD_CORE_REQUESTHANDLER_GSSAPIAUTHREQUESTHANDLER_H_ */ +#endif /* MAD_CORE_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandlers/Makefile.am b/src/Core/RequestHandlers/Makefile.am index c13d0d7..8155a80 100644 --- a/src/Core/RequestHandlers/Makefile.am +++ b/src/Core/RequestHandlers/Makefile.am @@ -1,4 +1,4 @@ noinst_LTLIBRARIES = librequesthandlers.la -librequesthandlers_la_SOURCES = CoreStatusRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp +librequesthandlers_la_SOURCES = CoreStatusRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp -noinst_HEADERS = CoreStatusRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h +noinst_HEADERS = CoreStatusRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h diff --git a/src/Core/RequestHandlers/Makefile.in b/src/Core/RequestHandlers/Makefile.in index 191fd28..88e1ca3 100644 --- a/src/Core/RequestHandlers/Makefile.in +++ b/src/Core/RequestHandlers/Makefile.in @@ -46,8 +46,8 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librequesthandlers_la_LIBADD = am_librequesthandlers_la_OBJECTS = CoreStatusRequestHandler.lo \ - DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \ - IdentifyRequestHandler.lo + DaemonListRequestHandler.lo DaemonStatusRequestHandler.lo \ + GSSAPIAuthRequestHandler.lo IdentifyRequestHandler.lo librequesthandlers_la_OBJECTS = $(am_librequesthandlers_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -186,8 +186,8 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librequesthandlers.la -librequesthandlers_la_SOURCES = CoreStatusRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp -noinst_HEADERS = CoreStatusRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h +librequesthandlers_la_SOURCES = CoreStatusRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp +noinst_HEADERS = CoreStatusRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h all: all-am .SUFFIXES: @@ -240,6 +240,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoreStatusRequestHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonListRequestHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequestHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GSSAPIAuthRequestHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdentifyRequestHandler.Plo@am__quote@ |