Skip to content

Commit 3aa5719

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process SSDP plugin
1 parent 69c7599 commit 3aa5719

File tree

5 files changed

+53
-61
lines changed

5 files changed

+53
-61
lines changed

src/plugins/process/CMakeLists.txt

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

src/plugins/process/ssdp/README.md

Whitespace-only changes.
Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,33 @@
11
/**
2-
* \file ssdp.cpp
3-
* \brief Plugin for parsing ssdp traffic.
4-
* \author Ondrej Sedlacek [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 ssdp traffic.
4+
* @author Ondrej Sedlacek [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 "ssdp.hpp"
3014

31-
#include "common.hpp"
32-
3315
#include <iostream>
3416

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

37-
int RecordExtSSDP::REGISTERED_ID = -1;
22+
int RecordExtSSDP::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
3823

39-
__attribute__((constructor)) static void register_this_plugin()
40-
{
41-
static PluginRecord rec = PluginRecord("ssdp", []() { return new SSDPPlugin(); });
42-
register_plugin(&rec);
43-
RecordExtSSDP::REGISTERED_ID = register_extension();
44-
}
24+
static const PluginManifest ssdpPluginManifest = {
25+
.name = "ssdp",
26+
.description = "Ssdp process plugin for parsing ssdp traffic.",
27+
.pluginVersion = "1.0.0",
28+
.apiVersion = "1.0.0",
29+
.usage = nullptr,
30+
};
4531

4632
// #define DEBUG_SSDP
4733

@@ -56,12 +42,13 @@ enum header_types { LOCATION, NT, ST, SERVER, USER_AGENT, NONE };
5642

5743
const char* headers[] = {"location", "nt", "st", "server", "user-agent"};
5844

59-
SSDPPlugin::SSDPPlugin()
45+
SSDPPlugin::SSDPPlugin(const std::string& params)
6046
: record(nullptr)
6147
, notifies(0)
6248
, searches(0)
6349
, total(0)
6450
{
51+
(void) params;
6552
}
6653

6754
SSDPPlugin::~SSDPPlugin()
@@ -296,4 +283,6 @@ void SSDPPlugin::parse_ssdp_message(Flow& rec, const Packet& pkt)
296283
SSDP_DEBUG_MSG("\n");
297284
}
298285

286+
static const PluginRegistrar<SSDPPlugin, ProcessPluginFactory> ssdpRegistrar(ssdpPluginManifest);
287+
299288
} // namespace ipxp
Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
/**
2-
* \file ssdp.hpp
3-
* \brief Plugin for parsing ssdp traffic.
4-
* \author Ondrej Sedlacek [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 ssdp traffic.
4+
* @author Ondrej Sedlacek [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_SSDP_HPP
30-
#define IPXP_PROCESS_SSDP_HPP
13+
#pragma once
3114

3215
#include <cstring>
3316
#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

@@ -164,7 +147,7 @@ struct RecordExtSSDP : public RecordExt {
164147
*/
165148
class SSDPPlugin : public ProcessPlugin {
166149
public:
167-
SSDPPlugin();
150+
SSDPPlugin(const std::string& params);
168151
~SSDPPlugin();
169152
void init(const char* params);
170153
void close();
@@ -202,4 +185,3 @@ class SSDPPlugin : public ProcessPlugin {
202185
};
203186

204187
} // namespace ipxp
205-
#endif /* IPXP_PROCESS_SSDP_HPP */

0 commit comments

Comments
 (0)