From 7dbe033ae0d6c5a9c94776d90bacfffd1ec1ee4d Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 27 Nov 2025 15:05:02 +0100 Subject: [PATCH] app-layer: function to register ci pattern + probe Ticket: 6591 --- rust/sys/src/sys.rs | 7 +++++++ src/app-layer-detect-proto.c | 10 ++++++++++ src/app-layer-detect-proto.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/rust/sys/src/sys.rs b/rust/sys/src/sys.rs index 49ee8035f5..60665a676f 100644 --- a/rust/sys/src/sys.rs +++ b/rust/sys/src/sys.rs @@ -916,6 +916,13 @@ extern "C" { offset: u16, direction: u8, ) -> ::std::os::raw::c_int; } +extern "C" { + pub fn SCAppLayerProtoDetectPMRegisterPatternCIwPP( + ipproto: u8, alproto: AppProto, pattern: *const ::std::os::raw::c_char, depth: u16, + offset: u16, direction: u8, PPFunc: ProbingParserFPtr, pp_min_depth: u16, + pp_max_depth: u16, + ) -> ::std::os::raw::c_int; +} extern "C" { pub fn SCAppLayerRequestProtocolTLSUpgrade(f: *mut Flow) -> bool; } diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 91f0d7bc92..0be4bcfc39 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -1645,6 +1645,16 @@ int SCAppLayerProtoDetectPMRegisterPatternCSwPP(uint8_t ipproto, AppProto alprot SCReturnInt(r); } +int SCAppLayerProtoDetectPMRegisterPatternCIwPP(uint8_t ipproto, AppProto alproto, + const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction, + ProbingParserFPtr PPFunc, uint16_t pp_min_depth, uint16_t pp_max_depth) +{ + SCEnter(); + int r = AppLayerProtoDetectPMRegisterPattern(ipproto, alproto, pattern, depth, offset, + direction, 0 /* case-insensitive */, PPFunc, pp_min_depth, pp_max_depth); + SCReturnInt(r); +} + int SCAppLayerProtoDetectPMRegisterPatternCI(uint8_t ipproto, AppProto alproto, const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction) { diff --git a/src/app-layer-detect-proto.h b/src/app-layer-detect-proto.h index 52737e9c25..276eeea736 100644 --- a/src/app-layer-detect-proto.h +++ b/src/app-layer-detect-proto.h @@ -89,6 +89,9 @@ int SCAppLayerProtoDetectPMRegisterPatternCSwPP(uint8_t ipproto, AppProto alprot */ int SCAppLayerProtoDetectPMRegisterPatternCI(uint8_t ipproto, AppProto alproto, const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction); +int SCAppLayerProtoDetectPMRegisterPatternCIwPP(uint8_t ipproto, AppProto alproto, + const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction, + ProbingParserFPtr PPFunc, uint16_t pp_min_depth, uint16_t pp_max_depth); /***** Setup/General Registration *****/