summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Backends/Makefile.am5
-rw-r--r--src/Common/Backends/Makefile.in442
-rw-r--r--src/Common/Backends/SystemBackendProc.cpp53
-rw-r--r--src/Common/Backends/SystemBackendProc.h45
-rw-r--r--src/Common/ConfigManager.cpp6
-rw-r--r--src/Common/ConfigManager.h6
-rw-r--r--src/Common/Makefile.am7
-rw-r--r--src/Common/Makefile.in13
-rw-r--r--src/Common/Request/CoreStatusRequest.h10
-rw-r--r--src/Common/Request/DisconnectRequest.h2
-rw-r--r--src/Common/Request/GSSAPIAuthRequest.h2
-rw-r--r--src/Common/Request/IdentifyRequest.h2
-rw-r--r--src/Common/Request/Request.h2
-rw-r--r--src/Common/RequestManager.cpp2
-rw-r--r--src/Common/RequestManager.h12
-rw-r--r--src/Common/SystemBackend.cpp28
-rw-r--r--src/Common/SystemBackend.h61
17 files changed, 673 insertions, 25 deletions
diff --git a/src/Common/Backends/Makefile.am b/src/Common/Backends/Makefile.am
new file mode 100644
index 0000000..aa705d8
--- /dev/null
+++ b/src/Common/Backends/Makefile.am
@@ -0,0 +1,5 @@
+noinst_LTLIBRARIES = libbackends.la
+libbackends_la_SOURCES = SystemBackendProc.cpp
+
+noinst_HEADERS = SystemBackendProc.h
+
diff --git a/src/Common/Backends/Makefile.in b/src/Common/Backends/Makefile.in
new file mode 100644
index 0000000..431e582
--- /dev/null
+++ b/src/Common/Backends/Makefile.in
@@ -0,0 +1,442 @@
+# 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/Common/Backends
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libbackends_la_LIBADD =
+am_libbackends_la_OBJECTS = SystemBackendProc.lo
+libbackends_la_OBJECTS = $(am_libbackends_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 = $(libbackends_la_SOURCES)
+DIST_SOURCES = $(libbackends_la_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@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+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@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+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@
+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_F77 = @ac_ct_F77@
+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@
+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_LTLIBRARIES = libbackends.la
+libbackends_la_SOURCES = SystemBackendProc.cpp
+noinst_HEADERS = SystemBackendProc.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 \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Common/Backends/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Common/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
+
+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
+libbackends.la: $(libbackends_la_OBJECTS) $(libbackends_la_DEPENDENCIES)
+ $(CXXLINK) $(libbackends_la_OBJECTS) $(libbackends_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackendProc.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
+
+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 $(LTLIBRARIES) $(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 clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile 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 -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile 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 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.
+.NOEXPORT:
diff --git a/src/Common/Backends/SystemBackendProc.cpp b/src/Common/Backends/SystemBackendProc.cpp
new file mode 100644
index 0000000..d33fbf3
--- /dev/null
+++ b/src/Common/Backends/SystemBackendProc.cpp
@@ -0,0 +1,53 @@
+/*
+ * SystemBackendProc.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 "SystemBackendProc.h"
+#include <fstream>
+
+namespace Mad {
+namespace Common {
+namespace Backends {
+
+SystemBackendProc::Uptime SystemBackendProc::getUptime() const {
+ Uptime uptime = {0, 0};
+
+ std::ifstream file("/proc/uptime");
+
+ if(!file.good())
+ return uptime;
+
+ float f;
+ file >> f;
+ if(!file.good())
+ return uptime;
+
+ uptime.uptime = (uint32_t)f;
+
+ file >> f;
+ if(!file.good())
+ return uptime;
+
+ uptime.idleTime = (uint32_t)f;
+
+ return uptime;
+}
+
+}
+}
+}
diff --git a/src/Common/Backends/SystemBackendProc.h b/src/Common/Backends/SystemBackendProc.h
new file mode 100644
index 0000000..af34eee
--- /dev/null
+++ b/src/Common/Backends/SystemBackendProc.h
@@ -0,0 +1,45 @@
+/*
+ * SystemBackendProc.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_COMMON_BACKENDS_SYSTEMBACKENDPROC_H_
+#define MAD_COMMON_BACKENDS_SYSTEMBACKENDPROC_H_
+
+#include "../SystemBackend.h"
+
+namespace Mad {
+namespace Common {
+namespace Backends {
+
+class SystemBackendProc : public SystemBackend {
+ private:
+ SystemBackendProc() {}
+
+ public:
+ static void useBackend() {
+ setBackend(new SystemBackendProc());
+ }
+
+ virtual Uptime getUptime() const;
+};
+
+}
+}
+}
+
+#endif /* MAD_COMMON_BACKENDS_SYSTEMBACKENDPROC_H_ */
diff --git a/src/Common/ConfigManager.cpp b/src/Common/ConfigManager.cpp
index 4d0e476..a363862 100644
--- a/src/Common/ConfigManager.cpp
+++ b/src/Common/ConfigManager.cpp
@@ -19,6 +19,8 @@
#include "ConfigManager.h"
#include "Util.h"
+#include "Backends/SystemBackendProc.h"
+
#include <fstream>
#include <stdexcept>
@@ -90,5 +92,9 @@ bool ConfigManager::loadFile(const std::string &filename) {
return true;
}
+void ConfigManager::initBackends() {
+ Backends::SystemBackendProc::useBackend();
+}
+
}
}
diff --git a/src/Common/ConfigManager.h b/src/Common/ConfigManager.h
index 68669d3..5c94614 100644
--- a/src/Common/ConfigManager.h
+++ b/src/Common/ConfigManager.h
@@ -28,12 +28,16 @@ namespace Common {
class ConfigManager {
protected:
- ConfigManager() {}
+ ConfigManager() {
+ initBackends();
+ }
virtual bool parseLine(const std::vector<std::string> &section, const std::string &key, const std::string &value = std::string()) = 0;
bool loadFile(const std::string &filename);
+ void initBackends();
+
public:
virtual ~ConfigManager() {}
};
diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am
index f04f3db..cd1b8c0 100644
--- a/src/Common/Makefile.am
+++ b/src/Common/Makefile.am
@@ -1,6 +1,7 @@
-SUBDIRS = Request
+SUBDIRS = Backends Request
noinst_LTLIBRARIES = libcommon.la
-libcommon_la_SOURCES = ConfigManager.cpp RequestManager.cpp
+libcommon_la_SOURCES = ConfigManager.cpp RequestManager.cpp SystemBackend.cpp
+libcommon_la_LIBADD = Backends/libbackends.la
-noinst_HEADERS = ConfigManager.h RequestHandler.h RequestManager.h Util.h
+noinst_HEADERS = ConfigManager.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in
index 9e02df1..7c805e9 100644
--- a/src/Common/Makefile.in
+++ b/src/Common/Makefile.in
@@ -44,8 +44,9 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libcommon_la_LIBADD =
-am_libcommon_la_OBJECTS = ConfigManager.lo RequestManager.lo
+libcommon_la_DEPENDENCIES = Backends/libbackends.la
+am_libcommon_la_OBJECTS = ConfigManager.lo RequestManager.lo \
+ SystemBackend.lo
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -189,10 +190,11 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = Request
+SUBDIRS = Backends Request
noinst_LTLIBRARIES = libcommon.la
-libcommon_la_SOURCES = ConfigManager.cpp RequestManager.cpp
-noinst_HEADERS = ConfigManager.h RequestHandler.h RequestManager.h Util.h
+libcommon_la_SOURCES = ConfigManager.cpp RequestManager.cpp SystemBackend.cpp
+libcommon_la_LIBADD = Backends/libbackends.la
+noinst_HEADERS = ConfigManager.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
all: all-recursive
.SUFFIXES:
@@ -246,6 +248,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestManager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackend.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/Common/Request/CoreStatusRequest.h b/src/Common/Request/CoreStatusRequest.h
index 97f8318..cd28cc2 100644
--- a/src/Common/Request/CoreStatusRequest.h
+++ b/src/Common/Request/CoreStatusRequest.h
@@ -23,7 +23,7 @@
#include "Request.h"
#include "../RequestManager.h"
#include <Net/Connection.h>
-#include <Net/Packet.h>
+#include <Net/Packets/CoreStatusPacket.h>
#include <sigc++/signal.h>
@@ -33,12 +33,12 @@ namespace Request {
class CoreStatusRequest: public Request {
private:
- sigc::signal<void> finished;
+ sigc::signal<void,const Net::Packets::CoreStatusPacket&> finished;
CoreStatusRequest() {}
public:
- static bool send(Net::Connection *connection, RequestManager &requestManager, const sigc::slot<void> &callback) {
+ static bool send(Net::Connection *connection, RequestManager &requestManager, const sigc::slot<void,const Net::Packets::CoreStatusPacket&> &callback) {
CoreStatusRequest *request = new CoreStatusRequest();
request->finished.connect(callback);
@@ -50,7 +50,7 @@ class CoreStatusRequest: public Request {
return false;
}
- virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) {
+ virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) {
if(isSent())
return false;
@@ -68,7 +68,7 @@ class CoreStatusRequest: public Request {
if(packet.getType() != Net::Packet::TYPE_OK)
return false; // TODO Logging
- finished();
+ finished(Net::Packets::CoreStatusPacket(packet));
setFinished();
return true;
diff --git a/src/Common/Request/DisconnectRequest.h b/src/Common/Request/DisconnectRequest.h
index c20a3d0..3f6e018 100644
--- a/src/Common/Request/DisconnectRequest.h
+++ b/src/Common/Request/DisconnectRequest.h
@@ -50,7 +50,7 @@ class DisconnectRequest: public Request {
return false;
}
- virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) {
+ virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) {
if(isSent())
return false;
diff --git a/src/Common/Request/GSSAPIAuthRequest.h b/src/Common/Request/GSSAPIAuthRequest.h
index 138107e..ff92755 100644
--- a/src/Common/Request/GSSAPIAuthRequest.h
+++ b/src/Common/Request/GSSAPIAuthRequest.h
@@ -65,7 +65,7 @@ class GSSAPIAuthRequest : public Request {
return false;
}
- virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) {
+ virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) {
if(isSent())
return false;
diff --git a/src/Common/Request/IdentifyRequest.h b/src/Common/Request/IdentifyRequest.h
index e88ce4b..dfb6ce6 100644
--- a/src/Common/Request/IdentifyRequest.h
+++ b/src/Common/Request/IdentifyRequest.h
@@ -49,7 +49,7 @@ class IdentifyRequest: public Request {
return false;
}
- virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) {
+ virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) {
if(isSent())
return false;
diff --git a/src/Common/Request/Request.h b/src/Common/Request/Request.h
index 5c8d6c4..657a0a7 100644
--- a/src/Common/Request/Request.h
+++ b/src/Common/Request/Request.h
@@ -38,7 +38,7 @@ class Request : public RequestHandler {
public:
bool isSent() const {return sent;}
- virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) = 0;
+ virtual bool sendRequest(Net::Connection *connection, uint16_t requestId) = 0;
};
}
diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp
index 82fc1af..c9761d2 100644
--- a/src/Common/RequestManager.cpp
+++ b/src/Common/RequestManager.cpp
@@ -84,7 +84,7 @@ bool RequestManager::sendRequest(Net::Connection *connection, Request::Request *
RequestMap *requestMap = it->second;
- unsigned short id;
+ uint16_t id;
do {
id = getRequestId();
} while(requestMap->findRequest(id));
diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h
index 77eca52..a783fe2 100644
--- a/src/Common/RequestManager.h
+++ b/src/Common/RequestManager.h
@@ -33,7 +33,7 @@ class Request;
class RequestManager {
private:
- class RequestMap : private std::map<unsigned short,RequestHandler*> {
+ class RequestMap : private std::map<uint16_t,RequestHandler*> {
private:
// Prevent shallow copy
RequestMap(const RequestMap &o);
@@ -47,11 +47,11 @@ class RequestManager {
delete it->second;
}
- bool addRequest(unsigned short id, RequestHandler *info) {
+ bool addRequest(uint16_t id, RequestHandler *info) {
return insert(std::make_pair(id, info)).second;
}
- RequestHandler* findRequest(unsigned short id) {
+ RequestHandler* findRequest(uint16_t id) {
iterator it = find(id);
if(it == end())
return 0;
@@ -59,7 +59,7 @@ class RequestManager {
return it->second;
}
- bool deleteRequest(unsigned short id) {
+ bool deleteRequest(uint16_t id) {
iterator it = find(id);
if(it == end())
return false;
@@ -92,11 +92,11 @@ class RequestManager {
RequestManager& operator=(const RequestManager &o);
std::map<Net::Connection*,RequestMap*> requestMaps;
- unsigned short requestId;
+ uint16_t requestId;
std::map<Net::Packet::Type,RequestHandlerFactory*> requestHandlerFactories;
- unsigned short getRequestId() {
+ uint16_t getRequestId() {
return requestId+=2;
}
diff --git a/src/Common/SystemBackend.cpp b/src/Common/SystemBackend.cpp
new file mode 100644
index 0000000..8b9aa0d
--- /dev/null
+++ b/src/Common/SystemBackend.cpp
@@ -0,0 +1,28 @@
+/*
+ * SystemBackend.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 "SystemBackend.h"
+
+namespace Mad {
+namespace Common {
+
+SystemBackend *SystemBackend::backend = new SystemBackend();
+
+}
+}
diff --git a/src/Common/SystemBackend.h b/src/Common/SystemBackend.h
new file mode 100644
index 0000000..f88ddd9
--- /dev/null
+++ b/src/Common/SystemBackend.h
@@ -0,0 +1,61 @@
+/*
+ * SystemBackend.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_COMMON_SYSTEMBACKEND_H_
+#define MAD_COMMON_SYSTEMBACKEND_H_
+
+#include <stdint.h>
+
+namespace Mad {
+namespace Common {
+
+class SystemBackend {
+ private:
+ static SystemBackend *backend;
+
+ protected:
+ SystemBackend() {}
+
+ static void setBackend(SystemBackend *backend0) {
+ delete backend;
+ backend = backend0;
+ }
+
+ public:
+ struct Uptime {
+ uint32_t uptime;
+ uint32_t idleTime;
+ };
+
+ virtual ~SystemBackend() {}
+
+ virtual Uptime getUptime() const {
+ Uptime ret = {0, 0};
+ return ret;
+ }
+
+ static SystemBackend *getBackend() {
+ return backend;
+ }
+};
+
+}
+}
+
+#endif /* MAD_COMMON_SYSTEMBACKEND_H_ */