http2/doc: list possible values for enum keywords

Ticket: 8675
This commit is contained in:
Philippe Antoine
2026-10-08 13:08:20 +00:00
committed by Victor Julien
parent c23ff8695b
commit 5a5dcdab3e
3 changed files with 30 additions and 1 deletions
+4
View File
@@ -26,6 +26,8 @@ http2.frametype is also a :ref:`multi-integer <multi-integers>`.
http2.frametype does not have any corresponding log output.
See ``suricata --list-keywords=json | jq '."http2.frametype".enum_values'``
Examples::
http2.frametype:GOAWAY;
@@ -40,6 +42,8 @@ http2.errorcode uses an :ref:`unsigned 32-bit integer <rules-integer-keywords>`.
http2.errorcode is also a :ref:`multi-integer <multi-integers>`.
See ``suricata --list-keywords=json | jq '."http2.errorcode".enum_values'``
Examples::
http2.errorcode: NO_ERROR;
+14 -1
View File
@@ -25,12 +25,13 @@ use crate::detect::uint::{
DetectUintArrayData, DetectUintData, DetectUintIndex, DetectUintMode,
};
use crate::detect::{DetectThreadBuf, EnumString};
use crate::jsonbuilder::JsonBuilder;
use crate::direction::Direction;
use base64::{engine::general_purpose::STANDARD, Engine};
use std::ffi::CStr;
use std::os::raw::c_void;
use std::rc::Rc;
use suricata_sys::sys::DetectEngineThreadCtx;
use suricata_sys::sys::{DetectEngineThreadCtx, SCJsonBuilder};
#[no_mangle]
pub unsafe extern "C" fn SCHttp2TxHasFrametype(
@@ -1178,3 +1179,15 @@ mod tests {
}
}
}
#[no_mangle]
pub unsafe extern "C" fn SCDetectHTTP2frameTypeListValues(jsb: *mut SCJsonBuilder) {
let jsb = cast_pointer!(jsb, JsonBuilder);
let _ = parser::HTTP2FrameType::list_values(jsb);
}
#[no_mangle]
pub unsafe extern "C" fn SCDetectHTTP2errorcodeListValues(jsb: *mut SCJsonBuilder) {
let jsb = cast_pointer!(jsb, JsonBuilder);
let _ = parser::HTTP2ErrorCode::list_values(jsb);
}
+12
View File
@@ -97,6 +97,16 @@ static int g_http2_match_buffer_id = 0;
static int g_http2_complete_buffer_id = 0;
static int g_http2_header_buffer_id = 0;
static void DetectHTTP2frameTypeListValues(SCJsonBuilder *jsb)
{
SCDetectHTTP2frameTypeListValues(jsb);
}
static void DetectHTTP2errorcodeListValues(SCJsonBuilder *jsb)
{
SCDetectHTTP2errorcodeListValues(jsb);
}
/**
* \brief Registration function for HTTP2 keywords
*/
@@ -112,6 +122,7 @@ void DetectHttp2Register(void)
sigmatch_table[DETECT_HTTP2_FRAMETYPE].Free = DetectHTTP2frametypeFree;
sigmatch_table[DETECT_HTTP2_FRAMETYPE].flags =
SIGMATCH_INFO_UINT8 | SIGMATCH_INFO_MULTI_UINT | SIGMATCH_INFO_ENUM_UINT;
sigmatch_table[DETECT_HTTP2_FRAMETYPE].JsonAdditionalInfo = DetectHTTP2frameTypeListValues;
#ifdef UNITTESTS
sigmatch_table[DETECT_HTTP2_FRAMETYPE].RegisterTests = DetectHTTP2frameTypeRegisterTests;
#endif
@@ -125,6 +136,7 @@ void DetectHttp2Register(void)
sigmatch_table[DETECT_HTTP2_ERRORCODE].Free = DetectHTTP2errorcodeFree;
sigmatch_table[DETECT_HTTP2_ERRORCODE].flags =
SIGMATCH_INFO_UINT32 | SIGMATCH_INFO_MULTI_UINT | SIGMATCH_INFO_ENUM_UINT;
sigmatch_table[DETECT_HTTP2_ERRORCODE].JsonAdditionalInfo = DetectHTTP2errorcodeListValues;
#ifdef UNITTESTS
sigmatch_table[DETECT_HTTP2_ERRORCODE].RegisterTests = DetectHTTP2errorCodeRegisterTests;
#endif