mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 09:58:54 +00:00
cleaning up the plugin interfaces
This commit is contained in:
parent
5998dbd1c5
commit
f06a4ba52e
@ -26,15 +26,11 @@ namespace osquery {
|
||||
* @code{.cpp}
|
||||
* class TestConfigPlugin : public ConfigPlugin {
|
||||
* public:
|
||||
* TestConfigPlugin() {};
|
||||
*
|
||||
* std::pair<osquery::Status, std::string> genConfig() {
|
||||
* virtual std::pair<osquery::Status, std::string> genConfig() {
|
||||
* std::string config;
|
||||
* auto status = getMyConfig(config);
|
||||
* return std::make_pair(status, config);
|
||||
* }
|
||||
*
|
||||
* virtual ~TestConfigPlugin() {}
|
||||
* };
|
||||
*
|
||||
* REGISTER_CONFIG_PLUGIN(
|
||||
@ -58,15 +54,6 @@ class ConfigPlugin {
|
||||
|
||||
/// Virtual destructor
|
||||
virtual ~ConfigPlugin() {}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*
|
||||
* ConfigPlugin should never be instantiated on it's own, so it's
|
||||
* constructor is private.
|
||||
*/
|
||||
ConfigPlugin() {};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,7 @@ namespace osquery {
|
||||
* @code{.cpp}
|
||||
* class TestLoggerPlugin : public ConfigPlugin {
|
||||
* public:
|
||||
* TestLoggerPlugin() {};
|
||||
*
|
||||
* osquery::Status logString(const std::string& s) {
|
||||
* virtual osquery::Status logString(const std::string& s) {
|
||||
* int i = 0;
|
||||
* internal::logStringToFlume(s, i);
|
||||
* std::string message;
|
||||
@ -38,8 +36,6 @@ namespace osquery {
|
||||
* }
|
||||
* return osquery::Status(i, message);
|
||||
* }
|
||||
*
|
||||
* virtual ~TestLoggerPlugin() {}
|
||||
* };
|
||||
*
|
||||
* REGISTER_LOGGER_PLUGIN(
|
||||
@ -60,15 +56,6 @@ class LoggerPlugin {
|
||||
|
||||
/// Virtual destructor
|
||||
virtual ~LoggerPlugin() {}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*
|
||||
* LoggerPlugin should never be instantiated on it's own, so it's
|
||||
* constructor is private.
|
||||
*/
|
||||
LoggerPlugin() {};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,7 @@ DEFINE_string(config_path, "/var/osquery/osquery.conf", "Path to config file");
|
||||
|
||||
class FilesystemConfigPlugin : public ConfigPlugin {
|
||||
public:
|
||||
FilesystemConfigPlugin() {};
|
||||
|
||||
std::pair<osquery::Status, std::string> genConfig() {
|
||||
virtual std::pair<osquery::Status, std::string> genConfig() {
|
||||
std::string config;
|
||||
if (!fs::exists(FLAGS_config_path)) {
|
||||
return std::make_pair(Status(1, "config file does not exist"), config);
|
||||
@ -33,8 +31,6 @@ class FilesystemConfigPlugin : public ConfigPlugin {
|
||||
std::istreambuf_iterator<char>());
|
||||
return std::make_pair(Status(0, "OK"), config);
|
||||
}
|
||||
|
||||
virtual ~FilesystemConfigPlugin() {}
|
||||
};
|
||||
|
||||
REGISTER_CONFIG_PLUGIN("filesystem",
|
||||
|
@ -25,7 +25,7 @@ class FilesystemLoggerPlugin : public LoggerPlugin {
|
||||
log_path = FLAGS_log_dir + "osqueryd.results.log";
|
||||
}
|
||||
|
||||
Status logString(const std::string& s) {
|
||||
virtual Status logString(const std::string& s) {
|
||||
std::lock_guard<std::mutex> lock(filesystemLoggerPluginMutex);
|
||||
try {
|
||||
VLOG(3) << "filesystem logger plugin: logging to " << log_path;
|
||||
@ -41,8 +41,6 @@ class FilesystemLoggerPlugin : public LoggerPlugin {
|
||||
}
|
||||
return Status(0, "OK");
|
||||
}
|
||||
|
||||
virtual ~FilesystemLoggerPlugin() {}
|
||||
};
|
||||
|
||||
REGISTER_LOGGER_PLUGIN("filesystem",
|
||||
|
Loading…
Reference in New Issue
Block a user