11/* *
2- * \file ndp.cpp
3- * \brief Packet reader using NDP library for high speed capture.
4- * \author Tomas Benes <[email protected] > 5- * \author Jiri Havranek <[email protected] > 6- * \date 2021
7- */
8- /*
9- * Copyright (C) 2020-2021 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 Packet reader using NDP library for high speed capture.
4+ * @author Jiri Havranek <[email protected] > 5+ * @author Tomas Benes <[email protected] > 6+ * @author Pavel Siska <[email protected] > 267 *
8+ * Copyright (c) 2025 CESNET
279 *
10+ * SPDX-License-Identifier: BSD-3-Clause
2811 */
2912
3013#include " ndp.hpp"
31-
3214#include " parser.hpp"
3315
3416#include < cstdio>
3517#include < cstring>
3618#include < iostream>
3719
20+ #include < ipfixprobe/pluginFactory/pluginManifest.hpp>
21+ #include < ipfixprobe/pluginFactory/pluginRegistrar.hpp>
22+
3823namespace ipxp {
3924
4025telemetry::Content NdpPacketReader::get_queue_telemetry ()
@@ -45,14 +30,23 @@ telemetry::Content NdpPacketReader::get_queue_telemetry()
4530 return dict;
4631}
4732
48- __attribute__ ((constructor)) static void register_this_plugin ()
33+ static const PluginManifest ndpPluginManifest = {
34+ .name = " ndp" ,
35+ .description = " Ndp input plugin for reading packets from network interface or ndp file." ,
36+ .pluginVersion = " 1.0.0" ,
37+ .apiVersion = " 1.0.0" ,
38+ .usage =
39+ []() {
40+ NdpOptParser parser;
41+ parser.usage (std::cout);
42+ },
43+ };
44+
45+ NdpPacketReader::NdpPacketReader (const std::string& params)
4946{
50- static PluginRecord rec = PluginRecord (" ndp" , []() { return new NdpPacketReader (); });
51- register_plugin (&rec);
47+ init (params.c_str ());
5248}
5349
54- NdpPacketReader::NdpPacketReader () {}
55-
5650NdpPacketReader::~NdpPacketReader ()
5751{
5852 close ();
@@ -134,4 +128,6 @@ void NdpPacketReader::configure_telemetry_dirs(
134128 register_file (queues_dir, " input-stats" , statsOps);
135129}
136130
131+ static const PluginRegistrar<NdpPacketReader, InputPluginFactory> ndpRegistrar (ndpPluginManifest);
132+
137133} // namespace ipxp
0 commit comments