diff options
Diffstat (limited to 'src/Client')
-rw-r--r-- | src/Client/CommandParser.cpp | 1 | ||||
-rw-r--r-- | src/Client/Makefile.am | 1 | ||||
-rw-r--r-- | src/Client/Makefile.in | 3 | ||||
-rw-r--r-- | src/Client/Request/CoreStatusRequest.cpp | 69 | ||||
-rw-r--r-- | src/Client/Request/CoreStatusRequest.h | 51 | ||||
-rw-r--r-- | src/Client/Request/Makefile.am | 5 | ||||
-rw-r--r-- | src/Client/Request/Makefile.in | 99 |
7 files changed, 173 insertions, 56 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 3100466..ed15b7b 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -20,6 +20,7 @@ #include "CommandParser.h" #include "Request/CoreStatusRequest.h" #include <Common/Request/DisconnectRequest.h> +#include <Net/Packets/HostStatusPacket.h> #include <iostream> #include <cstdio> diff --git a/src/Client/Makefile.am b/src/Client/Makefile.am index 0a1d8e3..65407f3 100644 --- a/src/Client/Makefile.am +++ b/src/Client/Makefile.am @@ -2,5 +2,6 @@ SUBDIRS = Request noinst_LTLIBRARIES = libclient.la libclient_la_SOURCES = CommandParser.cpp +libclient_la_LIBADD = Request/librequest.la noinst_HEADERS = CommandParser.h diff --git a/src/Client/Makefile.in b/src/Client/Makefile.in index 423e2f3..a1a049e 100644 --- a/src/Client/Makefile.in +++ b/src/Client/Makefile.in @@ -44,7 +44,7 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libclient_la_LIBADD = +libclient_la_DEPENDENCIES = Request/librequest.la am_libclient_la_OBJECTS = CommandParser.lo libclient_la_OBJECTS = $(am_libclient_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src @@ -194,6 +194,7 @@ top_srcdir = @top_srcdir@ SUBDIRS = Request noinst_LTLIBRARIES = libclient.la libclient_la_SOURCES = CommandParser.cpp +libclient_la_LIBADD = Request/librequest.la noinst_HEADERS = CommandParser.h all: all-recursive diff --git a/src/Client/Request/CoreStatusRequest.cpp b/src/Client/Request/CoreStatusRequest.cpp new file mode 100644 index 0000000..f5fe043 --- /dev/null +++ b/src/Client/Request/CoreStatusRequest.cpp @@ -0,0 +1,69 @@ +/* + * CoreStatusRequest.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 "CoreStatusRequest.h" + +#include <Common/RequestManager.h> +#include <Net/Packets/HostStatusPacket.h> + +#include <sigc++/signal.h> + +namespace Mad { +namespace Client { +namespace Request { + +bool CoreStatusRequest::send(Net::Connection *connection, Common::RequestManager &requestManager, const sigc::slot<void,const Net::Packets::HostStatusPacket&> &callback) { + CoreStatusRequest *request = new CoreStatusRequest(); + + request->finished.connect(callback); + + if(requestManager.sendRequest(connection, request)) + return true; + + delete request; + return false; +} + +bool CoreStatusRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { + if(isSent()) + return false; + + if(!connection->send(Net::Packet(Net::Packet::CORE_STATUS, requestId))) + return false; + + setSent(); + return true; +} + +bool CoreStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { + if(isFinished()) + return false; + + if(packet.getType() != Net::Packet::OK) + return false; // TODO Logging + + finished(Net::Packets::HostStatusPacket(packet)); + + setFinished(); + return true; +} + +} +} +} diff --git a/src/Client/Request/CoreStatusRequest.h b/src/Client/Request/CoreStatusRequest.h index 328c4ff..1a6a01e 100644 --- a/src/Client/Request/CoreStatusRequest.h +++ b/src/Client/Request/CoreStatusRequest.h @@ -20,14 +20,22 @@ #ifndef MAD_CLIENT_REQUEST_CORESTATUSREQUEST_H_ #define MAD_CLIENT_REQUEST_CORESTATUSREQUEST_H_ -#include <Common/RequestManager.h> #include <Common/Request/Request.h> -#include <Net/Connection.h> -#include <Net/Packets/HostStatusPacket.h> #include <sigc++/signal.h> namespace Mad { + +namespace Common { +class RequestManager; +} + +namespace Net { +namespace Packets { +class HostStatusPacket; +} +} + namespace Client { namespace Request { @@ -38,41 +46,10 @@ class CoreStatusRequest: public Common::Request::Request { CoreStatusRequest() {} public: - static bool send(Net::Connection *connection, Common::RequestManager &requestManager, const sigc::slot<void,const Net::Packets::HostStatusPacket&> &callback) { - CoreStatusRequest *request = new CoreStatusRequest(); - - request->finished.connect(callback); - - if(requestManager.sendRequest(connection, request)) - return true; - - delete request; - return false; - } - - virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) { - if(isSent()) - return false; - - if(!connection->send(Net::Packet(Net::Packet::CORE_STATUS, requestId))) - return false; - - setSent(); - return true; - } - - virtual bool handlePacket(Net::Connection*, const Net::Packet &packet) { - if(isFinished()) - return false; - - if(packet.getType() != Net::Packet::OK) - return false; // TODO Logging - - finished(Net::Packets::HostStatusPacket(packet)); + static bool send(Net::Connection *connection, Common::RequestManager &requestManager, const sigc::slot<void,const Net::Packets::HostStatusPacket&> &callback); - setFinished(); - return true; - } + virtual bool sendRequest(Net::Connection *connection, uint16_t requestId); + virtual bool handlePacket(Net::Connection*, const Net::Packet &packet); }; } diff --git a/src/Client/Request/Makefile.am b/src/Client/Request/Makefile.am index 58db76c..64b5a33 100644 --- a/src/Client/Request/Makefile.am +++ b/src/Client/Request/Makefile.am @@ -1 +1,4 @@ -noinst_HEADERS = CoreStatusRequest.h +noinst_LTLIBRARIES = librequest.la +librequest_la_SOURCES = CoreStatusRequest.cpp + +noinst_HEADERS = CoreStatusRequest.h diff --git a/src/Client/Request/Makefile.in b/src/Client/Request/Makefile.in index d81a597..fde067d 100644 --- a/src/Client/Request/Makefile.in +++ b/src/Client/Request/Makefile.in @@ -14,6 +14,7 @@ @SET_MAKE@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -42,8 +43,24 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +librequest_la_LIBADD = +am_librequest_la_OBJECTS = CoreStatusRequest.lo +librequest_la_OBJECTS = $(am_librequest_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(librequest_la_SOURCES) +DIST_SOURCES = $(librequest_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags @@ -164,10 +181,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = librequest.la +librequest_la_SOURCES = CoreStatusRequest.cpp noinst_HEADERS = CoreStatusRequest.h all: all-am .SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -198,6 +218,46 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +librequest.la: $(librequest_la_OBJECTS) $(librequest_la_DEPENDENCIES) + $(CXXLINK) $(librequest_la_OBJECTS) $(librequest_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoreStatusRequest.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + mostlyclean-libtool: -rm -f *.lo @@ -279,7 +339,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(HEADERS) +all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am @@ -307,11 +367,14 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am distclean: distclean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am @@ -342,12 +405,14 @@ install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-generic mostlyclean-libtool +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf: pdf-am @@ -362,17 +427,17 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. |