Skip to content

Commit 315993f

Browse files
author
Pavel Siska
committed
ipfixprobe - introduce process RTSP plugin
1 parent c362af6 commit 315993f

File tree

5 files changed

+56
-64
lines changed

5 files changed

+56
-64
lines changed

src/plugins/process/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ add_subdirectory(passiveDns)
2424
add_subdirectory(smtp)
2525
add_subdirectory(quic)
2626
add_subdirectory(tls)
27+
add_subdirectory(rtsp)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
project(ipfixprobe-process-rtsp VERSION 1.0.0 DESCRIPTION "ipfixprobe-process-rtsp plugin")
2+
3+
add_library(ipfixprobe-process-rtsp MODULE
4+
src/rtsp.cpp
5+
src/rtsp.hpp
6+
)
7+
8+
set_target_properties(ipfixprobe-process-rtsp PROPERTIES
9+
CXX_VISIBILITY_PRESET hidden
10+
VISIBILITY_INLINES_HIDDEN YES
11+
)
12+
13+
target_include_directories(ipfixprobe-process-rtsp PRIVATE
14+
${CMAKE_SOURCE_DIR}/include/
15+
${CMAKE_SOURCE_DIR}/src/plugins/process/common
16+
)
17+
18+
install(TARGETS ipfixprobe-process-rtsp
19+
LIBRARY DESTINATION "${INSTALL_DIR_LIB}/ipfixprobe/process/"
20+
)

src/plugins/process/rtsp/README.md

Whitespace-only changes.
Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
11
/**
2-
* \file rtsp.cpp
3-
* \brief Plugin for parsing RTSP traffic
4-
* \author Jiri Havranek <[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 RTSP traffic.
4+
* @author Jiri Havranek <[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

13+
#include "common.hpp"
14+
#include "rtsp.hpp"
15+
2916
#include <cstdlib>
3017
#include <cstring>
3118
#include <iostream>
3219

20+
#include <ipfixprobe/pluginFactory/pluginManifest.hpp>
21+
#include <ipfixprobe/pluginFactory/pluginRegistrar.hpp>
22+
3323
#ifdef WITH_NEMEA
3424
#include <unirec/unirec.h>
3525
#endif
3626

37-
#include "common.hpp"
38-
#include "rtsp.hpp"
39-
4027
namespace ipxp {
4128

42-
int RecordExtRTSP::REGISTERED_ID = -1;
29+
int RecordExtRTSP::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
4330

44-
__attribute__((constructor)) static void register_this_plugin()
45-
{
46-
static PluginRecord rec = PluginRecord("rtsp", []() { return new RTSPPlugin(); });
47-
register_plugin(&rec);
48-
RecordExtRTSP::REGISTERED_ID = register_extension();
49-
}
31+
static const PluginManifest rtspPluginManifest = {
32+
.name = "rtsp",
33+
.description = "Rtsp process plugin for parsing rtsp traffic.",
34+
.pluginVersion = "1.0.0",
35+
.apiVersion = "1.0.0",
36+
.usage = nullptr,
37+
};
5038

5139
// #define DEBUG_RTSP
5240

@@ -67,13 +55,14 @@ __attribute__((constructor)) static void register_this_plugin()
6755
#define RTSP_LINE_DELIMITER '\n'
6856
#define RTSP_KEYVAL_DELIMITER ':'
6957

70-
RTSPPlugin::RTSPPlugin()
58+
RTSPPlugin::RTSPPlugin(const std::string& params)
7159
: recPrealloc(nullptr)
7260
, flow_flush(false)
7361
, requests(0)
7462
, responses(0)
7563
, total(0)
7664
{
65+
init(params.c_str());
7766
}
7867

7968
RTSPPlugin::~RTSPPlugin()
@@ -506,4 +495,6 @@ void RTSPPlugin::add_ext_rtsp_response(const char* data, int payload_len, Flow&
506495
}
507496
}
508497

498+
static const PluginRegistrar<RTSPPlugin, ProcessPluginFactory> rtspRegistrar(rtspPluginManifest);
499+
509500
} // namespace ipxp
Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
/**
2-
* \file rtsp.hpp
3-
* \brief Plugin for parsing RTSP traffic
4-
* \author Jiri Havranek <[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 RTSP traffic.
4+
* @author Jiri Havranek <[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

29-
#ifndef IPXP_PROCESS_RTSP_HPP
30-
#define IPXP_PROCESS_RTSP_HPP
13+
#pragma once
3114

3215
#include <cstdlib>
3316
#include <cstring>
@@ -38,12 +21,10 @@
3821
#include <fields.h>
3922
#endif
4023

41-
#include "http.hpp"
42-
4324
#include <ipfixprobe/flowifc.hpp>
4425
#include <ipfixprobe/ipfix-elements.hpp>
4526
#include <ipfixprobe/packet.hpp>
46-
#include <ipfixprobe/process.hpp>
27+
#include <ipfixprobe/processPlugin.hpp>
4728

4829
namespace ipxp {
4930

@@ -188,7 +169,7 @@ struct RecordExtRTSP : public RecordExt {
188169
*/
189170
class RTSPPlugin : public ProcessPlugin {
190171
public:
191-
RTSPPlugin();
172+
RTSPPlugin(const std::string& params);
192173
~RTSPPlugin();
193174
void init(const char* params);
194175
void close();
@@ -218,4 +199,3 @@ class RTSPPlugin : public ProcessPlugin {
218199
};
219200

220201
} // namespace ipxp
221-
#endif /* IPXP_PROCESS_RTSP_HPP */

0 commit comments

Comments
 (0)