summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-17 11:43:35 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-17 11:43:35 +0200
commit4f1d1ad7c3105fc8ef8408465258c27c943b86cd (patch)
treef60c43528aba4c8d8cd4372171b1943a59e7f1bc /src
parent303d1780ffcaa0124ed9e641403f2618f300076e (diff)
downloadabrt-4f1d1ad7c3105fc8ef8408465258c27c943b86cd.tar.gz
abrt-4f1d1ad7c3105fc8ef8408465258c27c943b86cd.tar.xz
abrt-4f1d1ad7c3105fc8ef8408465258c27c943b86cd.zip
Move lib/Utils/DBusClientProxy.* to src/Applet/; do not link rpm to libABRTUtils
As a result, we can drop these libs from libABRTUtils: libbz2.so.1 => /lib64/libbz2.so.1 (0x00007ff8934ef000) libdb-4.7.so => /lib64/libdb-4.7.so (0x00007ff8921ae000) libdbus-c++-1.so.0 => /usr/lib64/libdbus-c++-1.so.0 (0x00007ff895276000) libelf.so.1 => /usr/lib64/libelf.so.1 (0x00007ff8930c5000) liblua-5.1.so => /usr/lib64/liblua-5.1.so (0x00007ff892c7a000) liblzma.so.0 => /usr/lib64/liblzma.so.0 (0x00007ff892ea5000) libnspr4.so => /lib64/libnspr4.so (0x00007ff890ec2000) libnss3.so => /lib64/libnss3.so (0x00007ff892948000) libnssutil3.so => /lib64/libnssutil3.so (0x00007ff891505000) libplc4.so => /lib64/libplc4.so (0x00007ff891300000) libplds4.so => /lib64/libplds4.so (0x00007ff8910fd000) libpopt.so.0 => /lib64/libpopt.so.0 (0x00007ff89273f000) librpmio.so.0 => /usr/lib64/librpmio.so.0 (0x00007ff8954a8000) librpm.so.0 => /usr/lib64/librpm.so.0 (0x00007ff8956d9000) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r--src/Applet/DBusClientProxy.cpp239
-rw-r--r--src/Applet/DBusClientProxy.h108
-rw-r--r--src/Applet/Makefile.am25
-rw-r--r--src/CLI/Makefile.am11
-rw-r--r--src/Daemon/Makefile.am30
-rw-r--r--src/Hooks/Makefile.am23
6 files changed, 397 insertions, 39 deletions
diff --git a/src/Applet/DBusClientProxy.cpp b/src/Applet/DBusClientProxy.cpp
new file mode 100644
index 00000000..ccb48d53
--- /dev/null
+++ b/src/Applet/DBusClientProxy.cpp
@@ -0,0 +1,239 @@
+/*
+ Copyright (C) 2009 Jiri Moskovcak (jmoskovc@redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ 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 2 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, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "DBusClientProxy.h"
+#include <iostream>
+
+namespace org {
+namespace freedesktop {
+namespace DBus {
+
+/* class DaemonWatcher_proxy */
+
+/* public: */
+
+DaemonWatcher_proxy::DaemonWatcher_proxy()
+: ::DBus::InterfaceProxy("org.freedesktop.DBus")
+{
+ m_pStateChangeHandler_cb_data = NULL;
+ m_pStateChangeHandler = NULL;
+ connect_signal(DaemonWatcher_proxy, NameOwnerChanged, _DaemonStateChanged);
+}
+
+void DaemonWatcher_proxy::ConnectStateChangeHandler(void (*pStateChangeHandler)(bool running, void* data), void *cb_data)
+{
+ m_pStateChangeHandler_cb_data = cb_data;
+ m_pStateChangeHandler = pStateChangeHandler;
+}
+
+/* private: */
+
+/* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+void DaemonWatcher_proxy::_DaemonStateChanged(const ::DBus::SignalMessage &sig)
+{
+ ::DBus::MessageIter ri = sig.reader();
+ std::string name;
+ std::string old_owner;
+ std::string new_owner;
+ ri >> name;
+ ri >> old_owner;
+ ri >> new_owner;
+ if(name.compare("com.redhat.abrt") == 0)
+ {
+ if(new_owner.length() > 0)
+ {
+ if(m_pStateChangeHandler)
+ {
+ m_pStateChangeHandler(true,m_pStateChangeHandler_cb_data);
+ }
+ else
+ {
+ std::cout << "Daemon appeared!" << std::endl;
+ }
+ }
+ if(new_owner.length() == 0)
+ {
+ if(m_pStateChangeHandler)
+ {
+ m_pStateChangeHandler(false, m_pStateChangeHandler_cb_data);
+ }
+ else
+ {
+ std::cout << "Daemon dissapeared!" << std::endl;
+ }
+ }
+ }
+}
+
+} } } /* closing namespaces */
+
+
+/* class DaemonWatcher */
+
+/* public: */
+
+DaemonWatcher::DaemonWatcher(DBus::Connection &connection, const char *path, const char *name)
+: ::DBus::ObjectProxy(connection, path, name)
+{
+}
+DaemonWatcher::~DaemonWatcher()
+{
+ std::cout << "~DaemonWatcher" << std::endl;
+}
+
+
+/* class CDBusClient_proxy */
+
+/* public: */
+
+CDBusClient_proxy::CDBusClient_proxy()
+: DBus::InterfaceProxy(CC_DBUS_IFACE)
+{
+ connect_signal(CDBusClient_proxy, Crash, _Crash_stub);
+ connect_signal(CDBusClient_proxy, JobDone, _JobDone_stub);
+ m_sConnName = "";
+}
+
+CDBusClient_proxy::CDBusClient_proxy(::DBus::Connection &pConnection)
+: DBus::InterfaceProxy(CC_DBUS_IFACE)
+{
+ gloop = g_main_loop_new(NULL, false);
+ //# define connect_signal(interface, signal, callback)
+ connect_signal(CDBusClient_proxy, Crash, _Crash_stub);
+ connect_signal(CDBusClient_proxy, JobDone, _JobDone_stub);
+ m_sConnName = pConnection.unique_name();
+}
+
+/* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ /*
+
+ <
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ ...
+ >
+ */
+vector_crash_infos_t CDBusClient_proxy::GetCrashInfos()
+{
+ DBus::CallMessage call;
+ DBus::MessageIter wi = call.writer();
+
+ call.member("GetCrashInfos");
+ DBus::Message ret = invoke_method(call);
+ DBus::MessageIter ri = ret.reader();
+
+ vector_crash_infos_t argout;
+ ri >> argout;
+ return argout;
+}
+
+bool CDBusClient_proxy::DeleteDebugDump(const std::string& pUUID)
+{
+ DBus::CallMessage call;
+
+ DBus::MessageIter wi = call.writer();
+
+ wi << pUUID;
+ call.member("DeleteDebugDump");
+ DBus::Message ret = invoke_method(call);
+ DBus::MessageIter ri = ret.reader();
+
+ bool argout;
+ ri >> argout;
+ return argout;
+}
+
+map_crash_report_t CDBusClient_proxy::CreateReport(const std::string& pUUID)
+{
+ m_bJobDone = false;
+ DBus::CallMessage call;
+
+ DBus::MessageIter wi = call.writer();
+
+ wi << pUUID;
+ call.member("CreateReport");
+ DBus::Message ret = invoke_method(call);
+ DBus::MessageIter ri = ret.reader();
+ ri >> m_iPendingJobID;
+ //FIXME: what if the report is created before we start the loop? (we miss the signal and get stuck in the loop)
+ g_main_loop_run(gloop);
+ return GetJobResult(m_iPendingJobID);
+};
+
+void CDBusClient_proxy::Report(const map_crash_report_t& pReport)
+{
+ DBus::CallMessage call;
+
+ DBus::MessageIter wi = call.writer();
+
+ wi << pReport;
+ call.member("Report");
+ DBus::Message ret = invoke_method(call);
+ DBus::MessageIter ri = ret.reader();
+}
+
+map_crash_report_t CDBusClient_proxy::GetJobResult(uint64_t pJobID)
+{
+ DBus::CallMessage call;
+
+ DBus::MessageIter wi = call.writer();
+
+ wi << pJobID;
+ call.member("GetJobResult");
+ DBus::Message ret = invoke_method(call);
+ DBus::MessageIter ri = ret.reader();
+ map_crash_report_t argout;
+ ri >> argout;
+ return argout;
+}
+
+/* signal handlers for this interface
+ */
+void CDBusClient_proxy::Crash(const std::string& progname, const std::string& uid)
+{
+}
+
+/* private: */
+
+/* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+void CDBusClient_proxy::_Crash_stub(const ::DBus::SignalMessage &sig)
+{
+ DBus::MessageIter ri = sig.reader();
+
+ std::string progname; ri >> progname;
+ std::string uid; ri >> uid;
+ Crash(progname, uid);
+}
+
+void CDBusClient_proxy::_JobDone_stub(const ::DBus::SignalMessage &sig)
+{
+ DBus::MessageIter ri = sig.reader();
+ std::string dest;
+ ri >> dest;
+ if(m_sConnName == dest)
+ {
+ ri >> m_iPendingJobID;
+ g_main_loop_quit(gloop);
+ }
+}
diff --git a/src/Applet/DBusClientProxy.h b/src/Applet/DBusClientProxy.h
new file mode 100644
index 00000000..e43805bf
--- /dev/null
+++ b/src/Applet/DBusClientProxy.h
@@ -0,0 +1,108 @@
+/*
+ Copyright (C) 2009 Jiri Moskovcak (jmoskovc@redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ 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 2 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, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef DBUSCLIENTPROXY_H_
+#define DBUSCLIENTPROXY_H_
+
+#include <dbus-c++/dbus.h>
+#include <dbus-c++/glib-integration.h>
+#include "DBusCommon.h"
+
+#define ABRT_NOT_RUNNING 0
+#define ABRT_RUNNING 1
+
+namespace org {
+namespace freedesktop {
+namespace DBus {
+
+class DaemonWatcher_proxy
+: public ::DBus::InterfaceProxy
+{
+private:
+ void *m_pStateChangeHandler_cb_data;
+ void (*m_pStateChangeHandler)(bool running, void* data);
+
+public:
+ DaemonWatcher_proxy();
+ void ConnectStateChangeHandler(void (*pStateChangeHandler)(bool running, void* data), void *cb_data);
+
+private:
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _DaemonStateChanged(const ::DBus::SignalMessage &sig);
+};
+
+} } }
+
+
+class DaemonWatcher
+: public org::freedesktop::DBus::DaemonWatcher_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ DaemonWatcher(DBus::Connection &connection, const char *path, const char *name);
+ ~DaemonWatcher();
+};
+
+
+class CDBusClient_proxy
+: public DBus::InterfaceProxy
+{
+private:
+ bool m_bJobDone;
+ uint64_t m_iPendingJobID;
+ GMainLoop *gloop;
+ std::string m_sConnName;
+
+public:
+ CDBusClient_proxy();
+ CDBusClient_proxy(::DBus::Connection &pConnection);
+
+public:
+ /* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ /*
+ <
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
+ ...
+ >
+ */
+ vector_crash_infos_t GetCrashInfos();
+ bool DeleteDebugDump(const std::string& pUUID);
+ map_crash_report_t CreateReport(const std::string& pUUID);
+ void Report(const map_crash_report_t& pReport);
+ map_crash_report_t GetJobResult(uint64_t pJobID);
+
+public:
+ /* signal handlers for this interface
+ */
+ virtual void Crash(const std::string& progname, const std::string& uid);
+
+private:
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _Crash_stub(const ::DBus::SignalMessage &sig);
+ void _JobDone_stub(const ::DBus::SignalMessage &sig);
+};
+
+#endif
diff --git a/src/Applet/Makefile.am b/src/Applet/Makefile.am
index 1c810350..accca397 100644
--- a/src/Applet/Makefile.am
+++ b/src/Applet/Makefile.am
@@ -2,25 +2,34 @@ bin_PROGRAMS = abrt-applet
abrt_applet_SOURCES = \
Applet.cpp \
- CCApplet.h CCApplet.cpp
+ CCApplet.h CCApplet.cpp \
+ DBusClientProxy.h DBusClientProxy.cpp
abrt_applet_CPPFLAGS = \
-Wall -Werror \
- -I../Daemon/ \
-I$(srcdir)/../../inc \
-I$(srcdir)/../../lib/Utils \
-I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include \
- -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
-DBIN_DIR=\"$(bindir)\" \
- $(DBUS_GLIB_CFLAGS) \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
+ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
+ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
+ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
$(GTK_CFLAGS) \
$(DBUSCPP_CFLAGS) \
- $(LIBNOTIFY_CFLAGS)
+ -D_GNU_SOURCE
+# $(LIBNOTIFY_CFLAGS)
+# $(DBUS_CFLAGS)
+# $(DBUS_GLIB_CFLAGS)
abrt_applet_LDADD = \
../../lib/Utils/libABRTUtils.la \
- -lglib-2.0 -lgthread-2.0 \
- $(DL_LIBS) $(GTK_LIBS) \
- $(DBUSCPP_LIBS) $(LIBNOTIFY_LIBS)
+ -lglib-2.0 \
+ -lgthread-2.0 \
+ $(DL_LIBS) \
+ $(GTK_LIBS) \
+ $(DBUSCPP_LIBS) \
+ $(LIBNOTIFY_LIBS)
EXTRA_DIST = abrt-applet.desktop popup.GtkBuilder
diff --git a/src/CLI/Makefile.am b/src/CLI/Makefile.am
index 9d7667eb..9447791b 100644
--- a/src/CLI/Makefile.am
+++ b/src/CLI/Makefile.am
@@ -1,7 +1,3 @@
-#bin_PROGRAMS = abrt-cli
-#abrt_cli_SOURCES = ABRTSocket.cpp ABRTSocket.h CLI.cpp
-#abrt_cli_CPPFLAGS = -I$(srcdir)/../../inc -DVAR_RUN=\"$(VAR_RUN)\"
-
bin_PROGRAMS = abrt-cli
abrt_cli_SOURCES = \
@@ -12,9 +8,8 @@ abrt_cli_CPPFLAGS = \
-I$(srcdir)/../../lib/Utils \
-DVAR_RUN=\"$(VAR_RUN)\" \
$(ENABLE_SOCKET_OR_DBUS) \
- $(DBUS_GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
- $(DBUSCPP_CFLAGS) \
- $(LIBNOTIFY_CFLAGS)
+ $(DBUS_CFLAGS) \
+ -D_GNU_SOURCE
+# $(GTK_CFLAGS)
abrt_cli_LDADD = \
../../lib/Utils/libABRTUtils.la
diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am
index a4698afc..49898c10 100644
--- a/src/Daemon/Makefile.am
+++ b/src/Daemon/Makefile.am
@@ -1,32 +1,34 @@
sbin_PROGRAMS = abrtd
-# FIXME: we still link against dbus-c++ (not just dbus)
-# because lib/Utils links it in
-
abrtd_SOURCES = \
- ABRTPlugin.cpp ABRTPlugin.h \
- PluginManager.cpp PluginManager.h \
- RPM.cpp RPM.h \
- MiddleWare.cpp MiddleWare.h \
- CrashWatcher.cpp CrashWatcher.h \
+ ABRTPlugin.h ABRTPlugin.cpp \
+ PluginManager.h PluginManager.cpp \
+ RPM.h RPM.cpp \
+ MiddleWare.h MiddleWare.cpp \
+ CrashWatcher.h CrashWatcher.cpp \
CommLayerServer.h CommLayerServer.cpp \
CommLayerServerSocket.h CommLayerServerSocket.cpp \
CommLayerServerDBus.h CommLayerServerDBus.cpp \
- Daemon.cpp Daemon.h \
+ Daemon.h Daemon.cpp \
Settings.h Settings.cpp
abrtd_CPPFLAGS = \
-I$(srcdir)/../../inc \
-I$(srcdir)/../../lib/Utils \
+ -DBIN_DIR=\"$(bindir)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
-DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
- -DCONF_DIR=\"$(CONF_DIR)\" \
- -DVAR_RUN=\"$(VAR_RUN)\" \
- $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
- $(ENABLE_SOCKET_OR_DBUS)
+ $(GLIB_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(ENABLE_SOCKET_OR_DBUS) \
+ -D_GNU_SOURCE
abrtd_LDADD = \
../../lib/Utils/libABRTUtils.la \
- $(DL_LIBS) $(DBUS_LIBS) $(RPM_LIBS)
+ $(DL_LIBS) \
+ $(DBUS_LIBS) \
+ $(RPM_LIBS)
dbusabrtconfdir = ${sysconfdir}/dbus-1/system.d/
dist_dbusabrtconf_DATA = dbus-abrt.conf
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am
index 2831cf9e..fd8eb409 100644
--- a/src/Hooks/Makefile.am
+++ b/src/Hooks/Makefile.am
@@ -2,18 +2,20 @@ libexec_PROGRAMS = hookCCpp
bin_PROGRAMS = dumpoops
# CCpp
-hookCCpp_SOURCES = CCpp.cpp
-hookCCpp_LDADD = ../../lib/Utils/libABRTUtils.la
-hookCCpp_CPPFLAGS = -I$(srcdir)/../../inc \
- -I$(srcdir)/../../lib/Utils \
- -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
- -DVAR_RUN=\"$(VAR_RUN)\"
+hookCCpp_SOURCES = \
+ CCpp.cpp
+hookCCpp_CPPFLAGS = \
+ -I$(srcdir)/../../inc \
+ -I$(srcdir)/../../lib/Utils \
+ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ -D_GNU_SOURCE
+hookCCpp_LDADD = \
+ ../../lib/Utils/libABRTUtils.la
# dumpoops
dumpoops_SOURCES = \
dumpoops.cpp
-dumpoops_LDADD = \
- ../../lib/Utils/libABRTUtils.la
dumpoops_CPPFLAGS = \
-I$(srcdir)/../../inc \
-I$(srcdir)/../../lib/Utils \
@@ -22,7 +24,10 @@ dumpoops_CPPFLAGS = \
-DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
-DCONF_DIR=\"$(CONF_DIR)\" \
- -DVAR_RUN=\"$(VAR_RUN)\"
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ -D_GNU_SOURCE
+dumpoops_LDADD = \
+ ../../lib/Utils/libABRTUtils.la
python_PYTHON = sitecustomize.py abrt_exception_handler.py
EXTRA_DIST = abrt_exception_handler.py.in