summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-12-12 20:34:13 +0100
committerMatthias Schiffer <matthias@gamezock.de>2008-12-12 20:34:13 +0100
commit5563591965b51f89f61859ef1a88ae8ff6eff106 (patch)
treed111e19f7e3a69db5ed1eee47b9cb82345194213 /src/modules
parent80b922b1557b2d6cee1e4ced3c08a26002d969e9 (diff)
downloadmad-5563591965b51f89f61859ef1a88ae8ff6eff106.tar
mad-5563591965b51f89f61859ef1a88ae8ff6eff106.zip
UserBackendMysql angefangen
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/Makefile.am8
-rw-r--r--src/modules/Makefile.in33
-rw-r--r--src/modules/SystemBackendPosix.h8
-rw-r--r--src/modules/SystemBackendProc.h8
-rw-r--r--src/modules/UserBackendMysql.cpp50
-rw-r--r--src/modules/UserBackendMysql.h64
6 files changed, 153 insertions, 18 deletions
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 40e15cc..a40da15 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -1,7 +1,7 @@
madlibdir = ${libdir}/mad
moddir = ${madlibdir}/modules
-mod_LTLIBRARIES = SystemBackendPosix.la SystemBackendProc.la
+mod_LTLIBRARIES = SystemBackendPosix.la SystemBackendProc.la UserBackendMysql.la
SystemBackendPosix_la_SOURCES = SystemBackendPosix.cpp
SystemBackendPosix_la_LIBADD = $(sigc_LIBS)
@@ -10,4 +10,8 @@ SystemBackendPosix_la_LDFLAGS = -module -avoid-version -export-dynamic -static -
SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
SystemBackendProc_la_LDFLAGS = -module -avoid-version -export-dynamic -static -export-symbols-regex '^SystemBackendProc_LTX_'
-noinst_HEADERS = SystemBackendPosix.h SystemBackendProc.h
+UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
+UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
+UserBackendMysql_la_LDFLAGS = -module -avoid-version -export-dynamic -export-symbols-regex '^UserBackendMysql_LTX_'
+
+noinst_HEADERS = SystemBackendPosix.h SystemBackendProc.h UserBackendMysql.h
diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in
index bc464ef..86ab52b 100644
--- a/src/modules/Makefile.in
+++ b/src/modules/Makefile.in
@@ -38,10 +38,11 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -69,6 +70,12 @@ SystemBackendProc_la_OBJECTS = $(am_SystemBackendProc_la_OBJECTS)
SystemBackendProc_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(SystemBackendProc_la_LDFLAGS) $(LDFLAGS) -o $@
+UserBackendMysql_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_UserBackendMysql_la_OBJECTS = UserBackendMysql.lo
+UserBackendMysql_la_OBJECTS = $(am_UserBackendMysql_la_OBJECTS)
+UserBackendMysql_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(UserBackendMysql_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@@ -82,9 +89,9 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(SystemBackendPosix_la_SOURCES) \
- $(SystemBackendProc_la_SOURCES)
+ $(SystemBackendProc_la_SOURCES) $(UserBackendMysql_la_SOURCES)
DIST_SOURCES = $(SystemBackendPosix_la_SOURCES) \
- $(SystemBackendProc_la_SOURCES)
+ $(SystemBackendProc_la_SOURCES) $(UserBackendMysql_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -149,6 +156,10 @@ LT_DLPREOPEN = @LT_DLPREOPEN@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_CONFIG = @MYSQL_CONFIG@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+MYSQL_VERSION = @MYSQL_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
@@ -228,13 +239,16 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
madlibdir = ${libdir}/mad
moddir = ${madlibdir}/modules
-mod_LTLIBRARIES = SystemBackendPosix.la SystemBackendProc.la
+mod_LTLIBRARIES = SystemBackendPosix.la SystemBackendProc.la UserBackendMysql.la
SystemBackendPosix_la_SOURCES = SystemBackendPosix.cpp
SystemBackendPosix_la_LIBADD = $(sigc_LIBS)
SystemBackendPosix_la_LDFLAGS = -module -avoid-version -export-dynamic -static -export-symbols-regex '^SystemBackendPosix_LTX_'
SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
SystemBackendProc_la_LDFLAGS = -module -avoid-version -export-dynamic -static -export-symbols-regex '^SystemBackendProc_LTX_'
-noinst_HEADERS = SystemBackendPosix.h SystemBackendProc.h
+UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
+UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
+UserBackendMysql_la_LDFLAGS = -module -avoid-version -export-dynamic -export-symbols-regex '^UserBackendMysql_LTX_'
+noinst_HEADERS = SystemBackendPosix.h SystemBackendProc.h UserBackendMysql.h
all: all-am
.SUFFIXES:
@@ -299,6 +313,8 @@ SystemBackendPosix.la: $(SystemBackendPosix_la_OBJECTS) $(SystemBackendPosix_la_
$(SystemBackendPosix_la_LINK) -rpath $(moddir) $(SystemBackendPosix_la_OBJECTS) $(SystemBackendPosix_la_LIBADD) $(LIBS)
SystemBackendProc.la: $(SystemBackendProc_la_OBJECTS) $(SystemBackendProc_la_DEPENDENCIES)
$(SystemBackendProc_la_LINK) -rpath $(moddir) $(SystemBackendProc_la_OBJECTS) $(SystemBackendProc_la_LIBADD) $(LIBS)
+UserBackendMysql.la: $(UserBackendMysql_la_OBJECTS) $(UserBackendMysql_la_DEPENDENCIES)
+ $(UserBackendMysql_la_LINK) -rpath $(moddir) $(UserBackendMysql_la_OBJECTS) $(UserBackendMysql_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -308,6 +324,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackendPosix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackendProc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserBackendMysql.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/modules/SystemBackendPosix.h b/src/modules/SystemBackendPosix.h
index 9be16af..bbf1941 100644
--- a/src/modules/SystemBackendPosix.h
+++ b/src/modules/SystemBackendPosix.h
@@ -17,8 +17,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_MODULE_SYSTEMBACKENDPOSIX_H_
-#define MAD_MODULE_SYSTEMBACKENDPOSIX_H_
+#ifndef MAD_MODULES_SYSTEMBACKENDPOSIX_H_
+#define MAD_MODULES_SYSTEMBACKENDPOSIX_H_
#include <Common/SystemBackend.h>
@@ -33,7 +33,7 @@
namespace Mad {
namespace Modules {
-class SystemBackendPosix : public Common::SystemBackend {
+class SystemBackendPosix : private Common::SystemBackend {
private:
static SystemBackendPosix *backend;
static std::map<pid_t, sigc::slot<void, int> > processes;
@@ -93,4 +93,4 @@ class SystemBackendPosix : public Common::SystemBackend {
}
}
-#endif /* MAD_MODULE_SYSTEMBACKENDPOSIX_H_ */
+#endif /* MAD_MODULES_SYSTEMBACKENDPOSIX_H_ */
diff --git a/src/modules/SystemBackendProc.h b/src/modules/SystemBackendProc.h
index db3c743..bd4767d 100644
--- a/src/modules/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc.h
@@ -17,8 +17,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_MODULE_SYSTEMBACKENDPROC_H_
-#define MAD_MODULE_SYSTEMBACKENDPROC_H_
+#ifndef MAD_MODULES_SYSTEMBACKENDPROC_H_
+#define MAD_MODULES_SYSTEMBACKENDPROC_H_
#include <Common/SystemBackend.h>
@@ -27,7 +27,7 @@
namespace Mad {
namespace Modules {
-class SystemBackendProc : public Common::SystemBackend {
+class SystemBackendProc : private Common::SystemBackend {
private:
static SystemBackendProc *backend;
@@ -64,4 +64,4 @@ class SystemBackendProc : public Common::SystemBackend {
}
}
-#endif /* MAD_MODULE_SYSTEMBACKENDPROC_H_ */
+#endif /* MAD_MODULES_SYSTEMBACKENDPROC_H_ */
diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp
new file mode 100644
index 0000000..f27bea5
--- /dev/null
+++ b/src/modules/UserBackendMysql.cpp
@@ -0,0 +1,50 @@
+/*
+ * UserBackendMysql.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 "UserBackendMysql.h"
+
+#define init UserBackendMysql_LTX_init
+#define deinit UserBackendMysql_LTX_deinit
+
+
+namespace Mad {
+namespace Modules {
+
+bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry&, bool handled) {
+
+}
+
+void UserBackendMysql::configFinished() {
+ UserBackend::registerBackend(backend);
+}
+
+}
+}
+
+extern "C" {
+
+void init() {
+ Mad::Modules::UserBackendMysql::registerBackend();
+}
+
+void deinit() {
+ Mad::Modules::UserBackendMysql::unregisterBackend();
+}
+
+}
diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h
new file mode 100644
index 0000000..7e134e5
--- /dev/null
+++ b/src/modules/UserBackendMysql.h
@@ -0,0 +1,64 @@
+/*
+ * UserBackendMysql.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_MODULES_USERBACKENDMYSQL_H_
+#define MAD_MODULES_USERBACKENDMYSQL_H_
+
+#include <Core/UserBackend.h>
+#include <Common/Configurable.h>
+#include <Common/ConfigManager.h>
+
+
+namespace Mad {
+namespace Modules {
+
+class UserBackendMysql : private Core::UserBackend, private Common::Configurable {
+ private:
+ static UserBackendMysql *backend;
+
+ UserBackendMysql() {}
+
+ protected:
+ virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool);
+ virtual void configFinished();
+
+ public:
+ static void registerBackend() {
+ if(backend)
+ return;
+
+ backend = new UserBackendMysql();
+ Common::ConfigManager::get()->registerConfigurable(backend);
+ }
+
+ static void unregisterBackend() {
+ if(!backend)
+ return;
+
+ Common::ConfigManager::get()->unregisterConfigurable(backend);
+ UserBackend::unregisterBackend(backend);
+ delete backend;
+ backend = 0;
+ }
+};
+
+}
+}
+
+#endif /* MAD_MODULES_USERBACKENDMYSQL_H_ */