enip/doc: list possible values for enum keywords

Ticket: 8675
pull/16404/head
Philippe Antoine 4 months ago committed by Victor Julien
parent 72afcb301f
commit e6231074b2

@ -6,6 +6,8 @@ enip_command
For the ENIP command, we are matching against the command field found in the ENIP encapsulation.
See ``suricata --list-keywords=json | jq '."enip_command".enum_values'``
Examples::
enip_command:99;
@ -42,6 +44,8 @@ It uses a 32-bit unsigned integer as value.
enip.status uses an :ref:`unsigned 32-bits integer <rules-integer-keywords>`.
It can also be specified by text from the enumeration.
See ``suricata --list-keywords=json | jq '."enip.status".enum_values'``
Examples::
enip.status:100;

@ -38,14 +38,17 @@ use crate::detect::uint::{
SCDetectU32Parse, SCDetectU8Free, SCDetectU8Match, SCDetectU8Parse,
};
use crate::detect::{
helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer, SIGMATCH_INFO_ENUM_UINT,
SIGMATCH_INFO_MULTI_UINT, SIGMATCH_INFO_UINT16, SIGMATCH_INFO_UINT32, SIGMATCH_INFO_UINT8,
helper_keyword_register_sticky_buffer, EnumString, SigTableElmtStickyBuffer,
SIGMATCH_INFO_ENUM_UINT, SIGMATCH_INFO_MULTI_UINT, SIGMATCH_INFO_UINT16, SIGMATCH_INFO_UINT32,
SIGMATCH_INFO_UINT8,
};
use crate::jsonbuilder::JsonBuilder;
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferProgressRegister,
SCDetectHelperKeywordRegister, SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList,
SCSigTableAppLiteElmt, SigMatchCtx, Signature,
SCDetectHelperKeywordJsonInfoRegister, SCDetectHelperKeywordRegister,
SCDetectSignatureSetAppProto, SCJsonBuilder, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt,
SigMatchCtx, Signature,
};
use crate::direction::Direction;
@ -1378,6 +1381,16 @@ unsafe extern "C" fn service_name_get_data(
return false;
}
unsafe extern "C" fn enip_status_list_values(jsb: *mut SCJsonBuilder) {
let jsb = cast_pointer!(jsb, JsonBuilder);
let _ = EnipStatus::list_values(jsb);
}
unsafe extern "C" fn enip_command_list_values(jsb: *mut SCJsonBuilder) {
let jsb = cast_pointer!(jsb, JsonBuilder);
let _ = EnipCommand::list_values(jsb);
}
#[no_mangle]
pub unsafe extern "C" fn SCDetectEnipRegister() {
let kw = SCSigTableAppLiteElmt {
@ -1471,6 +1484,8 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
flags: SIGMATCH_INFO_UINT32 | SIGMATCH_INFO_ENUM_UINT,
};
G_ENIP_STATUS_KW_ID = SCDetectHelperKeywordRegister(&kw);
SCDetectHelperKeywordJsonInfoRegister(G_ENIP_STATUS_KW_ID, Some(enip_status_list_values));
G_ENIP_STATUS_BUFFER_ID = SCDetectHelperBufferProgressRegister(
b"enip.status\0".as_ptr() as *const libc::c_char,
ALPROTO_ENIP,
@ -1567,6 +1582,8 @@ pub unsafe extern "C" fn SCDetectEnipRegister() {
flags: SIGMATCH_INFO_UINT16 | SIGMATCH_INFO_ENUM_UINT,
};
G_ENIP_COMMAND_KW_ID = SCDetectHelperKeywordRegister(&kw);
SCDetectHelperKeywordJsonInfoRegister(G_ENIP_COMMAND_KW_ID, Some(enip_command_list_values));
G_ENIP_COMMAND_BUFFER_ID = SCDetectHelperBufferProgressRegister(
b"enip.command\0".as_ptr() as *const libc::c_char,
ALPROTO_ENIP,

Loading…
Cancel
Save