Skip to content

Commit 4f9d4b0

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process SSADETECTOR plugin
1 parent 3aa5719 commit 4f9d4b0

File tree

5 files changed

+57
-61
lines changed

5 files changed

+57
-61
lines changed

src/plugins/process/CMakeLists.txt

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

src/plugins/process/ssaDetector/README.md

Whitespace-only changes.

src/plugins/process/ssadetector.cpp renamed to src/plugins/process/ssaDetector/src/ssadetector.cpp

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

3014
#include "ssadetector.hpp"
3115

3216
#include <iostream>
3317

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

36-
int RecordExtSSADetector::REGISTERED_ID = -1;
23+
int RecordExtSSADetector::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
24+
25+
static const PluginManifest ssadetectorPluginManifest = {
26+
.name = "ssadetector",
27+
.description = "Ssadetector process plugin for parsing vpn_automaton traffic.",
28+
.pluginVersion = "1.0.0",
29+
.apiVersion = "1.0.0",
30+
.usage = nullptr,
31+
};
3732

38-
__attribute__((constructor)) static void register_this_plugin()
33+
SSADetectorPlugin::SSADetectorPlugin(const std::string& params)
3934
{
40-
static PluginRecord rec = PluginRecord("ssadetector", []() { return new SSADetectorPlugin(); });
41-
register_plugin(&rec);
42-
RecordExtSSADetector::REGISTERED_ID = register_extension();
35+
init(params.c_str());
4336
}
4437

45-
SSADetectorPlugin::SSADetectorPlugin()
38+
SSADetectorPlugin::~SSADetectorPlugin()
4639
{
4740
close();
4841
}
4942

50-
SSADetectorPlugin::~SSADetectorPlugin() {}
51-
5243
void SSADetectorPlugin::init(const char* params) {}
5344

5445
void SSADetectorPlugin::close() {}
@@ -277,4 +268,7 @@ int8_t RecordExtSSADetector::pkt_table::get_idx_from_len(uint16_t len)
277268
return std::max(int(len) - MIN_PKT_SIZE, 0);
278269
}
279270

271+
static const PluginRegistrar<SSADetectorPlugin, ProcessPluginFactory>
272+
ssadetectorRegistrar(ssadetectorPluginManifest);
273+
280274
} // namespace ipxp

src/plugins/process/ssadetector.hpp renamed to src/plugins/process/ssaDetector/src/ssadetector.hpp

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

30-
#ifndef IPXP_SSADETECTOR_HPP
31-
#define IPXP_SSADETECTOR_HPP
14+
#pragma once
3215

3316
#include <cstring>
3417
#include <sstream>
@@ -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

@@ -160,7 +143,7 @@ struct RecordExtSSADetector : public RecordExt {
160143
*/
161144
class SSADetectorPlugin : public ProcessPlugin {
162145
public:
163-
SSADetectorPlugin();
146+
SSADetectorPlugin(const std::string& params);
164147
~SSADetectorPlugin();
165148
void init(const char* params);
166149
void close();
@@ -192,4 +175,3 @@ class SSADetectorPlugin : public ProcessPlugin {
192175
};
193176

194177
} // namespace ipxp
195-
#endif /* IPXP_SSADETECTOR_HPP */

0 commit comments

Comments
 (0)