Skip to content

Commit 1802e51

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process BASICPLUS plugin
1 parent e78d242 commit 1802e51

File tree

6 files changed

+54
-58
lines changed

6 files changed

+54
-58
lines changed

src/plugins/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add_subdirectory(input)
22
add_subdirectory(output)
3+
add_subdirectory(process)

src/plugins/process/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(basicplus)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
project(ipfixprobe-process-basicplus VERSION 1.0.0 DESCRIPTION "ipfixprobe-process-basicplus plugin")
2+
3+
add_library(ipfixprobe-process-basicplus SHARED
4+
src/basicplus.cpp
5+
src/basicplus.hpp
6+
)
7+
8+
set_target_properties(ipfixprobe-process-basicplus PROPERTIES
9+
CXX_VISIBILITY_PRESET hidden
10+
VISIBILITY_INLINES_HIDDEN YES
11+
)
12+
13+
target_include_directories(ipfixprobe-process-basicplus PRIVATE ${CMAKE_SOURCE_DIR}/include/)
14+
15+
install(
16+
TARGETS ipfixprobe-process-basicplus
17+
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixprobe/process/"
18+
)

src/plugins/process/basicplus/README.md

Whitespace-only changes.

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

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,39 @@
11
/**
2-
* \file basicplus.cpp
3-
* \brief Plugin for parsing basicplus traffic.
4-
* \author Jiri Havranek <[email protected]>
5-
* \date 2021
6-
*/
7-
/*
8-
* Copyright (C) 2021 CESNET
9-
*
10-
* LICENSE TERMS
11-
*
12-
* Redistribution and use in source and binary forms, with or without
13-
* modification, are permitted provided that the following conditions
14-
* are met:
15-
* 1. Redistributions of source code must retain the above copyright
16-
* notice, this list of conditions and the following disclaimer.
17-
* 2. Redistributions in binary form must reproduce the above copyright
18-
* notice, this list of conditions and the following disclaimer in
19-
* the documentation and/or other materials provided with the
20-
* distribution.
21-
* 3. Neither the name of the Company nor the names of its contributors
22-
* may be used to endorse or promote products derived from this
23-
* software without specific prior written permission.
24-
*
2+
* @file
3+
* @brief Plugin for parsing basicplus traffic.
4+
* @author Jiri Havranek <[email protected]>
5+
* @author Pavel Siska <[email protected]>
6+
* @date 2025
257
*
8+
* Copyright (c) 2025 CESNET
269
*
10+
* SPDX-License-Identifier: BSD-3-Clause
2711
*/
2812

2913
#include "basicplus.hpp"
3014

3115
#include <iostream>
3216

17+
#include <ipfixprobe/pluginFactory/pluginManifest.hpp>
18+
#include <ipfixprobe/pluginFactory/pluginRegistrar.hpp>
19+
3320
namespace ipxp {
3421

35-
int RecordExtBASICPLUS::REGISTERED_ID = -1;
22+
int RecordExtBASICPLUS::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
23+
24+
static const PluginManifest basicplusPluginManifest = {
25+
.name = "basicplus",
26+
.description = "Basicplus process plugin for parsing basicplus traffic.",
27+
.pluginVersion = "1.0.0",
28+
.apiVersion = "1.0.0",
29+
.usage = nullptr,
30+
};
3631

37-
__attribute__((constructor)) static void register_this_plugin()
32+
BASICPLUSPlugin::BASICPLUSPlugin(const std::string& params)
3833
{
39-
static PluginRecord rec = PluginRecord("basicplus", []() { return new BASICPLUSPlugin(); });
40-
register_plugin(&rec);
41-
RecordExtBASICPLUS::REGISTERED_ID = register_extension();
34+
(void) params;
4235
}
4336

44-
BASICPLUSPlugin::BASICPLUSPlugin() {}
45-
4637
BASICPLUSPlugin::~BASICPLUSPlugin()
4738
{
4839
close();
@@ -96,4 +87,7 @@ int BASICPLUSPlugin::pre_update(Flow& rec, Packet& pkt)
9687
return 0;
9788
}
9889

90+
static const PluginRegistrar<BASICPLUSPlugin, ProcessPluginFactory>
91+
basicplusRegistrar(basicplusPluginManifest);
92+
9993
} // namespace ipxp

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

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
/**
2-
* \file basicplus.hpp
3-
* \brief Plugin for parsing basicplus traffic.
4-
* \author Jiri Havranek <[email protected]>
5-
* \date 2021
6-
*/
7-
/*
8-
* Copyright (C) 2021 CESNET
9-
*
10-
* LICENSE TERMS
11-
*
12-
* Redistribution and use in source and binary forms, with or without
13-
* modification, are permitted provided that the following conditions
14-
* are met:
15-
* 1. Redistributions of source code must retain the above copyright
16-
* notice, this list of conditions and the following disclaimer.
17-
* 2. Redistributions in binary form must reproduce the above copyright
18-
* notice, this list of conditions and the following disclaimer in
19-
* the documentation and/or other materials provided with the
20-
* distribution.
21-
* 3. Neither the name of the Company nor the names of its contributors
22-
* may be used to endorse or promote products derived from this
23-
* software without specific prior written permission.
24-
*
2+
* @file
3+
* @brief Plugin for parsing basicplus traffic.
4+
* @author Jiri Havranek <[email protected]>
5+
* @author Pavel Siska <[email protected]>
6+
* @date 2025
257
*
8+
* Copyright (c) 2025 CESNET
269
*
10+
* SPDX-License-Identifier: BSD-3-Clause
2711
*/
2812

29-
#ifndef IPXP_PROCESS_BASICPLUS_HPP
30-
#define IPXP_PROCESS_BASICPLUS_HPP
13+
#pragma once
3114

3215
#include <sstream>
3316
#include <string>
@@ -40,7 +23,7 @@
4023
#include <ipfixprobe/flowifc.hpp>
4124
#include <ipfixprobe/ipfix-elements.hpp>
4225
#include <ipfixprobe/packet.hpp>
43-
#include <ipfixprobe/process.hpp>
26+
#include <ipfixprobe/processPlugin.hpp>
4427

4528
namespace ipxp {
4629

@@ -157,7 +140,7 @@ struct RecordExtBASICPLUS : public RecordExt {
157140
*/
158141
class BASICPLUSPlugin : public ProcessPlugin {
159142
public:
160-
BASICPLUSPlugin();
143+
BASICPLUSPlugin(const std::string& params);
161144
~BASICPLUSPlugin();
162145
void init(const char* params);
163146
void close();
@@ -176,4 +159,3 @@ class BASICPLUSPlugin : public ProcessPlugin {
176159
};
177160

178161
} // namespace ipxp
179-
#endif /* IPXP_PROCESS_BASICPLUS_HPP */

0 commit comments

Comments
 (0)