From: Jiri Moskovcak jmoskovc@redhat.com
- header files are required to write the custom plugins plugins without downloading the whole git tree, user just need to install abrt-devel package --- Makefile.am | 5 +- abrt-utils.pc.in | 11 ++++ abrt.spec | 2 + configure.ac | 1 + inc/Action.h | 44 ++++++++++++++ inc/Analyzer.h | 55 +++++++++++++++++ inc/CommLayerInner.h | 45 ++++++++++++++ inc/DBusCommon.h | 28 +++++++++ inc/Database.h | 118 ++++++++++++++++++++++++++++++++++++ inc/DebugDump.h | 67 +++++++++++++++++++++ inc/Makefile.am | 20 ++++++- inc/Observer.h | 33 ++++++++++ inc/Plugin.h | 142 ++++++++++++++++++++++++++++++++++++++++++++ inc/Reporter.h | 47 +++++++++++++++ inc/abrt_xmlrpc.h | 48 +++++++++++++++ inc/xfuncs.h | 96 +++++++++++++++++++++++++++++ lib/Utils/Action.h | 44 -------------- lib/Utils/Analyzer.h | 55 ----------------- lib/Utils/CommLayerInner.h | 45 -------------- lib/Utils/DBusCommon.h | 28 --------- lib/Utils/Database.h | 118 ------------------------------------ lib/Utils/DebugDump.h | 67 --------------------- lib/Utils/Makefile.am | 19 +++--- lib/Utils/Observer.h | 33 ---------- lib/Utils/Plugin.h | 142 -------------------------------------------- lib/Utils/Reporter.h | 47 --------------- lib/Utils/abrt_xmlrpc.h | 48 --------------- lib/Utils/xfuncs.h | 96 ----------------------------- 28 files changed, 769 insertions(+), 735 deletions(-) create mode 100755 abrt-utils.pc.in create mode 100644 inc/Action.h create mode 100644 inc/Analyzer.h create mode 100644 inc/CommLayerInner.h create mode 100644 inc/DBusCommon.h create mode 100644 inc/Database.h create mode 100644 inc/DebugDump.h create mode 100644 inc/Observer.h create mode 100644 inc/Plugin.h create mode 100644 inc/Reporter.h create mode 100644 inc/abrt_xmlrpc.h create mode 100644 inc/xfuncs.h delete mode 100644 lib/Utils/Action.h delete mode 100644 lib/Utils/Analyzer.h delete mode 100644 lib/Utils/CommLayerInner.h delete mode 100644 lib/Utils/DBusCommon.h delete mode 100644 lib/Utils/Database.h delete mode 100644 lib/Utils/DebugDump.h delete mode 100644 lib/Utils/Observer.h delete mode 100644 lib/Utils/Plugin.h delete mode 100644 lib/Utils/Reporter.h delete mode 100644 lib/Utils/abrt_xmlrpc.h delete mode 100644 lib/Utils/xfuncs.h
diff --git a/Makefile.am b/Makefile.am index 080a7bf..cf4aece 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,10 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = lib src inc po icons
-EXTRA_DIST = doc/CodingStyle abrt.spec +EXTRA_DIST = doc/CodingStyle abrt.spec abrt-utils.pc.in + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = abrt-utils.pc
RPM_DIRS = --define "_sourcedir `pwd`" \ --define "_rpmdir `pwd`" \ diff --git a/abrt-utils.pc.in b/abrt-utils.pc.in new file mode 100755 index 0000000..6f0fa41 --- /dev/null +++ b/abrt-utils.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: abrt-utils +Description: Library for writing ABRT plugins +#Requires: dbus-1 +Version: @VERSION@ +Libs: -L${libdir} -lABRTUtils -lABRTdUtils +Cflags: -I${includedir}/abrt -fPIC diff --git a/abrt.spec b/abrt.spec index f89151c..ddc6bef 100644 --- a/abrt.spec +++ b/abrt.spec @@ -332,7 +332,9 @@ fi
%files devel %defattr(-,root,root,-) +%{_includedir}/* %{_libdir}/lib*.so +%{_libdir}/pkgconfig/*
%files gui %defattr(-,root,root,-) diff --git a/configure.ac b/configure.ac index 9b6beb5..362e5f6 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([ Makefile + abrt-utils.pc lib/Makefile lib/Utils/Makefile lib/Plugins/Makefile diff --git a/inc/Action.h b/inc/Action.h new file mode 100644 index 0000000..fc56277 --- /dev/null +++ b/inc/Action.h @@ -0,0 +1,44 @@ +/* + Action.h - header file for action plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ +#define ACTION_H_ + +#include "Plugin.h" + +/** + * An abstract class. The class defines an action plugin interface. + */ +class CAction : public CPlugin +{ + public: + /** + * A Method which performs particular action. As the first parameter it + * takes an action directory. It could be either a directory of actual + * crash or it could be a directory contains all crashes. It depends on + * who call the plugin. The plugin can takes arguments, but the plugin + * has to parse them by itself. + * @param pActionDir An actual directory. + * @param pArgs Plugin's arguments. + */ + virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0; +}; + +#endif diff --git a/inc/Analyzer.h b/inc/Analyzer.h new file mode 100644 index 0000000..a45bd0e --- /dev/null +++ b/inc/Analyzer.h @@ -0,0 +1,55 @@ +/* + Analyzer.h - header file for analyzer plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ +#define ANALYZER_H_ + +#include <string> +#include "Plugin.h" + +/** + * An abstract class. The class defines an analyzer plugin interface. + */ +class CAnalyzer : public CPlugin +{ + public: + /** + * A method, which gets a local UUID of particular crash. The local + * UUID is usualy computed from data which are stored in debugdump dir. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + * @return A local UUID. + */ + virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0; + /** + * A method, which gets a global UUID of particular crash. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + * @return A global UUID. + */ + virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0; + /** + * A method, which takes care of getting all additional data needed + * for computing UUIDs and creating a report. This report could be send + * somewhere afterwards. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + */ + virtual void CreateReport(const char *pDebugDumpDir, int force) = 0; +}; + +#endif /*ANALYZER_H_*/ diff --git a/inc/CommLayerInner.h b/inc/CommLayerInner.h new file mode 100644 index 0000000..353cfc7 --- /dev/null +++ b/inc/CommLayerInner.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 COMMLAYERINNER_H_ +#define COMMLAYERINNER_H_ + +#include "Observer.h" + +void init_daemon_logging(CObserver *pObs); + +/* + * Set client's name (dbus ID). NULL unsets it. + */ +void set_client_name(const char* name); + +/* + * Ask a client to warn the user about a non-fatal, but unexpected condition. + * In GUI, it will usually be presented as a popup message. + * Usually there is no need to call it directly, just use [p]error_msg(). + */ +//now static: void warn_client(const char *msg); + +/* + * Logs a message to a client. + * In UI, it will usually appear as a new status line message in GUI, + * or as a new message line in CLI. + */ +void update_client(const char *fmt, ...); + +#endif diff --git a/inc/DBusCommon.h b/inc/DBusCommon.h new file mode 100644 index 0000000..58b4c8d --- /dev/null +++ b/inc/DBusCommon.h @@ -0,0 +1,28 @@ +/* + 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 DBUSCOMMON_H_ +#define DBUSCOMMON_H_ + +#include "CrashTypes.h" + +#define ABRTD_DBUS_NAME "com.redhat.abrt" +#define ABRTD_DBUS_PATH "/com/redhat/abrt" +#define ABRTD_DBUS_IFACE "com.redhat.abrt" + +#endif diff --git a/inc/Database.h b/inc/Database.h new file mode 100644 index 0000000..a698bcb --- /dev/null +++ b/inc/Database.h @@ -0,0 +1,118 @@ +/* + Database.h - header file for database plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ +#define DATABASE_H_ + +#include <string> +#include <vector> +#include "Plugin.h" + +/** + * Table + * ===== + * UUID | UID| DebugDumpPath | Count | Reported | Time | Message + * + * primary key (UUID, UID) + */ + +/** + * A struct contains one database row. + */ +typedef struct database_row_t +{ + std::string m_sUUID; /**< A local UUID.*/ + std::string m_sUID; /**< An UID of an user.*/ + std::string m_sInformAll; + std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/ + std::string m_sCount; /**< Crash rate.*/ + std::string m_sReported; /**< Is a row reported?*/ + std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/ + std::string m_sTime; /**< Time of last occurred crash with same local UUID*/ +} database_row_t; + +/** + * A vector contains one or more database rows. + */ +typedef std::vector<database_row_t> vector_database_rows_t; + +/** + * An abstract class. The class defines a database plugin interface. + */ +class CDatabase : public CPlugin +{ + public: + /** + * A method, which connects to a database. + */ + virtual void Connect() = 0; + /** + * A method, which disconnects from a database. + */ + virtual void DisConnect() = 0; + /** + * A method, which inserts one row to a database. + * @param pUUID A local UUID of a crash. + * @param pUID An UID of an user. + * @param pDebugDumpPath A debugdump path. + * @param pTime Time when a crash occurs. + */ + virtual void Insert_or_Update(const char *crash_id, + bool inform_all_users, + const char *pDebugDumpPath, + const char *pTime) = 0; + /** + * A method, which deletes one row in a database. + * @param pUUID A lodal UUID of a crash. + * @param pUID An UID of an user. + */ + virtual void DeleteRow(const char *crash_id) = 0; + virtual void DeleteRows_by_dir(const char *dump_dir) = 0; + /** + * A method, which sets that particular row was reported. + * @param pUUID A local UUID of a crash. + * @param pUID An UID of an user. + * @param pMessage A text explanation of reported problem + * (where it is stored etc)... + */ + virtual void SetReported(const char *crash_id, + const char *pMessage) = 0; + virtual void SetReportedPerReporter(const char *crash_id, + const char *reporter, + const char *pMessage) = 0; + /** + * A method, which gets all rows which belongs to particular user. + * If the user is root, then all rows are returned. If there are no + * rows, empty vector is returned. + * @param pUID An UID of an user. + * @return A vector of matched rows. + */ + virtual vector_database_rows_t GetUIDData(long caller_uid) = 0; + /** + * A method, which returns one row accordind to UUID of a crash and + * UID of an user. If there are no row, empty row is returned. + * @param pUUID A UUID of a crash. + * @param pUID An UID of an user. + * @return A matched row. + */ + virtual database_row_t GetRow(const char *crash_id) = 0; +}; + +#endif diff --git a/inc/DebugDump.h b/inc/DebugDump.h new file mode 100644 index 0000000..f8487a6 --- /dev/null +++ b/inc/DebugDump.h @@ -0,0 +1,67 @@ +/* + DebugDump.h - header file for the library caring of writing new reports + to the specific directory + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ +#define DEBUGDUMP_H_ + +#include <string> + +class CDebugDump +{ + private: + std::string m_sDebugDumpDir; + DIR* m_pGetNextFileDir; + bool m_bOpened; + bool m_bLocked; + uid_t m_uid; + gid_t m_gid; + + void Lock(); + void UnLock(); + + public: + CDebugDump(); + ~CDebugDump(); + + void Open(const char *pDir); + void Create(const char *pDir, uid_t uid); + void Delete(); + void Close(); + + bool Exist(const char* pFileName); + + void LoadText(const char* pName, std::string& pData); + + void SaveText(const char* pName, const char *pData); + void SaveBinary(const char* pName, const char* pData, unsigned pSize); + + void InitGetNextFile(); + /* Pointers may be NULL */ + bool GetNextFile(std::string *short_name, std::string *full_name); +}; + +/** + * Deletes particular debugdump directory. + * @param pDebugDumpDir A debugdump directory. + */ +void delete_debug_dump_dir(const char *pDebugDumpDir); + +#endif diff --git a/inc/Makefile.am b/inc/Makefile.am index 2ccc714..e668b48 100644 --- a/inc/Makefile.am +++ b/inc/Makefile.am @@ -1 +1,19 @@ -EXTRA_DIST = ABRTException.h CrashTypes.h abrtlib.h abrt_types.h +HEADER_FILES = \ + ABRTException.h \ + abrtlib.h \ + abrt_types.h \ + abrt_xmlrpc.h \ + Action.h \ + Analyzer.h \ + CommLayerInner.h \ + CrashTypes.h \ + Database.h \ + DBusCommon.h \ + DebugDump.h \ + Observer.h \ + Plugin.h \ + Reporter.h \ + xfuncs.h + +lib_includedir=$(includedir)/abrt/ +lib_include_HEADERS = $(HEADER_FILES) diff --git a/inc/Observer.h b/inc/Observer.h new file mode 100644 index 0000000..ec7dfa7 --- /dev/null +++ b/inc/Observer.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 OBSERVER_H_ +#define OBSERVER_H_ + +#include <string> +#include <stdint.h> +#include "DBusCommon.h" + +class CObserver { + public: + virtual ~CObserver() {} + virtual void Status(const char *pMessage, const char* peer) = 0; + virtual void Warning(const char *pMessage, const char* peer) = 0; +}; + +#endif diff --git a/inc/Plugin.h b/inc/Plugin.h new file mode 100644 index 0000000..367739f --- /dev/null +++ b/inc/Plugin.h @@ -0,0 +1,142 @@ +/* + Plugin.h - header file for plugin. It contains mandatory macros + and common function for plugins + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ +#define PLUGIN_H_ + +#include "abrt_types.h" +#include "CrashTypes.h" +#if HAVE_CONFIG_H +# include <config.h> +#endif +#if ENABLE_NLS +# include <libintl.h> +# define _(S) gettext(S) +#else +# define _(S) (S) +#endif + +#define PLUGINS_MAGIC_NUMBER 6 + +#define PLUGINS_CONF_EXTENSION "conf" +#define PLUGINS_LIB_EXTENSION "so" +#define PLUGINS_LIB_PREFIX "lib" + +/** + * An abstract class. The class defines a common plugin interface. If a plugin + * has some settings, then a *Settings(*) method has to be written. + */ +class CPlugin +{ + protected: + map_plugin_settings_t m_pSettings; + + public: + CPlugin(); + /** + * A destructor. + */ + virtual ~CPlugin(); + /** + * A method, which initializes a plugin. It is not mandatory method. + */ + virtual void Init(); + /** + * A method, which deinitializes a plugin. It is not mandatory method. + */ + virtual void DeInit(); + /** + * A method, which takes a settings and apply them. It is not a mandatory method. + * @param pSettings Plugin's settings + */ + virtual void SetSettings(const map_plugin_settings_t& pSettings); + /** + * A method, which return current settings. It is not mandatory method. + * @return Plugin's settings + */ + virtual const map_plugin_settings_t& GetSettings(); +}; + +/** + * An enum of plugin types. + */ +typedef enum { + ANALYZER, /**< An analyzer plugin*/ + ACTION, /**< An action plugin*/ + REPORTER, /**< A reporter plugin*/ + DATABASE, /**< A database plugin*/ + MAX_PLUGIN_TYPE = DATABASE, +} plugin_type_t; + +/** + * A struct contains all needed data about particular plugin. + */ +typedef struct SPluginInfo +{ + const plugin_type_t m_Type; /**< Plugin type.*/ + const char *const m_sName; /**< Plugin name.*/ + const char *const m_sVersion; /**< Plugin version.*/ + const char *const m_sDescription; /**< Plugin description.*/ + const char *const m_sEmail; /**< Plugin author's email.*/ + const char *const m_sWWW; /**< Plugin's home page.*/ + const char *const m_sGTKBuilder; /**< Plugin's gui description.*/ + const int m_nMagicNumber; /**< Plugin magical number.*/ +} plugin_info_t; + +#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\ + extern "C" CPlugin* plugin_new()\ + {\ + return new plugin_class();\ + }\ + extern "C" const plugin_info_t plugin_info =\ + {\ + type,\ + name,\ + version,\ + description,\ + email,\ + www,\ + gtk_builder,\ + PLUGINS_MAGIC_NUMBER,\ + }; + +/* helper functions */ +std::string make_description_bz(const map_crash_data_t& pCrashData); +std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); +std::string make_description_logger(const map_crash_data_t& pCrashData); + +/** + * Loads settings and stores it in second parameter. On success it + * returns true, otherwise returns false. + * + * @param path A path of config file. + * Config file consists of "key=value" lines. + * @param settings A readed plugin's settings. + * @param skipKeysWithoutValue + * If true, lines in format "key=" (without value) are skipped. + * Otherwise empty value "" is inserted into pSettings. + * @return if it success it returns true, otherwise it returns false. + */ +extern bool LoadPluginSettings(const char *pPath, + map_plugin_settings_t& pSettings, + bool skipKeysWithoutValue = true); + +#endif diff --git a/inc/Reporter.h b/inc/Reporter.h new file mode 100644 index 0000000..4144ec3 --- /dev/null +++ b/inc/Reporter.h @@ -0,0 +1,47 @@ +/* + Reporter.h - header file for reporter plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ +#define REPORTER_H_ + +#include <string> +#include "Plugin.h" +#include "CrashTypes.h" + +/** + * An abstract class. The class defines a reporter plugin interface. + */ +class CReporter : public CPlugin +{ + public: + /** + * A method, which reports a crash report to particular receiver. + * The plugin can takes arguments, but the plugin has to parse them + * by itself. + * @param pCrashData A crash report. + * @param pArgs Plugin's arguments. + * @retun A message which can be displayed after a report is created. + */ + virtual std::string Report(const map_crash_data_t& pCrashData, + const map_plugin_settings_t& pSettings, + const char *pArgs) = 0; +}; + +#endif /* REPORTER_H_ */ diff --git a/inc/abrt_xmlrpc.h b/inc/abrt_xmlrpc.h new file mode 100644 index 0000000..ce77038 --- /dev/null +++ b/inc/abrt_xmlrpc.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 ABRT_XMLRPC_H_ +#define ABRT_XMLRPC_H_ 1 + +#include <curl/curl.h> +#include <xmlrpc-c/base.h> +#include <xmlrpc-c/client.h> + +/* + * Simple class holding XMLRPC connection data. + * Used mainly to ensure we always destroy xmlrpc client and server_info + * on return or throw. + */ + +struct abrt_xmlrpc_conn { + xmlrpc_client* m_pClient; + xmlrpc_server_info* m_pServer_info; + + abrt_xmlrpc_conn(const char* url, bool no_ssl_verify) { new_xmlrpc_client(url, no_ssl_verify); } + /* this never throws exceptions - calls C functions only */ + ~abrt_xmlrpc_conn() { destroy_xmlrpc_client(); } + + void new_xmlrpc_client(const char* url, bool no_ssl_verify); + void destroy_xmlrpc_client(); +}; + +/* Utility functions */ +void throw_xml_fault(xmlrpc_env *env); +void throw_if_xml_fault_occurred(xmlrpc_env *env); + +#endif diff --git a/inc/xfuncs.h b/inc/xfuncs.h new file mode 100644 index 0000000..de785c8 --- /dev/null +++ b/inc/xfuncs.h @@ -0,0 +1,96 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 ABRT_XFUNCS_H +#define ABRT_XFUNCS_H + +#include <sys/socket.h> +#include <sys/stat.h> +#include <dirent.h> +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern int ndelay_on(int fd); +extern int ndelay_off(int fd); +extern int close_on_exec_on(int fd); + +extern void* xmalloc(size_t size); +extern void* xrealloc(void *ptr, size_t size); +extern void* xzalloc(size_t size); +extern char* xstrdup(const char *s); +extern char* xstrndup(const char *s, int n); + +extern void xpipe(int filedes[2]); +extern void xdup(int from); +extern void xdup2(int from, int to); +extern void xmove_fd(int from, int to); + +extern void xwrite(int fd, const void *buf, size_t count); +extern void xwrite_str(int fd, const char *str); + +extern off_t xlseek(int fd, off_t offset, int whence); + +extern void xchdir(const char *path); + +extern char* xvasprintf(const char *format, va_list p); +extern char* xasprintf(const char *format, ...); + +extern void xsetenv(const char *key, const char *value); +extern int xsocket(int domain, int type, int protocol); +extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +extern void xlisten(int s, int backlog); +extern ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); +extern void xstat(const char *name, struct stat *stat_buf); + +extern int xopen3(const char *pathname, int flags, int mode); +extern int xopen(const char *pathname, int flags); +extern void xunlink(const char *pathname); + +/* Just testing dent->d_type == DT_REG is wrong: some filesystems + * do not report the type, they report DT_UNKNOWN for every dirent + * (and this is not a bug in filesystem, this is allowed by standards). + * This function handles this case. Note: it returns 0 on symlinks + * even if they point to regular files. + */ +extern int is_regular_file(struct dirent *dent, const char *dirname); +extern bool dot_or_dotdot(const char *filename); +extern char *last_char_is(const char *s, int c); + +extern bool string_to_bool(const char *s); + +extern void xseteuid(uid_t euid); +extern void xsetegid(gid_t egid); +extern void xsetreuid(uid_t ruid, uid_t euid); +extern void xsetregid(gid_t rgid, gid_t egid); + +/* Returns getpwuid(uid)->pw_dir or NULL */ +extern const char *get_home_dir(uid_t uid); + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +std::string ssprintf(const char *format, ...); +std::string concat_path_file(const char *path, const char *filename); +#endif + +#endif diff --git a/lib/Utils/Action.h b/lib/Utils/Action.h deleted file mode 100644 index fc56277..0000000 --- a/lib/Utils/Action.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Action.h - header file for action plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ -#define ACTION_H_ - -#include "Plugin.h" - -/** - * An abstract class. The class defines an action plugin interface. - */ -class CAction : public CPlugin -{ - public: - /** - * A Method which performs particular action. As the first parameter it - * takes an action directory. It could be either a directory of actual - * crash or it could be a directory contains all crashes. It depends on - * who call the plugin. The plugin can takes arguments, but the plugin - * has to parse them by itself. - * @param pActionDir An actual directory. - * @param pArgs Plugin's arguments. - */ - virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0; -}; - -#endif diff --git a/lib/Utils/Analyzer.h b/lib/Utils/Analyzer.h deleted file mode 100644 index a45bd0e..0000000 --- a/lib/Utils/Analyzer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Analyzer.h - header file for analyzer plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ -#define ANALYZER_H_ - -#include <string> -#include "Plugin.h" - -/** - * An abstract class. The class defines an analyzer plugin interface. - */ -class CAnalyzer : public CPlugin -{ - public: - /** - * A method, which gets a local UUID of particular crash. The local - * UUID is usualy computed from data which are stored in debugdump dir. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - * @return A local UUID. - */ - virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0; - /** - * A method, which gets a global UUID of particular crash. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - * @return A global UUID. - */ - virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0; - /** - * A method, which takes care of getting all additional data needed - * for computing UUIDs and creating a report. This report could be send - * somewhere afterwards. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - */ - virtual void CreateReport(const char *pDebugDumpDir, int force) = 0; -}; - -#endif /*ANALYZER_H_*/ diff --git a/lib/Utils/CommLayerInner.h b/lib/Utils/CommLayerInner.h deleted file mode 100644 index 353cfc7..0000000 --- a/lib/Utils/CommLayerInner.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 COMMLAYERINNER_H_ -#define COMMLAYERINNER_H_ - -#include "Observer.h" - -void init_daemon_logging(CObserver *pObs); - -/* - * Set client's name (dbus ID). NULL unsets it. - */ -void set_client_name(const char* name); - -/* - * Ask a client to warn the user about a non-fatal, but unexpected condition. - * In GUI, it will usually be presented as a popup message. - * Usually there is no need to call it directly, just use [p]error_msg(). - */ -//now static: void warn_client(const char *msg); - -/* - * Logs a message to a client. - * In UI, it will usually appear as a new status line message in GUI, - * or as a new message line in CLI. - */ -void update_client(const char *fmt, ...); - -#endif diff --git a/lib/Utils/DBusCommon.h b/lib/Utils/DBusCommon.h deleted file mode 100644 index 58b4c8d..0000000 --- a/lib/Utils/DBusCommon.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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 DBUSCOMMON_H_ -#define DBUSCOMMON_H_ - -#include "CrashTypes.h" - -#define ABRTD_DBUS_NAME "com.redhat.abrt" -#define ABRTD_DBUS_PATH "/com/redhat/abrt" -#define ABRTD_DBUS_IFACE "com.redhat.abrt" - -#endif diff --git a/lib/Utils/Database.h b/lib/Utils/Database.h deleted file mode 100644 index a698bcb..0000000 --- a/lib/Utils/Database.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Database.h - header file for database plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ -#define DATABASE_H_ - -#include <string> -#include <vector> -#include "Plugin.h" - -/** - * Table - * ===== - * UUID | UID| DebugDumpPath | Count | Reported | Time | Message - * - * primary key (UUID, UID) - */ - -/** - * A struct contains one database row. - */ -typedef struct database_row_t -{ - std::string m_sUUID; /**< A local UUID.*/ - std::string m_sUID; /**< An UID of an user.*/ - std::string m_sInformAll; - std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/ - std::string m_sCount; /**< Crash rate.*/ - std::string m_sReported; /**< Is a row reported?*/ - std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/ - std::string m_sTime; /**< Time of last occurred crash with same local UUID*/ -} database_row_t; - -/** - * A vector contains one or more database rows. - */ -typedef std::vector<database_row_t> vector_database_rows_t; - -/** - * An abstract class. The class defines a database plugin interface. - */ -class CDatabase : public CPlugin -{ - public: - /** - * A method, which connects to a database. - */ - virtual void Connect() = 0; - /** - * A method, which disconnects from a database. - */ - virtual void DisConnect() = 0; - /** - * A method, which inserts one row to a database. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pDebugDumpPath A debugdump path. - * @param pTime Time when a crash occurs. - */ - virtual void Insert_or_Update(const char *crash_id, - bool inform_all_users, - const char *pDebugDumpPath, - const char *pTime) = 0; - /** - * A method, which deletes one row in a database. - * @param pUUID A lodal UUID of a crash. - * @param pUID An UID of an user. - */ - virtual void DeleteRow(const char *crash_id) = 0; - virtual void DeleteRows_by_dir(const char *dump_dir) = 0; - /** - * A method, which sets that particular row was reported. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pMessage A text explanation of reported problem - * (where it is stored etc)... - */ - virtual void SetReported(const char *crash_id, - const char *pMessage) = 0; - virtual void SetReportedPerReporter(const char *crash_id, - const char *reporter, - const char *pMessage) = 0; - /** - * A method, which gets all rows which belongs to particular user. - * If the user is root, then all rows are returned. If there are no - * rows, empty vector is returned. - * @param pUID An UID of an user. - * @return A vector of matched rows. - */ - virtual vector_database_rows_t GetUIDData(long caller_uid) = 0; - /** - * A method, which returns one row accordind to UUID of a crash and - * UID of an user. If there are no row, empty row is returned. - * @param pUUID A UUID of a crash. - * @param pUID An UID of an user. - * @return A matched row. - */ - virtual database_row_t GetRow(const char *crash_id) = 0; -}; - -#endif diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h deleted file mode 100644 index f8487a6..0000000 --- a/lib/Utils/DebugDump.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - DebugDump.h - header file for the library caring of writing new reports - to the specific directory - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ -#define DEBUGDUMP_H_ - -#include <string> - -class CDebugDump -{ - private: - std::string m_sDebugDumpDir; - DIR* m_pGetNextFileDir; - bool m_bOpened; - bool m_bLocked; - uid_t m_uid; - gid_t m_gid; - - void Lock(); - void UnLock(); - - public: - CDebugDump(); - ~CDebugDump(); - - void Open(const char *pDir); - void Create(const char *pDir, uid_t uid); - void Delete(); - void Close(); - - bool Exist(const char* pFileName); - - void LoadText(const char* pName, std::string& pData); - - void SaveText(const char* pName, const char *pData); - void SaveBinary(const char* pName, const char* pData, unsigned pSize); - - void InitGetNextFile(); - /* Pointers may be NULL */ - bool GetNextFile(std::string *short_name, std::string *full_name); -}; - -/** - * Deletes particular debugdump directory. - * @param pDebugDumpDir A debugdump directory. - */ -void delete_debug_dump_dir(const char *pDebugDumpDir); - -#endif diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am index 56678d4..070a6fb 100644 --- a/lib/Utils/Makefile.am +++ b/lib/Utils/Makefile.am @@ -1,7 +1,8 @@ # ABRTUtils has small set of deps. This reduces deps of smaller abrt binaries # ABRTdUtils has much more. It is used by daemon and plugins only lib_LTLIBRARIES = libABRTUtils.la libABRTdUtils.la - +HEADER_DIR = $(srcdir)/../../inc +AM_CPPFLAGS = -I$(HEADER_DIR) AM_YFLAGS = --verbose
# Not used just yet: @@ -9,7 +10,7 @@ AM_YFLAGS = --verbose # xconnect.cpp
libABRTUtils_la_SOURCES = \ - xfuncs.h xfuncs.cpp \ + xfuncs.cpp \ encbase64.cpp \ read_write.cpp \ logging.cpp \ @@ -20,7 +21,7 @@ libABRTUtils_la_SOURCES = \ spawn.cpp \ stringops.cpp \ dirsize.cpp \ - DebugDump.h DebugDump.cpp \ + DebugDump.cpp \ abrt_dbus.h abrt_dbus.cpp \ CrashTypes.cpp \ ABRTException.cpp \ @@ -51,15 +52,13 @@ libABRTUtils_la_LIBADD = \ libABRTdUtils_la_SOURCES = \ parse_release.cpp \ make_descr.cpp \ - CommLayerInner.h CommLayerInner.cpp \ - abrt_xmlrpc.h abrt_xmlrpc.cpp \ + $(HEADER_DIR)/CommLayerInner.h CommLayerInner.cpp \ + $(HEADER_DIR)/abrt_xmlrpc.h abrt_xmlrpc.cpp \ abrt_rh_support.h abrt_rh_support.cpp \ abrt_curl.h abrt_curl.cpp \ - Plugin.h Plugin.cpp \ - Polkit.h Polkit.cpp \ - Action.h Database.h Reporter.h Analyzer.h \ - Observer.h \ - DBusCommon.h + $(HEADER_DIR)/Plugin.h Plugin.cpp \ + Polkit.h Polkit.cpp + libABRTdUtils_la_CPPFLAGS = \ -Wall -Werror \ -I$(srcdir)/../../inc \ diff --git a/lib/Utils/Observer.h b/lib/Utils/Observer.h deleted file mode 100644 index ec7dfa7..0000000 --- a/lib/Utils/Observer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 OBSERVER_H_ -#define OBSERVER_H_ - -#include <string> -#include <stdint.h> -#include "DBusCommon.h" - -class CObserver { - public: - virtual ~CObserver() {} - virtual void Status(const char *pMessage, const char* peer) = 0; - virtual void Warning(const char *pMessage, const char* peer) = 0; -}; - -#endif diff --git a/lib/Utils/Plugin.h b/lib/Utils/Plugin.h deleted file mode 100644 index 367739f..0000000 --- a/lib/Utils/Plugin.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - Plugin.h - header file for plugin. It contains mandatory macros - and common function for plugins - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ -#define PLUGIN_H_ - -#include "abrt_types.h" -#include "CrashTypes.h" -#if HAVE_CONFIG_H -# include <config.h> -#endif -#if ENABLE_NLS -# include <libintl.h> -# define _(S) gettext(S) -#else -# define _(S) (S) -#endif - -#define PLUGINS_MAGIC_NUMBER 6 - -#define PLUGINS_CONF_EXTENSION "conf" -#define PLUGINS_LIB_EXTENSION "so" -#define PLUGINS_LIB_PREFIX "lib" - -/** - * An abstract class. The class defines a common plugin interface. If a plugin - * has some settings, then a *Settings(*) method has to be written. - */ -class CPlugin -{ - protected: - map_plugin_settings_t m_pSettings; - - public: - CPlugin(); - /** - * A destructor. - */ - virtual ~CPlugin(); - /** - * A method, which initializes a plugin. It is not mandatory method. - */ - virtual void Init(); - /** - * A method, which deinitializes a plugin. It is not mandatory method. - */ - virtual void DeInit(); - /** - * A method, which takes a settings and apply them. It is not a mandatory method. - * @param pSettings Plugin's settings - */ - virtual void SetSettings(const map_plugin_settings_t& pSettings); - /** - * A method, which return current settings. It is not mandatory method. - * @return Plugin's settings - */ - virtual const map_plugin_settings_t& GetSettings(); -}; - -/** - * An enum of plugin types. - */ -typedef enum { - ANALYZER, /**< An analyzer plugin*/ - ACTION, /**< An action plugin*/ - REPORTER, /**< A reporter plugin*/ - DATABASE, /**< A database plugin*/ - MAX_PLUGIN_TYPE = DATABASE, -} plugin_type_t; - -/** - * A struct contains all needed data about particular plugin. - */ -typedef struct SPluginInfo -{ - const plugin_type_t m_Type; /**< Plugin type.*/ - const char *const m_sName; /**< Plugin name.*/ - const char *const m_sVersion; /**< Plugin version.*/ - const char *const m_sDescription; /**< Plugin description.*/ - const char *const m_sEmail; /**< Plugin author's email.*/ - const char *const m_sWWW; /**< Plugin's home page.*/ - const char *const m_sGTKBuilder; /**< Plugin's gui description.*/ - const int m_nMagicNumber; /**< Plugin magical number.*/ -} plugin_info_t; - -#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\ - extern "C" CPlugin* plugin_new()\ - {\ - return new plugin_class();\ - }\ - extern "C" const plugin_info_t plugin_info =\ - {\ - type,\ - name,\ - version,\ - description,\ - email,\ - www,\ - gtk_builder,\ - PLUGINS_MAGIC_NUMBER,\ - }; - -/* helper functions */ -std::string make_description_bz(const map_crash_data_t& pCrashData); -std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); -std::string make_description_logger(const map_crash_data_t& pCrashData); - -/** - * Loads settings and stores it in second parameter. On success it - * returns true, otherwise returns false. - * - * @param path A path of config file. - * Config file consists of "key=value" lines. - * @param settings A readed plugin's settings. - * @param skipKeysWithoutValue - * If true, lines in format "key=" (without value) are skipped. - * Otherwise empty value "" is inserted into pSettings. - * @return if it success it returns true, otherwise it returns false. - */ -extern bool LoadPluginSettings(const char *pPath, - map_plugin_settings_t& pSettings, - bool skipKeysWithoutValue = true); - -#endif diff --git a/lib/Utils/Reporter.h b/lib/Utils/Reporter.h deleted file mode 100644 index 4144ec3..0000000 --- a/lib/Utils/Reporter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Reporter.h - header file for reporter plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ -#define REPORTER_H_ - -#include <string> -#include "Plugin.h" -#include "CrashTypes.h" - -/** - * An abstract class. The class defines a reporter plugin interface. - */ -class CReporter : public CPlugin -{ - public: - /** - * A method, which reports a crash report to particular receiver. - * The plugin can takes arguments, but the plugin has to parse them - * by itself. - * @param pCrashData A crash report. - * @param pArgs Plugin's arguments. - * @retun A message which can be displayed after a report is created. - */ - virtual std::string Report(const map_crash_data_t& pCrashData, - const map_plugin_settings_t& pSettings, - const char *pArgs) = 0; -}; - -#endif /* REPORTER_H_ */ diff --git a/lib/Utils/abrt_xmlrpc.h b/lib/Utils/abrt_xmlrpc.h deleted file mode 100644 index ce77038..0000000 --- a/lib/Utils/abrt_xmlrpc.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 ABRT_XMLRPC_H_ -#define ABRT_XMLRPC_H_ 1 - -#include <curl/curl.h> -#include <xmlrpc-c/base.h> -#include <xmlrpc-c/client.h> - -/* - * Simple class holding XMLRPC connection data. - * Used mainly to ensure we always destroy xmlrpc client and server_info - * on return or throw. - */ - -struct abrt_xmlrpc_conn { - xmlrpc_client* m_pClient; - xmlrpc_server_info* m_pServer_info; - - abrt_xmlrpc_conn(const char* url, bool no_ssl_verify) { new_xmlrpc_client(url, no_ssl_verify); } - /* this never throws exceptions - calls C functions only */ - ~abrt_xmlrpc_conn() { destroy_xmlrpc_client(); } - - void new_xmlrpc_client(const char* url, bool no_ssl_verify); - void destroy_xmlrpc_client(); -}; - -/* Utility functions */ -void throw_xml_fault(xmlrpc_env *env); -void throw_if_xml_fault_occurred(xmlrpc_env *env); - -#endif diff --git a/lib/Utils/xfuncs.h b/lib/Utils/xfuncs.h deleted file mode 100644 index de785c8..0000000 --- a/lib/Utils/xfuncs.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 ABRT_XFUNCS_H -#define ABRT_XFUNCS_H - -#include <sys/socket.h> -#include <sys/stat.h> -#include <dirent.h> -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern int ndelay_on(int fd); -extern int ndelay_off(int fd); -extern int close_on_exec_on(int fd); - -extern void* xmalloc(size_t size); -extern void* xrealloc(void *ptr, size_t size); -extern void* xzalloc(size_t size); -extern char* xstrdup(const char *s); -extern char* xstrndup(const char *s, int n); - -extern void xpipe(int filedes[2]); -extern void xdup(int from); -extern void xdup2(int from, int to); -extern void xmove_fd(int from, int to); - -extern void xwrite(int fd, const void *buf, size_t count); -extern void xwrite_str(int fd, const char *str); - -extern off_t xlseek(int fd, off_t offset, int whence); - -extern void xchdir(const char *path); - -extern char* xvasprintf(const char *format, va_list p); -extern char* xasprintf(const char *format, ...); - -extern void xsetenv(const char *key, const char *value); -extern int xsocket(int domain, int type, int protocol); -extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); -extern void xlisten(int s, int backlog); -extern ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); -extern void xstat(const char *name, struct stat *stat_buf); - -extern int xopen3(const char *pathname, int flags, int mode); -extern int xopen(const char *pathname, int flags); -extern void xunlink(const char *pathname); - -/* Just testing dent->d_type == DT_REG is wrong: some filesystems - * do not report the type, they report DT_UNKNOWN for every dirent - * (and this is not a bug in filesystem, this is allowed by standards). - * This function handles this case. Note: it returns 0 on symlinks - * even if they point to regular files. - */ -extern int is_regular_file(struct dirent *dent, const char *dirname); -extern bool dot_or_dotdot(const char *filename); -extern char *last_char_is(const char *s, int c); - -extern bool string_to_bool(const char *s); - -extern void xseteuid(uid_t euid); -extern void xsetegid(gid_t egid); -extern void xsetreuid(uid_t ruid, uid_t euid); -extern void xsetregid(gid_t rgid, gid_t egid); - -/* Returns getpwuid(uid)->pw_dir or NULL */ -extern const char *get_home_dir(uid_t uid); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -std::string ssprintf(const char *format, ...); -std::string concat_path_file(const char *path, const char *filename); -#endif - -#endif
Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- inc/ABRTException.h | 57 -------------- inc/Action.h | 44 ----------- inc/Analyzer.h | 55 -------------- inc/CommLayerInner.h | 45 ----------- inc/CrashTypes.h | 113 ---------------------------- inc/DBusCommon.h | 28 ------- inc/Database.h | 118 ------------------------------ inc/DebugDump.h | 67 ----------------- inc/Makefile.am | 22 +++--- inc/Observer.h | 33 -------- inc/Plugin.h | 142 ------------------------------------ inc/Reporter.h | 47 ------------ inc/abrt_exception.h | 57 ++++++++++++++ inc/action.h | 44 +++++++++++ inc/analyzer.h | 55 ++++++++++++++ inc/comm_layer_inner.h | 45 +++++++++++ inc/crash_types.h | 113 ++++++++++++++++++++++++++++ inc/database.h | 118 ++++++++++++++++++++++++++++++ inc/dbus_common.h | 28 +++++++ inc/debug_dump.h | 67 +++++++++++++++++ inc/observer.h | 33 ++++++++ inc/plugin.h | 142 ++++++++++++++++++++++++++++++++++++ inc/reporter.h | 47 ++++++++++++ lib/Plugins/Bugzilla.cpp | 8 +- lib/Plugins/Bugzilla.h | 4 +- lib/Plugins/CCpp.cpp | 6 +- lib/Plugins/CCpp.h | 4 +- lib/Plugins/FileTransfer.cpp | 6 +- lib/Plugins/FileTransfer.h | 4 +- lib/Plugins/Kerneloops.cpp | 6 +- lib/Plugins/Kerneloops.h | 4 +- lib/Plugins/KerneloopsReporter.cpp | 4 +- lib/Plugins/KerneloopsReporter.h | 4 +- lib/Plugins/KerneloopsScanner.cpp | 6 +- lib/Plugins/KerneloopsScanner.h | 4 +- lib/Plugins/Logger.cpp | 6 +- lib/Plugins/Logger.h | 4 +- lib/Plugins/Mailx.cpp | 6 +- lib/Plugins/Mailx.h | 4 +- lib/Plugins/Python.cpp | 4 +- lib/Plugins/Python.h | 4 +- lib/Plugins/RHTSupport.cpp | 8 +- lib/Plugins/RHTSupport.h | 4 +- lib/Plugins/ReportUploader.cpp | 6 +- lib/Plugins/ReportUploader.h | 4 +- lib/Plugins/RunApp.cpp | 6 +- lib/Plugins/RunApp.h | 2 +- lib/Plugins/SOSreport.cpp | 8 +- lib/Plugins/SOSreport.h | 2 +- lib/Plugins/SQLite3.cpp | 2 +- lib/Plugins/SQLite3.h | 4 +- lib/Utils/ABRTException.cpp | 2 +- lib/Utils/CommLayerInner.cpp | 2 +- lib/Utils/CrashTypes.cpp | 2 +- lib/Utils/DebugDump.cpp | 6 +- lib/Utils/Makefile.am | 4 +- lib/Utils/Plugin.cpp | 2 +- lib/Utils/abrt_curl.cpp | 2 +- lib/Utils/abrt_rh_support.cpp | 2 +- lib/Utils/abrt_xmlrpc.cpp | 2 +- lib/Utils/hooklib.cpp | 2 +- lib/Utils/make_descr.cpp | 4 +- src/Applet/Applet.cpp | 2 +- src/CLI/CLI.cpp | 4 +- src/CLI/dbus.cpp | 2 +- src/CLI/dbus.h | 2 +- src/CLI/report.cpp | 6 +- src/Daemon/CommLayerServer.h | 2 +- src/Daemon/CommLayerServerDBus.cpp | 2 +- src/Daemon/CrashWatcher.cpp | 4 +- src/Daemon/CrashWatcher.h | 2 +- src/Daemon/Daemon.cpp | 4 +- src/Daemon/Daemon.h | 2 +- src/Daemon/MiddleWare.cpp | 6 +- src/Daemon/PluginManager.cpp | 4 +- src/Daemon/PluginManager.h | 10 +- src/Daemon/RPM.cpp | 2 +- src/Daemon/dumpsocket.cpp | 6 +- src/Hooks/abrt-hook-ccpp.cpp | 6 +- 79 files changed, 875 insertions(+), 875 deletions(-) delete mode 100644 inc/ABRTException.h delete mode 100644 inc/Action.h delete mode 100644 inc/Analyzer.h delete mode 100644 inc/CommLayerInner.h delete mode 100644 inc/CrashTypes.h delete mode 100644 inc/DBusCommon.h delete mode 100644 inc/Database.h delete mode 100644 inc/DebugDump.h delete mode 100644 inc/Observer.h delete mode 100644 inc/Plugin.h delete mode 100644 inc/Reporter.h create mode 100644 inc/abrt_exception.h create mode 100644 inc/action.h create mode 100644 inc/analyzer.h create mode 100644 inc/comm_layer_inner.h create mode 100644 inc/crash_types.h create mode 100644 inc/database.h create mode 100644 inc/dbus_common.h create mode 100644 inc/debug_dump.h create mode 100644 inc/observer.h create mode 100644 inc/plugin.h create mode 100644 inc/reporter.h
diff --git a/inc/ABRTException.h b/inc/ABRTException.h deleted file mode 100644 index b826bfa..0000000 --- a/inc/ABRTException.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 ABRTEXCEPTION_H_ -#define ABRTEXCEPTION_H_ - -#include "abrtlib.h" - -typedef enum { - EXCEP_UNKNOW, - EXCEP_DD_OPEN, - EXCEP_DD_LOAD, - EXCEP_DD_SAVE, - EXCEP_DD_DELETE, - EXCEP_DL, - EXCEP_PLUGIN, - EXCEP_ERROR, -} abrt_exception_t; - -/* std::exception is a class with virtual members. - * deriving from it makes our ctor/dtor much more heavy, - * and those are inlined in every throw and catch site! - */ -class CABRTException /*: public std::exception*/ -{ - private: - abrt_exception_t m_type; - char *m_what; - - /* Not defined. You can't use it */ - CABRTException& operator= (const CABRTException&); - - public: - ~CABRTException() { free(m_what); } - CABRTException(abrt_exception_t type, const char* fmt, ...); - CABRTException(const CABRTException& rhs); - - abrt_exception_t type() { return m_type; } - const char* what() const { return m_what; } -}; - -#endif diff --git a/inc/Action.h b/inc/Action.h deleted file mode 100644 index fc56277..0000000 --- a/inc/Action.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Action.h - header file for action plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ -#define ACTION_H_ - -#include "Plugin.h" - -/** - * An abstract class. The class defines an action plugin interface. - */ -class CAction : public CPlugin -{ - public: - /** - * A Method which performs particular action. As the first parameter it - * takes an action directory. It could be either a directory of actual - * crash or it could be a directory contains all crashes. It depends on - * who call the plugin. The plugin can takes arguments, but the plugin - * has to parse them by itself. - * @param pActionDir An actual directory. - * @param pArgs Plugin's arguments. - */ - virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0; -}; - -#endif diff --git a/inc/Analyzer.h b/inc/Analyzer.h deleted file mode 100644 index a45bd0e..0000000 --- a/inc/Analyzer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Analyzer.h - header file for analyzer plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ -#define ANALYZER_H_ - -#include <string> -#include "Plugin.h" - -/** - * An abstract class. The class defines an analyzer plugin interface. - */ -class CAnalyzer : public CPlugin -{ - public: - /** - * A method, which gets a local UUID of particular crash. The local - * UUID is usualy computed from data which are stored in debugdump dir. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - * @return A local UUID. - */ - virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0; - /** - * A method, which gets a global UUID of particular crash. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - * @return A global UUID. - */ - virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0; - /** - * A method, which takes care of getting all additional data needed - * for computing UUIDs and creating a report. This report could be send - * somewhere afterwards. - * @param pDebugDumpPath A debugdump dir containing all necessary data. - */ - virtual void CreateReport(const char *pDebugDumpDir, int force) = 0; -}; - -#endif /*ANALYZER_H_*/ diff --git a/inc/CommLayerInner.h b/inc/CommLayerInner.h deleted file mode 100644 index 353cfc7..0000000 --- a/inc/CommLayerInner.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 COMMLAYERINNER_H_ -#define COMMLAYERINNER_H_ - -#include "Observer.h" - -void init_daemon_logging(CObserver *pObs); - -/* - * Set client's name (dbus ID). NULL unsets it. - */ -void set_client_name(const char* name); - -/* - * Ask a client to warn the user about a non-fatal, but unexpected condition. - * In GUI, it will usually be presented as a popup message. - * Usually there is no need to call it directly, just use [p]error_msg(). - */ -//now static: void warn_client(const char *msg); - -/* - * Logs a message to a client. - * In UI, it will usually appear as a new status line message in GUI, - * or as a new message line in CLI. - */ -void update_client(const char *fmt, ...); - -#endif diff --git a/inc/CrashTypes.h b/inc/CrashTypes.h deleted file mode 100644 index 25dbcd4..0000000 --- a/inc/CrashTypes.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - 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 CRASHTYPES_H_ -#define CRASHTYPES_H_ - -#include "abrt_types.h" - -// Filenames in dump directory: -// filled by a hook: -#define FILENAME_ANALYZER "analyzer" -#define FILENAME_EXECUTABLE "executable" -#define FILENAME_BINARY "binary" -#define FILENAME_CMDLINE "cmdline" -#define FILENAME_REASON "reason" -#define FILENAME_COREDUMP "coredump" -#define FILENAME_BACKTRACE "backtrace" -#define FILENAME_MEMORYMAP "memorymap" -// Used by CCpp analyzer to cache GetGlobalUUID() calls. -#define FILENAME_GLOBAL_UUID "global_uuid" -// Name of the function where the application crashed. -// Optional. -#define FILENAME_CRASH_FUNCTION "crash_function" -// filled by CDebugDump::Create() (which also fills CD_UID): -#define FILENAME_ARCHITECTURE "architecture" -#define FILENAME_KERNEL "kernel" -#define FILENAME_TIME "time" -#define FILENAME_RELEASE "release" /* from /etc/redhat-release */ -// filled by <what?> -#define FILENAME_PACKAGE "package" -#define FILENAME_COMPONENT "component" -#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */ -#define FILENAME_COMMENT "comment" -#define FILENAME_REPRODUCE "reproduce" -#define FILENAME_RATING "rating" -#define FILENAME_HOSTNAME "hostname" -// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump -#define FILENAME_REMOTE "remote" -// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files - -// Apart from CD_UID, which is also stored as a file in dump directory, -// these items only exist in db. (CD_UID is also a file because -// dump directory is created before its DB entry, and DB has to learn -// CD_UID from _somewhere_ in order to be able to store it in DB record, -// right?) -#define CD_UID "uid" /* lowercase: compat with older versions */ -#define CD_UUID "UUID" -#define CD_INFORMALL "InformAll" -#define CD_DUPHASH "DUPHASH" -#define CD_DUMPDIR "DumpDir" -#define CD_COUNT "Count" -#define CD_REPORTED "Reported" -#define CD_MESSAGE "Message" - - -// Crash data is a map of 3-element vectors of strings: type, editable, content -#define CD_TYPE 0 -#define CD_EDITABLE 1 -#define CD_CONTENT 2 - -// SYS - system value, should not be displayed -// BIN - binary data -// TXT - text data, can be displayed -#define CD_SYS "s" -#define CD_BIN "b" -#define CD_TXT "t" -// Text bigger than this usually is attached, not added inline -#define CD_TEXT_ATT_SIZE (2*1024) - -#define CD_ISEDITABLE "y" -#define CD_ISNOTEDITABLE "n" - - -extern const char *const must_have_files[]; - -bool is_editable_file(const char *file_name); - -// <key, data> -typedef map_vector_string_t map_crash_data_t; -typedef std::vector<map_crash_data_t> vector_map_crash_data_t; - -void add_to_crash_data_ext(map_crash_data_t& pCrashData, - const char *pItem, - const char *pType, - const char *pEditable, - const char *pContent); -// Uses type:CD_TXT, editable:CD_ISNOTEDITABLE -void add_to_crash_data(map_crash_data_t& pCrashData, - const char *pItem, - const char *pContent); - -const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key); -// Aborts if key is not found: -const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key); - -void log_map_crash_data(const map_crash_data_t& data, const char *name); - -#endif diff --git a/inc/DBusCommon.h b/inc/DBusCommon.h deleted file mode 100644 index 58b4c8d..0000000 --- a/inc/DBusCommon.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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 DBUSCOMMON_H_ -#define DBUSCOMMON_H_ - -#include "CrashTypes.h" - -#define ABRTD_DBUS_NAME "com.redhat.abrt" -#define ABRTD_DBUS_PATH "/com/redhat/abrt" -#define ABRTD_DBUS_IFACE "com.redhat.abrt" - -#endif diff --git a/inc/Database.h b/inc/Database.h deleted file mode 100644 index a698bcb..0000000 --- a/inc/Database.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Database.h - header file for database plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ -#define DATABASE_H_ - -#include <string> -#include <vector> -#include "Plugin.h" - -/** - * Table - * ===== - * UUID | UID| DebugDumpPath | Count | Reported | Time | Message - * - * primary key (UUID, UID) - */ - -/** - * A struct contains one database row. - */ -typedef struct database_row_t -{ - std::string m_sUUID; /**< A local UUID.*/ - std::string m_sUID; /**< An UID of an user.*/ - std::string m_sInformAll; - std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/ - std::string m_sCount; /**< Crash rate.*/ - std::string m_sReported; /**< Is a row reported?*/ - std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/ - std::string m_sTime; /**< Time of last occurred crash with same local UUID*/ -} database_row_t; - -/** - * A vector contains one or more database rows. - */ -typedef std::vector<database_row_t> vector_database_rows_t; - -/** - * An abstract class. The class defines a database plugin interface. - */ -class CDatabase : public CPlugin -{ - public: - /** - * A method, which connects to a database. - */ - virtual void Connect() = 0; - /** - * A method, which disconnects from a database. - */ - virtual void DisConnect() = 0; - /** - * A method, which inserts one row to a database. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pDebugDumpPath A debugdump path. - * @param pTime Time when a crash occurs. - */ - virtual void Insert_or_Update(const char *crash_id, - bool inform_all_users, - const char *pDebugDumpPath, - const char *pTime) = 0; - /** - * A method, which deletes one row in a database. - * @param pUUID A lodal UUID of a crash. - * @param pUID An UID of an user. - */ - virtual void DeleteRow(const char *crash_id) = 0; - virtual void DeleteRows_by_dir(const char *dump_dir) = 0; - /** - * A method, which sets that particular row was reported. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pMessage A text explanation of reported problem - * (where it is stored etc)... - */ - virtual void SetReported(const char *crash_id, - const char *pMessage) = 0; - virtual void SetReportedPerReporter(const char *crash_id, - const char *reporter, - const char *pMessage) = 0; - /** - * A method, which gets all rows which belongs to particular user. - * If the user is root, then all rows are returned. If there are no - * rows, empty vector is returned. - * @param pUID An UID of an user. - * @return A vector of matched rows. - */ - virtual vector_database_rows_t GetUIDData(long caller_uid) = 0; - /** - * A method, which returns one row accordind to UUID of a crash and - * UID of an user. If there are no row, empty row is returned. - * @param pUUID A UUID of a crash. - * @param pUID An UID of an user. - * @return A matched row. - */ - virtual database_row_t GetRow(const char *crash_id) = 0; -}; - -#endif diff --git a/inc/DebugDump.h b/inc/DebugDump.h deleted file mode 100644 index f8487a6..0000000 --- a/inc/DebugDump.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - DebugDump.h - header file for the library caring of writing new reports - to the specific directory - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ -#define DEBUGDUMP_H_ - -#include <string> - -class CDebugDump -{ - private: - std::string m_sDebugDumpDir; - DIR* m_pGetNextFileDir; - bool m_bOpened; - bool m_bLocked; - uid_t m_uid; - gid_t m_gid; - - void Lock(); - void UnLock(); - - public: - CDebugDump(); - ~CDebugDump(); - - void Open(const char *pDir); - void Create(const char *pDir, uid_t uid); - void Delete(); - void Close(); - - bool Exist(const char* pFileName); - - void LoadText(const char* pName, std::string& pData); - - void SaveText(const char* pName, const char *pData); - void SaveBinary(const char* pName, const char* pData, unsigned pSize); - - void InitGetNextFile(); - /* Pointers may be NULL */ - bool GetNextFile(std::string *short_name, std::string *full_name); -}; - -/** - * Deletes particular debugdump directory. - * @param pDebugDumpDir A debugdump directory. - */ -void delete_debug_dump_dir(const char *pDebugDumpDir); - -#endif diff --git a/inc/Makefile.am b/inc/Makefile.am index e668b48..901c23f 100644 --- a/inc/Makefile.am +++ b/inc/Makefile.am @@ -1,18 +1,18 @@ HEADER_FILES = \ - ABRTException.h \ + abrt_exception.h \ abrtlib.h \ abrt_types.h \ abrt_xmlrpc.h \ - Action.h \ - Analyzer.h \ - CommLayerInner.h \ - CrashTypes.h \ - Database.h \ - DBusCommon.h \ - DebugDump.h \ - Observer.h \ - Plugin.h \ - Reporter.h \ + action.h \ + analyzer.h \ + comm_layer_inner.h \ + crash_types.h \ + database.h \ + dbus_common.h \ + debug_dump.h \ + observer.h \ + plugin.h \ + reporter.h \ xfuncs.h
lib_includedir=$(includedir)/abrt/ diff --git a/inc/Observer.h b/inc/Observer.h deleted file mode 100644 index ec7dfa7..0000000 --- a/inc/Observer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 OBSERVER_H_ -#define OBSERVER_H_ - -#include <string> -#include <stdint.h> -#include "DBusCommon.h" - -class CObserver { - public: - virtual ~CObserver() {} - virtual void Status(const char *pMessage, const char* peer) = 0; - virtual void Warning(const char *pMessage, const char* peer) = 0; -}; - -#endif diff --git a/inc/Plugin.h b/inc/Plugin.h deleted file mode 100644 index 367739f..0000000 --- a/inc/Plugin.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - Plugin.h - header file for plugin. It contains mandatory macros - and common function for plugins - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ -#define PLUGIN_H_ - -#include "abrt_types.h" -#include "CrashTypes.h" -#if HAVE_CONFIG_H -# include <config.h> -#endif -#if ENABLE_NLS -# include <libintl.h> -# define _(S) gettext(S) -#else -# define _(S) (S) -#endif - -#define PLUGINS_MAGIC_NUMBER 6 - -#define PLUGINS_CONF_EXTENSION "conf" -#define PLUGINS_LIB_EXTENSION "so" -#define PLUGINS_LIB_PREFIX "lib" - -/** - * An abstract class. The class defines a common plugin interface. If a plugin - * has some settings, then a *Settings(*) method has to be written. - */ -class CPlugin -{ - protected: - map_plugin_settings_t m_pSettings; - - public: - CPlugin(); - /** - * A destructor. - */ - virtual ~CPlugin(); - /** - * A method, which initializes a plugin. It is not mandatory method. - */ - virtual void Init(); - /** - * A method, which deinitializes a plugin. It is not mandatory method. - */ - virtual void DeInit(); - /** - * A method, which takes a settings and apply them. It is not a mandatory method. - * @param pSettings Plugin's settings - */ - virtual void SetSettings(const map_plugin_settings_t& pSettings); - /** - * A method, which return current settings. It is not mandatory method. - * @return Plugin's settings - */ - virtual const map_plugin_settings_t& GetSettings(); -}; - -/** - * An enum of plugin types. - */ -typedef enum { - ANALYZER, /**< An analyzer plugin*/ - ACTION, /**< An action plugin*/ - REPORTER, /**< A reporter plugin*/ - DATABASE, /**< A database plugin*/ - MAX_PLUGIN_TYPE = DATABASE, -} plugin_type_t; - -/** - * A struct contains all needed data about particular plugin. - */ -typedef struct SPluginInfo -{ - const plugin_type_t m_Type; /**< Plugin type.*/ - const char *const m_sName; /**< Plugin name.*/ - const char *const m_sVersion; /**< Plugin version.*/ - const char *const m_sDescription; /**< Plugin description.*/ - const char *const m_sEmail; /**< Plugin author's email.*/ - const char *const m_sWWW; /**< Plugin's home page.*/ - const char *const m_sGTKBuilder; /**< Plugin's gui description.*/ - const int m_nMagicNumber; /**< Plugin magical number.*/ -} plugin_info_t; - -#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\ - extern "C" CPlugin* plugin_new()\ - {\ - return new plugin_class();\ - }\ - extern "C" const plugin_info_t plugin_info =\ - {\ - type,\ - name,\ - version,\ - description,\ - email,\ - www,\ - gtk_builder,\ - PLUGINS_MAGIC_NUMBER,\ - }; - -/* helper functions */ -std::string make_description_bz(const map_crash_data_t& pCrashData); -std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); -std::string make_description_logger(const map_crash_data_t& pCrashData); - -/** - * Loads settings and stores it in second parameter. On success it - * returns true, otherwise returns false. - * - * @param path A path of config file. - * Config file consists of "key=value" lines. - * @param settings A readed plugin's settings. - * @param skipKeysWithoutValue - * If true, lines in format "key=" (without value) are skipped. - * Otherwise empty value "" is inserted into pSettings. - * @return if it success it returns true, otherwise it returns false. - */ -extern bool LoadPluginSettings(const char *pPath, - map_plugin_settings_t& pSettings, - bool skipKeysWithoutValue = true); - -#endif diff --git a/inc/Reporter.h b/inc/Reporter.h deleted file mode 100644 index 4144ec3..0000000 --- a/inc/Reporter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Reporter.h - header file for reporter plugin - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ -#define REPORTER_H_ - -#include <string> -#include "Plugin.h" -#include "CrashTypes.h" - -/** - * An abstract class. The class defines a reporter plugin interface. - */ -class CReporter : public CPlugin -{ - public: - /** - * A method, which reports a crash report to particular receiver. - * The plugin can takes arguments, but the plugin has to parse them - * by itself. - * @param pCrashData A crash report. - * @param pArgs Plugin's arguments. - * @retun A message which can be displayed after a report is created. - */ - virtual std::string Report(const map_crash_data_t& pCrashData, - const map_plugin_settings_t& pSettings, - const char *pArgs) = 0; -}; - -#endif /* REPORTER_H_ */ diff --git a/inc/abrt_exception.h b/inc/abrt_exception.h new file mode 100644 index 0000000..b826bfa --- /dev/null +++ b/inc/abrt_exception.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 ABRTEXCEPTION_H_ +#define ABRTEXCEPTION_H_ + +#include "abrtlib.h" + +typedef enum { + EXCEP_UNKNOW, + EXCEP_DD_OPEN, + EXCEP_DD_LOAD, + EXCEP_DD_SAVE, + EXCEP_DD_DELETE, + EXCEP_DL, + EXCEP_PLUGIN, + EXCEP_ERROR, +} abrt_exception_t; + +/* std::exception is a class with virtual members. + * deriving from it makes our ctor/dtor much more heavy, + * and those are inlined in every throw and catch site! + */ +class CABRTException /*: public std::exception*/ +{ + private: + abrt_exception_t m_type; + char *m_what; + + /* Not defined. You can't use it */ + CABRTException& operator= (const CABRTException&); + + public: + ~CABRTException() { free(m_what); } + CABRTException(abrt_exception_t type, const char* fmt, ...); + CABRTException(const CABRTException& rhs); + + abrt_exception_t type() { return m_type; } + const char* what() const { return m_what; } +}; + +#endif diff --git a/inc/action.h b/inc/action.h new file mode 100644 index 0000000..2118336 --- /dev/null +++ b/inc/action.h @@ -0,0 +1,44 @@ +/* + Action.h - header file for action plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ +#define ACTION_H_ + +#include "plugin.h" + +/** + * An abstract class. The class defines an action plugin interface. + */ +class CAction : public CPlugin +{ + public: + /** + * A Method which performs particular action. As the first parameter it + * takes an action directory. It could be either a directory of actual + * crash or it could be a directory contains all crashes. It depends on + * who call the plugin. The plugin can takes arguments, but the plugin + * has to parse them by itself. + * @param pActionDir An actual directory. + * @param pArgs Plugin's arguments. + */ + virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0; +}; + +#endif diff --git a/inc/analyzer.h b/inc/analyzer.h new file mode 100644 index 0000000..25ea69a --- /dev/null +++ b/inc/analyzer.h @@ -0,0 +1,55 @@ +/* + Analyzer.h - header file for analyzer plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ +#define ANALYZER_H_ + +#include <string> +#include "plugin.h" + +/** + * An abstract class. The class defines an analyzer plugin interface. + */ +class CAnalyzer : public CPlugin +{ + public: + /** + * A method, which gets a local UUID of particular crash. The local + * UUID is usualy computed from data which are stored in debugdump dir. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + * @return A local UUID. + */ + virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0; + /** + * A method, which gets a global UUID of particular crash. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + * @return A global UUID. + */ + virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0; + /** + * A method, which takes care of getting all additional data needed + * for computing UUIDs and creating a report. This report could be send + * somewhere afterwards. + * @param pDebugDumpPath A debugdump dir containing all necessary data. + */ + virtual void CreateReport(const char *pDebugDumpDir, int force) = 0; +}; + +#endif /*ANALYZER_H_*/ diff --git a/inc/comm_layer_inner.h b/inc/comm_layer_inner.h new file mode 100644 index 0000000..e966238 --- /dev/null +++ b/inc/comm_layer_inner.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 COMMLAYERINNER_H_ +#define COMMLAYERINNER_H_ + +#include "observer.h" + +void init_daemon_logging(CObserver *pObs); + +/* + * Set client's name (dbus ID). NULL unsets it. + */ +void set_client_name(const char* name); + +/* + * Ask a client to warn the user about a non-fatal, but unexpected condition. + * In GUI, it will usually be presented as a popup message. + * Usually there is no need to call it directly, just use [p]error_msg(). + */ +//now static: void warn_client(const char *msg); + +/* + * Logs a message to a client. + * In UI, it will usually appear as a new status line message in GUI, + * or as a new message line in CLI. + */ +void update_client(const char *fmt, ...); + +#endif diff --git a/inc/crash_types.h b/inc/crash_types.h new file mode 100644 index 0000000..25dbcd4 --- /dev/null +++ b/inc/crash_types.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2009 Abrt team. + 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 CRASHTYPES_H_ +#define CRASHTYPES_H_ + +#include "abrt_types.h" + +// Filenames in dump directory: +// filled by a hook: +#define FILENAME_ANALYZER "analyzer" +#define FILENAME_EXECUTABLE "executable" +#define FILENAME_BINARY "binary" +#define FILENAME_CMDLINE "cmdline" +#define FILENAME_REASON "reason" +#define FILENAME_COREDUMP "coredump" +#define FILENAME_BACKTRACE "backtrace" +#define FILENAME_MEMORYMAP "memorymap" +// Used by CCpp analyzer to cache GetGlobalUUID() calls. +#define FILENAME_GLOBAL_UUID "global_uuid" +// Name of the function where the application crashed. +// Optional. +#define FILENAME_CRASH_FUNCTION "crash_function" +// filled by CDebugDump::Create() (which also fills CD_UID): +#define FILENAME_ARCHITECTURE "architecture" +#define FILENAME_KERNEL "kernel" +#define FILENAME_TIME "time" +#define FILENAME_RELEASE "release" /* from /etc/redhat-release */ +// filled by <what?> +#define FILENAME_PACKAGE "package" +#define FILENAME_COMPONENT "component" +#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */ +#define FILENAME_COMMENT "comment" +#define FILENAME_REPRODUCE "reproduce" +#define FILENAME_RATING "rating" +#define FILENAME_HOSTNAME "hostname" +// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump +#define FILENAME_REMOTE "remote" +// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files + +// Apart from CD_UID, which is also stored as a file in dump directory, +// these items only exist in db. (CD_UID is also a file because +// dump directory is created before its DB entry, and DB has to learn +// CD_UID from _somewhere_ in order to be able to store it in DB record, +// right?) +#define CD_UID "uid" /* lowercase: compat with older versions */ +#define CD_UUID "UUID" +#define CD_INFORMALL "InformAll" +#define CD_DUPHASH "DUPHASH" +#define CD_DUMPDIR "DumpDir" +#define CD_COUNT "Count" +#define CD_REPORTED "Reported" +#define CD_MESSAGE "Message" + + +// Crash data is a map of 3-element vectors of strings: type, editable, content +#define CD_TYPE 0 +#define CD_EDITABLE 1 +#define CD_CONTENT 2 + +// SYS - system value, should not be displayed +// BIN - binary data +// TXT - text data, can be displayed +#define CD_SYS "s" +#define CD_BIN "b" +#define CD_TXT "t" +// Text bigger than this usually is attached, not added inline +#define CD_TEXT_ATT_SIZE (2*1024) + +#define CD_ISEDITABLE "y" +#define CD_ISNOTEDITABLE "n" + + +extern const char *const must_have_files[]; + +bool is_editable_file(const char *file_name); + +// <key, data> +typedef map_vector_string_t map_crash_data_t; +typedef std::vector<map_crash_data_t> vector_map_crash_data_t; + +void add_to_crash_data_ext(map_crash_data_t& pCrashData, + const char *pItem, + const char *pType, + const char *pEditable, + const char *pContent); +// Uses type:CD_TXT, editable:CD_ISNOTEDITABLE +void add_to_crash_data(map_crash_data_t& pCrashData, + const char *pItem, + const char *pContent); + +const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key); +// Aborts if key is not found: +const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key); + +void log_map_crash_data(const map_crash_data_t& data, const char *name); + +#endif diff --git a/inc/database.h b/inc/database.h new file mode 100644 index 0000000..df109bd --- /dev/null +++ b/inc/database.h @@ -0,0 +1,118 @@ +/* + Database.h - header file for database plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ +#define DATABASE_H_ + +#include <string> +#include <vector> +#include "plugin.h" + +/** + * Table + * ===== + * UUID | UID| DebugDumpPath | Count | Reported | Time | Message + * + * primary key (UUID, UID) + */ + +/** + * A struct contains one database row. + */ +typedef struct database_row_t +{ + std::string m_sUUID; /**< A local UUID.*/ + std::string m_sUID; /**< An UID of an user.*/ + std::string m_sInformAll; + std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/ + std::string m_sCount; /**< Crash rate.*/ + std::string m_sReported; /**< Is a row reported?*/ + std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/ + std::string m_sTime; /**< Time of last occurred crash with same local UUID*/ +} database_row_t; + +/** + * A vector contains one or more database rows. + */ +typedef std::vector<database_row_t> vector_database_rows_t; + +/** + * An abstract class. The class defines a database plugin interface. + */ +class CDatabase : public CPlugin +{ + public: + /** + * A method, which connects to a database. + */ + virtual void Connect() = 0; + /** + * A method, which disconnects from a database. + */ + virtual void DisConnect() = 0; + /** + * A method, which inserts one row to a database. + * @param pUUID A local UUID of a crash. + * @param pUID An UID of an user. + * @param pDebugDumpPath A debugdump path. + * @param pTime Time when a crash occurs. + */ + virtual void Insert_or_Update(const char *crash_id, + bool inform_all_users, + const char *pDebugDumpPath, + const char *pTime) = 0; + /** + * A method, which deletes one row in a database. + * @param pUUID A lodal UUID of a crash. + * @param pUID An UID of an user. + */ + virtual void DeleteRow(const char *crash_id) = 0; + virtual void DeleteRows_by_dir(const char *dump_dir) = 0; + /** + * A method, which sets that particular row was reported. + * @param pUUID A local UUID of a crash. + * @param pUID An UID of an user. + * @param pMessage A text explanation of reported problem + * (where it is stored etc)... + */ + virtual void SetReported(const char *crash_id, + const char *pMessage) = 0; + virtual void SetReportedPerReporter(const char *crash_id, + const char *reporter, + const char *pMessage) = 0; + /** + * A method, which gets all rows which belongs to particular user. + * If the user is root, then all rows are returned. If there are no + * rows, empty vector is returned. + * @param pUID An UID of an user. + * @return A vector of matched rows. + */ + virtual vector_database_rows_t GetUIDData(long caller_uid) = 0; + /** + * A method, which returns one row accordind to UUID of a crash and + * UID of an user. If there are no row, empty row is returned. + * @param pUUID A UUID of a crash. + * @param pUID An UID of an user. + * @return A matched row. + */ + virtual database_row_t GetRow(const char *crash_id) = 0; +}; + +#endif diff --git a/inc/dbus_common.h b/inc/dbus_common.h new file mode 100644 index 0000000..63053cc --- /dev/null +++ b/inc/dbus_common.h @@ -0,0 +1,28 @@ +/* + 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 DBUSCOMMON_H_ +#define DBUSCOMMON_H_ + +#include "crash_types.h" + +#define ABRTD_DBUS_NAME "com.redhat.abrt" +#define ABRTD_DBUS_PATH "/com/redhat/abrt" +#define ABRTD_DBUS_IFACE "com.redhat.abrt" + +#endif diff --git a/inc/debug_dump.h b/inc/debug_dump.h new file mode 100644 index 0000000..f8487a6 --- /dev/null +++ b/inc/debug_dump.h @@ -0,0 +1,67 @@ +/* + DebugDump.h - header file for the library caring of writing new reports + to the specific directory + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ +#define DEBUGDUMP_H_ + +#include <string> + +class CDebugDump +{ + private: + std::string m_sDebugDumpDir; + DIR* m_pGetNextFileDir; + bool m_bOpened; + bool m_bLocked; + uid_t m_uid; + gid_t m_gid; + + void Lock(); + void UnLock(); + + public: + CDebugDump(); + ~CDebugDump(); + + void Open(const char *pDir); + void Create(const char *pDir, uid_t uid); + void Delete(); + void Close(); + + bool Exist(const char* pFileName); + + void LoadText(const char* pName, std::string& pData); + + void SaveText(const char* pName, const char *pData); + void SaveBinary(const char* pName, const char* pData, unsigned pSize); + + void InitGetNextFile(); + /* Pointers may be NULL */ + bool GetNextFile(std::string *short_name, std::string *full_name); +}; + +/** + * Deletes particular debugdump directory. + * @param pDebugDumpDir A debugdump directory. + */ +void delete_debug_dump_dir(const char *pDebugDumpDir); + +#endif diff --git a/inc/observer.h b/inc/observer.h new file mode 100644 index 0000000..f3565ff --- /dev/null +++ b/inc/observer.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2010 ABRT team + Copyright (C) 2010 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 OBSERVER_H_ +#define OBSERVER_H_ + +#include <string> +#include <stdint.h> +#include "dbus_common.h" + +class CObserver { + public: + virtual ~CObserver() {} + virtual void Status(const char *pMessage, const char* peer) = 0; + virtual void Warning(const char *pMessage, const char* peer) = 0; +}; + +#endif diff --git a/inc/plugin.h b/inc/plugin.h new file mode 100644 index 0000000..34d5743 --- /dev/null +++ b/inc/plugin.h @@ -0,0 +1,142 @@ +/* + Plugin.h - header file for plugin. It contains mandatory macros + and common function for plugins + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ +#define PLUGIN_H_ + +#include "abrt_types.h" +#include "crash_types.h" +#if HAVE_CONFIG_H +# include <config.h> +#endif +#if ENABLE_NLS +# include <libintl.h> +# define _(S) gettext(S) +#else +# define _(S) (S) +#endif + +#define PLUGINS_MAGIC_NUMBER 6 + +#define PLUGINS_CONF_EXTENSION "conf" +#define PLUGINS_LIB_EXTENSION "so" +#define PLUGINS_LIB_PREFIX "lib" + +/** + * An abstract class. The class defines a common plugin interface. If a plugin + * has some settings, then a *Settings(*) method has to be written. + */ +class CPlugin +{ + protected: + map_plugin_settings_t m_pSettings; + + public: + CPlugin(); + /** + * A destructor. + */ + virtual ~CPlugin(); + /** + * A method, which initializes a plugin. It is not mandatory method. + */ + virtual void Init(); + /** + * A method, which deinitializes a plugin. It is not mandatory method. + */ + virtual void DeInit(); + /** + * A method, which takes a settings and apply them. It is not a mandatory method. + * @param pSettings Plugin's settings + */ + virtual void SetSettings(const map_plugin_settings_t& pSettings); + /** + * A method, which return current settings. It is not mandatory method. + * @return Plugin's settings + */ + virtual const map_plugin_settings_t& GetSettings(); +}; + +/** + * An enum of plugin types. + */ +typedef enum { + ANALYZER, /**< An analyzer plugin*/ + ACTION, /**< An action plugin*/ + REPORTER, /**< A reporter plugin*/ + DATABASE, /**< A database plugin*/ + MAX_PLUGIN_TYPE = DATABASE, +} plugin_type_t; + +/** + * A struct contains all needed data about particular plugin. + */ +typedef struct SPluginInfo +{ + const plugin_type_t m_Type; /**< Plugin type.*/ + const char *const m_sName; /**< Plugin name.*/ + const char *const m_sVersion; /**< Plugin version.*/ + const char *const m_sDescription; /**< Plugin description.*/ + const char *const m_sEmail; /**< Plugin author's email.*/ + const char *const m_sWWW; /**< Plugin's home page.*/ + const char *const m_sGTKBuilder; /**< Plugin's gui description.*/ + const int m_nMagicNumber; /**< Plugin magical number.*/ +} plugin_info_t; + +#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\ + extern "C" CPlugin* plugin_new()\ + {\ + return new plugin_class();\ + }\ + extern "C" const plugin_info_t plugin_info =\ + {\ + type,\ + name,\ + version,\ + description,\ + email,\ + www,\ + gtk_builder,\ + PLUGINS_MAGIC_NUMBER,\ + }; + +/* helper functions */ +std::string make_description_bz(const map_crash_data_t& pCrashData); +std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); +std::string make_description_logger(const map_crash_data_t& pCrashData); + +/** + * Loads settings and stores it in second parameter. On success it + * returns true, otherwise returns false. + * + * @param path A path of config file. + * Config file consists of "key=value" lines. + * @param settings A readed plugin's settings. + * @param skipKeysWithoutValue + * If true, lines in format "key=" (without value) are skipped. + * Otherwise empty value "" is inserted into pSettings. + * @return if it success it returns true, otherwise it returns false. + */ +extern bool LoadPluginSettings(const char *pPath, + map_plugin_settings_t& pSettings, + bool skipKeysWithoutValue = true); + +#endif diff --git a/inc/reporter.h b/inc/reporter.h new file mode 100644 index 0000000..12f1b0b --- /dev/null +++ b/inc/reporter.h @@ -0,0 +1,47 @@ +/* + Reporter.h - header file for reporter plugin + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ +#define REPORTER_H_ + +#include <string> +#include "plugin.h" +#include "crash_types.h" + +/** + * An abstract class. The class defines a reporter plugin interface. + */ +class CReporter : public CPlugin +{ + public: + /** + * A method, which reports a crash report to particular receiver. + * The plugin can takes arguments, but the plugin has to parse them + * by itself. + * @param pCrashData A crash report. + * @param pArgs Plugin's arguments. + * @retun A message which can be displayed after a report is created. + */ + virtual std::string Report(const map_crash_data_t& pCrashData, + const map_plugin_settings_t& pSettings, + const char *pArgs) = 0; +}; + +#endif /* REPORTER_H_ */ diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index f267b98..f4068a2 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -20,10 +20,10 @@ #include "abrtlib.h" #include "abrt_xmlrpc.h" #include "Bugzilla.h" -#include "CrashTypes.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "crash_types.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/lib/Plugins/Bugzilla.h b/lib/Plugins/Bugzilla.h index 1c9a06e..e2090a2 100644 --- a/lib/Plugins/Bugzilla.h +++ b/lib/Plugins/Bugzilla.h @@ -19,8 +19,8 @@ #ifndef BUGZILLA_H_ #define BUGZILLA_H_
-#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
class CReporterBugzilla : public CReporter { diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 2a32953..7a48331 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -25,9 +25,9 @@ #include "abrtlib.h" #include "strbuf.h" #include "CCpp.h" -#include "ABRTException.h" -#include "DebugDump.h" -#include "CommLayerInner.h" +#include "abrt_exception.h" +#include "debug_dump.h" +#include "comm_layer_inner.h" #include "Polkit.h" #include "backtrace.h" #include "CCpp_sha1.h" diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h index ce6ba7a..f547686 100644 --- a/lib/Plugins/CCpp.h +++ b/lib/Plugins/CCpp.h @@ -23,8 +23,8 @@ #define CCPP_H_
#include <string> -#include "Plugin.h" -#include "Analyzer.h" +#include "plugin.h" +#include "analyzer.h"
class CAnalyzerCCpp : public CAnalyzer { diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp index fd07388..76c5670 100644 --- a/lib/Plugins/FileTransfer.cpp +++ b/lib/Plugins/FileTransfer.cpp @@ -28,9 +28,9 @@ #include "abrtlib.h" #include "abrt_curl.h" #include "FileTransfer.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
using namespace std;
diff --git a/lib/Plugins/FileTransfer.h b/lib/Plugins/FileTransfer.h index 8f77223..5e9f493 100644 --- a/lib/Plugins/FileTransfer.h +++ b/lib/Plugins/FileTransfer.h @@ -23,8 +23,8 @@ #define FILETRANSFER_H_
#include <string> -#include "Plugin.h" -#include "Action.h" +#include "plugin.h" +#include "action.h"
class CFileTransfer : public CAction { diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp index 6fb9cb5..64d3e40 100644 --- a/lib/Plugins/Kerneloops.cpp +++ b/lib/Plugins/Kerneloops.cpp @@ -19,9 +19,9 @@
#include "abrtlib.h" #include "Kerneloops.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
static unsigned hash_oops_str(const char *oops_ptr) { diff --git a/lib/Plugins/Kerneloops.h b/lib/Plugins/Kerneloops.h index 9e2010c..2160f44 100644 --- a/lib/Plugins/Kerneloops.h +++ b/lib/Plugins/Kerneloops.h @@ -27,8 +27,8 @@ #ifndef __INCLUDE_GUARD_KERNELOOPS_H_ #define __INCLUDE_GUARD_KERNELOOPS_H_
-#include "Plugin.h" -#include "Analyzer.h" +#include "plugin.h" +#include "analyzer.h" #include <string>
class CAnalyzerKerneloops : public CAnalyzer diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp index f14902f..63efc8b 100644 --- a/lib/Plugins/KerneloopsReporter.cpp +++ b/lib/Plugins/KerneloopsReporter.cpp @@ -20,8 +20,8 @@ #include "abrtlib.h" #include "abrt_curl.h" #include "KerneloopsReporter.h" -#include "CommLayerInner.h" -#include "ABRTException.h" +#include "comm_layer_inner.h" +#include "abrt_exception.h"
/* helpers */ static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream) diff --git a/lib/Plugins/KerneloopsReporter.h b/lib/Plugins/KerneloopsReporter.h index 9132652..cb939d0 100644 --- a/lib/Plugins/KerneloopsReporter.h +++ b/lib/Plugins/KerneloopsReporter.h @@ -27,8 +27,8 @@ #ifndef __INCLUDE_GUARD_KERNELOOPSREPORTER_H_ #define __INCLUDE_GUARD_KERNELOOPSREPORTER_H_
-#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
#include <string>
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp index 0d27e5e..b24f2a2 100644 --- a/lib/Plugins/KerneloopsScanner.cpp +++ b/lib/Plugins/KerneloopsScanner.cpp @@ -25,9 +25,9 @@ #include <syslog.h> #include <asm/unistd.h> /* __NR_syslog */ #include "abrtlib.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #include "KerneloopsSysLog.h" #include "KerneloopsScanner.h"
diff --git a/lib/Plugins/KerneloopsScanner.h b/lib/Plugins/KerneloopsScanner.h index a76d141..0904146 100644 --- a/lib/Plugins/KerneloopsScanner.h +++ b/lib/Plugins/KerneloopsScanner.h @@ -27,8 +27,8 @@ #define KERNELOOPSSCANNER_H_
#include "abrt_types.h" -#include "Plugin.h" -#include "Action.h" +#include "plugin.h" +#include "action.h"
class CKerneloopsScanner : public CAction { diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index a0c2364..c8f00a3 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -20,9 +20,9 @@ */ #include "abrtlib.h" #include "Logger.h" -#include "DebugDump.h" -#include "CommLayerInner.h" -#include "ABRTException.h" +#include "debug_dump.h" +#include "comm_layer_inner.h" +#include "abrt_exception.h"
CLogger::CLogger() : m_sLogPath("/var/log/abrt.log"), diff --git a/lib/Plugins/Logger.h b/lib/Plugins/Logger.h index 8801dd4..aa7def3 100644 --- a/lib/Plugins/Logger.h +++ b/lib/Plugins/Logger.h @@ -22,8 +22,8 @@ #ifndef LOGGER_H_ #define LOGGER_H_
-#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
class CLogger : public CReporter { diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index d2039b4..45c8abe 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -20,9 +20,9 @@ */ #include "abrtlib.h" #include "Mailx.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
#define MAILX_COMMAND "/bin/mailx"
diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h index c71d83d..aa870ec 100644 --- a/lib/Plugins/Mailx.h +++ b/lib/Plugins/Mailx.h @@ -23,8 +23,8 @@ #define MAILX_H_
#include <string> -#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
class CMailx : public CReporter { diff --git a/lib/Plugins/Python.cpp b/lib/Plugins/Python.cpp index fc3e41c..047d1d1 100644 --- a/lib/Plugins/Python.cpp +++ b/lib/Plugins/Python.cpp @@ -18,8 +18,8 @@ */ #include "abrtlib.h" #include "Python.h" -#include "DebugDump.h" -#include "ABRTException.h" +#include "debug_dump.h" +#include "abrt_exception.h" #include "Python_hash.h"
using namespace std; diff --git a/lib/Plugins/Python.h b/lib/Plugins/Python.h index b7eebda..52655ec 100644 --- a/lib/Plugins/Python.h +++ b/lib/Plugins/Python.h @@ -20,8 +20,8 @@ #define PYTHON_H_
#include <string> -#include "Plugin.h" -#include "Analyzer.h" +#include "plugin.h" +#include "analyzer.h"
class CAnalyzerPython : public CAnalyzer { diff --git a/lib/Plugins/RHTSupport.cpp b/lib/Plugins/RHTSupport.cpp index c9467a4..3d3989c 100644 --- a/lib/Plugins/RHTSupport.cpp +++ b/lib/Plugins/RHTSupport.cpp @@ -22,10 +22,10 @@ #include "abrtlib.h" #include "abrt_curl.h" #include "abrt_rh_support.h" -#include "CrashTypes.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "crash_types.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #include "RHTSupport.h" #ifdef HAVE_CONFIG_H # include <config.h> diff --git a/lib/Plugins/RHTSupport.h b/lib/Plugins/RHTSupport.h index 8f915ba..a96a3b3 100644 --- a/lib/Plugins/RHTSupport.h +++ b/lib/Plugins/RHTSupport.h @@ -19,8 +19,8 @@ #ifndef RHTICKET_H_ #define RHTICKET_H_
-#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
class CReporterRHticket: public CReporter { diff --git a/lib/Plugins/ReportUploader.cpp b/lib/Plugins/ReportUploader.cpp index ae11899..ebe229b 100644 --- a/lib/Plugins/ReportUploader.cpp +++ b/lib/Plugins/ReportUploader.cpp @@ -20,9 +20,9 @@ #include "abrtlib.h" #include "abrt_curl.h" #include "ReportUploader.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
using namespace std;
diff --git a/lib/Plugins/ReportUploader.h b/lib/Plugins/ReportUploader.h index 3611eb9..4ff780b 100644 --- a/lib/Plugins/ReportUploader.h +++ b/lib/Plugins/ReportUploader.h @@ -24,8 +24,8 @@ #ifndef REPORTUPLOADER_H_ #define REPORTUPLAODER_H_
-#include "Plugin.h" -#include "Reporter.h" +#include "plugin.h" +#include "reporter.h"
class CReportUploader : public CReporter { diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp index c7d5183..adab865 100644 --- a/lib/Plugins/RunApp.cpp +++ b/lib/Plugins/RunApp.cpp @@ -20,9 +20,9 @@ */ #include "abrtlib.h" #include "RunApp.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #include "abrtlib.h"
#define COMMAND 0 diff --git a/lib/Plugins/RunApp.h b/lib/Plugins/RunApp.h index 390b60a..58f572d 100644 --- a/lib/Plugins/RunApp.h +++ b/lib/Plugins/RunApp.h @@ -21,7 +21,7 @@ #ifndef RUNAPP_H_ #define RUNAPP_H_
-#include "Action.h" +#include "action.h" #include <string> #include <vector>
diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp index 8ca9534..2bc927d 100644 --- a/lib/Plugins/SOSreport.cpp +++ b/lib/Plugins/SOSreport.cpp @@ -19,11 +19,11 @@ */ #include "abrtlib.h" #include "abrt_types.h" -#include "ABRTException.h" +#include "abrt_exception.h" #include "SOSreport.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
using namespace std;
diff --git a/lib/Plugins/SOSreport.h b/lib/Plugins/SOSreport.h index d5c4423..4b32940 100644 --- a/lib/Plugins/SOSreport.h +++ b/lib/Plugins/SOSreport.h @@ -20,7 +20,7 @@ #ifndef SOSREPORT_H_ #define SOSREPORT_H_
-#include "Action.h" +#include "action.h"
class CActionSOSreport : public CAction { diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp index 499346f..c7f3683 100644 --- a/lib/Plugins/SQLite3.cpp +++ b/lib/Plugins/SQLite3.cpp @@ -21,7 +21,7 @@ #include <sqlite3.h> #include "abrtlib.h" #include "SQLite3.h" -#include "ABRTException.h" +#include "abrt_exception.h"
using namespace std;
diff --git a/lib/Plugins/SQLite3.h b/lib/Plugins/SQLite3.h index b9dc9e7..d2af864 100644 --- a/lib/Plugins/SQLite3.h +++ b/lib/Plugins/SQLite3.h @@ -21,8 +21,8 @@ #ifndef SQLITE3_H_ #define SQLITE3_H_
-#include "Plugin.h" -#include "Database.h" +#include "plugin.h" +#include "database.h"
class CSQLite3 : public CDatabase { diff --git a/lib/Utils/ABRTException.cpp b/lib/Utils/ABRTException.cpp index a451cbd..0ae5d45 100644 --- a/lib/Utils/ABRTException.cpp +++ b/lib/Utils/ABRTException.cpp @@ -16,7 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "ABRTException.h" +#include "abrt_exception.h"
CABRTException::CABRTException(abrt_exception_t type, const char* fmt, ...) { diff --git a/lib/Utils/CommLayerInner.cpp b/lib/Utils/CommLayerInner.cpp index 9512019..3c102d6 100644 --- a/lib/Utils/CommLayerInner.cpp +++ b/lib/Utils/CommLayerInner.cpp @@ -19,7 +19,7 @@ #include <pthread.h> #include <map> #include "abrtlib.h" -#include "CommLayerInner.h" +#include "comm_layer_inner.h"
static CObserver *s_pObs;
diff --git a/lib/Utils/CrashTypes.cpp b/lib/Utils/CrashTypes.cpp index 4fc9333..96be28c 100644 --- a/lib/Utils/CrashTypes.cpp +++ b/lib/Utils/CrashTypes.cpp @@ -18,7 +18,7 @@ */ #include "abrt_types.h" #include "abrtlib.h" -#include "CrashTypes.h" +#include "crash_types.h"
const char *const must_have_files[] = { FILENAME_ARCHITECTURE, diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 8b3d27d..30ceacc 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -20,9 +20,9 @@ */ #include <sys/utsname.h> #include "abrtlib.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h"
static bool isdigit_str(const char *str) { diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am index 070a6fb..d016577 100644 --- a/lib/Utils/Makefile.am +++ b/lib/Utils/Makefile.am @@ -52,11 +52,11 @@ libABRTUtils_la_LIBADD = \ libABRTdUtils_la_SOURCES = \ parse_release.cpp \ make_descr.cpp \ - $(HEADER_DIR)/CommLayerInner.h CommLayerInner.cpp \ + $(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \ $(HEADER_DIR)/abrt_xmlrpc.h abrt_xmlrpc.cpp \ abrt_rh_support.h abrt_rh_support.cpp \ abrt_curl.h abrt_curl.cpp \ - $(HEADER_DIR)/Plugin.h Plugin.cpp \ + $(HEADER_DIR)/plugin.h Plugin.cpp \ Polkit.h Polkit.cpp
libABRTdUtils_la_CPPFLAGS = \ diff --git a/lib/Utils/Plugin.cpp b/lib/Utils/Plugin.cpp index 0741265..40fa39d 100644 --- a/lib/Utils/Plugin.cpp +++ b/lib/Utils/Plugin.cpp @@ -16,7 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "Plugin.h" +#include "plugin.h" #include "abrtlib.h"
CPlugin::CPlugin() {} diff --git a/lib/Utils/abrt_curl.cpp b/lib/Utils/abrt_curl.cpp index 49d6e0b..0eea9db 100644 --- a/lib/Utils/abrt_curl.cpp +++ b/lib/Utils/abrt_curl.cpp @@ -18,7 +18,7 @@ */ #include "abrtlib.h" #include "abrt_curl.h" -#include "CommLayerInner.h" +#include "comm_layer_inner.h"
using namespace std;
diff --git a/lib/Utils/abrt_rh_support.cpp b/lib/Utils/abrt_rh_support.cpp index a162a43..7252398 100644 --- a/lib/Utils/abrt_rh_support.cpp +++ b/lib/Utils/abrt_rh_support.cpp @@ -24,7 +24,7 @@ #include "abrtlib.h" #include "abrt_curl.h" #include "abrt_xmlrpc.h" -#include "ABRTException.h" +#include "abrt_exception.h" #include "abrt_rh_support.h"
using namespace std; diff --git a/lib/Utils/abrt_xmlrpc.cpp b/lib/Utils/abrt_xmlrpc.cpp index cbe0990..0157c2d 100644 --- a/lib/Utils/abrt_xmlrpc.cpp +++ b/lib/Utils/abrt_xmlrpc.cpp @@ -21,7 +21,7 @@ #endif #include "abrtlib.h" #include "abrt_xmlrpc.h" -#include "ABRTException.h" +#include "abrt_exception.h"
void throw_xml_fault(xmlrpc_env *env) { diff --git a/lib/Utils/hooklib.cpp b/lib/Utils/hooklib.cpp index 10b575a..6897066 100644 --- a/lib/Utils/hooklib.cpp +++ b/lib/Utils/hooklib.cpp @@ -17,7 +17,7 @@ */ #include "abrtlib.h" #include "hooklib.h" -#include "DebugDump.h" +#include "debug_dump.h" #include <sys/statvfs.h>
using namespace std; diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp index 7faafcb..46d9644 100644 --- a/lib/Utils/make_descr.cpp +++ b/lib/Utils/make_descr.cpp @@ -17,8 +17,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "abrtlib.h" -#include "CrashTypes.h" -#include "DebugDump.h" /* FILENAME_ARCHITECTURE etc */ +#include "crash_types.h" +#include "debug_dump.h" /* FILENAME_ARCHITECTURE etc */ #ifdef HAVE_CONFIG_H # include "config.h" #endif diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp index ccd6f39..d2daa05 100644 --- a/src/Applet/Applet.cpp +++ b/src/Applet/Applet.cpp @@ -33,7 +33,7 @@ #endif #include "abrtlib.h" #include "abrt_dbus.h" -#include "DBusCommon.h" +#include "dbus_common.h" #include "CCApplet.h"
diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp index 0a9384d..0852ed4 100644 --- a/src/CLI/CLI.cpp +++ b/src/CLI/CLI.cpp @@ -16,10 +16,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <getopt.h> -#include "ABRTException.h" +#include "abrt_exception.h" #include "abrtlib.h" #include "abrt_dbus.h" -#include "DBusCommon.h" +#include "dbus_common.h" #include "report.h" #include "dbus.h" #if HAVE_CONFIG_H diff --git a/src/CLI/dbus.cpp b/src/CLI/dbus.cpp index 55ebf9d..7565d5b 100644 --- a/src/CLI/dbus.cpp +++ b/src/CLI/dbus.cpp @@ -16,7 +16,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "dbus.h" -#include "DBusCommon.h" +#include "dbus_common.h"
DBusConnection* s_dbus_conn;
diff --git a/src/CLI/dbus.h b/src/CLI/dbus.h index 6461ccf..8b56b15 100644 --- a/src/CLI/dbus.h +++ b/src/CLI/dbus.h @@ -19,7 +19,7 @@ #define ABRT_CLI_DBUS_H
#include "abrt_dbus.h" -#include "CrashTypes.h" +#include "crash_types.h"
extern DBusConnection* s_dbus_conn;
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp index d917fd5..6bbeb95 100644 --- a/src/CLI/report.cpp +++ b/src/CLI/report.cpp @@ -19,9 +19,9 @@ #include "run-command.h" #include "dbus.h" #include "abrtlib.h" -#include "DebugDump.h" -#include "CrashTypes.h" // FILENAME_* defines -#include "Plugin.h" // LoadPluginSettings +#include "debug_dump.h" +#include "crash_types.h" // FILENAME_* defines +#include "plugin.h" // LoadPluginSettings #include <cassert> #include <algorithm> #include <termios.h> diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h index 9e095c3..c6bf71e 100644 --- a/src/Daemon/CommLayerServer.h +++ b/src/Daemon/CommLayerServer.h @@ -20,7 +20,7 @@ #define COMMLAYERSERVER_H_
#include "abrtlib.h" -#include "CrashTypes.h" +#include "crash_types.h"
class CCommLayerServer { public: diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index 347278f..4b11fc0 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -19,7 +19,7 @@ #include <dbus/dbus.h> #include "abrtlib.h" #include "abrt_dbus.h" -#include "ABRTException.h" +#include "abrt_exception.h" #include "CrashWatcher.h" #include "Settings.h" #include "Daemon.h" diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index b221571..dad4381 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -18,8 +18,8 @@ */ #include "abrtlib.h" #include "Daemon.h" -#include "ABRTException.h" -#include "DebugDump.h" +#include "abrt_exception.h" +#include "debug_dump.h" #include "CrashWatcher.h"
void CCrashWatcher::Status(const char *pMessage, const char* peer) diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 276adea..44c0413 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -27,7 +27,7 @@ #include "Settings.h"
#include "CommLayerServerDBus.h" -#include "CommLayerInner.h" +#include "comm_layer_inner.h"
class CCrashWatcher diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 3ba8d4d..d15ac5b 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -38,9 +38,9 @@ #define _(S) (S) #endif #include "abrtlib.h" -#include "ABRTException.h" +#include "abrt_exception.h" #include "CrashWatcher.h" -#include "DebugDump.h" +#include "debug_dump.h" #include "Daemon.h" #include "dumpsocket.h"
diff --git a/src/Daemon/Daemon.h b/src/Daemon/Daemon.h index 4f01d17..6208865 100644 --- a/src/Daemon/Daemon.h +++ b/src/Daemon/Daemon.h @@ -21,7 +21,7 @@
#include <pthread.h> #include "abrt_types.h" -#include "CrashTypes.h" +#include "crash_types.h"
class CCrashWatcher; class CCommLayerServer; diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 4b85758..b06d198 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -25,9 +25,9 @@ #include "Daemon.h" #include "Settings.h" #include "RPM.h" -#include "DebugDump.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "debug_dump.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #include "MiddleWare.h"
using namespace std; diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 4bbc8b2..4f64ed0 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -20,8 +20,8 @@ */ #include <dlfcn.h> #include "abrtlib.h" -#include "ABRTException.h" -#include "CommLayerInner.h" +#include "abrt_exception.h" +#include "comm_layer_inner.h" #include "Polkit.h" #include "PluginManager.h"
diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h index bf6952f..a00fd3e 100644 --- a/src/Daemon/PluginManager.h +++ b/src/Daemon/PluginManager.h @@ -23,11 +23,11 @@ #define PLUGINMANAGER_H_
#include "abrt_types.h" -#include "Plugin.h" -#include "Analyzer.h" -#include "Reporter.h" -#include "Database.h" -#include "Action.h" +#include "plugin.h" +#include "analyzer.h" +#include "reporter.h" +#include "database.h" +#include "action.h"
class CLoadedModule; /* opaque */
diff --git a/src/Daemon/RPM.cpp b/src/Daemon/RPM.cpp index d183d4c..fd25b49 100644 --- a/src/Daemon/RPM.cpp +++ b/src/Daemon/RPM.cpp @@ -18,7 +18,7 @@ */ #include "abrtlib.h" #include "RPM.h" -#include "CommLayerInner.h" +#include "comm_layer_inner.h"
CRPM::CRPM() { diff --git a/src/Daemon/dumpsocket.cpp b/src/Daemon/dumpsocket.cpp index f1171ea..a88c24b 100644 --- a/src/Daemon/dumpsocket.cpp +++ b/src/Daemon/dumpsocket.cpp @@ -21,9 +21,9 @@ #include <sys/socket.h> #include <sys/types.h> #include <sys/un.h> -#include "DebugDump.h" -#include "CrashTypes.h" -#include "ABRTException.h" +#include "debug_dump.h" +#include "crash_types.h" +#include "abrt_exception.h" #include "hooklib.h" #include "strbuf.h"
diff --git a/src/Hooks/abrt-hook-ccpp.cpp b/src/Hooks/abrt-hook-ccpp.cpp index 2cf74ef..59a75a0 100644 --- a/src/Hooks/abrt-hook-ccpp.cpp +++ b/src/Hooks/abrt-hook-ccpp.cpp @@ -20,9 +20,9 @@ */ #include "abrtlib.h" #include "hooklib.h" -#include "DebugDump.h" -#include "CrashTypes.h" -#include "ABRTException.h" +#include "debug_dump.h" +#include "crash_types.h" +#include "abrt_exception.h" #include <syslog.h>
using namespace std;
On 07/08/2010 04:38 PM, Nikola Pajkovsky wrote:
From: Jiri Moskovcakjmoskovc@redhat.com
- header files are required to write the custom plugins plugins without downloading the whole git tree, user just need to install abrt-devel package
Makefile.am | 5 +- abrt-utils.pc.in | 11 ++++ abrt.spec | 2 + configure.ac | 1 + inc/Action.h | 44 ++++++++++++++ inc/Analyzer.h | 55 +++++++++++++++++ inc/CommLayerInner.h | 45 ++++++++++++++ inc/DBusCommon.h | 28 +++++++++ inc/Database.h | 118 ++++++++++++++++++++++++++++++++++++ inc/DebugDump.h | 67 +++++++++++++++++++++ inc/Makefile.am | 20 ++++++- inc/Observer.h | 33 ++++++++++ inc/Plugin.h | 142 ++++++++++++++++++++++++++++++++++++++++++++ inc/Reporter.h | 47 +++++++++++++++ inc/abrt_xmlrpc.h | 48 +++++++++++++++ inc/xfuncs.h | 96 +++++++++++++++++++++++++++++ lib/Utils/Action.h | 44 -------------- lib/Utils/Analyzer.h | 55 ----------------- lib/Utils/CommLayerInner.h | 45 -------------- lib/Utils/DBusCommon.h | 28 --------- lib/Utils/Database.h | 118 ------------------------------------ lib/Utils/DebugDump.h | 67 --------------------- lib/Utils/Makefile.am | 19 +++--- lib/Utils/Observer.h | 33 ---------- lib/Utils/Plugin.h | 142 -------------------------------------------- lib/Utils/Reporter.h | 47 --------------- lib/Utils/abrt_xmlrpc.h | 48 --------------- lib/Utils/xfuncs.h | 96 ----------------------------- 28 files changed, 769 insertions(+), 735 deletions(-) create mode 100755 abrt-utils.pc.in create mode 100644 inc/Action.h create mode 100644 inc/Analyzer.h create mode 100644 inc/CommLayerInner.h create mode 100644 inc/DBusCommon.h create mode 100644 inc/Database.h create mode 100644 inc/DebugDump.h create mode 100644 inc/Observer.h create mode 100644 inc/Plugin.h create mode 100644 inc/Reporter.h create mode 100644 inc/abrt_xmlrpc.h create mode 100644 inc/xfuncs.h delete mode 100644 lib/Utils/Action.h delete mode 100644 lib/Utils/Analyzer.h delete mode 100644 lib/Utils/CommLayerInner.h delete mode 100644 lib/Utils/DBusCommon.h delete mode 100644 lib/Utils/Database.h delete mode 100644 lib/Utils/DebugDump.h delete mode 100644 lib/Utils/Observer.h delete mode 100644 lib/Utils/Plugin.h delete mode 100644 lib/Utils/Reporter.h delete mode 100644 lib/Utils/abrt_xmlrpc.h delete mode 100644 lib/Utils/xfuncs.h
diff --git a/Makefile.am b/Makefile.am index 080a7bf..cf4aece 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,10 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = lib src inc po icons
-EXTRA_DIST = doc/CodingStyle abrt.spec +EXTRA_DIST = doc/CodingStyle abrt.spec abrt-utils.pc.in
+pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = abrt-utils.pc
RPM_DIRS = --define "_sourcedir `pwd`" \ --define "_rpmdir `pwd`" \ diff --git a/abrt-utils.pc.in b/abrt-utils.pc.in new file mode 100755 index 0000000..6f0fa41 --- /dev/null +++ b/abrt-utils.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@
+Name: abrt-utils +Description: Library for writing ABRT plugins +#Requires: dbus-1 +Version: @VERSION@ +Libs: -L${libdir} -lABRTUtils -lABRTdUtils +Cflags: -I${includedir}/abrt -fPIC
You don't need -I${includedir}/abrt. Include in external plugin should be #include <abrt/abrtlib.h>
diff --git a/abrt.spec b/abrt.spec index f89151c..ddc6bef 100644 --- a/abrt.spec +++ b/abrt.spec @@ -332,7 +332,9 @@ fi
%files devel %defattr(-,root,root,-) +%{_includedir}/* %{_libdir}/lib*.so +%{_libdir}/pkgconfig/*
%files gui %defattr(-,root,root,-) diff --git a/configure.ac b/configure.ac index 9b6beb5..362e5f6 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([ Makefile
- abrt-utils.pc lib/Makefile lib/Utils/Makefile lib/Plugins/Makefile
diff --git a/inc/Action.h b/inc/Action.h new file mode 100644 index 0000000..fc56277 --- /dev/null +++ b/inc/Action.h @@ -0,0 +1,44 @@ +/*
- Action.h - header file for action plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ +#define ACTION_H_
+#include "Plugin.h"
+/**
- An abstract class. The class defines an action plugin interface.
- */
+class CAction : public CPlugin +{
- public:
/**
* A Method which performs particular action. As the first parameter it
* takes an action directory. It could be either a directory of actual
* crash or it could be a directory contains all crashes. It depends on
* who call the plugin. The plugin can takes arguments, but the plugin
* has to parse them by itself.
* @param pActionDir An actual directory.
* @param pArgs Plugin's arguments.
*/
virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0;
+};
+#endif diff --git a/inc/Analyzer.h b/inc/Analyzer.h new file mode 100644 index 0000000..a45bd0e --- /dev/null +++ b/inc/Analyzer.h @@ -0,0 +1,55 @@ +/*
- Analyzer.h - header file for analyzer plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ +#define ANALYZER_H_
+#include<string> +#include "Plugin.h"
+/**
- An abstract class. The class defines an analyzer plugin interface.
- */
+class CAnalyzer : public CPlugin +{
- public:
/**
* A method, which gets a local UUID of particular crash. The local
* UUID is usualy computed from data which are stored in debugdump dir.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
* @return A local UUID.
*/
virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0;
/**
* A method, which gets a global UUID of particular crash.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
* @return A global UUID.
*/
virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0;
/**
* A method, which takes care of getting all additional data needed
* for computing UUIDs and creating a report. This report could be send
* somewhere afterwards.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
*/
virtual void CreateReport(const char *pDebugDumpDir, int force) = 0;
+};
+#endif /*ANALYZER_H_*/ diff --git a/inc/CommLayerInner.h b/inc/CommLayerInner.h new file mode 100644 index 0000000..353cfc7 --- /dev/null +++ b/inc/CommLayerInner.h @@ -0,0 +1,45 @@ +/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 COMMLAYERINNER_H_ +#define COMMLAYERINNER_H_
+#include "Observer.h"
+void init_daemon_logging(CObserver *pObs);
+/*
- Set client's name (dbus ID). NULL unsets it.
- */
+void set_client_name(const char* name);
+/*
- Ask a client to warn the user about a non-fatal, but unexpected condition.
- In GUI, it will usually be presented as a popup message.
- Usually there is no need to call it directly, just use [p]error_msg().
- */
+//now static: void warn_client(const char *msg);
+/*
- Logs a message to a client.
- In UI, it will usually appear as a new status line message in GUI,
- or as a new message line in CLI.
- */
+void update_client(const char *fmt, ...);
+#endif diff --git a/inc/DBusCommon.h b/inc/DBusCommon.h new file mode 100644 index 0000000..58b4c8d --- /dev/null +++ b/inc/DBusCommon.h @@ -0,0 +1,28 @@ +/*
- 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 DBUSCOMMON_H_ +#define DBUSCOMMON_H_
+#include "CrashTypes.h"
+#define ABRTD_DBUS_NAME "com.redhat.abrt" +#define ABRTD_DBUS_PATH "/com/redhat/abrt" +#define ABRTD_DBUS_IFACE "com.redhat.abrt"
+#endif diff --git a/inc/Database.h b/inc/Database.h new file mode 100644 index 0000000..a698bcb --- /dev/null +++ b/inc/Database.h @@ -0,0 +1,118 @@ +/*
- Database.h - header file for database plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ +#define DATABASE_H_
+#include<string> +#include<vector> +#include "Plugin.h"
+/**
- Table
- =====
- UUID | UID| DebugDumpPath | Count | Reported | Time | Message
- primary key (UUID, UID)
- */
+/**
- A struct contains one database row.
- */
+typedef struct database_row_t +{
- std::string m_sUUID; /**< A local UUID.*/
- std::string m_sUID; /**< An UID of an user.*/
- std::string m_sInformAll;
- std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/
- std::string m_sCount; /**< Crash rate.*/
- std::string m_sReported; /**< Is a row reported?*/
- std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/
- std::string m_sTime; /**< Time of last occurred crash with same local UUID*/
+} database_row_t;
+/**
- A vector contains one or more database rows.
- */
+typedef std::vector<database_row_t> vector_database_rows_t;
+/**
- An abstract class. The class defines a database plugin interface.
- */
+class CDatabase : public CPlugin +{
- public:
/**
* A method, which connects to a database.
*/
virtual void Connect() = 0;
/**
* A method, which disconnects from a database.
*/
virtual void DisConnect() = 0;
/**
* A method, which inserts one row to a database.
* @param pUUID A local UUID of a crash.
* @param pUID An UID of an user.
* @param pDebugDumpPath A debugdump path.
* @param pTime Time when a crash occurs.
*/
virtual void Insert_or_Update(const char *crash_id,
bool inform_all_users,
const char *pDebugDumpPath,
const char *pTime) = 0;
/**
* A method, which deletes one row in a database.
* @param pUUID A lodal UUID of a crash.
* @param pUID An UID of an user.
*/
virtual void DeleteRow(const char *crash_id) = 0;
virtual void DeleteRows_by_dir(const char *dump_dir) = 0;
/**
* A method, which sets that particular row was reported.
* @param pUUID A local UUID of a crash.
* @param pUID An UID of an user.
* @param pMessage A text explanation of reported problem
* (where it is stored etc)...
*/
virtual void SetReported(const char *crash_id,
const char *pMessage) = 0;
virtual void SetReportedPerReporter(const char *crash_id,
const char *reporter,
const char *pMessage) = 0;
/**
* A method, which gets all rows which belongs to particular user.
* If the user is root, then all rows are returned. If there are no
* rows, empty vector is returned.
* @param pUID An UID of an user.
* @return A vector of matched rows.
*/
virtual vector_database_rows_t GetUIDData(long caller_uid) = 0;
/**
* A method, which returns one row accordind to UUID of a crash and
* UID of an user. If there are no row, empty row is returned.
* @param pUUID A UUID of a crash.
* @param pUID An UID of an user.
* @return A matched row.
*/
virtual database_row_t GetRow(const char *crash_id) = 0;
+};
+#endif diff --git a/inc/DebugDump.h b/inc/DebugDump.h new file mode 100644 index 0000000..f8487a6 --- /dev/null +++ b/inc/DebugDump.h @@ -0,0 +1,67 @@ +/*
- DebugDump.h - header file for the library caring of writing new reports
to the specific directory
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ +#define DEBUGDUMP_H_
+#include<string>
+class CDebugDump +{
- private:
std::string m_sDebugDumpDir;
DIR* m_pGetNextFileDir;
bool m_bOpened;
bool m_bLocked;
uid_t m_uid;
gid_t m_gid;
void Lock();
void UnLock();
- public:
CDebugDump();
~CDebugDump();
void Open(const char *pDir);
void Create(const char *pDir, uid_t uid);
void Delete();
void Close();
bool Exist(const char* pFileName);
void LoadText(const char* pName, std::string& pData);
void SaveText(const char* pName, const char *pData);
void SaveBinary(const char* pName, const char* pData, unsigned pSize);
void InitGetNextFile();
/* Pointers may be NULL */
bool GetNextFile(std::string *short_name, std::string *full_name);
+};
+/**
- Deletes particular debugdump directory.
- @param pDebugDumpDir A debugdump directory.
- */
+void delete_debug_dump_dir(const char *pDebugDumpDir);
+#endif diff --git a/inc/Makefile.am b/inc/Makefile.am index 2ccc714..e668b48 100644 --- a/inc/Makefile.am +++ b/inc/Makefile.am @@ -1 +1,19 @@ -EXTRA_DIST = ABRTException.h CrashTypes.h abrtlib.h abrt_types.h +HEADER_FILES = \
- ABRTException.h \
- abrtlib.h \
- abrt_types.h \
- abrt_xmlrpc.h \
- Action.h \
- Analyzer.h \
- CommLayerInner.h \
- CrashTypes.h \
- Database.h \
- DBusCommon.h \
- DebugDump.h \
- Observer.h \
- Plugin.h \
- Reporter.h \
- xfuncs.h
+lib_includedir=$(includedir)/abrt/ +lib_include_HEADERS = $(HEADER_FILES) diff --git a/inc/Observer.h b/inc/Observer.h new file mode 100644 index 0000000..ec7dfa7 --- /dev/null +++ b/inc/Observer.h @@ -0,0 +1,33 @@ +/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 OBSERVER_H_ +#define OBSERVER_H_
+#include<string> +#include<stdint.h> +#include "DBusCommon.h"
+class CObserver {
- public:
virtual ~CObserver() {}
virtual void Status(const char *pMessage, const char* peer) = 0;
virtual void Warning(const char *pMessage, const char* peer) = 0;
+};
+#endif diff --git a/inc/Plugin.h b/inc/Plugin.h new file mode 100644 index 0000000..367739f --- /dev/null +++ b/inc/Plugin.h @@ -0,0 +1,142 @@ +/*
- Plugin.h - header file for plugin. It contains mandatory macros
and common function for plugins
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ +#define PLUGIN_H_
+#include "abrt_types.h" +#include "CrashTypes.h" +#if HAVE_CONFIG_H +# include<config.h> +#endif +#if ENABLE_NLS +# include<libintl.h> +# define _(S) gettext(S) +#else +# define _(S) (S) +#endif
+#define PLUGINS_MAGIC_NUMBER 6
+#define PLUGINS_CONF_EXTENSION "conf" +#define PLUGINS_LIB_EXTENSION "so" +#define PLUGINS_LIB_PREFIX "lib"
+/**
- An abstract class. The class defines a common plugin interface. If a plugin
- has some settings, then a *Settings(*) method has to be written.
- */
+class CPlugin +{
- protected:
map_plugin_settings_t m_pSettings;
- public:
CPlugin();
/**
* A destructor.
*/
virtual ~CPlugin();
/**
* A method, which initializes a plugin. It is not mandatory method.
*/
virtual void Init();
/**
* A method, which deinitializes a plugin. It is not mandatory method.
*/
virtual void DeInit();
/**
* A method, which takes a settings and apply them. It is not a mandatory method.
* @param pSettings Plugin's settings
*/
virtual void SetSettings(const map_plugin_settings_t& pSettings);
/**
* A method, which return current settings. It is not mandatory method.
* @return Plugin's settings
*/
virtual const map_plugin_settings_t& GetSettings();
+};
+/**
- An enum of plugin types.
- */
+typedef enum {
- ANALYZER, /**< An analyzer plugin*/
- ACTION, /**< An action plugin*/
- REPORTER, /**< A reporter plugin*/
- DATABASE, /**< A database plugin*/
- MAX_PLUGIN_TYPE = DATABASE,
+} plugin_type_t;
+/**
- A struct contains all needed data about particular plugin.
- */
+typedef struct SPluginInfo +{
- const plugin_type_t m_Type; /**< Plugin type.*/
- const char *const m_sName; /**< Plugin name.*/
- const char *const m_sVersion; /**< Plugin version.*/
- const char *const m_sDescription; /**< Plugin description.*/
- const char *const m_sEmail; /**< Plugin author's email.*/
- const char *const m_sWWW; /**< Plugin's home page.*/
- const char *const m_sGTKBuilder; /**< Plugin's gui description.*/
- const int m_nMagicNumber; /**< Plugin magical number.*/
+} plugin_info_t;
+#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\
- extern "C" CPlugin* plugin_new()\
- {\
return new plugin_class();\
- }\
- extern "C" const plugin_info_t plugin_info =\
- {\
type,\
name,\
version,\
description,\
email,\
www,\
gtk_builder,\
PLUGINS_MAGIC_NUMBER,\
- };
+/* helper functions */ +std::string make_description_bz(const map_crash_data_t& pCrashData); +std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); +std::string make_description_logger(const map_crash_data_t& pCrashData);
+/**
- Loads settings and stores it in second parameter. On success it
- returns true, otherwise returns false.
- @param path A path of config file.
- Config file consists of "key=value" lines.
- @param settings A readed plugin's settings.
- @param skipKeysWithoutValue
- If true, lines in format "key=" (without value) are skipped.
- Otherwise empty value "" is inserted into pSettings.
- @return if it success it returns true, otherwise it returns false.
- */
+extern bool LoadPluginSettings(const char *pPath,
map_plugin_settings_t& pSettings,
bool skipKeysWithoutValue = true);
+#endif diff --git a/inc/Reporter.h b/inc/Reporter.h new file mode 100644 index 0000000..4144ec3 --- /dev/null +++ b/inc/Reporter.h @@ -0,0 +1,47 @@ +/*
- Reporter.h - header file for reporter plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ +#define REPORTER_H_
+#include<string> +#include "Plugin.h" +#include "CrashTypes.h"
+/**
- An abstract class. The class defines a reporter plugin interface.
- */
+class CReporter : public CPlugin +{
- public:
/**
* A method, which reports a crash report to particular receiver.
* The plugin can takes arguments, but the plugin has to parse them
* by itself.
* @param pCrashData A crash report.
* @param pArgs Plugin's arguments.
* @retun A message which can be displayed after a report is created.
*/
virtual std::string Report(const map_crash_data_t& pCrashData,
const map_plugin_settings_t& pSettings,
const char *pArgs) = 0;
+};
+#endif /* REPORTER_H_ */ diff --git a/inc/abrt_xmlrpc.h b/inc/abrt_xmlrpc.h new file mode 100644 index 0000000..ce77038 --- /dev/null +++ b/inc/abrt_xmlrpc.h @@ -0,0 +1,48 @@ +/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 ABRT_XMLRPC_H_ +#define ABRT_XMLRPC_H_ 1
+#include<curl/curl.h> +#include<xmlrpc-c/base.h> +#include<xmlrpc-c/client.h>
+/*
- Simple class holding XMLRPC connection data.
- Used mainly to ensure we always destroy xmlrpc client and server_info
- on return or throw.
- */
+struct abrt_xmlrpc_conn {
- xmlrpc_client* m_pClient;
- xmlrpc_server_info* m_pServer_info;
- abrt_xmlrpc_conn(const char* url, bool no_ssl_verify) { new_xmlrpc_client(url, no_ssl_verify); }
- /* this never throws exceptions - calls C functions only */
- ~abrt_xmlrpc_conn() { destroy_xmlrpc_client(); }
- void new_xmlrpc_client(const char* url, bool no_ssl_verify);
- void destroy_xmlrpc_client();
+};
+/* Utility functions */ +void throw_xml_fault(xmlrpc_env *env); +void throw_if_xml_fault_occurred(xmlrpc_env *env);
+#endif diff --git a/inc/xfuncs.h b/inc/xfuncs.h new file mode 100644 index 0000000..de785c8 --- /dev/null +++ b/inc/xfuncs.h @@ -0,0 +1,96 @@ +/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 ABRT_XFUNCS_H +#define ABRT_XFUNCS_H
+#include<sys/socket.h> +#include<sys/stat.h> +#include<dirent.h> +#include<stdbool.h>
+#ifdef __cplusplus +extern "C" { +#endif
+extern int ndelay_on(int fd); +extern int ndelay_off(int fd); +extern int close_on_exec_on(int fd);
+extern void* xmalloc(size_t size); +extern void* xrealloc(void *ptr, size_t size); +extern void* xzalloc(size_t size); +extern char* xstrdup(const char *s); +extern char* xstrndup(const char *s, int n);
+extern void xpipe(int filedes[2]); +extern void xdup(int from); +extern void xdup2(int from, int to); +extern void xmove_fd(int from, int to);
+extern void xwrite(int fd, const void *buf, size_t count); +extern void xwrite_str(int fd, const char *str);
+extern off_t xlseek(int fd, off_t offset, int whence);
+extern void xchdir(const char *path);
+extern char* xvasprintf(const char *format, va_list p); +extern char* xasprintf(const char *format, ...);
+extern void xsetenv(const char *key, const char *value); +extern int xsocket(int domain, int type, int protocol); +extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +extern void xlisten(int s, int backlog); +extern ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); +extern void xstat(const char *name, struct stat *stat_buf);
+extern int xopen3(const char *pathname, int flags, int mode); +extern int xopen(const char *pathname, int flags); +extern void xunlink(const char *pathname);
+/* Just testing dent->d_type == DT_REG is wrong: some filesystems
- do not report the type, they report DT_UNKNOWN for every dirent
- (and this is not a bug in filesystem, this is allowed by standards).
- This function handles this case. Note: it returns 0 on symlinks
- even if they point to regular files.
- */
+extern int is_regular_file(struct dirent *dent, const char *dirname); +extern bool dot_or_dotdot(const char *filename); +extern char *last_char_is(const char *s, int c);
+extern bool string_to_bool(const char *s);
+extern void xseteuid(uid_t euid); +extern void xsetegid(gid_t egid); +extern void xsetreuid(uid_t ruid, uid_t euid); +extern void xsetregid(gid_t rgid, gid_t egid);
+/* Returns getpwuid(uid)->pw_dir or NULL */ +extern const char *get_home_dir(uid_t uid);
+#ifdef __cplusplus +} +#endif
+#ifdef __cplusplus +std::string ssprintf(const char *format, ...); +std::string concat_path_file(const char *path, const char *filename); +#endif
+#endif diff --git a/lib/Utils/Action.h b/lib/Utils/Action.h deleted file mode 100644 index fc56277..0000000 --- a/lib/Utils/Action.h +++ /dev/null @@ -1,44 +0,0 @@ -/*
- Action.h - header file for action plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ACTION_H_ -#define ACTION_H_
-#include "Plugin.h"
-/**
- An abstract class. The class defines an action plugin interface.
- */
-class CAction : public CPlugin -{
- public:
/**
* A Method which performs particular action. As the first parameter it
* takes an action directory. It could be either a directory of actual
* crash or it could be a directory contains all crashes. It depends on
* who call the plugin. The plugin can takes arguments, but the plugin
* has to parse them by itself.
* @param pActionDir An actual directory.
* @param pArgs Plugin's arguments.
*/
virtual void Run(const char *pActionDir, const char *pArgs, int force) = 0;
-};
-#endif diff --git a/lib/Utils/Analyzer.h b/lib/Utils/Analyzer.h deleted file mode 100644 index a45bd0e..0000000 --- a/lib/Utils/Analyzer.h +++ /dev/null @@ -1,55 +0,0 @@ -/*
- Analyzer.h - header file for analyzer plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 ANALYZER_H_ -#define ANALYZER_H_
-#include<string> -#include "Plugin.h"
-/**
- An abstract class. The class defines an analyzer plugin interface.
- */
-class CAnalyzer : public CPlugin -{
- public:
/**
* A method, which gets a local UUID of particular crash. The local
* UUID is usualy computed from data which are stored in debugdump dir.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
* @return A local UUID.
*/
virtual std::string GetLocalUUID(const char *pDebugDumpDir) = 0;
/**
* A method, which gets a global UUID of particular crash.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
* @return A global UUID.
*/
virtual std::string GetGlobalUUID(const char *pDebugDumpDir) = 0;
/**
* A method, which takes care of getting all additional data needed
* for computing UUIDs and creating a report. This report could be send
* somewhere afterwards.
* @param pDebugDumpPath A debugdump dir containing all necessary data.
*/
virtual void CreateReport(const char *pDebugDumpDir, int force) = 0;
-};
-#endif /*ANALYZER_H_*/ diff --git a/lib/Utils/CommLayerInner.h b/lib/Utils/CommLayerInner.h deleted file mode 100644 index 353cfc7..0000000 --- a/lib/Utils/CommLayerInner.h +++ /dev/null @@ -1,45 +0,0 @@ -/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 COMMLAYERINNER_H_ -#define COMMLAYERINNER_H_
-#include "Observer.h"
-void init_daemon_logging(CObserver *pObs);
-/*
- Set client's name (dbus ID). NULL unsets it.
- */
-void set_client_name(const char* name);
-/*
- Ask a client to warn the user about a non-fatal, but unexpected condition.
- In GUI, it will usually be presented as a popup message.
- Usually there is no need to call it directly, just use [p]error_msg().
- */
-//now static: void warn_client(const char *msg);
-/*
- Logs a message to a client.
- In UI, it will usually appear as a new status line message in GUI,
- or as a new message line in CLI.
- */
-void update_client(const char *fmt, ...);
-#endif diff --git a/lib/Utils/DBusCommon.h b/lib/Utils/DBusCommon.h deleted file mode 100644 index 58b4c8d..0000000 --- a/lib/Utils/DBusCommon.h +++ /dev/null @@ -1,28 +0,0 @@ -/*
- 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 DBUSCOMMON_H_ -#define DBUSCOMMON_H_
-#include "CrashTypes.h"
-#define ABRTD_DBUS_NAME "com.redhat.abrt" -#define ABRTD_DBUS_PATH "/com/redhat/abrt" -#define ABRTD_DBUS_IFACE "com.redhat.abrt"
-#endif diff --git a/lib/Utils/Database.h b/lib/Utils/Database.h deleted file mode 100644 index a698bcb..0000000 --- a/lib/Utils/Database.h +++ /dev/null @@ -1,118 +0,0 @@ -/*
- Database.h - header file for database plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DATABASE_H_ -#define DATABASE_H_
-#include<string> -#include<vector> -#include "Plugin.h"
-/**
- Table
- =====
- UUID | UID| DebugDumpPath | Count | Reported | Time | Message
- primary key (UUID, UID)
- */
-/**
- A struct contains one database row.
- */
-typedef struct database_row_t -{
- std::string m_sUUID; /**< A local UUID.*/
- std::string m_sUID; /**< An UID of an user.*/
- std::string m_sInformAll;
- std::string m_sDebugDumpDir; /**< A debugdump directory of a crash.*/
- std::string m_sCount; /**< Crash rate.*/
- std::string m_sReported; /**< Is a row reported?*/
- std::string m_sMessage; /**< if a row is reported, then there can be store message abotu that*/
- std::string m_sTime; /**< Time of last occurred crash with same local UUID*/
-} database_row_t;
-/**
- A vector contains one or more database rows.
- */
-typedef std::vector<database_row_t> vector_database_rows_t;
-/**
- An abstract class. The class defines a database plugin interface.
- */
-class CDatabase : public CPlugin -{
- public:
/**
* A method, which connects to a database.
*/
virtual void Connect() = 0;
/**
* A method, which disconnects from a database.
*/
virtual void DisConnect() = 0;
/**
* A method, which inserts one row to a database.
* @param pUUID A local UUID of a crash.
* @param pUID An UID of an user.
* @param pDebugDumpPath A debugdump path.
* @param pTime Time when a crash occurs.
*/
virtual void Insert_or_Update(const char *crash_id,
bool inform_all_users,
const char *pDebugDumpPath,
const char *pTime) = 0;
/**
* A method, which deletes one row in a database.
* @param pUUID A lodal UUID of a crash.
* @param pUID An UID of an user.
*/
virtual void DeleteRow(const char *crash_id) = 0;
virtual void DeleteRows_by_dir(const char *dump_dir) = 0;
/**
* A method, which sets that particular row was reported.
* @param pUUID A local UUID of a crash.
* @param pUID An UID of an user.
* @param pMessage A text explanation of reported problem
* (where it is stored etc)...
*/
virtual void SetReported(const char *crash_id,
const char *pMessage) = 0;
virtual void SetReportedPerReporter(const char *crash_id,
const char *reporter,
const char *pMessage) = 0;
/**
* A method, which gets all rows which belongs to particular user.
* If the user is root, then all rows are returned. If there are no
* rows, empty vector is returned.
* @param pUID An UID of an user.
* @return A vector of matched rows.
*/
virtual vector_database_rows_t GetUIDData(long caller_uid) = 0;
/**
* A method, which returns one row accordind to UUID of a crash and
* UID of an user. If there are no row, empty row is returned.
* @param pUUID A UUID of a crash.
* @param pUID An UID of an user.
* @return A matched row.
*/
virtual database_row_t GetRow(const char *crash_id) = 0;
-};
-#endif diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h deleted file mode 100644 index f8487a6..0000000 --- a/lib/Utils/DebugDump.h +++ /dev/null @@ -1,67 +0,0 @@ -/*
- DebugDump.h - header file for the library caring of writing new reports
to the specific directory
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 DEBUGDUMP_H_ -#define DEBUGDUMP_H_
-#include<string>
-class CDebugDump -{
- private:
std::string m_sDebugDumpDir;
DIR* m_pGetNextFileDir;
bool m_bOpened;
bool m_bLocked;
uid_t m_uid;
gid_t m_gid;
void Lock();
void UnLock();
- public:
CDebugDump();
~CDebugDump();
void Open(const char *pDir);
void Create(const char *pDir, uid_t uid);
void Delete();
void Close();
bool Exist(const char* pFileName);
void LoadText(const char* pName, std::string& pData);
void SaveText(const char* pName, const char *pData);
void SaveBinary(const char* pName, const char* pData, unsigned pSize);
void InitGetNextFile();
/* Pointers may be NULL */
bool GetNextFile(std::string *short_name, std::string *full_name);
-};
-/**
- Deletes particular debugdump directory.
- @param pDebugDumpDir A debugdump directory.
- */
-void delete_debug_dump_dir(const char *pDebugDumpDir);
-#endif diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am index 56678d4..070a6fb 100644 --- a/lib/Utils/Makefile.am +++ b/lib/Utils/Makefile.am @@ -1,7 +1,8 @@ # ABRTUtils has small set of deps. This reduces deps of smaller abrt binaries # ABRTdUtils has much more. It is used by daemon and plugins only lib_LTLIBRARIES = libABRTUtils.la libABRTdUtils.la
+HEADER_DIR = $(srcdir)/../../inc +AM_CPPFLAGS = -I$(HEADER_DIR) AM_YFLAGS = --verbose
# Not used just yet: @@ -9,7 +10,7 @@ AM_YFLAGS = --verbose # xconnect.cpp
libABRTUtils_la_SOURCES = \
- xfuncs.h xfuncs.cpp \
- xfuncs.cpp \ encbase64.cpp \ read_write.cpp \ logging.cpp \
@@ -20,7 +21,7 @@ libABRTUtils_la_SOURCES = \ spawn.cpp \ stringops.cpp \ dirsize.cpp \
- DebugDump.h DebugDump.cpp \
- DebugDump.cpp \ abrt_dbus.h abrt_dbus.cpp \ CrashTypes.cpp \ ABRTException.cpp \
@@ -51,15 +52,13 @@ libABRTUtils_la_LIBADD = \ libABRTdUtils_la_SOURCES = \ parse_release.cpp \ make_descr.cpp \
- CommLayerInner.h CommLayerInner.cpp \
- abrt_xmlrpc.h abrt_xmlrpc.cpp \
- $(HEADER_DIR)/CommLayerInner.h CommLayerInner.cpp \
- $(HEADER_DIR)/abrt_xmlrpc.h abrt_xmlrpc.cpp \ abrt_rh_support.h abrt_rh_support.cpp \ abrt_curl.h abrt_curl.cpp \
- Plugin.h Plugin.cpp \
- Polkit.h Polkit.cpp \
- Action.h Database.h Reporter.h Analyzer.h \
- Observer.h \
- DBusCommon.h
- $(HEADER_DIR)/Plugin.h Plugin.cpp \
- Polkit.h Polkit.cpp
- libABRTdUtils_la_CPPFLAGS = \ -Wall -Werror \ -I$(srcdir)/../../inc \
diff --git a/lib/Utils/Observer.h b/lib/Utils/Observer.h deleted file mode 100644 index ec7dfa7..0000000 --- a/lib/Utils/Observer.h +++ /dev/null @@ -1,33 +0,0 @@ -/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 OBSERVER_H_ -#define OBSERVER_H_
-#include<string> -#include<stdint.h> -#include "DBusCommon.h"
-class CObserver {
- public:
virtual ~CObserver() {}
virtual void Status(const char *pMessage, const char* peer) = 0;
virtual void Warning(const char *pMessage, const char* peer) = 0;
-};
-#endif diff --git a/lib/Utils/Plugin.h b/lib/Utils/Plugin.h deleted file mode 100644 index 367739f..0000000 --- a/lib/Utils/Plugin.h +++ /dev/null @@ -1,142 +0,0 @@ -/*
- Plugin.h - header file for plugin. It contains mandatory macros
and common function for plugins
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 PLUGIN_H_ -#define PLUGIN_H_
-#include "abrt_types.h" -#include "CrashTypes.h" -#if HAVE_CONFIG_H -# include<config.h> -#endif -#if ENABLE_NLS -# include<libintl.h> -# define _(S) gettext(S) -#else -# define _(S) (S) -#endif
-#define PLUGINS_MAGIC_NUMBER 6
-#define PLUGINS_CONF_EXTENSION "conf" -#define PLUGINS_LIB_EXTENSION "so" -#define PLUGINS_LIB_PREFIX "lib"
-/**
- An abstract class. The class defines a common plugin interface. If a plugin
- has some settings, then a *Settings(*) method has to be written.
- */
-class CPlugin -{
- protected:
map_plugin_settings_t m_pSettings;
- public:
CPlugin();
/**
* A destructor.
*/
virtual ~CPlugin();
/**
* A method, which initializes a plugin. It is not mandatory method.
*/
virtual void Init();
/**
* A method, which deinitializes a plugin. It is not mandatory method.
*/
virtual void DeInit();
/**
* A method, which takes a settings and apply them. It is not a mandatory method.
* @param pSettings Plugin's settings
*/
virtual void SetSettings(const map_plugin_settings_t& pSettings);
/**
* A method, which return current settings. It is not mandatory method.
* @return Plugin's settings
*/
virtual const map_plugin_settings_t& GetSettings();
-};
-/**
- An enum of plugin types.
- */
-typedef enum {
- ANALYZER, /**< An analyzer plugin*/
- ACTION, /**< An action plugin*/
- REPORTER, /**< A reporter plugin*/
- DATABASE, /**< A database plugin*/
- MAX_PLUGIN_TYPE = DATABASE,
-} plugin_type_t;
-/**
- A struct contains all needed data about particular plugin.
- */
-typedef struct SPluginInfo -{
- const plugin_type_t m_Type; /**< Plugin type.*/
- const char *const m_sName; /**< Plugin name.*/
- const char *const m_sVersion; /**< Plugin version.*/
- const char *const m_sDescription; /**< Plugin description.*/
- const char *const m_sEmail; /**< Plugin author's email.*/
- const char *const m_sWWW; /**< Plugin's home page.*/
- const char *const m_sGTKBuilder; /**< Plugin's gui description.*/
- const int m_nMagicNumber; /**< Plugin magical number.*/
-} plugin_info_t;
-#define PLUGIN_INFO(type, plugin_class, name, version, description, email, www, gtk_builder)\
- extern "C" CPlugin* plugin_new()\
- {\
return new plugin_class();\
- }\
- extern "C" const plugin_info_t plugin_info =\
- {\
type,\
name,\
version,\
description,\
email,\
www,\
gtk_builder,\
PLUGINS_MAGIC_NUMBER,\
- };
-/* helper functions */ -std::string make_description_bz(const map_crash_data_t& pCrashData); -std::string make_description_reproduce_comment(const map_crash_data_t& pCrashData); -std::string make_description_logger(const map_crash_data_t& pCrashData);
-/**
- Loads settings and stores it in second parameter. On success it
- returns true, otherwise returns false.
- @param path A path of config file.
- Config file consists of "key=value" lines.
- @param settings A readed plugin's settings.
- @param skipKeysWithoutValue
- If true, lines in format "key=" (without value) are skipped.
- Otherwise empty value "" is inserted into pSettings.
- @return if it success it returns true, otherwise it returns false.
- */
-extern bool LoadPluginSettings(const char *pPath,
map_plugin_settings_t& pSettings,
bool skipKeysWithoutValue = true);
-#endif diff --git a/lib/Utils/Reporter.h b/lib/Utils/Reporter.h deleted file mode 100644 index 4144ec3..0000000 --- a/lib/Utils/Reporter.h +++ /dev/null @@ -1,47 +0,0 @@ -/*
- Reporter.h - header file for reporter plugin
- Copyright (C) 2009 Zdenek Prikryl (zprikryl@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 REPORTER_H_ -#define REPORTER_H_
-#include<string> -#include "Plugin.h" -#include "CrashTypes.h"
-/**
- An abstract class. The class defines a reporter plugin interface.
- */
-class CReporter : public CPlugin -{
- public:
/**
* A method, which reports a crash report to particular receiver.
* The plugin can takes arguments, but the plugin has to parse them
* by itself.
* @param pCrashData A crash report.
* @param pArgs Plugin's arguments.
* @retun A message which can be displayed after a report is created.
*/
virtual std::string Report(const map_crash_data_t& pCrashData,
const map_plugin_settings_t& pSettings,
const char *pArgs) = 0;
-};
-#endif /* REPORTER_H_ */ diff --git a/lib/Utils/abrt_xmlrpc.h b/lib/Utils/abrt_xmlrpc.h deleted file mode 100644 index ce77038..0000000 --- a/lib/Utils/abrt_xmlrpc.h +++ /dev/null @@ -1,48 +0,0 @@ -/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 ABRT_XMLRPC_H_ -#define ABRT_XMLRPC_H_ 1
-#include<curl/curl.h> -#include<xmlrpc-c/base.h> -#include<xmlrpc-c/client.h>
-/*
- Simple class holding XMLRPC connection data.
- Used mainly to ensure we always destroy xmlrpc client and server_info
- on return or throw.
- */
-struct abrt_xmlrpc_conn {
- xmlrpc_client* m_pClient;
- xmlrpc_server_info* m_pServer_info;
- abrt_xmlrpc_conn(const char* url, bool no_ssl_verify) { new_xmlrpc_client(url, no_ssl_verify); }
- /* this never throws exceptions - calls C functions only */
- ~abrt_xmlrpc_conn() { destroy_xmlrpc_client(); }
- void new_xmlrpc_client(const char* url, bool no_ssl_verify);
- void destroy_xmlrpc_client();
-};
-/* Utility functions */ -void throw_xml_fault(xmlrpc_env *env); -void throw_if_xml_fault_occurred(xmlrpc_env *env);
-#endif diff --git a/lib/Utils/xfuncs.h b/lib/Utils/xfuncs.h deleted file mode 100644 index de785c8..0000000 --- a/lib/Utils/xfuncs.h +++ /dev/null @@ -1,96 +0,0 @@ -/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 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 ABRT_XFUNCS_H -#define ABRT_XFUNCS_H
-#include<sys/socket.h> -#include<sys/stat.h> -#include<dirent.h> -#include<stdbool.h>
-#ifdef __cplusplus -extern "C" { -#endif
-extern int ndelay_on(int fd); -extern int ndelay_off(int fd); -extern int close_on_exec_on(int fd);
-extern void* xmalloc(size_t size); -extern void* xrealloc(void *ptr, size_t size); -extern void* xzalloc(size_t size); -extern char* xstrdup(const char *s); -extern char* xstrndup(const char *s, int n);
-extern void xpipe(int filedes[2]); -extern void xdup(int from); -extern void xdup2(int from, int to); -extern void xmove_fd(int from, int to);
-extern void xwrite(int fd, const void *buf, size_t count); -extern void xwrite_str(int fd, const char *str);
-extern off_t xlseek(int fd, off_t offset, int whence);
-extern void xchdir(const char *path);
-extern char* xvasprintf(const char *format, va_list p); -extern char* xasprintf(const char *format, ...);
-extern void xsetenv(const char *key, const char *value); -extern int xsocket(int domain, int type, int protocol); -extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); -extern void xlisten(int s, int backlog); -extern ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); -extern void xstat(const char *name, struct stat *stat_buf);
-extern int xopen3(const char *pathname, int flags, int mode); -extern int xopen(const char *pathname, int flags); -extern void xunlink(const char *pathname);
-/* Just testing dent->d_type == DT_REG is wrong: some filesystems
- do not report the type, they report DT_UNKNOWN for every dirent
- (and this is not a bug in filesystem, this is allowed by standards).
- This function handles this case. Note: it returns 0 on symlinks
- even if they point to regular files.
- */
-extern int is_regular_file(struct dirent *dent, const char *dirname); -extern bool dot_or_dotdot(const char *filename); -extern char *last_char_is(const char *s, int c);
-extern bool string_to_bool(const char *s);
-extern void xseteuid(uid_t euid); -extern void xsetegid(gid_t egid); -extern void xsetreuid(uid_t ruid, uid_t euid); -extern void xsetregid(gid_t rgid, gid_t egid);
-/* Returns getpwuid(uid)->pw_dir or NULL */ -extern const char *get_home_dir(uid_t uid);
-#ifdef __cplusplus -} -#endif
-#ifdef __cplusplus -std::string ssprintf(const char *format, ...); -std::string concat_path_file(const char *path, const char *filename); -#endif
-#endif
crash-catcher@lists.fedorahosted.org