Skip to content

Commit 274bcf2

Browse files
Zainullin DamirZainullin Damir
authored andcommitted
Process plugins - Introduce QUIC process plugin
1 parent e3da2ec commit 274bcf2

23 files changed

+2764
-2425
lines changed

src/plugins/process/quic/CMakeLists.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,35 @@ project(ipfixprobe-process-quic VERSION 1.0.0 DESCRIPTION "ipfixprobe-process-qu
33
add_library(ipfixprobe-process-quic MODULE
44
src/quic.cpp
55
src/quic.hpp
6-
src/quic_parser.cpp
7-
src/quic_parser.hpp
6+
src/quicParser.cpp
7+
src/quicParser.hpp
8+
src/quicConnectionId.hpp
9+
src/quicContext.hpp
10+
src/quicFields.hpp
11+
src/quicHeaderView.hpp
12+
src/quicHeaderView.cpp
13+
src/quicInitialHeaderView.hpp
14+
src/quicInitialHeaderView.cpp
15+
src/quicInitialSecrets.hpp
16+
src/quicPacketType.hpp
17+
src/quicSalt.hpp
18+
src/quicTemporalStorage.hpp
19+
src/quicTypesCumulative.hpp
20+
src/quicVariableInt.hpp
21+
src/quicVersion.hpp
822
)
923

1024
set_target_properties(ipfixprobe-process-quic PROPERTIES
1125
CXX_VISIBILITY_PRESET hidden
1226
VISIBILITY_INLINES_HIDDEN YES
1327
)
1428

15-
target_include_directories(ipfixprobe-process-quic PRIVATE
29+
target_include_directories(ipfixprobe-process-quic PRIVATE
1630
${CMAKE_SOURCE_DIR}/include/
31+
${CMAKE_SOURCE_DIR}/include/ipfixprobe/processPlugin
32+
${CMAKE_SOURCE_DIR}/include/ipfixprobe/pluginFactory
1733
${CMAKE_SOURCE_DIR}/src/plugins/process/common
34+
${adaptmon_SOURCE_DIR}/lib/include/public/
1835
)
1936

2037
target_link_libraries(ipfixprobe-process-quic PRIVATE

src/plugins/process/quic/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# QUIC Plugin
2+
3+
The **QUIC Plugin** parses QUIC packets and exports extracted values.
4+
5+
## Features
6+
7+
- Removes plugin data if some parsing fails.
8+
- Allocates memory only if the flow is considered to belong to QUIC.
9+
10+
## Output Fields
11+
12+
| Field Name | Data Type | Description |
13+
| --------------------- | ------------------- | --------------------------------------------------------------- |
14+
| `QUIC_SNI` | `string` | Subject Name Indentifier (SNI) from the QUIC handshake |
15+
| `QUIC_USER_AGENT` | `string` | User Agent from the QUIC handshake |
16+
| `QUIC_VERSION` | `uint32_t` | QUIC version used in the connection |
17+
| `QUIC_CLIENT_VERSION` | `uint32_t` | QUIC version used by the client |
18+
| `QUIC_TOKEN_LENGTH` | `uint16_t` | Length of the token used in the handshake |
19+
| `QUIC_OCCID` | `string` | Original Connection ID used in the handshake |
20+
| `QUIC_OSCID` | `string` | Original Source Connection ID used in the handshake |
21+
| `QUIC_SCID` | `string` | Source Connection ID used in the handshake |
22+
| `QUIC_RETRY_SCID` | `string` | Source Connection ID from the Retry packet |
23+
| `QUIC_MULTIPLEXED` | `uint8_t` | Whether the connection is multiplexed (1) or not (0) |
24+
| `QUIC_ZERO_RTT` | `uint8_t` | Whether 0-RTT was used (1) or not (0) |
25+
| `QUIC_SERVER_PORT` | `uint16_t` | Server port used in the connection |
26+
| `QUIC_PACKETS` | `array of uint8_t` | Cumulative of header types observed in each QUIC packet |
27+
| `QUIC_CH_PARSED` | `uint8_t` | Whether the Client Hello was successfully parsed (1) or not (0) |
28+
| `QUIC_TLS_EXT_TYPE` | `array of uint16_t` | Types of TLS extensions in the Client Hello |
29+
| `QUIC_TLS_EXT_LEN` | `array of uint16_t` | Lengths of TLS extensions in the Client Hello |
30+
| `QUIC_TLS_EXT` | `array of bytes` | Data of TLS extensions in the Client Hello |
31+
32+
## Usage
33+
34+
### YAML Configuration
35+
36+
Add the plugin to your ipfixprobe YAML configuration:
37+
38+
```yaml
39+
process_plugins:
40+
- quic
41+
```
42+
43+
### CLI Usage
44+
45+
You can also enable the plugin directly from the command line:
46+
47+
`ipfixprobe -p quic ...`
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* @file
3+
* @brief Provides OpenSSL wrappers to help maintain lifetime.
4+
* @author Damir Zainullin <[email protected]>
5+
* @date 2025
6+
*
7+
* @copyright Copyright (c) 2025 CESNET, z.s.p.o.
8+
*/
9+
10+
#pragma once
11+
12+
#include <memory>
13+
14+
#include <openssl/evp.h>
15+
16+
namespace ipxp::process::quic {
17+
18+
/**
19+
* @brief Unique pointer types for OpenSSL cipher contexts with automatic cleanup.
20+
*/
21+
using CipherContext = std::unique_ptr<EVP_CIPHER_CTX, decltype(&EVP_CIPHER_CTX_free)>;
22+
23+
/**
24+
* @brief Unique pointer type for OpenSSL key context with automatic cleanup.
25+
*/
26+
using KeyContext = std::unique_ptr<EVP_PKEY_CTX, decltype(&EVP_PKEY_CTX_free)>;
27+
28+
/**
29+
* @brief Creates a new OpenSSL cipher context with destructor.
30+
*
31+
* @return New cipher context.
32+
*/
33+
auto createCipherContext
34+
= []() -> CipherContext { return CipherContext(EVP_CIPHER_CTX_new(), EVP_CIPHER_CTX_free); };
35+
36+
/**
37+
* @brief Creates a new KeyContext for HKDF operations using OpenSSL.
38+
*
39+
* This lambda function initializes an EVP_PKEY_CTX context for HKDF (HMAC-based Extract-and-Expand
40+
* Key Derivation Function). The context is wrapped which ensures proper cleanup using
41+
* EVP_PKEY_CTX_free.
42+
*
43+
* @return New key context.
44+
*/
45+
auto createKeyContext = []() -> KeyContext {
46+
return KeyContext(EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr), EVP_PKEY_CTX_free);
47+
};
48+
49+
} // namespace ipxp::process::quic

0 commit comments

Comments
 (0)