Module: check_mk
Branch: master
Commit: b3adee1c911ef7d61e8d920525d321ebe6feba42
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3adee1c911ef7…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Jun 6 09:16:18 2016 +0200
Fetched Livestatus from downstream.
---
livestatus/src/DynamicColumn.cc | 13 +++++++---
livestatus/src/DynamicColumn.h | 26 ++++++++------------
.../src/DynamicEventConsoleReplicationColumn.cc | 2 +-
.../src/DynamicEventConsoleReplicationColumn.h | 3 +--
livestatus/src/DynamicLogwatchFileColumn.cc | 18 +++++++-------
livestatus/src/DynamicLogwatchFileColumn.h | 3 +--
livestatus/src/TableEventConsoleReplication.h | 1 +
7 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/livestatus/src/DynamicColumn.cc b/livestatus/src/DynamicColumn.cc
index fd49957..c17c86d 100644
--- a/livestatus/src/DynamicColumn.cc
+++ b/livestatus/src/DynamicColumn.cc
@@ -24,8 +24,15 @@
#include "DynamicColumn.h"
+using std::string;
+
+DynamicColumn::DynamicColumn(const string& name, const string& description,
+ int indirect_offset, int extra_offset)
+ : _name(name)
+ , _description(description)
+ , _indirect_offset(indirect_offset)
+ , _extra_offset(extra_offset) {}
+
DynamicColumn::~DynamicColumn() = default;
-Column *DynamicColumn::createColumn(const char *arguments) {
- return createColumn(_indirect_offset, _extra_offset, arguments);
-}
+string DynamicColumn::name() const { return _name; }
diff --git a/livestatus/src/DynamicColumn.h b/livestatus/src/DynamicColumn.h
index b5d21d5..aa5ef65 100644
--- a/livestatus/src/DynamicColumn.h
+++ b/livestatus/src/DynamicColumn.h
@@ -30,24 +30,18 @@
class Column;
class DynamicColumn {
- std::string _name;
- std::string _description;
- int _indirect_offset;
- int _extra_offset;
-
public:
- DynamicColumn(std::string name, std::string description,
- int indirect_offset, int extra_offset)
- : _name(name)
- , _description(description)
- , _indirect_offset(indirect_offset)
- , _extra_offset(extra_offset) {}
+ DynamicColumn(const std::string &name, const std::string &description,
+ int indirect_offset, int extra_offset);
virtual ~DynamicColumn();
- const char *name() const { return _name.c_str(); }
- const char *description() const { return _description.c_str(); }
- Column *createColumn(const char *arguments);
- virtual Column *createColumn(int indirect_offset, int extra_offset,
- const char *arguments) = 0;
+ std::string name() const;
+ virtual Column *createColumn(const std::string &arguments) = 0;
+
+protected:
+ const std::string _name;
+ const std::string _description; // Note: Currently unused!
+ const int _indirect_offset;
+ const int _extra_offset;
};
#endif // DynamicColumn_h
diff --git a/livestatus/src/DynamicEventConsoleReplicationColumn.cc
b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
index c1af0ea..7f3d22d 100644
--- a/livestatus/src/DynamicEventConsoleReplicationColumn.cc
+++ b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
@@ -30,6 +30,6 @@
DynamicEventConsoleReplicationColumn::DynamicEventConsoleReplicationColumn(
: DynamicColumn(name, description, indirect_offset, extra_offset) {}
Column *DynamicEventConsoleReplicationColumn::createColumn(
- int indirect_offset, int extra_offset, const char *arguments) {
+ const std::string &arguments) {
return nullptr;
}
diff --git a/livestatus/src/DynamicEventConsoleReplicationColumn.h
b/livestatus/src/DynamicEventConsoleReplicationColumn.h
index 360d0ac..804463b 100644
--- a/livestatus/src/DynamicEventConsoleReplicationColumn.h
+++ b/livestatus/src/DynamicEventConsoleReplicationColumn.h
@@ -35,8 +35,7 @@ public:
DynamicEventConsoleReplicationColumn(std::string name,
std::string description,
int indirect_offset, int extra_offset);
- Column *createColumn(int indirect_offset, int extra_offset,
- const char *arguments) override;
+ Column *createColumn(const std::string &arguments) override;
};
#endif // DynamicEventConsoleReplicationColumn_h
diff --git a/livestatus/src/DynamicLogwatchFileColumn.cc
b/livestatus/src/DynamicLogwatchFileColumn.cc
index 197b50c..49c844f 100644
--- a/livestatus/src/DynamicLogwatchFileColumn.cc
+++ b/livestatus/src/DynamicLogwatchFileColumn.cc
@@ -55,23 +55,22 @@ string unescape_filename(string filename) {
return filename_native;
}
-Column *DynamicLogwatchFileColumn::createColumn(int indirect_offset,
- int extra_offset,
- const char *arguments) {
+Column *DynamicLogwatchFileColumn::createColumn(const std::string &arguments) {
// We expect:
// COLNAME:FILENAME
// Example:
// file_contents:var\log\messages
- vector<char> args(arguments, arguments + strlen(arguments) + 1);
+ vector<char> args(arguments.begin(), arguments.end());
+ args.push_back('\0');
char *scan = &args[0];
char *colname = next_token(&scan, ':');
if ((colname == nullptr) || (colname[0] == 0)) {
logger(LOG_WARNING,
"Invalid arguments for column %s: missing result column name",
- name());
+ _name.c_str());
return nullptr;
}
@@ -79,14 +78,15 @@ Column *DynamicLogwatchFileColumn::createColumn(int indirect_offset,
char *filename = scan;
if ((filename == nullptr) || (filename[0] == 0)) {
logger(LOG_WARNING,
- "Invalid arguments for column %s: missing file name", name());
+ "Invalid arguments for column %s: missing file name",
+ _name.c_str());
return nullptr;
}
if (nullptr != strchr(filename, '/')) {
logger(LOG_WARNING,
"Invalid arguments for column %s: file name '%s' contains
slash",
- name(), filename);
+ _name.c_str(), filename);
return nullptr;
}
@@ -96,6 +96,6 @@ Column *DynamicLogwatchFileColumn::createColumn(int indirect_offset,
suffix += filename_native;
return new HostFileColumn(colname, "Contents of logwatch file",
- MK_LOGWATCH_PATH, suffix.c_str(), indirect_offset,
- extra_offset);
+ MK_LOGWATCH_PATH, suffix.c_str(),
+ _indirect_offset, _extra_offset);
}
diff --git a/livestatus/src/DynamicLogwatchFileColumn.h
b/livestatus/src/DynamicLogwatchFileColumn.h
index aa49248..a60cf22 100644
--- a/livestatus/src/DynamicLogwatchFileColumn.h
+++ b/livestatus/src/DynamicLogwatchFileColumn.h
@@ -36,8 +36,7 @@ public:
int indirect_offset, int extra_offset = -1)
: DynamicColumn(name, description, indirect_offset, extra_offset) {}
~DynamicLogwatchFileColumn() {}
- Column *createColumn(int indirect_offset, int extra_offset,
- const char *arguments) override;
+ Column *createColumn(const std::string &arguments) override;
};
#endif // DynamicLogwatchFileColumn_h
diff --git a/livestatus/src/TableEventConsoleReplication.h
b/livestatus/src/TableEventConsoleReplication.h
index 76f6d42..c19a553 100644
--- a/livestatus/src/TableEventConsoleReplication.h
+++ b/livestatus/src/TableEventConsoleReplication.h
@@ -27,6 +27,7 @@
#include "config.h" // IWYU pragma: keep
#include "Table.h"
+class Query;
class TableEventConsoleReplication : public Table {
public: