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+
3520namespace 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,20 +42,24 @@ enum header_types { LOCATION, NT, ST, SERVER, USER_AGENT, NONE };
5642
5743const 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+ init (params.c_str ());
6552}
6653
6754SSDPPlugin::~SSDPPlugin ()
6855{
6956 close ();
7057}
7158
72- void SSDPPlugin::init (const char * params) {}
59+ void SSDPPlugin::init (const char * params)
60+ {
61+ (void ) params;
62+ }
7363
7464void SSDPPlugin::close () {}
7565
@@ -275,7 +265,9 @@ void SSDPPlugin::parse_ssdp_message(Flow& rec, const Packet& pkt)
275265 header_parser_conf parse_conf
276266 = {headers,
277267 rec.ip_version ,
278- static_cast <RecordExtSSDP*>(rec.get_extension (RecordExtSSDP::REGISTERED_ID))};
268+ static_cast <RecordExtSSDP*>(rec.get_extension (RecordExtSSDP::REGISTERED_ID)),
269+ 0 ,
270+ nullptr };
279271
280272 total++;
281273 if (pkt.payload [0 ] == ' N' ) {
@@ -296,4 +288,6 @@ void SSDPPlugin::parse_ssdp_message(Flow& rec, const Packet& pkt)
296288 SSDP_DEBUG_MSG (" \n " );
297289}
298290
291+ static const PluginRegistrar<SSDPPlugin, ProcessPluginFactory> ssdpRegistrar (ssdpPluginManifest);
292+
299293} // namespace ipxp
0 commit comments