diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-20 19:34:50 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-20 19:34:50 +0200 |
| commit | ae7fe705ef6ff6f979a397aabb08ae26135e9ec5 (patch) | |
| tree | 50ae09b1fc8375a27ad7085426eaeb4ba5a966a4 /src | |
| parent | e463253e9b11299bf7fabf7e5037d54e0c74a7fd (diff) | |
| download | abrt-ae7fe705ef6ff6f979a397aabb08ae26135e9ec5.tar.gz abrt-ae7fe705ef6ff6f979a397aabb08ae26135e9ec5.tar.xz abrt-ae7fe705ef6ff6f979a397aabb08ae26135e9ec5.zip | |
move lib/CommLayer/DBusServerProxy.{h,cpp} to src/Daemon/. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/Daemon/DBusServerProxy.cpp | 258 | ||||
| -rw-r--r-- | src/Daemon/DBusServerProxy.h | 85 | ||||
| -rw-r--r-- | src/Daemon/Makefile.am | 1 |
3 files changed, 344 insertions, 0 deletions
diff --git a/src/Daemon/DBusServerProxy.cpp b/src/Daemon/DBusServerProxy.cpp new file mode 100644 index 0000000..5730fd5 --- /dev/null +++ b/src/Daemon/DBusServerProxy.cpp @@ -0,0 +1,258 @@ +/* + 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 "DBusServerProxy.h" +#include <stdlib.h> + +/* public: */ + +CDBusServer_adaptor::CDBusServer_adaptor() +: DBus::InterfaceAdaptor(CC_DBUS_IFACE) +{ + register_method(CDBusServer_adaptor, GetCrashInfos, _GetCrashInfos_stub); + register_method(CDBusServer_adaptor, CreateReport, _CreateReport_stub); + register_method(CDBusServer_adaptor, Report, _Report_stub); + register_method(CDBusServer_adaptor, DeleteDebugDump, _DeleteDebugDump_stub); + register_method(CDBusServer_adaptor, GetJobResult, _GetJobResult_stub); + register_method(CDBusServer_adaptor, GetPluginsInfo, _GetPluginsInfo_stub); + register_method(CDBusServer_adaptor, GetPluginSettings, _GetPluginSettings_stub); + register_method(CDBusServer_adaptor, RegisterPlugin, _RegisterPlugin_stub); + register_method(CDBusServer_adaptor, UnRegisterPlugin, _UnRegisterPlugin_stub); + register_method(CDBusServer_adaptor, SetPluginSettings, _SetPluginSettings_stub); +} +/* reveal Interface introspection when we stabilize the API */ +/* +DBus::IntrospectedInterface *const CDBusServer_adaptor::introspect() const +{ + static DBus::IntrospectedArgument GetCrashInfos_args[] = + { + //{ "uid", "i", true}, + { "info", "a{ss}", false }, + { 0, 0, 0 } + }; + static DBus::IntrospectedArgument Crash_args[] = + { + { "package", "s", false }, + { 0, 0, 0 } + }; + static DBus::IntrospectedMethod CDBusServer_adaptor_methods[] = + { + { "GetCrashInfos", GetCrashInfos_args }, + { 0, 0 }, + { "GetCrashInfosMap", GetCrashInfos_args }, + { 0, 0 } + }; + static DBus::IntrospectedMethod CDBusServer_adaptor_signals[] = + { + { "Crash", Crash_args }, + { 0, 0 } + }; + static DBus::IntrospectedProperty CDBusServer_adaptor_properties[] = + { + { 0, 0, 0, 0 } + }; + static DBus::IntrospectedInterface CDBusServer_adaptor_interface = + { + "com.redhat.abrt", + CDBusServer_adaptor_methods, + CDBusServer_adaptor_signals, + CDBusServer_adaptor_properties + }; + return &CDBusServer_adaptor_interface; +} +*/ + +/* public: */ + +/* signal emitters for this interface */ + +/* Notify the clients (UI) about a new crash */ +void CDBusServer_adaptor::Crash(const std::string& arg1) +{ + ::DBus::SignalMessage sig("Crash"); + ::DBus::MessageIter wi = sig.writer(); + wi << arg1; + emit_signal(sig); +} + +/* Notify the clients that creating a report has finished */ +void CDBusServer_adaptor::AnalyzeComplete(map_crash_report_t arg1) +{ + ::DBus::SignalMessage sig("AnalyzeComplete"); + ::DBus::MessageIter wi = sig.writer(); + wi << arg1; + emit_signal(sig); +} + +void CDBusServer_adaptor::JobDone(const std::string &pDest, uint64_t job_id) +{ + ::DBus::SignalMessage sig("JobDone"); + ::DBus::MessageIter wi = sig.writer(); + wi << pDest; + wi << job_id; + emit_signal(sig); +} + +void CDBusServer_adaptor::Error(const std::string& arg1) +{ + ::DBus::SignalMessage sig("Error"); + ::DBus::MessageIter wi = sig.writer(); + wi << arg1; + emit_signal(sig); +} + +void CDBusServer_adaptor::Update(const std::string pDest, const std::string& pMessage) +{ + ::DBus::SignalMessage sig("Update"); + ::DBus::MessageIter wi = sig.writer(); + wi << pDest; + wi << pMessage; + emit_signal(sig); +} + +void CDBusServer_adaptor::Warning(const std::string& arg1) +{ + ::DBus::SignalMessage sig("Warning"); + ::DBus::MessageIter wi = sig.writer(); + wi << arg1; + emit_signal(sig); +} + +/* private: */ + +/* unmarshalers (to unpack the DBus message before calling the actual interface method) + */ +DBus::Message CDBusServer_adaptor::_GetCrashInfos_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + //FIXME: @@@REMOVE!! + vector_crash_infos_t argout1 = GetCrashInfos(call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; +} + +DBus::Message CDBusServer_adaptor::_CreateReport_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + + std::string argin1; ri >> argin1; + uint64_t argout1 = CreateReport_t(argin1, call.sender()); + if(sizeof (uint64_t) != 8) abort (); + //map_crash_report_t argout1 = CreateReport(argin1,call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; +} + +DBus::Message CDBusServer_adaptor::_Report_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + + map_crash_report_t argin1; ri >> argin1; + report_status_t argout1 = Report(argin1, call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; +} + +DBus::Message CDBusServer_adaptor::_DeleteDebugDump_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + + std::string argin1; ri >> argin1; + bool argout1 = DeleteDebugDump(argin1, call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; +} + +DBus::Message CDBusServer_adaptor::_GetJobResult_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + uint64_t job_id; + ri >> job_id; + map_crash_report_t report = GetJobResult(job_id, call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << report; + return reply; +} + +DBus::Message CDBusServer_adaptor::_GetPluginsInfo_stub(const DBus::CallMessage &call) +{ + vector_map_string_string_t plugins_info; + plugins_info = GetPluginsInfo(); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << plugins_info; + return reply; +} + +DBus::Message CDBusServer_adaptor::_GetPluginSettings_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + std::string PluginName; + std::string uid; + ri >> PluginName; + map_plugin_settings_t plugin_settings; + plugin_settings = GetPluginSettings(PluginName, call.sender()); + DBus::ReturnMessage reply(call); + DBus::MessageIter wi = reply.writer(); + wi << plugin_settings; + return reply; +} + +DBus::Message CDBusServer_adaptor::_RegisterPlugin_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + std::string PluginName; + ri >> PluginName; + RegisterPlugin(PluginName); + DBus::ReturnMessage reply(call); + //DBus::MessageIter wi = reply.writer(); + //wi << plugin_settings; + return reply; +} + +DBus::Message CDBusServer_adaptor::_UnRegisterPlugin_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + std::string PluginName; + ri >> PluginName; + UnRegisterPlugin(PluginName); + DBus::ReturnMessage reply(call); + return reply; +} + +DBus::Message CDBusServer_adaptor::_SetPluginSettings_stub(const DBus::CallMessage &call) +{ + DBus::MessageIter ri = call.reader(); + std::string PluginName; + map_plugin_settings_t plugin_settings; + ri >> PluginName; + ri >> plugin_settings; + SetPluginSettings(PluginName, call.sender(), plugin_settings); + DBus::ReturnMessage reply(call); + return reply; +} diff --git a/src/Daemon/DBusServerProxy.h b/src/Daemon/DBusServerProxy.h new file mode 100644 index 0000000..a68a44f --- /dev/null +++ b/src/Daemon/DBusServerProxy.h @@ -0,0 +1,85 @@ +/* + 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 DBUSSERVERPROXY_H_ +#define DBUSSERVERPROXY_H_ + +#include <dbus-c++/dbus.h> +#include <dbus-c++/glib-integration.h> +#include "DBusCommon.h" + +class CDBusServer_adaptor +: public DBus::InterfaceAdaptor +{ +public: + CDBusServer_adaptor(); +/* reveal Interface introspection when we stabilize the API */ +/* + DBus::IntrospectedInterface *const introspect() const; +*/ + +public: + /* properties exposed by this interface, use + * property() and property(value) to get and set a particular property + */ + +public: + /* methods exported by this interface, + * you will have to implement them in your ObjectAdaptor + */ + + virtual vector_crash_infos_t GetCrashInfos(const std::string &pDBusSender) = 0; + virtual map_crash_report_t CreateReport(const std::string &pUUID, const std::string &pDBusSender) = 0; + virtual uint64_t CreateReport_t(const std::string &pUUID, const std::string &pDBusSender) = 0; + virtual report_status_t Report(map_crash_report_t pReport, const std::string &pDBusSender) = 0; + virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender) = 0; + virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pDBusSender) = 0; + virtual vector_map_string_string_t GetPluginsInfo() = 0; + virtual map_plugin_settings_t GetPluginSettings(const std::string& pName, const std::string& pDBusSender) = 0; + virtual void SetPluginSettings(const std::string& pName, const std::string& pSender, const map_plugin_settings_t& pSettings) = 0; + virtual void RegisterPlugin(const std::string& pName) = 0; + virtual void UnRegisterPlugin(const std::string& pName) = 0; + +public: + /* signal emitters for this interface + */ + /* Notify the clients (UI) about a new crash */ + void Crash(const std::string& arg1); + /* Notify the clients that creating a report has finished */ + void AnalyzeComplete(map_crash_report_t arg1); + void JobDone(const std::string &pDest, uint64_t job_id); + void Error(const std::string& arg1); + void Update(const std::string pDest, const std::string& pMessage); + void Warning(const std::string& arg1); + +private: + /* unmarshalers (to unpack the DBus message before calling the actual interface method) + */ + DBus::Message _GetCrashInfos_stub(const DBus::CallMessage &call); + DBus::Message _CreateReport_stub(const DBus::CallMessage &call); + DBus::Message _Report_stub(const DBus::CallMessage &call); + DBus::Message _DeleteDebugDump_stub(const DBus::CallMessage &call); + DBus::Message _GetJobResult_stub(const DBus::CallMessage &call); + DBus::Message _GetPluginsInfo_stub(const DBus::CallMessage &call); + DBus::Message _GetPluginSettings_stub(const DBus::CallMessage &call); + DBus::Message _RegisterPlugin_stub(const DBus::CallMessage &call); + DBus::Message _UnRegisterPlugin_stub(const DBus::CallMessage &call); + DBus::Message _SetPluginSettings_stub(const DBus::CallMessage &call); +}; + +#endif diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am index 780760b..fdc1d60 100644 --- a/src/Daemon/Makefile.am +++ b/src/Daemon/Makefile.am @@ -1,6 +1,7 @@ sbin_PROGRAMS = abrt abrt_SOURCES = \ + DBusServerProxy.h DBusServerProxy.cpp \ DynamicLibrary.cpp DynamicLibrary.h \ ABRTPlugin.cpp ABRTPlugin.h \ PluginManager.cpp PluginManager.h \ |
