Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/include/factory/pluginFactoryRegistrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ struct PluginFactoryRegistrator {
*/
explicit PluginFactoryRegistrator(
const PluginManifest& manifest,
Generator generator = g_lambdaPluginGenerator<Base, Derived>)
const Generator& generator = g_lambdaPluginGenerator<Base, Derived>)
{
static_assert(
std::is_base_of<Base, Derived>::value,
std::is_base_of_v<Base, Derived>,
"Derived template type must be derived from Base");

bool inserted;
Expand Down
6 changes: 3 additions & 3 deletions modules/deduplicator/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace Nemea;
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance.
*/
void handleFormatChange(
static void handleFormatChange(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
Expand All @@ -49,7 +49,7 @@ void handleFormatChange(
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance to process flows.
*/
void processNextRecord(
static void processNextRecord(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
Expand All @@ -73,7 +73,7 @@ void processNextRecord(
* @param biInterface Bidirectional interface for Unirec communication.
* @param deduplicator Deduplicator instance to process flows.
*/
void processUnirecRecords(
static void processUnirecRecords(
UnirecBidirectionalInterface& biInterface,
Deduplicator::Deduplicator& deduplicator)
{
Expand Down
4 changes: 2 additions & 2 deletions modules/listDetector/src/ipAddressFieldMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ uint16_t IpAddressFieldMatcher::getNotLastNodeNextNode(NodePos pos) const noexce
const auto& [octetIndex, startIndex] = pos;

if (octetIndex == 0) {
return (uint16_t)m_octets[octetIndex].size();
return (uint16_t) m_octets[octetIndex].size();
}
auto index = startIndex + 1U;
for (; index < m_octets[octetIndex - 1UL].size() && m_octets[octetIndex - 1UL][index].isLast;
index++) {}
if (index == m_octets[octetIndex - 1UL].size()) {
return (uint16_t)m_octets[octetIndex].size();
return (uint16_t) m_octets[octetIndex].size();
}
return m_octets[octetIndex - 1UL][index].index.nextNode;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/listDetector/src/ipAddressPrefix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ IpAddressPrefix::IpAddressPrefix(Nemea::IpAddress ipAddress, size_t prefix)
}

if (prefixBits != 0U) {
m_mask.ip.bytes[prefixBytes] = (uint8_t)(UINT8_MAX << (CHAR_BIT - prefixBits));
m_mask.ip.bytes[prefixBytes] = (uint8_t) (UINT8_MAX << (CHAR_BIT - prefixBits));
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/listDetector/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

using namespace Nemea;

std::atomic<bool> g_stopFlag(false);
static std::atomic<bool> g_stopFlag(false);

void signalHandler(int signum)
static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
Expand Down
8 changes: 4 additions & 4 deletions modules/listDetector/src/octetNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace ListDetector {
struct OctetNode {
public:
/**
* @brief Operator for comparing two OctetNodes.
* @param other The OctetNode to compare with.
* @return True if the two OctetNodes have same value and mask, but current node is terminating.
*/
* @brief Operator for comparing two OctetNodes.
* @param other The OctetNode to compare with.
* @return True if the two OctetNodes have same value and mask, but current node is terminating.
*/
bool operator==(const OctetNode& other) const noexcept
{
return value == other.value && mask == other.mask && !isLast;
Expand Down
13 changes: 7 additions & 6 deletions modules/sampler/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

using namespace Nemea;

std::atomic<bool> g_stopFlag(false);
static std::atomic<bool> g_stopFlag(false);

void signalHandler(int signum)
static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
Expand All @@ -43,7 +43,7 @@ void signalHandler(int signum)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
void handleFormatChange(UnirecBidirectionalInterface& biInterface)
static void handleFormatChange(UnirecBidirectionalInterface& biInterface)
{
biInterface.changeTemplate();
}
Expand All @@ -58,7 +58,7 @@ void handleFormatChange(UnirecBidirectionalInterface& biInterface)
* @param sampler Sampler class for sampling.
*/

void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
static void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
{
std::optional<UnirecRecordView> unirecRecord = biInterface.receive();
if (!unirecRecord) {
Expand All @@ -80,7 +80,8 @@ void processNextRecord(UnirecBidirectionalInterface& biInterface, Sampler::Sampl
* @param biInterface Bidirectional interface for Unirec communication.
* @param sampler Sampler class for sampling.
*/
void processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
static void
processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sampler& sampler)
{
while (!g_stopFlag.load()) {
try {
Expand All @@ -95,7 +96,7 @@ void processUnirecRecords(UnirecBidirectionalInterface& biInterface, Sampler::Sa
}
}

telemetry::Content getSamplerTelemetry(const Sampler::Sampler& sampler)
static telemetry::Content getSamplerTelemetry(const Sampler::Sampler& sampler)
{
auto stats = sampler.getStats();

Expand Down
2 changes: 1 addition & 1 deletion modules/sampler/src/sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Sampler {
*/
struct SamplerStats {
uint64_t sampledRecords = 0; ///< Number of sampled records.
uint64_t totalRecords = 0; ///< Total number of records.
uint64_t totalRecords = 0; ///< Total number of records.
};

/**
Expand Down
14 changes: 7 additions & 7 deletions modules/telemetry/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

using namespace Nemea;

std::atomic<bool> g_stopFlag(false);
static std::atomic<bool> g_stopFlag(false);

void signalHandler(int signum)
static void signalHandler(int signum)
{
Nm::loggerGet("signalHandler")->info("Interrupt signal {} received", signum);
g_stopFlag.store(true);
Expand All @@ -44,7 +44,7 @@ void signalHandler(int signum)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
void handleFormatChange(UnirecBidirectionalInterface& biInterface)
static void handleFormatChange(UnirecBidirectionalInterface& biInterface)
{
biInterface.changeTemplate();
}
Expand All @@ -54,7 +54,7 @@ void handleFormatChange(UnirecBidirectionalInterface& biInterface)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
void processNextRecord(UnirecBidirectionalInterface& biInterface)
static void processNextRecord(UnirecBidirectionalInterface& biInterface)
{
std::optional<UnirecRecordView> unirecRecord = biInterface.receive();
if (!unirecRecord) {
Expand All @@ -72,7 +72,7 @@ void processNextRecord(UnirecBidirectionalInterface& biInterface)
*
* @param biInterface Bidirectional interface for Unirec communication.
*/
void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
static void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
{
while (!g_stopFlag.load()) {
try {
Expand All @@ -87,7 +87,7 @@ void processUnirecRecords(UnirecBidirectionalInterface& biInterface)
}
}

std::pair<std::string, std::string> splitPluginParams(const std::string& pluginParams)
static std::pair<std::string, std::string> splitPluginParams(const std::string& pluginParams)
{
const std::size_t position = pluginParams.find_first_of(':');
if (position == std::string::npos) {
Expand All @@ -99,7 +99,7 @@ std::pair<std::string, std::string> splitPluginParams(const std::string& pluginP
std::string(pluginParams, position + 1));
}

void showOutputPluginUsage()
static void showOutputPluginUsage()
{
auto& outputPluginFactory = Nm::PluginFactory<
TelemetryStats::OutputPlugin,
Expand Down
2 changes: 1 addition & 1 deletion modules/telemetry/src/ncurses-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void Ncurces::print(const std::string_view& string)
const std::lock_guard<std::mutex> lock(m_mutex);

clear();
printw("%s\n", string.data());
printw("%.*s\n", static_cast<int>(string.size()), string.data());
refresh();
}

Expand Down