1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
MiddleWare.h - header file for MiddleWare library. It wraps plugins and
take case of them.
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 MIDDLEWARE_H_
#define MIDDLEWARE_H_
#include "PluginManager.h"
#include "CrashTypes.h"
#include "MiddleWareTypes.h"
#include "RPM.h"
class CMiddleWare
{
private:
typedef set_strings_t set_blacklist_t;
typedef set_strings_t set_enabled_plugins_t;
typedef std::set<pair_string_string_t> set_pairt_strings_t;
typedef std::map<std::string, set_pairt_strings_t> map_reporter_associations_t;
typedef std::map<std::string, set_pairt_strings_t> map_action_associations_t;
typedef set_pairt_strings_t set_reporters_t;
CPluginManager* m_pPluginManager;
CRPM m_RPM;
set_blacklist_t m_setBlackList;
std::string m_sDatabase;
map_reporter_associations_t m_mapAnalyzerReporters;
map_action_associations_t m_mapAnalyzerActions;
set_reporters_t m_setReporters;
bool m_bOpenGPGCheck;
std::string GetLocalUUID(const std::string& pAnalyzer,
const std::string& pDebugDumpDir);
std::string GetGlobalUUID(const std::string& pAnalyzer,
const std::string& pDebugDumpDir);
void CreateReport(const std::string& pAnalyzer,
const std::string& pDebugDumpDir);
void RunAnalyzerActions(const std::string& pAnalyzer, const std::string& pDebugDumpDir);
void DebugDumpToCrashReport(const std::string& pDebugDumpDir,
map_crash_report_t& pCrashReport);
bool IsDebugDumpSaved(const std::string& pUID, const std::string& pDebugDumpDir);
int SavePackageDescriptionToDebugDump(const std::string& pExecutable, const std::string& pDebugDumpDir);
int SaveDebugDumpToDatabase(const std::string& pUUID,
const std::string& pUID,
const std::string& pTime,
const std::string& pDebugDumpDir,
map_crash_info_t& pCrashInfo);
map_crash_info_t GetCrashInfo(const std::string& pUUID,
const std::string& pUID);
public:
CMiddleWare(const std::string& pPlugisConfDir,
const std::string& pPlugisLibDir);
~CMiddleWare();
void RegisterPlugin(const std::string& pName);
void UnRegisterPlugin(const std::string& pName);
int CreateCrashReport(const std::string& pUUID,
const std::string& pUID,
map_crash_report_t& pCrashReport);
void Report(const std::string& pDebugDumpDir);
void Report(const map_crash_report_t& pCrashReport);
void DeleteDebugDumpDir(const std::string& pDebugDumpDir);
void DeleteCrashInfo(const std::string& pUUID,
const std::string& pUID,
const bool bWithDebugDump = true);
int SaveDebugDump(const std::string& pDebugDumpDir);
int SaveDebugDump(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo);
vector_crash_infos_t GetCrashInfos(const std::string& pUID);
void SetOpenGPGCheck(const bool& pCheck);
void SetDatabase(const std::string& pDatabase);
void AddOpenGPGPublicKey(const std::string& pKey);
void AddBlackListedPackage(const std::string& pPackage);
void AddAnalyzerReporter(const std::string& pAnalyzer,
const std::string& pReporter,
const std::string& pArgs);
void AddAnalyzerAction(const std::string& pAnalyzer,
const std::string& pAction,
const std::string& pArgs);
void AddReporter(const std::string& pReporter,
const std::string& pArgs);
};
#endif /*MIDDLEWARE_H_*/
|