summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-02 16:24:46 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-02 16:24:46 +0200
commit62a15a2e7cc5186661bef2ec172422989c72e5db (patch)
tree8561ea8bfabbb1136a6ca7b222f18c7a6f343eb7 /lib
parentf02f0b3c6b8801584884fb2e4da0707417374185 (diff)
new crash types
Diffstat (limited to 'lib')
-rw-r--r--lib/CommLayer/CommLayerServer.h8
-rw-r--r--lib/CommLayer/CommLayerServerDBus.cpp27
-rw-r--r--lib/CommLayer/CommLayerServerDBus.h6
-rw-r--r--lib/CommLayer/DBusClientProxy.h4
-rw-r--r--lib/CommLayer/DBusCommon.h6
-rw-r--r--lib/CommLayer/DBusServerProxy.h14
-rw-r--r--lib/MiddleWare/CrashTypes.h110
-rw-r--r--lib/MiddleWare/MiddleWare.cpp77
-rw-r--r--lib/MiddleWare/MiddleWare.h14
-rw-r--r--lib/MiddleWare/Reporter.h2
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp4
-rw-r--r--lib/Plugins/KerneloopsReporter.h2
-rw-r--r--lib/Plugins/Logger.cpp16
-rw-r--r--lib/Plugins/Logger.h2
-rw-r--r--lib/Plugins/Mailx.cpp16
-rw-r--r--lib/Plugins/Mailx.h2
16 files changed, 137 insertions, 173 deletions
diff --git a/lib/CommLayer/CommLayerServer.h b/lib/CommLayer/CommLayerServer.h
index fa8023a..e4a5170 100644
--- a/lib/CommLayer/CommLayerServer.h
+++ b/lib/CommLayer/CommLayerServer.h
@@ -5,12 +5,6 @@
#include "MiddleWare.h"
#include "Observer.h"
-
-//typedef std::vector<crash_info_t> vector_crash_infos_t;
-typedef std::vector< std::vector<std::string> > dbus_vector_crash_infos_t;
-typedef std::vector< std::map<std::string, std::string> > dbus_vector_map_crash_infos_t;
-typedef std::map<std::string, std::string> dbus_map_report_info_t;
-
/* just a helper function */
template< class T >
std::string
@@ -44,6 +38,6 @@ class CCommLayerServer{
public:
/* just stubs to be called when not implemented in specific comm layer */
void Crash(const std::string& arg1) {}
- void AnalyzeComplete(dbus_map_report_info_t arg1) {}
+ void AnalyzeComplete(map_crash_report_t arg1) {}
void Error(const std::string& arg1) {}
};
diff --git a/lib/CommLayer/CommLayerServerDBus.cpp b/lib/CommLayer/CommLayerServerDBus.cpp
index 33bb2f9..a62ed2e 100644
--- a/lib/CommLayer/CommLayerServerDBus.cpp
+++ b/lib/CommLayer/CommLayerServerDBus.cpp
@@ -26,21 +26,21 @@ CCommLayerServerDBus::~CCommLayerServerDBus()
delete m_pDispatcher;
}
-dbus_vector_crash_infos_t CCommLayerServerDBus::GetCrashInfos(const std::string &pUID)
+vector_crash_infos_t CCommLayerServerDBus::GetCrashInfos(const std::string &pUID)
{
- dbus_vector_crash_infos_t retval;
- vector_crash_infos_t crash_info;
+ vector_crash_infos_t retval;
+ /* vector_crash_infos_t crash_info;
m_pMW->GetCrashInfos("501");
for (vector_crash_infos_t::iterator it = crash_info.begin(); it!=crash_info.end(); ++it) {
std::cerr << it->m_sExecutable << std::endl;
- }
+ }*/
return retval;
}
dbus_vector_map_crash_infos_t CCommLayerServerDBus::GetCrashInfosMap(const std::string &pDBusSender)
{
dbus_vector_map_crash_infos_t retval;
- vector_crash_infos_t crash_info;
+ /*vector_crash_infos_t crash_info;
unsigned long unix_uid = m_pConn->sender_unix_uid(pDBusSender.c_str());
try
{
@@ -54,35 +54,32 @@ dbus_vector_map_crash_infos_t CCommLayerServerDBus::GetCrashInfosMap(const std::
std::cerr << it->m_sExecutable << std::endl;
retval.push_back(it->GetMap());
}
- Notify("Sent crash info");
+ Notify("Sent crash info");*/
return retval;
}
-dbus_vector_crash_report_info_t CCommLayerServerDBus::CreateReport(const std::string &pUUID,const std::string &pDBusSender)
+map_crash_report_t CCommLayerServerDBus::CreateReport(const std::string &pUUID,const std::string &pDBusSender)
{
- dbus_vector_crash_report_info_t retval;
unsigned long unix_uid = m_pConn->sender_unix_uid(pDBusSender.c_str());
//std::cerr << pUUID << ":" << unix_uid << std::endl;
- crash_report_t crashReport;
+ map_crash_report_t crashReport;
std::cerr << "Creating report" << std::endl;
try
{
m_pMW->CreateCrashReport(pUUID,to_string(unix_uid), crashReport);
- retval = crash_report_to_vector_strings(crashReport);
//send out the message about completed analyze
- CDBusServer_adaptor::AnalyzeComplete(retval);
+ CDBusServer_adaptor::AnalyzeComplete(crashReport);
}
catch(std::string err)
{
CDBusServer_adaptor::Error(err);
std::cerr << err << std::endl;
}
- return retval;
+ return crashReport;
}
-bool CCommLayerServerDBus::Report(dbus_vector_crash_report_info_t pReport)
+bool CCommLayerServerDBus::Report(map_crash_report_t pReport)
{
- crash_report_t crashReport = vector_strings_to_crash_report(pReport);
//#define FIELD(X) crashReport.m_s##X = pReport[#X];
//crashReport.m_sUUID = pReport["UUID"];
//ALL_CRASH_REPORT_FIELDS;
@@ -92,7 +89,7 @@ bool CCommLayerServerDBus::Report(dbus_vector_crash_report_info_t pReport)
//}
try
{
- m_pMW->Report(crashReport);
+ m_pMW->Report(pReport);
}
catch(std::string err)
{
diff --git a/lib/CommLayer/CommLayerServerDBus.h b/lib/CommLayer/CommLayerServerDBus.h
index 175be21..c5715c9 100644
--- a/lib/CommLayer/CommLayerServerDBus.h
+++ b/lib/CommLayer/CommLayerServerDBus.h
@@ -18,10 +18,10 @@ class CCommLayerServerDBus
CCommLayerServerDBus(CMiddleWare *m_pMW);
virtual ~CCommLayerServerDBus();
- virtual dbus_vector_crash_infos_t GetCrashInfos(const std::string &pUID);
+ virtual vector_crash_infos_t GetCrashInfos(const std::string &pUID);
virtual dbus_vector_map_crash_infos_t GetCrashInfosMap(const std::string &pDBusSender);
- virtual dbus_vector_crash_report_info_t CreateReport(const std::string &pUUID,const std::string &pDBusSender);
- virtual bool Report(dbus_vector_crash_report_info_t pReport);
+ virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pDBusSender);
+ virtual bool Report(map_crash_report_t pReport);
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender);
};
diff --git a/lib/CommLayer/DBusClientProxy.h b/lib/CommLayer/DBusClientProxy.h
index f0b8a00..4bbf5ee 100644
--- a/lib/CommLayer/DBusClientProxy.h
+++ b/lib/CommLayer/DBusClientProxy.h
@@ -50,7 +50,7 @@ public:
...
>
*/
- dbus_vector_crash_infos_t GetCrashInfos(const std::string &pUID)
+ vector_crash_infos_t GetCrashInfos(const std::string &pUID)
{
DBus::CallMessage call;
@@ -61,7 +61,7 @@ public:
DBus::Message ret = invoke_method(call);
DBus::MessageIter ri = ret.reader();
- dbus_vector_crash_infos_t argout;
+ vector_crash_infos_t argout;
ri >> argout;
return argout;
}
diff --git a/lib/CommLayer/DBusCommon.h b/lib/CommLayer/DBusCommon.h
index acd508d..0f58abc 100644
--- a/lib/CommLayer/DBusCommon.h
+++ b/lib/CommLayer/DBusCommon.h
@@ -21,8 +21,6 @@
#define CC_DBUS_PATH "/com/redhat/abrt"
#define CC_DBUS_IFACE "com.redhat.abrt"
-//typedef std::vector<crash_info_t> vector_crash_infos_t;
-typedef std::vector< std::vector<std::string> > dbus_vector_crash_infos_t;
typedef std::vector< std::map<std::string, std::string> > dbus_vector_map_crash_infos_t;
-//typedef std::map<std::string, std::string> dbus_map_report_info_t;
-typedef std::vector<std::string> dbus_vector_crash_report_info_t;
+
+#include "CrashTypes.h"
diff --git a/lib/CommLayer/DBusServerProxy.h b/lib/CommLayer/DBusServerProxy.h
index f1c011a..2d52d15 100644
--- a/lib/CommLayer/DBusServerProxy.h
+++ b/lib/CommLayer/DBusServerProxy.h
@@ -88,10 +88,10 @@ public:
/* methods exported by this interface,
* you will have to implement them in your ObjectAdaptor
*/
- virtual dbus_vector_crash_infos_t GetCrashInfos(const std::string &pUID) = 0;
+ virtual vector_crash_infos_t GetCrashInfos(const std::string &pUID) = 0;
virtual dbus_vector_map_crash_infos_t GetCrashInfosMap(const std::string &pDBusSender) = 0;
- virtual dbus_vector_crash_report_info_t CreateReport(const std::string &pUUID,const std::string &pDBusSender) = 0;
- virtual bool Report(dbus_vector_crash_report_info_t pReport) = 0;
+ virtual map_crash_report_t CreateReport(const std::string &pUUID,const std::string &pDBusSender) = 0;
+ virtual bool Report(map_crash_report_t pReport) = 0;
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender) = 0;
public:
@@ -106,7 +106,7 @@ public:
emit_signal(sig);
}
/* Notify the clients that creating a report has finished */
- void AnalyzeComplete(dbus_vector_crash_report_info_t arg1)
+ void AnalyzeComplete(map_crash_report_t arg1)
{
::DBus::SignalMessage sig("AnalyzeComplete");
::DBus::MessageIter wi = sig.writer();
@@ -131,7 +131,7 @@ private:
DBus::MessageIter ri = call.reader();
std::string argin1; ri >> argin1;
- dbus_vector_crash_infos_t argout1 = GetCrashInfos(argin1);
+ vector_crash_infos_t argout1 = GetCrashInfos(argin1);
DBus::ReturnMessage reply(call);
DBus::MessageIter wi = reply.writer();
wi << argout1;
@@ -143,7 +143,7 @@ private:
DBus::MessageIter ri = call.reader();
std::string argin1; ri >> argin1;
- dbus_vector_crash_report_info_t argout1 = CreateReport(argin1,call.sender());
+ map_crash_report_t argout1 = CreateReport(argin1,call.sender());
DBus::ReturnMessage reply(call);
DBus::MessageIter wi = reply.writer();
wi << argout1;
@@ -166,7 +166,7 @@ private:
{
DBus::MessageIter ri = call.reader();
- dbus_vector_crash_report_info_t argin1; ri >> argin1;
+ map_crash_report_t argin1; ri >> argin1;
bool argout1 = Report(argin1);
DBus::ReturnMessage reply(call);
DBus::MessageIter wi = reply.writer();
diff --git a/lib/MiddleWare/CrashTypes.h b/lib/MiddleWare/CrashTypes.h
index 65dff90..81e1612 100644
--- a/lib/MiddleWare/CrashTypes.h
+++ b/lib/MiddleWare/CrashTypes.h
@@ -5,80 +5,64 @@
#include <map>
#include <vector>
-typedef std::map<std::string, std::string> map_crash_t;
+// SYS - system value, should not be displayed
+// BIN - binary value, should be displayed
+// TXT = text value, should be displayed
+typedef enum { CD_SYS, CD_BIN, CD_TXT } content_crash_data_t;
-typedef struct SCrashInfo
-{
- std::string m_sUUID;
- std::string m_sUID;
- std::string m_sCount;
- std::string m_sExecutable;
- std::string m_sPackage;
- std::string m_sDescription;
- std::string m_sTime;
- std::string m_sReported;
-
- const map_crash_t GetMap()
- {
- map_crash_t mci;
- mci["UUID"] = m_sUUID;
- mci["UID"] = m_sUID;
- mci["Count"] = m_sCount;
- mci["Executable"] = m_sExecutable;
- mci["Package"] = m_sPackage;
- mci["Description"] = m_sDescription;
- mci["Time"] = m_sTime;
- mci["Reported"] = m_sReported;
-
- return mci;
- }
-} crash_info_t;
+const char* const type_crash_data_t_str[] = { "s", "b", "t" };
-typedef std::vector<crash_info_t> vector_crash_infos_t;
+typedef enum { CI_UUID,
+ CI_UID,
+ CI_COUNT,
+ CI_EXECUTABLE,
+ CI_PACKAGE,
+ CI_DESCRIPTION,
+ CI_TIME,
+ CI_REPORTED,
+ CI_MWANALYZER,
+ CI_MWUID,
+ CI_MWUUID } item_crash_into_t;
-// text value, should be displayed
-#define TYPE_TXT "t"
-// binary value, should be displayed
-#define TYPE_BIN "b"
-// system value, should not be displayed
-#define TYPE_SYS "s"
+const char* const item_crash_into_t_str[] = { "UUID",
+ "UID",
+ "Count",
+ "Executable",
+ "Package",
+ "Time",
+ "Reported",
+ "_MWAnalyzer",
+ "_MWUID",
+ "_MWUUID" };
-typedef struct CCrashFile
-{
- std::string m_sType;
- std::string m_sContent;
-} crash_file_t;
+typedef enum { CD_TYPE, CD_CONTENT } item_crash_data_t;
-// < key, type, value, key, type, value, ....>
+// now, size of a vecor is always 2 -> <type, content>
typedef std::vector<std::string> vector_strings_t;
-typedef std::map<std::string, crash_file_t> crash_report_t;
+// <key, data>
+typedef std::map<std::string, vector_strings_t> map_crash_data_t;
+
+typedef map_crash_data_t map_crash_info_t;
+typedef std::vector<map_crash_info_t> vector_crash_infos_t;
+typedef map_crash_data_t map_crash_report_t;
-inline vector_strings_t crash_report_to_vector_strings(const crash_report_t& pCrashReport)
+inline void add_crash_data_to_crash_info(map_crash_info_t& pCrashInfo,
+ const item_crash_into_t& pItem,
+ const content_crash_data_t& pType,
+ const std::string& pContent)
{
- vector_strings_t vec;
- crash_report_t::const_iterator it;
- for (it = pCrashReport.begin(); it != pCrashReport.end(); it++)
- {
- vec.push_back(it->first);
- vec.push_back(it->second.m_sType);
- vec.push_back(it->second.m_sContent);
- }
- return vec;
+ pCrashInfo[type_crash_data_t_str[pItem]].push_back(type_crash_data_t_str[pType]);
+ pCrashInfo[type_crash_data_t_str[pItem]].push_back(pContent);
}
-inline crash_report_t vector_strings_to_crash_report(const vector_strings_t& pVectorStrings)
+inline void add_crash_data_to_crash_report(map_crash_report_t& pCrashReport,
+ const std::string& pFileName,
+ const content_crash_data_t& pType,
+ const std::string& pContent)
{
- unsigned int ii;
- crash_report_t crashReport;
- for (ii = 0; ii < pVectorStrings.size(); ii += 3)
- {
- crash_file_t crashFile;
- std::string fileName = pVectorStrings[ii];
- crashFile.m_sType = pVectorStrings[ii + 1];
- crashFile.m_sContent = pVectorStrings[ii + 2];
- crashReport[fileName] = crashFile;
- }
- return crashReport;
+ pCrashReport[pFileName].push_back(type_crash_data_t_str[pType]);
+ pCrashReport[pFileName].push_back(pContent);
}
+
#endif /* CRASHTYPES_H_ */
diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp
index 56709db..cf2f699 100644
--- a/lib/MiddleWare/MiddleWare.cpp
+++ b/lib/MiddleWare/MiddleWare.cpp
@@ -37,7 +37,7 @@ CMiddleWare::~CMiddleWare()
delete m_pPluginManager;
}
-void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, crash_report_t& pCrashReport)
+void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_crash_report_t& pCrashReport)
{
CDebugDump dd;
dd.Open(pDebugDumpDir);
@@ -57,15 +57,14 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, crash
dd.InitGetNextFile();
while (dd.GetNextFile(fileName, content, isTextFile))
{
- crash_file_t crashFile;
- crashFile.m_sType = TYPE_TXT;
if (!isTextFile)
{
- crashFile.m_sType = TYPE_BIN;
- content = pDebugDumpDir + "/" + fileName;
+ add_crash_data_to_crash_report(pCrashReport, fileName, CD_BIN, pDebugDumpDir + "/" + fileName);
+ }
+ else
+ {
+ add_crash_data_to_crash_report(pCrashReport, fileName, CD_TXT, content);
}
- crashFile.m_sContent = content;
- pCrashReport[fileName] = crashFile;
}
dd.Close();
}
@@ -104,7 +103,7 @@ void CMiddleWare::CreateReport(const std::string& pAnalyzer,
void CMiddleWare::CreateCrashReport(const std::string& pUUID,
const std::string& pUID,
- crash_report_t& pCrashReport)
+ map_crash_report_t& pCrashReport)
{
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
database_row_t row;
@@ -140,27 +139,22 @@ void CMiddleWare::CreateCrashReport(const std::string& pUUID,
RunAnalyzerActions(analyzer, row.m_sDebugDumpDir);
DebugDumpToCrashReport(row.m_sDebugDumpDir, pCrashReport);
- crash_file_t file;
- file.m_sType = TYPE_SYS;
- file.m_sContent = analyzer;
- pCrashReport["_MWAnalyzer"] = file;
- file.m_sContent = pUID;
- pCrashReport["_MWUID"] = file;
- file.m_sContent = pUUID;
- pCrashReport["_MWUUID"] = file;
+ add_crash_data_to_crash_report(pCrashReport, item_crash_into_t_str[CI_MWANALYZER], CD_SYS, analyzer);
+ add_crash_data_to_crash_report(pCrashReport, item_crash_into_t_str[CI_MWUID], CD_SYS, pUID);
+ add_crash_data_to_crash_report(pCrashReport, item_crash_into_t_str[CI_MWUUID], CD_SYS, pUUID);
}
-void CMiddleWare::Report(const crash_report_t& pCrashReport)
+void CMiddleWare::Report(const map_crash_report_t& pCrashReport)
{
- if (pCrashReport.find("_MWAnalyzer") == pCrashReport.end() ||
- pCrashReport.find("_MWUID") == pCrashReport.end() ||
- pCrashReport.find("_MWUUID") == pCrashReport.end())
+ if (pCrashReport.find(item_crash_into_t_str[CI_MWANALYZER]) == pCrashReport.end() ||
+ pCrashReport.find(item_crash_into_t_str[CI_MWUID]) == pCrashReport.end() ||
+ pCrashReport.find(item_crash_into_t_str[CI_MWUUID]) == pCrashReport.end())
{
throw std::string("CMiddleWare::Report(): Important data are missing.");
}
- std::string analyzer = pCrashReport.find("_MWAnalyzer")->second.m_sContent;
- std::string UID = pCrashReport.find("_MWUID")->second.m_sContent;
- std::string UUID = pCrashReport.find("_MWUUID")->second.m_sContent;;
+ std::string analyzer = pCrashReport.find(item_crash_into_t_str[CI_MWANALYZER])->second[CD_CONTENT];
+ std::string UID = pCrashReport.find(item_crash_into_t_str[CI_MWUID])->second[CD_CONTENT];
+ std::string UUID = pCrashReport.find(item_crash_into_t_str[CI_MWUUID])->second[CD_CONTENT];
if (m_mapAnalyzerReporters.find(analyzer) != m_mapAnalyzerReporters.end())
{
@@ -306,7 +300,7 @@ void CMiddleWare::RunAnalyzerActions(const std::string& pAnalyzer, const std::st
}
}
-int CMiddleWare::SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo)
+int CMiddleWare::SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo)
{
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
@@ -348,11 +342,11 @@ int CMiddleWare::SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, crash
int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir)
{
- crash_info_t info;
+ map_crash_info_t info;
return SaveDebugDump(pDebugDumpDir, info);
}
-int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo)
+int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo)
{
if (IsDebugDumpSaved(pDebugDumpDir))
{
@@ -370,10 +364,10 @@ int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, crash_info_t& p
return SaveDebugDumpToDatabase(pDebugDumpDir, pCrashInfo);
}
-crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
+map_crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
const std::string& pUID)
{
- crash_info_t info;
+ map_crash_info_t crashInfo;
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
database_row_t row;
database->Connect();
@@ -388,25 +382,25 @@ crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
catch (std::string sErr)
{
DeleteCrashInfo(row.m_sUUID, row.m_sUID, false);
- return info;
+ return crashInfo;
}
std::string data;
dd.LoadText(FILENAME_EXECUTABLE, data);
- info.m_sExecutable = data;
+ add_crash_data_to_crash_info(crashInfo, CI_EXECUTABLE, CD_TXT, data);
dd.LoadText(FILENAME_PACKAGE, data);
- info.m_sPackage = data;
+ add_crash_data_to_crash_info(crashInfo, CI_PACKAGE, CD_TXT, data);
dd.LoadText(FILENAME_DESCRIPTION, data);
- info.m_sDescription = data;
+ add_crash_data_to_crash_info(crashInfo, CI_DESCRIPTION, CD_TXT, data);
dd.Close();
- info.m_sUUID = row.m_sUUID;
- info.m_sUID = row.m_sUID;
- info.m_sCount = row.m_sCount;
- info.m_sTime = row.m_sTime;
- info.m_sReported = row.m_sReported;
+ add_crash_data_to_crash_info(crashInfo, CI_UUID, CD_TXT, row.m_sUUID);
+ add_crash_data_to_crash_info(crashInfo, CI_UID, CD_TXT, row.m_sUID);
+ add_crash_data_to_crash_info(crashInfo, CI_COUNT, CD_TXT, row.m_sCount);
+ add_crash_data_to_crash_info(crashInfo, CI_TIME, CD_TXT, row.m_sTime);
+ add_crash_data_to_crash_info(crashInfo, CI_REPORTED, CD_TXT, row.m_sReported);
- return info;
+ return crashInfo;
}
vector_crash_infos_t CMiddleWare::GetCrashInfos(const std::string& pUID)
@@ -422,11 +416,8 @@ vector_crash_infos_t CMiddleWare::GetCrashInfos(const std::string& pUID)
int ii;
for (ii = 0; ii < rows.size(); ii++)
{
- crash_info_t info = GetCrashInfo(rows[ii].m_sUUID, rows[ii].m_sUID);
- if (info.m_sUUID == rows[ii].m_sUUID)
- {
- infos.push_back(info);
- }
+ map_crash_info_t info = GetCrashInfo(rows[ii].m_sUUID, rows[ii].m_sUID);
+ infos.push_back(info);
}
return infos;
diff --git a/lib/MiddleWare/MiddleWare.h b/lib/MiddleWare/MiddleWare.h
index 5eafce8..e8d5212 100644
--- a/lib/MiddleWare/MiddleWare.h
+++ b/lib/MiddleWare/MiddleWare.h
@@ -56,14 +56,14 @@ class CMiddleWare
const std::string& pDebugDumpDir);
void RunAnalyzerActions(const std::string& pAnalyzer, const std::string& pDebugDumpDir);
void DebugDumpToCrashReport(const std::string& pDebugDumpDir,
- crash_report_t& pCrashReport);
+ map_crash_report_t& pCrashReport);
bool IsDebugDumpSaved(const std::string& pDebugDumpDir);
int SavePackageDescriptionToDebugDump(const std::string& pDebugDumpDir);
int SaveUUIDToDebugDump(const std::string& pDebugDumpDir);
- int SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo);
- crash_info_t GetCrashInfo(const std::string& pUUID,
- const std::string& pUID);
+ int SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo);
+ map_crash_info_t GetCrashInfo(const std::string& pUUID,
+ const std::string& pUID);
public:
@@ -77,9 +77,9 @@ class CMiddleWare
void CreateCrashReport(const std::string& pUUID,
const std::string& pUID,
- crash_report_t& pCrashReport);
+ map_crash_report_t& pCrashReport);
- void Report(const crash_report_t& pCrashReport);
+ void Report(const map_crash_report_t& pCrashReport);
void DeleteCrashInfo(const std::string& pUUID,
const std::string& pUID,
@@ -87,7 +87,7 @@ class CMiddleWare
int SaveDebugDump(const std::string& pDebugDumpDir);
- int SaveDebugDump(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo);
+ int SaveDebugDump(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo);
vector_crash_infos_t GetCrashInfos(const std::string& pUID);
diff --git a/lib/MiddleWare/Reporter.h b/lib/MiddleWare/Reporter.h
index b3d8b8c..02fae12 100644
--- a/lib/MiddleWare/Reporter.h
+++ b/lib/MiddleWare/Reporter.h
@@ -31,7 +31,7 @@ class CReporter : public CPlugin
public:
virtual ~CReporter() {}
- virtual void Report(const crash_report_t& pCrashReport) = 0;
+ virtual void Report(const map_crash_report_t& pCrashReport) = 0;
};
#endif /* REPORTER_H_ */
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index 1bf485c..116fc8d 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -55,7 +55,7 @@ size_t writefunction(void *ptr, size_t size, size_t nmemb, void __attribute((unu
return size * nmemb;
}
-void CKerneloopsReporter::Report(const crash_report_t& pCrashReport)
+void CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport)
{
CURL *handle;
struct curl_httppost *post = NULL;
@@ -66,7 +66,7 @@ void CKerneloopsReporter::Report(const crash_report_t& pCrashReport)
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "oopsdata",
- CURLFORM_COPYCONTENTS, pCrashReport.find(FILENAME_TEXTDATA1)->second.m_sContent.c_str(),
+ CURLFORM_COPYCONTENTS, pCrashReport.find(FILENAME_TEXTDATA1)->second[CD_CONTENT].c_str(),
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "pass_on_allowed",
diff --git a/lib/Plugins/KerneloopsReporter.h b/lib/Plugins/KerneloopsReporter.h
index 668c0fa..7c06d99 100644
--- a/lib/Plugins/KerneloopsReporter.h
+++ b/lib/Plugins/KerneloopsReporter.h
@@ -42,7 +42,7 @@ class CKerneloopsReporter : public CReporter
virtual ~CKerneloopsReporter() {}
void LoadSettings(const std::string& pPath);
- void Report(const crash_report_t& pCrashReport);
+ void Report(const map_crash_report_t& pCrashReport);
};
PLUGIN_INFO(REPORTER,
diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp
index c17e85e..c6e076f 100644
--- a/lib/Plugins/Logger.cpp
+++ b/lib/Plugins/Logger.cpp
@@ -45,15 +45,15 @@ void CLogger::LoadSettings(const std::string& pPath)
}
}
-void CLogger::Report(const crash_report_t& pCrashReport)
+void CLogger::Report(const map_crash_report_t& pCrashReport)
{
std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile;
std::ofstream fOut;
- crash_report_t::const_iterator it;
+ map_crash_report_t::const_iterator it;
for (it = pCrashReport.begin(); it != pCrashReport.end(); it++)
{
- if (it->second.m_sType == TYPE_TXT)
+ if (it->second[CD_TYPE] == type_crash_data_t_str[CD_TXT])
{
if (it->first != FILENAME_UUID &&
it->first != FILENAME_ARCHITECTURE &&
@@ -62,26 +62,26 @@ void CLogger::Report(const crash_report_t& pCrashReport)
{
additionalFiles << it->first << std::endl;
additionalFiles << "-----" << std::endl;
- additionalFiles << it->second.m_sContent << std::endl << std::endl;
+ additionalFiles << it->second[CD_CONTENT] << std::endl << std::endl;
}
else if (it->first == FILENAME_UUID)
{
UUIDFile << it->first << std::endl;
UUIDFile << "-----" << std::endl;
- UUIDFile << it->second.m_sContent << std::endl << std::endl;
+ UUIDFile << it->second[CD_CONTENT] << std::endl << std::endl;
}
else
{
commonFiles << it->first << std::endl;
commonFiles << "-----" << std::endl;
- commonFiles << it->second.m_sContent << std::endl << std::endl;
+ commonFiles << it->second[CD_CONTENT] << std::endl << std::endl;
}
}
- if (it->second.m_sType == TYPE_BIN)
+ if (it->second[CD_TYPE] == type_crash_data_t_str[CD_BIN])
{
binaryFiles << it->first << std::endl;
binaryFiles << "-----" << std::endl;
- binaryFiles << it->second.m_sContent << std::endl << std::endl;
+ binaryFiles << it->second[CD_CONTENT] << std::endl << std::endl;
}
}
diff --git a/lib/Plugins/Logger.h b/lib/Plugins/Logger.h
index f465ee0..f5db73f 100644
--- a/lib/Plugins/Logger.h
+++ b/lib/Plugins/Logger.h
@@ -36,7 +36,7 @@ class CLogger : public CReporter
virtual ~CLogger() {}
void LoadSettings(const std::string& pPath);
- void Report(const crash_report_t& pCrashReport);
+ void Report(const map_crash_report_t& pCrashReport);
};
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 62e3d2b..172f5fd 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -58,15 +58,15 @@ void CMailx::SendEmail(const std::string& pText)
}
-void CMailx::Report(const crash_report_t& pCrashReport)
+void CMailx::Report(const map_crash_report_t& pCrashReport)
{
std::stringstream emailBody;
std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile;
- crash_report_t::const_iterator it;
+ map_crash_report_t::const_iterator it;
for (it = pCrashReport.begin(); it != pCrashReport.end(); it++)
{
- if (it->second.m_sType == TYPE_TXT)
+ if (it->second[CD_TYPE] == type_crash_data_t_str[CD_TXT])
{
if (it->first != FILENAME_UUID &&
it->first != FILENAME_ARCHITECTURE &&
@@ -75,24 +75,24 @@ void CMailx::Report(const crash_report_t& pCrashReport)
{
additionalFiles << it->first << std::endl;
additionalFiles << "-----" << std::endl;
- additionalFiles << it->second.m_sContent << std::endl;
+ additionalFiles << it->second[CD_CONTENT] << std::endl;
}
else if (it->first == FILENAME_UUID)
{
UUIDFile << it->first << std::endl;
UUIDFile << "-----" << std::endl;
- UUIDFile << it->second.m_sContent << std::endl;
+ UUIDFile << it->second[CD_CONTENT] << std::endl;
}
else
{
commonFiles << it->first << std::endl;
commonFiles << "-----" << std::endl;
- commonFiles << it->second.m_sContent << std::endl;
+ commonFiles << it->second[CD_CONTENT] << std::endl;
}
}
- if (it->second.m_sType == TYPE_BIN)
+ if (it->second[CD_TYPE] == type_crash_data_t_str[CD_BIN])
{
- binaryFiles << " -a " << it->second.m_sContent;
+ binaryFiles << " -a " << it->second[CD_CONTENT];
}
}
diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h
index 0303bb6..3100a17 100644
--- a/lib/Plugins/Mailx.h
+++ b/lib/Plugins/Mailx.h
@@ -43,7 +43,7 @@ class CMailx : public CReporter
virtual ~CMailx() {}
void LoadSettings(const std::string& pPath);
- void Report(const crash_report_t& pCrashReport);
+ void Report(const map_crash_report_t& pCrashReport);
};