diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-26 14:18:58 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-26 14:18:58 +0200 |
| commit | a20328b6c62c1688d6f3f1310f211d02da560f50 (patch) | |
| tree | 02b8e17d357dda2372d48c4d6b1db08890fd5b1c /src/Daemon | |
| parent | 118f441f80fa10a2ed552c9a68951d80868809a5 (diff) | |
| download | abrt-a20328b6c62c1688d6f3f1310f211d02da560f50.tar.gz abrt-a20328b6c62c1688d6f3f1310f211d02da560f50.tar.xz abrt-a20328b6c62c1688d6f3f1310f211d02da560f50.zip | |
consolidate common data declarations in new file Daemon.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon')
| -rw-r--r-- | src/Daemon/CrashWatcher.cpp | 6 | ||||
| -rw-r--r-- | src/Daemon/CrashWatcher.h | 14 | ||||
| -rw-r--r-- | src/Daemon/Daemon.cpp | 7 | ||||
| -rw-r--r-- | src/Daemon/Daemon.h | 54 | ||||
| -rw-r--r-- | src/Daemon/Makefile.am | 2 | ||||
| -rw-r--r-- | src/Daemon/MiddleWare.cpp | 17 | ||||
| -rw-r--r-- | src/Daemon/PluginManager.h | 2 |
7 files changed, 72 insertions, 30 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index ffc7133..26e906f 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -16,11 +16,13 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "abrtlib.h" -#include "CrashWatcher.h" + #include <iostream> #include <sstream> +#include "abrtlib.h" +#include "Daemon.h" #include "ABRTException.h" +#include "CrashWatcher.h" void CCrashWatcher::Status(const std::string& pMessage, const std::string& pDest) { diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index b22577c..ce82fc5 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -66,18 +66,4 @@ class CCrashWatcher virtual void UnRegisterPlugin(const std::string& pName); }; - -/* used only for ->Warning() calls */ -extern CCrashWatcher *g_cw; -/* conduit for these messages */ -extern CCommLayerServer *g_pCommLayer; - -/* - * Map to cache the results from CreateReport_t - * <UID, <UUID, result>> - */ -extern std::map<const std::string, std::map<int, map_crash_report_t> > g_pending_jobs; -/* mutex to protect g_pending_jobs */ -extern pthread_mutex_t g_pJobsMutex; - #endif /*CRASHWATCHER_H_*/ diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index bf5215d..60341f7 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -17,16 +17,15 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "abrtlib.h" #include <sys/inotify.h> #include <glib.h> #include <pthread.h> - -#include "ABRTException.h" #include <iostream> #include <string> - +#include "abrtlib.h" +#include "ABRTException.h" #include "CrashWatcher.h" +#include "Daemon.h" //FIXME: add some struct to be able to join all threads! diff --git a/src/Daemon/Daemon.h b/src/Daemon/Daemon.h new file mode 100644 index 0000000..8d0a4c6 --- /dev/null +++ b/src/Daemon/Daemon.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2009 Denys Vlasenko (dvlasenk@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 DAEMON_H_ +#define DAEMON_H_ + +#include <pthread.h> +#include "MiddleWareTypes.h" +#include "CrashTypes.h" + +class CCrashWatcher; +class CCommLayerServer; +class CPluginManager; +class CRPM; + +/* Used only for ->Warning() calls */ +extern CCrashWatcher *g_cw; +/* Conduit for these messages */ +extern CCommLayerServer *g_pCommLayer; +/* Collection of loaded plugins */ +extern CPluginManager* g_pPluginManager; +/** + * An instance of CRPM used for package checking. + * @see RPM.h + */ +extern CRPM g_RPM; +/** + * A set of blacklisted packages. + */ +extern set_strings_t g_setBlackList; + + +/* Map <UID, <UUID, result>> to cache the results from CreateReport_t() */ +extern std::map<const std::string, std::map<int, map_crash_report_t> > g_pending_jobs; +/* Mutex to protect g_pending_jobs */ +extern pthread_mutex_t g_pJobsMutex; + +#endif diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am index eb9a059..f4e5b77 100644 --- a/src/Daemon/Makefile.am +++ b/src/Daemon/Makefile.am @@ -9,7 +9,7 @@ abrt_SOURCES = \ CommLayerServer.h CommLayerServer.cpp \ CommLayerServerSocket.h CommLayerServerSocket.cpp \ CommLayerServerDBus.h CommLayerServerDBus.cpp \ - Daemon.cpp \ + Daemon.cpp Daemon.h \ Settings.h Settings.cpp abrt_CPPFLAGS = \ -I$(srcdir)/../../inc \ diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 58ac10e..4dff8f7 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -20,6 +20,7 @@ */ #include "abrtlib.h" +#include "Daemon.h" #include "Settings.h" #include "DebugDump.h" #include "ABRTException.h" @@ -33,17 +34,17 @@ * @see PluginManager.h */ CPluginManager* g_pPluginManager; - - /** * An instance of CRPM used for package checking. * @see RPM.h */ -static CRPM s_RPM; +CRPM g_RPM; /** * A set of blacklisted packages. */ -static set_strings_t s_setBlackList; +set_strings_t g_setBlackList; + + /** * A map, which associates particular analyzer to one or more * action or reporter plugins. These are activated when a crash, which @@ -442,7 +443,7 @@ static mw_result_t SavePackageDescriptionToDebugDump(const std::string& pExecuta package = GetPackage(pExecutable); packageName = package.substr(0, package.rfind("-", package.rfind("-") - 1)); if (packageName == "" || - (s_setBlackList.find(packageName) != s_setBlackList.end())) + (g_setBlackList.find(packageName) != g_setBlackList.end())) { if (packageName == "") { @@ -454,7 +455,7 @@ static mw_result_t SavePackageDescriptionToDebugDump(const std::string& pExecuta } if (g_settings_bOpenGPGCheck) { - if (!s_RPM.CheckFingerprint(packageName)) + if (!g_RPM.CheckFingerprint(packageName)) { error_msg("package isn't signed with proper key"); return MW_GPG_ERROR; @@ -683,12 +684,12 @@ vector_pair_string_string_t GetUUIDsOfCrash(const std::string& pUID) void AddOpenGPGPublicKey(const std::string& pKey) { - s_RPM.LoadOpenGPGPublicKey(pKey); + g_RPM.LoadOpenGPGPublicKey(pKey); } void AddBlackListedPackage(const std::string& pPackage) { - s_setBlackList.insert(pPackage); + g_setBlackList.insert(pPackage); } void AddAnalyzerActionOrReporter(const std::string& pAnalyzer, diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h index 590192f..6cf84f3 100644 --- a/src/Daemon/PluginManager.h +++ b/src/Daemon/PluginManager.h @@ -150,7 +150,7 @@ class CPluginManager }; /** - * A function. It loads settings and store it in second parameter. On success it + * Loads settings and stores it in second parameter. On success it * returns true, otherwise returns false. * @param path A path of config file. * @param settings A readed plugin's settings. |
