Skip to content

Commit 6179207

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process IDPCONTENT plugin
1 parent 38c1e74 commit 6179207

File tree

5 files changed

+55
-59
lines changed

5 files changed

+55
-59
lines changed

src/plugins/process/CMakeLists.txt

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

src/plugins/process/idpContent/README.md

Whitespace-only changes.

src/plugins/process/idpcontent.cpp renamed to src/plugins/process/idpContent/src/idpcontent.cpp

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,40 @@
11
/**
2-
* \file idpcontent.cpp
3-
* \brief Plugin for parsing idpcontent traffic.
4-
* \author Karel Hynek <[email protected]>
5-
* \date 2020
6-
*/
7-
/*
8-
* Copyright (C) 2020 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 idpcontent traffic.
4+
* @author Karel Hynek <[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 "idpcontent.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 RecordExtIDPCONTENT::REGISTERED_ID = -1;
22+
int RecordExtIDPCONTENT::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
3623

37-
__attribute__((constructor)) static void register_this_plugin()
38-
{
39-
static PluginRecord rec = PluginRecord("idpcontent", []() { return new IDPCONTENTPlugin(); });
40-
register_plugin(&rec);
41-
RecordExtIDPCONTENT::REGISTERED_ID = register_extension();
42-
}
24+
static const PluginManifest idpcontentPluginManifest = {
25+
.name = "idpcontent",
26+
.description = "Idpcontent process plugin for parsing idpcontent traffic.",
27+
.pluginVersion = "1.0.0",
28+
.apiVersion = "1.0.0",
29+
.usage = nullptr,
30+
};
4331

4432
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
4533

46-
IDPCONTENTPlugin::IDPCONTENTPlugin() {}
34+
IDPCONTENTPlugin::IDPCONTENTPlugin(const std::string& params)
35+
{
36+
(void) params;
37+
}
4738

4839
IDPCONTENTPlugin::~IDPCONTENTPlugin()
4940
{
@@ -93,4 +84,7 @@ int IDPCONTENTPlugin::post_update(Flow& rec, const Packet& pkt)
9384
return 0;
9485
}
9586

87+
static const PluginRegistrar<IDPCONTENTPlugin, ProcessPluginFactory>
88+
idpcontentRegistrar(idpcontentPluginManifest);
89+
9690
} // namespace ipxp

src/plugins/process/idpcontent.hpp renamed to src/plugins/process/idpContent/src/idpcontent.hpp

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
/**
2-
* \file idpcontent.hpp
3-
* \brief Plugin for parsing idpcontent traffic.
4-
* \author Karel Hynek <[email protected]>
5-
* \date 2020
6-
*/
7-
/*
8-
* Copyright (C) 2020 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 idpcontent traffic.
4+
* @author Karel Hynek <[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_IDPCONTENT_HPP
30-
#define IPXP_PROCESS_IDPCONTENT_HPP
13+
#pragma once
3114

3215
#include <cstring>
3316
#include <iomanip>
@@ -41,7 +24,7 @@
4124
#include <ipfixprobe/flowifc.hpp>
4225
#include <ipfixprobe/ipfix-elements.hpp>
4326
#include <ipfixprobe/packet.hpp>
44-
#include <ipfixprobe/process.hpp>
27+
#include <ipfixprobe/processPlugin.hpp>
4528

4629
namespace ipxp {
4730

@@ -140,7 +123,7 @@ struct RecordExtIDPCONTENT : public RecordExt {
140123
*/
141124
class IDPCONTENTPlugin : public ProcessPlugin {
142125
public:
143-
IDPCONTENTPlugin();
126+
IDPCONTENTPlugin(const std::string& params);
144127
~IDPCONTENTPlugin();
145128
void init(const char* params);
146129
void close();
@@ -158,4 +141,3 @@ class IDPCONTENTPlugin : public ProcessPlugin {
158141
};
159142

160143
} // namespace ipxp
161-
#endif /* IPXP_PROCESS_IDPCONTENT_HPP */

0 commit comments

Comments
 (0)