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"
3518#include < cstring>
3619#include < iostream>
3720
21+ #include < ipfixprobe/pluginFactory/pluginManifest.hpp>
22+ #include < ipfixprobe/pluginFactory/pluginRegistrar.hpp>
23+
3824namespace ipxp {
3925
4026telemetry::Content NdpPacketReader::get_queue_telemetry ()
@@ -45,14 +31,23 @@ telemetry::Content NdpPacketReader::get_queue_telemetry()
4531 return dict;
4632}
4733
48- __attribute__ ((constructor)) static void register_this_plugin ()
34+ static const PluginManifest ndpPluginManifest = {
35+ .name = " ndp" ,
36+ .description = " Ndp input plugin for reading packets from network interface or ndp file." ,
37+ .pluginVersion = " 1.0.0" ,
38+ .apiVersion = " 1.0.0" ,
39+ .usage =
40+ []() {
41+ NdpOptParser parser;
42+ parser.usage (std::cout);
43+ },
44+ };
45+
46+ NdpPacketReader::NdpPacketReader (const std::string& params)
4947{
50- static PluginRecord rec = PluginRecord (" ndp" , []() { return new NdpPacketReader (); });
51- register_plugin (&rec);
48+ init (params.c_str ());
5249}
5350
54- NdpPacketReader::NdpPacketReader () {}
55-
5651NdpPacketReader::~NdpPacketReader ()
5752{
5853 close ();
@@ -134,4 +129,6 @@ void NdpPacketReader::configure_telemetry_dirs(
134129 register_file (queues_dir, " input-stats" , statsOps);
135130}
136131
132+ static const PluginRegistrar<NdpPacketReader, InputPluginFactory> ndpRegistrar (ndpPluginManifest);
133+
137134} // namespace ipxp
0 commit comments