summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure3
-rw-r--r--configure.ac1
-rw-r--r--src/Common/Request.h6
-rw-r--r--src/Core/ConnectionManager.cpp2
-rw-r--r--src/Core/RequestHandlers/IdentifyRequestHandler.h6
-rw-r--r--src/Core/RequestHandlers/LogRequestHandler.cpp51
-rw-r--r--src/Core/RequestHandlers/LogRequestHandler.h41
-rw-r--r--src/Core/RequestHandlers/Makefile.am4
-rw-r--r--src/Core/RequestHandlers/Makefile.in7
-rw-r--r--src/Daemon/Backends/Makefile.am1
-rw-r--r--src/Daemon/Backends/Makefile.in384
-rw-r--r--src/Daemon/Backends/NetworkLogger.h51
-rw-r--r--src/Daemon/Makefile.am2
-rw-r--r--src/Daemon/Makefile.in2
-rw-r--r--src/Daemon/Requests/LogRequest.cpp43
-rw-r--r--src/Daemon/Requests/LogRequest.h49
-rw-r--r--src/Daemon/Requests/Makefile.am4
-rw-r--r--src/Daemon/Requests/Makefile.in7
-rw-r--r--src/Net/Packet.h2
-rw-r--r--src/Net/Packets/LogPacket.cpp51
-rw-r--r--src/Net/Packets/LogPacket.h79
-rw-r--r--src/Net/Packets/Makefile.am4
-rw-r--r--src/Net/Packets/Makefile.in7
-rw-r--r--src/mad.cpp13
26 files changed, 796 insertions, 27 deletions
diff --git a/Makefile.am b/Makefile.am
index af437a6..26226b0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,3 @@
SUBDIRS = src
+
+ACLOCAL_AMFLAGS = -I m4
diff --git a/Makefile.in b/Makefile.in
index 3895e8d..7a5c390 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -192,6 +192,7 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src
+ACLOCAL_AMFLAGS = -I m4
all: all-recursive
.SUFFIXES:
diff --git a/configure b/configure
index d76ab6a..04d091d 100755
--- a/configure
+++ b/configure
@@ -16835,7 +16835,7 @@ done
-ac_config_files="$ac_config_files Makefile src/Makefile src/Client/Makefile src/Client/Requests/Makefile src/Common/Makefile src/Common/Backends/Makefile src/Common/Requests/Makefile src/Common/RequestHandlers/Makefile src/Core/Makefile src/Core/Requests/Makefile src/Core/RequestHandlers/Makefile src/Daemon/Makefile src/Daemon/Requests/Makefile src/Daemon/RequestHandlers/Makefile src/Net/Makefile src/Net/Packets/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile src/Client/Makefile src/Client/Requests/Makefile src/Common/Makefile src/Common/Backends/Makefile src/Common/Requests/Makefile src/Common/RequestHandlers/Makefile src/Core/Makefile src/Core/Requests/Makefile src/Core/RequestHandlers/Makefile src/Daemon/Makefile src/Daemon/Backends/Makefile src/Daemon/Requests/Makefile src/Daemon/RequestHandlers/Makefile src/Net/Makefile src/Net/Packets/Makefile"
cat >confcache <<\_ACEOF
@@ -17794,6 +17794,7 @@ do
"src/Core/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Core/Requests/Makefile" ;;
"src/Core/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Core/RequestHandlers/Makefile" ;;
"src/Daemon/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Makefile" ;;
+ "src/Daemon/Backends/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Backends/Makefile" ;;
"src/Daemon/Requests/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/Requests/Makefile" ;;
"src/Daemon/RequestHandlers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Daemon/RequestHandlers/Makefile" ;;
"src/Net/Makefile") CONFIG_FILES="$CONFIG_FILES src/Net/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 8f12427..1544360 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ AC_CONFIG_FILES([
src/Core/Requests/Makefile
src/Core/RequestHandlers/Makefile
src/Daemon/Makefile
+ src/Daemon/Backends/Makefile
src/Daemon/Requests/Makefile
src/Daemon/RequestHandlers/Makefile
src/Net/Makefile
diff --git a/src/Common/Request.h b/src/Common/Request.h
index fa6b619..229b8b8 100644
--- a/src/Common/Request.h
+++ b/src/Common/Request.h
@@ -36,9 +36,10 @@ template<typename T = void> class Request : public RequestBase {
std::auto_ptr<T> res;
Exception exp;
- protected:
+ public:
typedef sigc::slot<void,const Request<T>&> slot_type;
+ protected:
Request(slot_type slot) : exp(Exception::NOT_FINISHED) {
finished.connect(slot);
finished.connect(sigc::hide(signalFinished().make_slot()));
@@ -64,9 +65,10 @@ template<> class Request<void> : public RequestBase {
bool isFinished;
Exception exp;
- protected:
+ public:
typedef sigc::slot<void,const Request<void>&> slot_type;
+ protected:
Request(slot_type slot) : isFinished(false), exp(Exception::NOT_FINISHED) {
finished.connect(slot);
finished.connect(sigc::hide(signalFinished().make_slot()));
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index 8356594..272c04b 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -25,6 +25,7 @@
#include "RequestHandlers/DaemonStatusRequestHandler.h"
#include "RequestHandlers/GSSAPIAuthRequestHandler.h"
#include "RequestHandlers/IdentifyRequestHandler.h"
+#include "RequestHandlers/LogRequestHandler.h"
#include <Net/ServerConnection.h>
#include <Net/Packet.h>
#include <Net/Listener.h>
@@ -70,6 +71,7 @@ ConnectionManager::ConnectionManager() {
Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>(Net::Packet::DAEMON_STATUS);
Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::GSSAPIAuthRequestHandler>(Net::Packet::GSSAPI_AUTH);
Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::IdentifyRequestHandler>(Net::Packet::IDENTIFY);
+ Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::LogRequestHandler>(Net::Packet::LOG);
ConfigManager *configManager = ConfigManager::getConfigManager();
diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.h b/src/Core/RequestHandlers/IdentifyRequestHandler.h
index 58f10ba..f38fff6 100644
--- a/src/Core/RequestHandlers/IdentifyRequestHandler.h
+++ b/src/Core/RequestHandlers/IdentifyRequestHandler.h
@@ -17,8 +17,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_COMMON_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
-#define MAD_COMMON_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
+#ifndef MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
+#define MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
#include <Common/RequestHandler.h>
@@ -38,4 +38,4 @@ class IdentifyRequestHandler : public Common::RequestHandler {
}
}
-#endif /* MAD_COMMON_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ */
+#endif /* MAD_CORE_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ */
diff --git a/src/Core/RequestHandlers/LogRequestHandler.cpp b/src/Core/RequestHandlers/LogRequestHandler.cpp
new file mode 100644
index 0000000..f2021b2
--- /dev/null
+++ b/src/Core/RequestHandlers/LogRequestHandler.cpp
@@ -0,0 +1,51 @@
+/*
+ * LogRequestHandler.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 "LogRequestHandler.h"
+#include <Common/Logger.h>
+#include <Net/Connection.h>
+#include <Net/Packets/ErrorPacket.h>
+#include <Net/Packets/LogPacket.h>
+
+namespace Mad {
+namespace Core {
+namespace RequestHandlers {
+
+void LogRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) {
+ if(packet.getType() != Net::Packet::LOG) {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+ connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), Common::Exception(Common::Exception::UNEXPECTED_PACKET)));
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ Net::Packets::LogPacket logPacket(packet);
+ Common::Logger::logf(logPacket.getCategory(), logPacket.getLevel(), "Remote log: %s", logPacket.getMessage().c_str());
+
+ connection->send(Net::Packet(Net::Packet::OK, packet.getRequestId()));
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Core/RequestHandlers/LogRequestHandler.h b/src/Core/RequestHandlers/LogRequestHandler.h
new file mode 100644
index 0000000..b82f24b
--- /dev/null
+++ b/src/Core/RequestHandlers/LogRequestHandler.h
@@ -0,0 +1,41 @@
+/*
+ * LogRequestHandler.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_LOGREQUESTHANDLER_H_
+#define MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+
+namespace Mad {
+namespace Core {
+namespace RequestHandlers {
+
+class LogRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
+
+ public:
+ LogRequestHandler() {}
+};
+
+}
+}
+}
+
+#endif /* MAD_CORE_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ */
diff --git a/src/Core/RequestHandlers/Makefile.am b/src/Core/RequestHandlers/Makefile.am
index 2c65ceb..3c52634 100644
--- a/src/Core/RequestHandlers/Makefile.am
+++ b/src/Core/RequestHandlers/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = librequesthandlers.la
-librequesthandlers_la_SOURCES = DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp
+librequesthandlers_la_SOURCES = DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp
-noinst_HEADERS = DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h
+noinst_HEADERS = DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h
diff --git a/src/Core/RequestHandlers/Makefile.in b/src/Core/RequestHandlers/Makefile.in
index af6ffb4..a450ea0 100644
--- a/src/Core/RequestHandlers/Makefile.in
+++ b/src/Core/RequestHandlers/Makefile.in
@@ -50,7 +50,7 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
librequesthandlers_la_LIBADD =
am_librequesthandlers_la_OBJECTS = DaemonListRequestHandler.lo \
DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \
- IdentifyRequestHandler.lo
+ IdentifyRequestHandler.lo LogRequestHandler.lo
librequesthandlers_la_OBJECTS = $(am_librequesthandlers_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -189,8 +189,8 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = librequesthandlers.la
-librequesthandlers_la_SOURCES = DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp
-noinst_HEADERS = DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h
+librequesthandlers_la_SOURCES = DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp
+noinst_HEADERS = DaemonListRequestHandler.h DaemonStatusRequestHandler.h GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h
all: all-am
.SUFFIXES:
@@ -246,6 +246,7 @@ distclean-compile:
@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@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogRequestHandler.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/Daemon/Backends/Makefile.am b/src/Daemon/Backends/Makefile.am
new file mode 100644
index 0000000..0fe0370
--- /dev/null
+++ b/src/Daemon/Backends/Makefile.am
@@ -0,0 +1 @@
+noinst_HEADERS = NetworkLogger.h
diff --git a/src/Daemon/Backends/Makefile.in b/src/Daemon/Backends/Makefile.in
new file mode 100644
index 0000000..71a1c65
--- /dev/null
+++ b/src/Daemon/Backends/Makefile.in
@@ -0,0 +1,384 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/Daemon/Backends
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSSAPI_LIBS = @GSSAPI_LIBS@
+GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
+GnuTLS_LIBS = @GnuTLS_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sigc_CFLAGS = @sigc_CFLAGS@
+sigc_LIBS = @sigc_LIBS@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_HEADERS = NetworkLogger.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Daemon/Backends/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Daemon/Backends/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+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
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+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
+
+# 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.
+.NOEXPORT:
diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h
new file mode 100644
index 0000000..b2895d2
--- /dev/null
+++ b/src/Daemon/Backends/NetworkLogger.h
@@ -0,0 +1,51 @@
+/*
+ * NetworkLogger.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_DAEMON_BACKENDS_NETWORKLOGGER_H_
+#define MAD_DAEMON_BACKENDS_NETWORKLOGGER_H_
+
+#include <Common/Logger.h>
+#include <Common/RequestManager.h>
+#include <Daemon/Requests/LogRequest.h>
+#include <Net/Connection.h>
+
+namespace Mad {
+namespace Daemon {
+namespace Backends {
+
+class NetworkLogger : public Common::Logger {
+ private:
+ Net::Connection *connection;
+
+ protected:
+ virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, const std::string &message) {
+ Common::RequestManager::getRequestManager()->sendRequest(connection,
+ std::auto_ptr<Common::RequestBase>(new Requests::LogRequest(category, level, message, Requests::LogRequest::slot_type()))
+ );
+ }
+
+ public:
+ NetworkLogger(Net::Connection *connection0) : connection(connection0) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_DAEMON_BACKENDS_NETWORKLOGGER_H_ */
diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am
index 61efc38..3aff4d6 100644
--- a/src/Daemon/Makefile.am
+++ b/src/Daemon/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = Requests RequestHandlers
+SUBDIRS = Backends Requests RequestHandlers
noinst_LTLIBRARIES = libdaemon.la
diff --git a/src/Daemon/Makefile.in b/src/Daemon/Makefile.in
index 6d8e60b..013ed72 100644
--- a/src/Daemon/Makefile.in
+++ b/src/Daemon/Makefile.in
@@ -195,7 +195,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = Requests RequestHandlers
+SUBDIRS = Backends Requests RequestHandlers
noinst_LTLIBRARIES = libdaemon.la
libdaemon_la_SOURCES =
libdaemon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la
diff --git a/src/Daemon/Requests/LogRequest.cpp b/src/Daemon/Requests/LogRequest.cpp
new file mode 100644
index 0000000..62115cc
--- /dev/null
+++ b/src/Daemon/Requests/LogRequest.cpp
@@ -0,0 +1,43 @@
+/*
+ * LogRequest.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 "LogRequest.h"
+#include <Net/Connection.h>
+#include <Net/Packets/LogPacket.h>
+
+namespace Mad {
+namespace Daemon {
+namespace Requests {
+
+void LogRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
+ connection->send(Net::Packets::LogPacket(Net::Packet::LOG, requestId, category, level, message));
+}
+
+void LogRequest::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/Daemon/Requests/LogRequest.h b/src/Daemon/Requests/LogRequest.h
new file mode 100644
index 0000000..a0a2e44
--- /dev/null
+++ b/src/Daemon/Requests/LogRequest.h
@@ -0,0 +1,49 @@
+/*
+ * LogRequest.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_DAEMON_REQUESTS_LOGREQUEST_H_
+#define MAD_DAEMON_REQUESTS_LOGREQUEST_H_
+
+#include <Common/Request.h>
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Daemon {
+namespace Requests {
+
+class LogRequest : public Common::Request<> {
+ private:
+ Common::Logger::MessageCategory category;
+ Common::Logger::MessageLevel level;
+ std::string message;
+
+ protected:
+ virtual void sendRequest(Net::Connection *connection, uint16_t requestId);
+ virtual void handlePacket(Net::Connection*, const Net::Packet &packet);
+
+ public:
+ LogRequest(Common::Logger::MessageCategory category0, Common::Logger::MessageLevel level0, const std::string &message0, slot_type slot)
+ : Common::Request<>(slot), category(category0), level(level0), message(message0) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_DAEMON_REQUESTS_LOGREQUEST_H_ */
diff --git a/src/Daemon/Requests/Makefile.am b/src/Daemon/Requests/Makefile.am
index 5de84de..6ea9548 100644
--- a/src/Daemon/Requests/Makefile.am
+++ b/src/Daemon/Requests/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = librequests.la
-librequests_la_SOURCES = IdentifyRequest.cpp
+librequests_la_SOURCES = IdentifyRequest.cpp LogRequest.cpp
-noinst_HEADERS = IdentifyRequest.h
+noinst_HEADERS = IdentifyRequest.h LogRequest.h
diff --git a/src/Daemon/Requests/Makefile.in b/src/Daemon/Requests/Makefile.in
index 9a63acc..d915874 100644
--- a/src/Daemon/Requests/Makefile.in
+++ b/src/Daemon/Requests/Makefile.in
@@ -48,7 +48,7 @@ CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
librequests_la_LIBADD =
-am_librequests_la_OBJECTS = IdentifyRequest.lo
+am_librequests_la_OBJECTS = IdentifyRequest.lo LogRequest.lo
librequests_la_OBJECTS = $(am_librequests_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -187,8 +187,8 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = librequests.la
-librequests_la_SOURCES = IdentifyRequest.cpp
-noinst_HEADERS = IdentifyRequest.h
+librequests_la_SOURCES = IdentifyRequest.cpp LogRequest.cpp
+noinst_HEADERS = IdentifyRequest.h LogRequest.h
all: all-am
.SUFFIXES:
@@ -241,6 +241,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdentifyRequest.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogRequest.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/Net/Packet.h b/src/Net/Packet.h
index 9c23132..6b6ed75 100644
--- a/src/Net/Packet.h
+++ b/src/Net/Packet.h
@@ -31,7 +31,7 @@ namespace Net {
class Packet {
public:
enum Type {
- OK = 0x0000, ERROR = 0x0001, DISCONNECT = 0x0002,
+ OK = 0x0000, ERROR = 0x0001, DISCONNECT = 0x0002, LOG = 0x0003,
GSSAPI_AUTH = 0x0010, IDENTIFY = 0x0011,
LIST_DAEMONS = 0x0020,
STATUS = 0x0030, DAEMON_STATUS = 0x0031
diff --git a/src/Net/Packets/LogPacket.cpp b/src/Net/Packets/LogPacket.cpp
new file mode 100644
index 0000000..97994b0
--- /dev/null
+++ b/src/Net/Packets/LogPacket.cpp
@@ -0,0 +1,51 @@
+/*
+ * LogPacket.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 "LogPacket.h"
+
+namespace Mad {
+namespace Net {
+namespace Packets {
+
+LogPacket::LogPacket(Type type, uint16_t requestId, Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, const std::string &message)
+: Packet(type, requestId)
+{
+ setLength(sizeof(LogData) + message.length());
+ logData = (LogData*)&rawData->data;
+
+ logData->category = htons(category);
+ logData->level = htons(level);
+
+ std::memcpy(logData->message, message.c_str(), message.length());
+}
+
+LogPacket& LogPacket::operator=(const Packet &p) {
+ Packet::operator=(p);
+
+ if(getLength() < sizeof(LogData))
+ setLength(sizeof(LogData));
+
+ logData = (LogData*)&rawData->data;
+
+ return *this;
+}
+
+}
+}
+}
diff --git a/src/Net/Packets/LogPacket.h b/src/Net/Packets/LogPacket.h
new file mode 100644
index 0000000..814ea28
--- /dev/null
+++ b/src/Net/Packets/LogPacket.h
@@ -0,0 +1,79 @@
+/*
+ * LogPacket.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_NET_PACKETS_LOGPACKET_H_
+#define MAD_NET_PACKETS_LOGPACKET_H_
+
+#include "../Packet.h"
+#include <Common/Logger.h>
+
+#include <string>
+
+namespace Mad {
+namespace Net {
+namespace Packets {
+
+class LogPacket : public Packet {
+ protected:
+ struct LogData {
+ uint16_t category;
+ uint16_t level;
+ uint8_t message[0];
+ };
+
+ LogData *logData;
+
+ public:
+ LogPacket(Type type, uint16_t requestId, Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, const std::string &message);
+
+ LogPacket(const Packet &p) : Packet(p) {
+ if(getLength() < sizeof(LogData))
+ setLength(sizeof(LogData));
+
+ logData = (LogData*)&rawData->data;
+ }
+
+ LogPacket(const LogPacket &p) : Packet(p) {
+ logData = (LogData*)&rawData->data;
+ }
+
+ LogPacket& operator=(const Packet &p);
+
+ LogPacket& operator=(const LogPacket &p) {
+ return (*this = (Packet)p);
+ }
+
+ Common::Logger::MessageCategory getCategory() const {
+ return (Common::Logger::MessageCategory)ntohs(logData->category);
+ }
+
+ Common::Logger::MessageLevel getLevel() const {
+ return (Common::Logger::MessageLevel)ntohs(logData->level);
+ }
+
+ std::string getMessage() const {
+ return std::string((char*)logData->message, getLength()-sizeof(LogData));
+ }
+};
+
+}
+}
+}
+
+#endif /* MAD_NET_PACKETS_LOGPACKET_H_ */
diff --git a/src/Net/Packets/Makefile.am b/src/Net/Packets/Makefile.am
index 6402c10..0b44f6d 100644
--- a/src/Net/Packets/Makefile.am
+++ b/src/Net/Packets/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libpackets.la
-libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp
+libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp LogPacket.cpp
-noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h
+noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h LogPacket.h
diff --git a/src/Net/Packets/Makefile.in b/src/Net/Packets/Makefile.in
index b258c93..9109103 100644
--- a/src/Net/Packets/Makefile.in
+++ b/src/Net/Packets/Makefile.in
@@ -49,7 +49,7 @@ CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libpackets_la_LIBADD =
am_libpackets_la_OBJECTS = ErrorPacket.lo HostListPacket.lo \
- HostStatusPacket.lo
+ HostStatusPacket.lo LogPacket.lo
libpackets_la_OBJECTS = $(am_libpackets_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -188,8 +188,8 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libpackets.la
-libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp
-noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h
+libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp LogPacket.cpp
+noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h LogPacket.h
all: all-am
.SUFFIXES:
@@ -244,6 +244,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ErrorPacket.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HostListPacket.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HostStatusPacket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogPacket.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/mad.cpp b/src/mad.cpp
index 3486a6a..309660d 100644
--- a/src/mad.cpp
+++ b/src/mad.cpp
@@ -25,6 +25,7 @@
#include "Common/Request.h"
#include "Common/RequestManager.h"
#include "Common/RequestHandlers/StatusRequestHandler.h"
+#include "Daemon/Backends/NetworkLogger.h"
#include "Daemon/Requests/IdentifyRequest.h"
#include <unistd.h>
@@ -32,13 +33,13 @@
using namespace Mad;
-static void requestFinished(const Mad::Common::Request<>&) {
+static void requestFinished(const Common::Request<>&) {
Common::Logger::log("Identified.");
}
int main() {
- Common::Backends::ConsoleLogger logger;
- Common::Logger::registerLogger(&logger);
+ Common::Backends::ConsoleLogger consoleLogger;
+ Common::Logger::registerLogger(&consoleLogger);
Net::Connection::init();
@@ -61,6 +62,10 @@ int main() {
Common::RequestManager::getRequestManager()->registerConnection(connection);
+ Daemon::Backends::NetworkLogger networkLogger(connection);
+ Common::Logger::registerLogger(&networkLogger);
+
+
//char hostname[256];
//gethostname(hostname, sizeof(hostname));
//Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished))));
@@ -73,6 +78,8 @@ int main() {
connection->sendReceive(fd.revents);
}
+ Common::Logger::unregisterLogger(&networkLogger);
+
Common::RequestManager::getRequestManager()->unregisterConnection(connection);
}
catch(Mad::Common::Exception &e) {