Skip to content

Commit b8111db

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process SIP plugin
1 parent b3e6de5 commit b8111db

File tree

5 files changed

+51
-60
lines changed

5 files changed

+51
-60
lines changed

src/plugins/process/CMakeLists.txt

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

src/plugins/process/sip/README.md

Whitespace-only changes.
Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
11
/**
2-
* \file sip.cpp
3-
* \author Tomas Jansky <[email protected]>
4-
* \date 2015
5-
* \date 2016
6-
*/
7-
/*
8-
* Copyright (C) 2015-2016 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 sip traffic.
4+
* @author Tomas Jansky <[email protected]>
5+
* @date 2025
256
*
7+
* Copyright (c) 2025 CESNET
268
*
9+
* SPDX-License-Identifier: BSD-3-Clause
2710
*/
2811

12+
#include "sip.hpp"
13+
2914
#include <cstdlib>
3015
#include <cstring>
3116
#include <iostream>
@@ -34,25 +19,28 @@
3419
#include <unirec/unirec.h>
3520
#endif
3621

37-
#include "sip.hpp"
22+
#include <ipfixprobe/pluginFactory/pluginManifest.hpp>
23+
#include <ipfixprobe/pluginFactory/pluginRegistrar.hpp>
3824

3925
namespace ipxp {
4026

41-
int RecordExtSIP::REGISTERED_ID = -1;
27+
int RecordExtSIP::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
4228

43-
__attribute__((constructor)) static void register_this_plugin()
44-
{
45-
static PluginRecord rec = PluginRecord("sip", []() { return new SIPPlugin(); });
46-
register_plugin(&rec);
47-
RecordExtSIP::REGISTERED_ID = register_extension();
48-
}
29+
static const PluginManifest sipPluginManifest = {
30+
.name = "sip",
31+
.description = "Sip process plugin for parsing sip traffic.",
32+
.pluginVersion = "1.0.0",
33+
.apiVersion = "1.0.0",
34+
.usage = nullptr,
35+
};
4936

50-
SIPPlugin::SIPPlugin()
37+
SIPPlugin::SIPPlugin(const std::string& params)
5138
: requests(0)
5239
, responses(0)
5340
, total(0)
5441
, flow_flush(false)
5542
{
43+
(void) params;
5644
}
5745

5846
SIPPlugin::~SIPPlugin()
@@ -620,4 +608,6 @@ int SIPPlugin::parser_process_sip(const Packet& pkt, RecordExtSIP* sip_data)
620608
return 0;
621609
}
622610

611+
static const PluginRegistrar<SIPPlugin, ProcessPluginFactory> sipRegistrar(sipPluginManifest);
612+
623613
} // namespace ipxp
Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
11
/**
2-
* \file sip.hpp
3-
* \author Tomas Jansky <[email protected]>
4-
* \date 2015
5-
* \date 2016
6-
*/
7-
/*
8-
* Copyright (C) 2015-2016 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 sip traffic.
4+
* @author Tomas Jansky <[email protected]>
5+
* @date 2025
256
*
7+
* Copyright (c) 2025 CESNET
268
*
9+
* SPDX-License-Identifier: BSD-3-Clause
2710
*/
2811

29-
#ifndef IPXP_PROCESS_SIP_HPP
30-
#define IPXP_PROCESS_SIP_HPP
12+
#pragma once
3113

3214
#include <cstdlib>
3315
#include <cstring>
@@ -41,7 +23,7 @@
4123
#include <ipfixprobe/flowifc.hpp>
4224
#include <ipfixprobe/ipfix-elements.hpp>
4325
#include <ipfixprobe/packet.hpp>
44-
#include <ipfixprobe/process.hpp>
26+
#include <ipfixprobe/processPlugin.hpp>
4527

4628
namespace ipxp {
4729

@@ -483,7 +465,7 @@ struct RecordExtSIP : public RecordExt {
483465

484466
class SIPPlugin : public ProcessPlugin {
485467
public:
486-
SIPPlugin();
468+
SIPPlugin(const std::string& params);
487469
~SIPPlugin();
488470
void init(const char* params);
489471
void close();
@@ -524,4 +506,3 @@ class SIPPlugin : public ProcessPlugin {
524506
};
525507

526508
} // namespace ipxp
527-
#endif /* IPXP_PROCESS_SIP_HPP */

0 commit comments

Comments
 (0)