-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathqinq.cpp
More file actions
56 lines (46 loc) · 1.25 KB
/
qinq.cpp
File metadata and controls
56 lines (46 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @file
* @brief Plugin for parsing basicplus traffic.
* @author Jakub Antonín Štigler xstigl00@xstigl00@stud.fit.vut.cz
* @author Pavel Siska <siska@cesnet.cz>
* @date 2025
*
* Copyright (c) 2025 CESNET
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "qinq.hpp"
#include <iostream>
#include <ipfixprobe/pluginFactory/pluginManifest.hpp>
#include <ipfixprobe/pluginFactory/pluginRegistrar.hpp>
namespace ipxp {
static const PluginManifest qinqPluginManifest = {
.name = "qinq",
.description = "QinQ process plugin for parsing QinQ traffic, outputs outer and inner VLAN IDs.",
.pluginVersion = "1.0.0",
.apiVersion = "1.0.0",
.usage =
[]() {
OptionsParser parser("qinq", "Parse qinq traffic");
parser.usage(std::cout);
},
};
QinQPlugin::QinQPlugin(const std::string& params, int pluginID)
: ProcessPlugin(pluginID)
{
init(params.c_str());
}
ProcessPlugin* QinQPlugin::copy()
{
return new QinQPlugin(*this);
}
int QinQPlugin::post_create(Flow& rec, const Packet& pkt)
{
auto ext = new RecordExtQinQ(m_pluginID);
ext->vlan_id = pkt.vlan_id;
ext->vlan_id2 = pkt.vlan_id2;
rec.add_extension(ext);
return 0;
}
static const PluginRegistrar<QinQPlugin, ProcessPluginFactory> qinqRegistrar(qinqPluginManifest);
} // namespace ipxp