Skip to content

Commit e632bcb

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process NETTISA plugin
1 parent ed73093 commit e632bcb

File tree

5 files changed

+59
-18
lines changed

5 files changed

+59
-18
lines changed

src/plugins/process/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ if (ENABLE_PROCESS_EXPERIMENTAL)
2727
add_subdirectory(rtsp)
2828
add_subdirectory(mpls)
2929
add_subdirectory(ntp)
30+
add_subdirectory(nettisa)
3031
endif()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
project(ipfixprobe-process-nettisa VERSION 1.0.0 DESCRIPTION "ipfixprobe-process-nettisa plugin")
2+
3+
add_library(ipfixprobe-process-nettisa MODULE
4+
src/nettisa.cpp
5+
src/nettisa.hpp
6+
)
7+
8+
set_target_properties(ipfixprobe-process-nettisa PROPERTIES
9+
CXX_VISIBILITY_PRESET hidden
10+
VISIBILITY_INLINES_HIDDEN YES
11+
)
12+
13+
target_include_directories(ipfixprobe-process-nettisa PRIVATE
14+
${CMAKE_SOURCE_DIR}/include/
15+
)
16+
17+
target_link_libraries(ipfixprobe-process-nettisa PRIVATE
18+
ipfixprobe-core
19+
)
20+
21+
install(
22+
TARGETS ipfixprobe-process-nettisa
23+
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixprobe/process/"
24+
)

src/plugins/process/nettisa/README.md

Whitespace-only changes.

src/plugins/process/nettisa.cpp renamed to src/plugins/process/nettisa/src/nettisa.cpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
/**
2-
* \file nettisa.cpp
3-
* \brief Plugin for creating NetTiSA flow.
4-
* \author Josef Koumar [email protected]
5-
* \date 2023
2+
* @file
3+
* @brief Plugin for parsing Nettisa flow.
4+
* @author Josef Koumar [email protected]
5+
* @date 2025
6+
*
7+
* Copyright (c) 2025 CESNET
8+
*
9+
* SPDX-License-Identifier: BSD-3-Clause
610
*/
711

812
#include "nettisa.hpp"
913

1014
#include <cmath>
1115
#include <iostream>
1216

17+
#include <ipfixprobe/pluginFactory/pluginManifest.hpp>
18+
#include <ipfixprobe/pluginFactory/pluginRegistrar.hpp>
1319
#include <ipfixprobe/utils.hpp>
1420

1521
namespace ipxp {
1622

17-
int RecordExtNETTISA::REGISTERED_ID = -1;
23+
int RecordExtNETTISA::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
1824

19-
__attribute__((constructor)) static void register_this_plugin()
25+
static const PluginManifest nettisaPluginManifest = {
26+
.name = "nettisa",
27+
.description = "Nettisa process plugin for parsing Nettisa flow.",
28+
.pluginVersion = "1.0.0",
29+
.apiVersion = "1.0.0",
30+
.usage = nullptr,
31+
};
32+
33+
NETTISAPlugin::NETTISAPlugin(const std::string& params)
2034
{
21-
static PluginRecord rec = PluginRecord("nettisa", []() { return new NETTISAPlugin(); });
22-
register_plugin(&rec);
23-
RecordExtNETTISA::REGISTERED_ID = register_extension();
35+
(void) params;
2436
}
2537

2638
ProcessPlugin* NETTISAPlugin::copy()
@@ -115,4 +127,7 @@ void NETTISAPlugin::pre_export(Flow& rec)
115127
nettisa_data->average_dispersion = nettisa_data->average_dispersion / n;
116128
}
117129

130+
static const PluginRegistrar<NETTISAPlugin, ProcessPluginFactory>
131+
nettisaRegistrar(nettisaPluginManifest);
132+
118133
} // namespace ipxp

src/plugins/process/nettisa.hpp renamed to src/plugins/process/nettisa/src/nettisa.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* SPDX-License-Identifier: BSD-3-Clause
2-
* Copyright (C) 2023, CESNET z.s.p.o.
3-
*/
4-
51
/**
6-
* \file nettisa.hpp
7-
* \brief Class for creating NetTiSA flow.
8-
* \author Josef Koumar [email protected]
9-
* \date 2023
2+
* @file
3+
* @brief Plugin for parsing Nettisa flow.
4+
* @author Josef Koumar [email protected]
5+
* @date 2025
6+
*
7+
* Copyright (c) 2025 CESNET
8+
*
9+
* SPDX-License-Identifier: BSD-3-Clause
1010
*/
1111

1212
#pragma once
@@ -22,7 +22,7 @@
2222
#include <ipfixprobe/flowifc.hpp>
2323
#include <ipfixprobe/ipfix-elements.hpp>
2424
#include <ipfixprobe/packet.hpp>
25-
#include <ipfixprobe/process.hpp>
25+
#include <ipfixprobe/processPlugin.hpp>
2626

2727
namespace ipxp {
2828

@@ -173,6 +173,7 @@ struct RecordExtNETTISA : public RecordExt {
173173
*/
174174
class NETTISAPlugin : public ProcessPlugin {
175175
public:
176+
NETTISAPlugin(const std::string& params);
176177
OptionsParser* get_parser() const { return new OptionsParser("nettisa", "Parse NetTiSA flow"); }
177178
std::string get_name() const { return "nettisa"; }
178179
RecordExt* get_ext() const { return new RecordExtNETTISA(); }

0 commit comments

Comments
 (0)