From 3086f10f53ced17ab4a237ab57da62395d259f0a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 29 Sep 2008 18:16:20 +0200 Subject: InformationManager zur Verwaltung der Host-Liste hinzugef?gt --- src/Core/Requests/DaemonStatusRequest.cpp | 1 - src/Core/Requests/DaemonStatusRequest.h | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'src/Core/Requests') diff --git a/src/Core/Requests/DaemonStatusRequest.cpp b/src/Core/Requests/DaemonStatusRequest.cpp index 1741731..3b028c9 100644 --- a/src/Core/Requests/DaemonStatusRequest.cpp +++ b/src/Core/Requests/DaemonStatusRequest.cpp @@ -19,7 +19,6 @@ #include "DaemonStatusRequest.h" #include -#include namespace Mad { namespace Core { diff --git a/src/Core/Requests/DaemonStatusRequest.h b/src/Core/Requests/DaemonStatusRequest.h index baeb847..09cbc2b 100644 --- a/src/Core/Requests/DaemonStatusRequest.h +++ b/src/Core/Requests/DaemonStatusRequest.h @@ -21,15 +21,9 @@ #define MAD_CORE_REQUESTS_DAEMONSTATUSREQUEST_H_ #include +#include namespace Mad { - -namespace Net { -namespace Packets { -class HostStatusPacket; -} -} - namespace Core { namespace Requests { -- cgit v1.2.3 From 13fd1bb4f19e4791e000cb71cca2065820184bdb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 29 Sep 2008 22:25:04 +0200 Subject: Daemon-Liste wird jetzt vom Core aktualisiert --- src/Core/Requests/DaemonStateUpdateRequest.cpp | 43 +++++++++++++++++++++++ src/Core/Requests/DaemonStateUpdateRequest.h | 47 ++++++++++++++++++++++++++ src/Core/Requests/Makefile.am | 4 +-- src/Core/Requests/Makefile.in | 8 +++-- 4 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 src/Core/Requests/DaemonStateUpdateRequest.cpp create mode 100644 src/Core/Requests/DaemonStateUpdateRequest.h (limited to 'src/Core/Requests') diff --git a/src/Core/Requests/DaemonStateUpdateRequest.cpp b/src/Core/Requests/DaemonStateUpdateRequest.cpp new file mode 100644 index 0000000..00e0bdf --- /dev/null +++ b/src/Core/Requests/DaemonStateUpdateRequest.cpp @@ -0,0 +1,43 @@ +/* + * DaemonStateUpdateRequest.cpp + * + * Copyright (C) 2008 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 "DaemonStateUpdateRequest.h" +#include +#include + +namespace Mad { +namespace Core { +namespace Requests { + +void DaemonStateUpdateRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { + connection->send(Net::Packets::HostStatePacket(Net::Packet::DAEMON_STATE_UPDATE, requestId, name, state)); +} + +void DaemonStateUpdateRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::OK) { + finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); + return; // TODO Logging + } + + finish(); +} + +} +} +} diff --git a/src/Core/Requests/DaemonStateUpdateRequest.h b/src/Core/Requests/DaemonStateUpdateRequest.h new file mode 100644 index 0000000..9a1c8f0 --- /dev/null +++ b/src/Core/Requests/DaemonStateUpdateRequest.h @@ -0,0 +1,47 @@ +/* + * DaemonStateUpdateRequest.h + * + * Copyright (C) 2008 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_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ +#define MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ + +#include +#include + +namespace Mad { +namespace Core { +namespace Requests { + +class DaemonStateUpdateRequest : public Common::Request<> { + private: + std::string name; + Common::HostInfo::State state; + + protected: + virtual void sendRequest(Net::Connection *connection, uint16_t requestId); + virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); + + public: + DaemonStateUpdateRequest(const std::string &name0, Common::HostInfo::State state0) : Common::Request<>(slot_type()), name(name0), state(state0) {} +}; + +} +} +} + +#endif /* MAD_CORE_REQUESTS_DAEMONSTATEUPDATEREQUEST_H_ */ diff --git a/src/Core/Requests/Makefile.am b/src/Core/Requests/Makefile.am index 2d08477..e69088b 100644 --- a/src/Core/Requests/Makefile.am +++ b/src/Core/Requests/Makefile.am @@ -1,4 +1,4 @@ noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = CommandRequest.cpp DaemonStatusRequest.cpp +librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp DaemonStatusRequest.cpp -noinst_HEADERS = CommandRequest.h DaemonStatusRequest.h +noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h DaemonStatusRequest.h diff --git a/src/Core/Requests/Makefile.in b/src/Core/Requests/Makefile.in index 22ac701..e6367a2 100644 --- a/src/Core/Requests/Makefile.in +++ b/src/Core/Requests/Makefile.in @@ -48,7 +48,8 @@ CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) librequests_la_LIBADD = -am_librequests_la_OBJECTS = CommandRequest.lo DaemonStatusRequest.lo +am_librequests_la_OBJECTS = CommandRequest.lo \ + DaemonStateUpdateRequest.lo DaemonStatusRequest.lo librequests_la_OBJECTS = $(am_librequests_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -187,8 +188,8 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = librequests.la -librequests_la_SOURCES = CommandRequest.cpp DaemonStatusRequest.cpp -noinst_HEADERS = CommandRequest.h DaemonStatusRequest.h +librequests_la_SOURCES = CommandRequest.cpp DaemonStateUpdateRequest.cpp DaemonStatusRequest.cpp +noinst_HEADERS = CommandRequest.h DaemonStateUpdateRequest.h DaemonStatusRequest.h all: all-am .SUFFIXES: @@ -241,6 +242,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CommandRequest.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStateUpdateRequest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequest.Plo@am__quote@ .cpp.o: -- cgit v1.2.3