diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-07-08 16:38:19 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-07-09 11:42:30 +0200 |
commit | 6c4ea60aa257907deebcdb346a9d68bbe722837e (patch) | |
tree | 9169a621bdb63de41ccc6711636f8e5b6a432c49 /lib | |
parent | 27572201de598e6c097dac708826a724e4154659 (diff) | |
download | abrt-6c4ea60aa257907deebcdb346a9d68bbe722837e.tar.gz abrt-6c4ea60aa257907deebcdb346a9d68bbe722837e.tar.xz abrt-6c4ea60aa257907deebcdb346a9d68bbe722837e.zip |
mv devel header files to inc/ and install them
- header files are required to write the custom plugins plugins
without downloading the whole git tree, user just need to install
abrt-devel package
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Utils/Action.h | 44 | ||||
-rw-r--r-- | lib/Utils/Analyzer.h | 55 | ||||
-rw-r--r-- | lib/Utils/CommLayerInner.h | 45 | ||||
-rw-r--r-- | lib/Utils/DBusCommon.h | 28 | ||||
-rw-r--r-- | lib/Utils/Database.h | 118 | ||||
-rw-r--r-- | lib/Utils/DebugDump.h | 67 | ||||
-rw-r--r-- | lib/Utils/Makefile.am | 19 | ||||
-rw-r--r-- | lib/Utils/Observer.h | 33 | ||||
-rw-r--r-- | lib/Utils/Plugin.h | 142 | ||||
-rw-r--r-- | lib/Utils/Reporter.h | 47 | ||||
-rw-r--r-- | lib/Utils/abrt_xmlrpc.h | 48 | ||||
-rw-r--r-- | lib/Utils/xfuncs.h | 96 |
12 files changed, 9 insertions, 733 deletions
diff --git a/lib/Utils/Action.h b/lib/Utils/Action.h deleted file mode 100644 index fc56277b..00000000 --- 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 a45bd0e8..00000000 --- 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 353cfc76..00000000 --- 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 58b4c8dc..00000000 --- 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 a698bcbc..00000000 --- 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 f8487a65..00000000 --- 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 56678d49..070a6fb0 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 ec7dfa7b..00000000 --- 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 367739ff..00000000 --- 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 4144ec33..00000000 --- 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 ce770384..00000000 --- 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 de785c8e..00000000 --- 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 |