summaryrefslogtreecommitdiffstats
path: root/src/Daemon/CommLayerServerDBus.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-19 19:08:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-19 19:08:55 +0200
commitcba5b047558b7f0d9643a84a6257adf1a7f41086 (patch)
tree9d08b91308e5300f8b7cab965369f730dd61bfa8 /src/Daemon/CommLayerServerDBus.cpp
parent14b68dc5f0b2bea106383f623e9ad037a4fdc682 (diff)
downloadabrt-cba5b047558b7f0d9643a84a6257adf1a7f41086.tar.gz
abrt-cba5b047558b7f0d9643a84a6257adf1a7f41086.tar.xz
abrt-cba5b047558b7f0d9643a84a6257adf1a7f41086.zip
move lib/CommLayer/CommLayerServer*.{h,cpp} to src/Daemon/, the sole user
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/CommLayerServerDBus.cpp')
-rw-r--r--src/Daemon/CommLayerServerDBus.cpp147
1 files changed, 147 insertions, 0 deletions
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp
new file mode 100644
index 00000000..90a78780
--- /dev/null
+++ b/src/Daemon/CommLayerServerDBus.cpp
@@ -0,0 +1,147 @@
+#include "CommLayerServerDBus.h"
+#include <iostream>
+#include "ABRTException.h"
+
+DBus::Connection *CCommLayerServerDBus::init_dbus(CCommLayerServerDBus *self)
+{
+ CCommLayerServerDBus *server = (CCommLayerServerDBus*) self;
+ server->m_pDispatcher = new DBus::Glib::BusDispatcher();
+ server->m_pDispatcher->attach(NULL);
+ DBus::default_dispatcher = self->m_pDispatcher;
+ server->m_pConn = new DBus::Connection(DBus::Connection::SystemBus());
+ return server->m_pConn;
+}
+
+CCommLayerServerDBus::CCommLayerServerDBus()
+: CCommLayerServer(),
+ DBus::ObjectAdaptor(*init_dbus(this), CC_DBUS_PATH)
+{
+ try
+ {
+ m_pConn->request_name(CC_DBUS_NAME);
+ }
+ catch(DBus::Error err)
+ {
+ throw CABRTException(EXCEP_FATAL, std::string(__func__) +
+ "\nPlease check if:\n"
+ + " * abrt is being run with root permissions\n"
+ + " * you have reloaded the dbus\n"+
+ + "Original exception was:\n " + err.what());
+ }
+
+}
+
+CCommLayerServerDBus::~CCommLayerServerDBus()
+{
+ delete m_pDispatcher;
+}
+
+vector_crash_infos_t CCommLayerServerDBus::GetCrashInfos(const std::string &pSender)
+{
+ vector_crash_infos_t crashInfos;
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ crashInfos = m_pObserver->GetCrashInfos(to_string(unix_uid));
+ return crashInfos;
+}
+//FIXME: fix CLI and remove this
+/*
+map_crash_report_t CCommLayerServerDBus::CreateReport(const std::string &pUUID,const std::string &pSender)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ map_crash_report_t crashReport;
+ crashReport = m_pObserver->CreateReport(pUUID, to_string(unix_uid));
+ return crashReport;
+}
+*/
+uint64_t CCommLayerServerDBus::CreateReport_t(const std::string &pUUID,const std::string &pSender)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ map_crash_report_t crashReport;
+ uint64_t job_id = m_pObserver->CreateReport_t(pUUID, to_string(unix_uid), pSender);
+ return job_id;
+}
+
+report_status_t CCommLayerServerDBus::Report(map_crash_report_t pReport,const std::string &pSender)
+{
+ report_status_t rs;
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ rs = m_pObserver->Report(pReport, to_string(unix_uid));
+ return rs;
+}
+
+bool CCommLayerServerDBus::DeleteDebugDump(const std::string& pUUID, const std::string& pSender)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ m_pObserver->DeleteDebugDump(pUUID,to_string(unix_uid));
+ return true;
+}
+
+map_crash_report_t CCommLayerServerDBus::GetJobResult(uint64_t pJobID, const std::string& pSender)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ map_crash_report_t crashReport;
+ crashReport = m_pObserver->GetJobResult(pJobID,to_string(unix_uid));
+ return crashReport;
+}
+
+void CCommLayerServerDBus::Crash(const std::string& arg)
+{
+ CDBusServer_adaptor::Crash(arg);
+}
+
+void CCommLayerServerDBus::AnalyzeComplete(map_crash_report_t arg1)
+{
+ CDBusServer_adaptor::AnalyzeComplete(arg1);
+}
+
+void CCommLayerServerDBus::Error(const std::string& arg1)
+{
+ CDBusServer_adaptor::Error(arg1);
+}
+
+void CCommLayerServerDBus::Update(const std::string& pDest, const std::string& pMessage)
+{
+ CDBusServer_adaptor::Update(pDest, pMessage);
+}
+
+void CCommLayerServerDBus::JobDone(const std::string &pDest, uint64_t pJobID)
+{
+ CDBusServer_adaptor::JobDone(pDest, pJobID);
+}
+
+void CCommLayerServerDBus::Warning(const std::string& pDest, const std::string& pMessage)
+{
+ CDBusServer_adaptor::Warning(pMessage);
+}
+
+vector_map_string_string_t CCommLayerServerDBus::GetPluginsInfo()
+{
+ //FIXME: simplify?
+ vector_map_string_string_t plugins_info;
+ plugins_info = m_pObserver->GetPluginsInfo();
+ return plugins_info;
+}
+
+map_plugin_settings_t CCommLayerServerDBus::GetPluginSettings(const std::string& pName, const std::string& pSender)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ return m_pObserver->GetPluginSettings(pName, to_string(unix_uid));
+}
+
+
+void CCommLayerServerDBus::RegisterPlugin(const std::string& pName)
+{
+ return m_pObserver->RegisterPlugin(pName);
+}
+
+void CCommLayerServerDBus::UnRegisterPlugin(const std::string& pName)
+{
+ return m_pObserver->UnRegisterPlugin(pName);
+}
+
+void CCommLayerServerDBus::SetPluginSettings(const std::string& pName, const std::string& pSender, const map_plugin_settings_t& pSettings)
+{
+ unsigned long unix_uid = m_pConn->sender_unix_uid(pSender.c_str());
+ return m_pObserver->SetPluginSettings(pName, to_string(unix_uid), pSettings);
+}
+