[PATCH] GUI: stripped package name in warning message
by Jiri Moskovcak
This patch should fix bz#612191 - it's the case when GUI strips the last
char from the package name when the crash is in kernel. This message
should never be seen again, with the previous patches, as it won't care
about the rating for the oopses, but there might be some other case when
this might happen, so why not to fix it. It's just a one liner, so
shouldn't take long to review.
Thank you,
Jirka
13 years, 10 months
[PATCH] removing rhfastcheck, catcut and rhticket
by Jiri Moskovcak
Since we removed plugins in ${subj} we need to obsolete them in the new
release otherwise the update process will fail. This patch should fix
it, so please review and test it.
Thank you,
Jirka
13 years, 10 months
String updates
by Karel Klic
FYI, Martin Prpic checked ABRT's texts and made some corrections. I'm
going to fix the strings in our code soon, and discuss some more
corrections with him.
K
13 years, 10 months
Impression et routage
by Printing Corporation Ltd
Bonjour,
Dans le cadre de vos besoins en matière d'impression et de routage, nous nous permettons de vous présenter nos prestations.
Notre groupe implanté en Asie et en Europe met à votre disposition plusieurs sites de production pour la réalisation de vos travaux d'impression (livres, catalogues, magazines, brochures, tabloid, dépliants, produits dédiés au marketing direct avec personnalisation + façonnage en ligne).
Parallèlement et pour répondre à la forte demande du marché Européen, nous avons 4 usines de routage en Espagne nous permettant de traiter vos envois pour le marché Français (Destinéo Intégral) et à l'international (25 machines de mise sous film et mise sous papier).
Restant à votre entière disposition pour répondre à l'ensemble de vos demandes.
Contact commercial
Tel : 0820 620 135 - Fax : 01 78 768 729
Demande de devis (production en Europe) & Demande de devis (production en Asie)
Veuillez me retirer de votre liste de diffusion
http://www.printingcorporationltd.com/desinscription.html
13 years, 10 months
ABRT2 brainstorming
by Denys Vlasenko
Hi,
I was brainstorming a bit about future direction for abrt.
Here are my haphazard design notes.
What I want to change in abrt compared to current design?
* I want to simplify long-running processes (ideally I'd like
to eliminate them, but this might be impractical),
and do most of the complex work in short lived, separate
processes. Resource leaks are hard to weed out,
this way, they will be more manageable
* I want different reporting steps to be easier to debug
individually
* I want to make it more configurable without adding ad-hoc
options for every imaginable thing to abrt.conf
* I want to make it possible for third-party packages to add
their own processing for crashes in their packages
* I don't want to require dbus
Here is a tentative list of programs I came up with,
with descriptions what they do:
abrtd [-dsvvv]
Installs abrt-hook-ccpp as userspace core dumper.
Waits for socket connections (used by e.g python crashes,
can be extended to accept remote dumps?),
then spawns abrt-server for accepted connection.
Also waits using inotify for new archives to appear
in upload directory, then spawns abrt-handle-upload.
Also waits on specified log files (used for kerneloops,
X server crash detection, etc) and when a suspicious change
is detected [regex match?], spawns abrt-plugin-FOO
to process it.
Options:
-d Do not daemonize
-s Log to syslog even with -d
-v Verbose
abrt-hook-ccpp
Exec'ed by kernel. Creates new crashdump directory,
then exec's abrt-handle-crashdump.
abrt-plugin-kerneloops ABRT_DIR [-i INFILE] [-o OUTFILE]
Processes given syslog file, creates crashdump(s) and spawns
abrt-handle-crashdump for each found oops.
abrt-handle-upload ABRT_DIR UPLOAD_DIR ARCHIVE
Processes given crashdump archive: checks and unpacks it,
then exec's abrt-handle-crashdump.
abrt-applet
Provides GUI notification icon and launcher for abrt-gui
abrt-cli/gui [-v]
User interface. +Web interface, anyone?
abrt-dbus [-dsvvv] [-t SEC]
Autostarted by client (abrt-cli/gui/etc).
Waits for dbus commands, for every new dbus client spawns
a copy of abrt-server.
After this, pipes dbus client commands to abrt-server's
stdin and pipes abrt-server's output to dbus client.
If no child abrt-server's are running and no new dbus commands
are coming, exits after a timeout.
dbus cmds:
GetCrashInfos (no params)
StartJob crash_id force
Report map_crash_data reporters user_conf_data
DeleteDebugDump crash_id
CreateReport crash_id
GetPluginsInfo (no params)
GetPluginSettings PluginName
SetPluginSettings PluginName plugin_settings
GetSettings (no params)
SetSettings map_abrt_settings
Options:
-d Do not daemonize
-s Log to syslog even with -d
-v Verbose
-t SEC Exit after SEC seconds of inactivity
abrt-server [-dsvvv] [-t SEC] ABRT_DIR
If run from abrtd:
Reads data from stdin and creates new crashdump directory,
then spawns abrt-handle-crashdump.
If run from abrt-dbus:
Reads data from stdin and performs requested ops.
[Rationale for separate process: easy to debug,
easy to prevent resource leaks in abrtd/abrt-dbus,
easy to implement connection timeout, does not need to link
against dbus libs, can be used with e.g. network connection.]
Creating new crashdump:
EXECUTABLE=asciz
BACKTRACE=asciz
BASENAME=asciz
ANALYZER=asciz
REASON=asciz
PID=asciz
DONE
Dbus ops:
CreateReport crashdump_dir - preparing crashdump (generate backtrace etc):
DeleteDebugDump crashdump_dir
Report crashdump_dir reporter user_conf_data
Note: not a lot of configurability is needed for the above programs -
they do basically the same processing for all use cases.
abrt-handle-crashdump DIR [PARAMS]
Processes given crashdump directory.
[Best to implement as shell script, to make it easier to set up
custom processing? this way, sosreport, filetransfer/ticketuploader
plugins are no longer needed - they can be easily implemented
in shell script]
STAGE: created / uploaded / collectinfo / report / ...
abrt-plugin-ANALYZER
Do we need separate programs for this?
abrt-plugin-REPORTER (bugzilla,rhtsupport)
Used by abrt-handle-crashdump to interface to bug databases.
abrt-backtrace
abrt-debuginfo-install
===============================================================
How to configure abrt-handle-crashdump?
conf file?
# stage [env vars] cmd [params]
uploaded abrt-action-get-build_ids
uploaded abrt-action-generate-backtrace
created abrt-action-upload ftp://user:pass@host/dir
created abrt-action-sosreport
collectinfo abrt-action-sosreport
collectinfo abrt-action-get-build_ids
collectinfo abrt-action-debuginfo-install
collectinfo FORCE=1 abrt-action-generate-backtrace
report abrt-action-bugzilla https://bz-web1-test.devel.redhat.com/
report abrt-action-logger
report user_custom_shell_script
other ideas?
===============================================================
For reference, abrt1 plugins are:
Bugzilla.cpp
CCpp.cpp
FileTransfer.cpp
Kerneloops.cpp
KerneloopsScanner.cpp
Logger.cpp
Mailx.cpp
Python.cpp
RHTSupport.cpp
RunApp.cpp
SOSreport.cpp
ReportUploader.cpp
13 years, 10 months
INTERPRETED_LANGUAGES
by Karel Klic
Hi,
I have written a document that describes how an interpreted language
should interact with ABRT, as requested by Jirka.
I tried to write it for non-ABRT people and describe the situation as we
have it now (unfortunately src/Daemon/MiddleWare.cpp must be patched
when adding an interpreter support).
This file should go to doc/INTERPRETED_LANGUAGES in our repository.
Feel free to extend/rewrite/mix this and propose your own version.
Suggestions are welcome.
Karel
13 years, 10 months
[PATCH] fedora bugs should not depend on rhel bugs
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
lib/Plugins/Bugzilla.cpp | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index cde1712..f267b98 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -692,7 +692,16 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
update_client(_("Checking for duplicates..."));
- xmlrpc_value *result = bz_server.call_quicksearch_duphash(component.c_str(), NULL, duphash.c_str());
+ char *product = NULL;
+ char *version = NULL;
+ parse_release(release, &product, &version);
+
+ xmlrpc_value *result;
+ if (strcmp(product, "Fedora") == 0)
+ result = bz_server.call_quicksearch_duphash(component.c_str(), product, duphash.c_str());
+ else
+ result = bz_server.call_quicksearch_duphash(component.c_str(), NULL, duphash.c_str());
+
if (!result)
throw_if_xml_fault_occurred(&bz_server.env);
@@ -708,8 +717,6 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
int all_bugs_size = bz_server.get_array_size(all_bugs);
struct bug_info bz;
int depend_on_bugno = -1;
- char *product = NULL;
- char *version = NULL;
if (all_bugs_size > 0)
{
bug_id = bz_server.get_bug_id(all_bugs);
@@ -725,7 +732,6 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
throw CABRTException(EXCEP_PLUGIN, _("get_bug_info() failed. Could not collect all mandatory information"));
}
- parse_release(release, &product, &version);
if (strcmp(bz.bug_product, product) != 0)
{
depend_on_bugno = bug_id;
--
1.7.1
13 years, 10 months
[PATCH 1/2] mv devel header files to inc/ and install them
by Nikola Pajkovsky
From: Jiri Moskovcak <jmoskovc(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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
--
1.7.1
13 years, 10 months