}
}
- if (SigMatchAppendSMToList(de_ctx, s, ndpi_protocol_keyword_id, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, ndpi_protocol_keyword_id, (SigMatchCtx *)data,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
}
}
- if (SigMatchAppendSMToList(de_ctx, s, ndpi_risk_keyword_id, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, ndpi_risk_keyword_id, (SigMatchCtx *)data,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
func(DetectEngineCtx *de_ctx, Signature *s, char *str) {
...
-SigMatchAppendSMToList(s, ...)@p1;
+SCSigMatchAppendSMToList(s, ...)@p1;
...
if (s->alproto != E1 && ...) {
...
pub mod vlan;
pub mod datasets;
-use std::os::raw::{c_int, c_void};
+use std::os::raw::c_int;
use std::ffi::CString;
use suricata_sys::sys::{
) -> c_int,
}
-pub fn helper_keyword_register_sticky_buffer(kw: &SigTableElmtStickyBuffer) -> c_int {
+pub fn helper_keyword_register_sticky_buffer(kw: &SigTableElmtStickyBuffer) -> u16 {
let name = CString::new(kw.name.as_bytes()).unwrap().into_raw();
let desc = CString::new(kw.desc.as_bytes()).unwrap().into_raw();
let url = CString::new(kw.url.as_bytes()).unwrap().into_raw();
pub(crate) const SIGMATCH_QUOTES_MANDATORY: u16 = 0x40; // BIT_U16(6) in detect.h
pub const SIGMATCH_INFO_STICKY_BUFFER: u16 = 0x200; // BIT_U16(9)
-/// cbindgen:ignore
-extern "C" {
- // from detect-parse.h
- pub fn SigMatchAppendSMToList(
- de: *mut DetectEngineCtx, s: *mut Signature, kwid: c_int, ctx: *const c_void, bufid: c_int,
- ) -> *mut c_void;
-}
#[repr(u8)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
// endian <big|little|dce>
use super::parser::DHCPOptionWrapper;
use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
use crate::detect::uint::{DetectUintData, SCDetectU64Free, SCDetectU64Match, SCDetectU64Parse};
-use crate::detect::SigMatchAppendSMToList;
use std::os::raw::{c_int, c_void};
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectHelperBufferRegister,
- SCDetectHelperKeywordRegister, SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt,
- SigMatchCtx, Signature,
+ SCDetectHelperKeywordRegister, SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList,
+ SCSigTableAppLiteElmt, SigMatchCtx, Signature,
};
fn dhcp_tx_get_time(tx: &DHCPTransaction, code: u8) -> Option<u64> {
return None;
}
-static mut G_DHCP_LEASE_TIME_KW_ID: c_int = 0;
+static mut G_DHCP_LEASE_TIME_KW_ID: u16 = 0;
static mut G_DHCP_LEASE_TIME_BUFFER_ID: c_int = 0;
-static mut G_DHCP_REBINDING_TIME_KW_ID: c_int = 0;
+static mut G_DHCP_REBINDING_TIME_KW_ID: u16 = 0;
static mut G_DHCP_REBINDING_TIME_BUFFER_ID: c_int = 0;
-static mut G_DHCP_RENEWAL_TIME_KW_ID: c_int = 0;
+static mut G_DHCP_RENEWAL_TIME_KW_ID: u16 = 0;
static mut G_DHCP_RENEWAL_TIME_BUFFER_ID: c_int = 0;
unsafe extern "C" fn dhcp_detect_leasetime_setup(
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_DHCP_LEASE_TIME_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_DHCP_LEASE_TIME_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_DHCP_REBINDING_TIME_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_DHCP_REBINDING_TIME_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_DHCP_RENEWAL_TIME_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_DHCP_RENEWAL_TIME_BUFFER_ID,
)
.is_null()
detect_match_uint, detect_parse_uint_enum, DetectUintData, SCDetectU16Free, SCDetectU8Free,
SCDetectU8Parse,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use crate::direction::Direction;
use std::ffi::CStr;
use std::os::raw::{c_int, c_void};
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferRegister, SCDetectHelperKeywordAliasRegister,
SCDetectHelperKeywordRegister, SCDetectHelperMultiBufferProgressMpmRegister,
- SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchCtx, Signature,
+ SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt, SigMatchCtx,
+ Signature,
};
/// Perform the DNS opcode match.
static mut G_DNS_ANSWER_NAME_BUFFER_ID: c_int = 0;
static mut G_DNS_QUERY_NAME_BUFFER_ID: c_int = 0;
static mut G_DNS_QUERY_BUFFER_ID: c_int = 0;
-static mut G_DNS_OPCODE_KW_ID: c_int = 0;
+static mut G_DNS_OPCODE_KW_ID: u16 = 0;
static mut G_DNS_OPCODE_BUFFER_ID: c_int = 0;
-static mut G_DNS_RCODE_KW_ID: c_int = 0;
+static mut G_DNS_RCODE_KW_ID: u16 = 0;
static mut G_DNS_RCODE_BUFFER_ID: c_int = 0;
-static mut G_DNS_RRTYPE_KW_ID: c_int = 0;
+static mut G_DNS_RRTYPE_KW_ID: u16 = 0;
static mut G_DNS_RRTYPE_BUFFER_ID: c_int = 0;
unsafe extern "C" fn dns_opcode_setup(
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_DNS_OPCODE_KW_ID, ctx, G_DNS_OPCODE_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_DNS_OPCODE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_DNS_OPCODE_BUFFER_ID,
+ )
+ .is_null()
+ {
dns_opcode_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_DNS_RCODE_KW_ID, ctx, G_DNS_RCODE_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_DNS_RCODE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_DNS_RCODE_BUFFER_ID,
+ )
+ .is_null()
+ {
dns_rcode_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_DNS_RRTYPE_KW_ID, ctx, G_DNS_RRTYPE_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_DNS_RRTYPE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_DNS_RRTYPE_BUFFER_ID,
+ )
+ .is_null()
+ {
dns_rrtype_free(std::ptr::null_mut(), ctx);
return -1;
}
SCDetectU16Parse, SCDetectU32Free, SCDetectU32Match, SCDetectU32Parse, SCDetectU8Free,
SCDetectU8Match, SCDetectU8Parse,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchCtx, Signature,
+ SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt, SigMatchCtx,
+ Signature,
};
use crate::direction::Direction;
return None;
}
-static mut G_ENIP_CIPSERVICE_KW_ID: c_int = 0;
+static mut G_ENIP_CIPSERVICE_KW_ID: u16 = 0;
static mut G_ENIP_CIPSERVICE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CAPABILITIES_KW_ID: c_int = 0;
+static mut G_ENIP_CAPABILITIES_KW_ID: u16 = 0;
static mut G_ENIP_CAPABILITIES_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CIP_ATTRIBUTE_KW_ID: c_int = 0;
+static mut G_ENIP_CIP_ATTRIBUTE_KW_ID: u16 = 0;
static mut G_ENIP_CIP_ATTRIBUTE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CIP_CLASS_KW_ID: c_int = 0;
+static mut G_ENIP_CIP_CLASS_KW_ID: u16 = 0;
static mut G_ENIP_CIP_CLASS_BUFFER_ID: c_int = 0;
-static mut G_ENIP_VENDOR_ID_KW_ID: c_int = 0;
+static mut G_ENIP_VENDOR_ID_KW_ID: u16 = 0;
static mut G_ENIP_VENDOR_ID_BUFFER_ID: c_int = 0;
-static mut G_ENIP_STATUS_KW_ID: c_int = 0;
+static mut G_ENIP_STATUS_KW_ID: u16 = 0;
static mut G_ENIP_STATUS_BUFFER_ID: c_int = 0;
-static mut G_ENIP_STATE_KW_ID: c_int = 0;
+static mut G_ENIP_STATE_KW_ID: u16 = 0;
static mut G_ENIP_STATE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_SERIAL_KW_ID: c_int = 0;
+static mut G_ENIP_SERIAL_KW_ID: u16 = 0;
static mut G_ENIP_SERIAL_BUFFER_ID: c_int = 0;
-static mut G_ENIP_REVISION_KW_ID: c_int = 0;
+static mut G_ENIP_REVISION_KW_ID: u16 = 0;
static mut G_ENIP_REVISION_BUFFER_ID: c_int = 0;
-static mut G_ENIP_PROTOCOL_VERSION_KW_ID: c_int = 0;
+static mut G_ENIP_PROTOCOL_VERSION_KW_ID: u16 = 0;
static mut G_ENIP_PROTOCOL_VERSION_BUFFER_ID: c_int = 0;
-static mut G_ENIP_PRODUCT_CODE_KW_ID: c_int = 0;
+static mut G_ENIP_PRODUCT_CODE_KW_ID: u16 = 0;
static mut G_ENIP_PRODUCT_CODE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_IDENTITY_STATUS_KW_ID: c_int = 0;
+static mut G_ENIP_IDENTITY_STATUS_KW_ID: u16 = 0;
static mut G_ENIP_IDENTITY_STATUS_BUFFER_ID: c_int = 0;
-static mut G_ENIP_DEVICE_TYPE_KW_ID: c_int = 0;
+static mut G_ENIP_DEVICE_TYPE_KW_ID: u16 = 0;
static mut G_ENIP_DEVICE_TYPE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_COMMAND_KW_ID: c_int = 0;
+static mut G_ENIP_COMMAND_KW_ID: u16 = 0;
static mut G_ENIP_COMMAND_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CIP_STATUS_KW_ID: c_int = 0;
+static mut G_ENIP_CIP_STATUS_KW_ID: u16 = 0;
static mut G_ENIP_CIP_STATUS_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CIP_INSTANCE_KW_ID: c_int = 0;
+static mut G_ENIP_CIP_INSTANCE_KW_ID: u16 = 0;
static mut G_ENIP_CIP_INSTANCE_BUFFER_ID: c_int = 0;
-static mut G_ENIP_CIP_EXTENDEDSTATUS_KW_ID: c_int = 0;
+static mut G_ENIP_CIP_EXTENDEDSTATUS_KW_ID: u16 = 0;
static mut G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID: c_int = 0;
static mut G_ENIP_PRODUCT_NAME_BUFFER_ID: c_int = 0;
static mut G_ENIP_SERVICE_NAME_BUFFER_ID: c_int = 0;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIPSERVICE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIPSERVICE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CAPABILITIES_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CAPABILITIES_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIP_ATTRIBUTE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIP_ATTRIBUTE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIP_CLASS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIP_CLASS_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_VENDOR_ID_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_VENDOR_ID_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_ENIP_STATUS_KW_ID, ctx, G_ENIP_STATUS_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_ENIP_STATUS_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_ENIP_STATUS_BUFFER_ID,
+ )
+ .is_null()
+ {
status_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_ENIP_STATE_KW_ID, ctx, G_ENIP_STATE_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_ENIP_STATE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_ENIP_STATE_BUFFER_ID,
+ )
+ .is_null()
+ {
state_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_ENIP_SERIAL_KW_ID, ctx, G_ENIP_SERIAL_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_ENIP_SERIAL_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_ENIP_SERIAL_BUFFER_ID,
+ )
+ .is_null()
+ {
serial_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_ENIP_REVISION_KW_ID, ctx, G_ENIP_REVISION_BUFFER_ID)
- .is_null()
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_ENIP_REVISION_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_ENIP_REVISION_BUFFER_ID,
+ )
+ .is_null()
{
revision_free(std::ptr::null_mut(), ctx);
return -1;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_PROTOCOL_VERSION_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_PROTOCOL_VERSION_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_PRODUCT_CODE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_PRODUCT_CODE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_IDENTITY_STATUS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_IDENTITY_STATUS_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_DEVICE_TYPE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_DEVICE_TYPE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_ENIP_COMMAND_KW_ID, ctx, G_ENIP_COMMAND_BUFFER_ID).is_null()
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_ENIP_COMMAND_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_ENIP_COMMAND_BUFFER_ID,
+ )
+ .is_null()
{
command_free(std::ptr::null_mut(), ctx);
return -1;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIP_STATUS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIP_STATUS_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIP_INSTANCE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIP_INSTANCE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_ENIP_CIP_EXTENDEDSTATUS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_ENIP_CIP_EXTENDEDSTATUS_BUFFER_ID,
)
.is_null()
detect_match_uint, detect_parse_uint_enum, DetectUintData, SCDetectU32Free, SCDetectU32Parse,
SCDetectU8Free,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use crate::ldap::types::{LdapMessage, LdapResultCode, ProtocolOp, ProtocolOpCode};
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectHelperMultiBufferMpmRegister, SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt,
- SigMatchCtx, Signature,
+ SCDetectHelperMultiBufferMpmRegister, SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList,
+ SCSigTableAppLiteElmt, SigMatchCtx, Signature,
};
use std::collections::VecDeque;
pub index: LdapIndex,
}
-static mut G_LDAP_REQUEST_OPERATION_KW_ID: c_int = 0;
+static mut G_LDAP_REQUEST_OPERATION_KW_ID: u16 = 0;
static mut G_LDAP_REQUEST_OPERATION_BUFFER_ID: c_int = 0;
-static mut G_LDAP_RESPONSES_OPERATION_KW_ID: c_int = 0;
+static mut G_LDAP_RESPONSES_OPERATION_KW_ID: u16 = 0;
static mut G_LDAP_RESPONSES_OPERATION_BUFFER_ID: c_int = 0;
-static mut G_LDAP_RESPONSES_COUNT_KW_ID: c_int = 0;
+static mut G_LDAP_RESPONSES_COUNT_KW_ID: u16 = 0;
static mut G_LDAP_RESPONSES_COUNT_BUFFER_ID: c_int = 0;
static mut G_LDAP_REQUEST_DN_BUFFER_ID: c_int = 0;
static mut G_LDAP_RESPONSES_DN_BUFFER_ID: c_int = 0;
-static mut G_LDAP_RESPONSES_RESULT_CODE_KW_ID: c_int = 0;
+static mut G_LDAP_RESPONSES_RESULT_CODE_KW_ID: u16 = 0;
static mut G_LDAP_RESPONSES_RESULT_CODE_BUFFER_ID: c_int = 0;
static mut G_LDAP_RESPONSES_MSG_BUFFER_ID: c_int = 0;
static mut G_LDAP_REQUEST_ATTRIBUTE_TYPE_BUFFER_ID: c_int = 0;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_LDAP_REQUEST_OPERATION_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_LDAP_REQUEST_OPERATION_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_LDAP_RESPONSES_OPERATION_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_LDAP_RESPONSES_OPERATION_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_LDAP_RESPONSES_COUNT_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_LDAP_RESPONSES_COUNT_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_LDAP_RESPONSES_RESULT_CODE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_LDAP_RESPONSES_RESULT_CODE_BUFFER_ID,
)
.is_null()
detect_match_uint, detect_parse_uint, detect_parse_uint_enum, DetectUintData, DetectUintMode,
SCDetectU8Free, SCDetectU8Parse,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectHelperMultiBufferMpmRegister, SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt,
- SigMatchCtx, Signature,
+ SCDetectHelperMultiBufferMpmRegister, SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList,
+ SCSigTableAppLiteElmt, SigMatchCtx, Signature,
};
use nom7::branch::alt;
static mut UNSUB_TOPIC_MATCH_LIMIT: isize = 100;
static mut G_MQTT_UNSUB_TOPIC_BUFFER_ID: c_int = 0;
-static mut G_MQTT_TYPE_KW_ID: c_int = 0;
+static mut G_MQTT_TYPE_KW_ID: u16 = 0;
static mut G_MQTT_TYPE_BUFFER_ID: c_int = 0;
static mut SUB_TOPIC_MATCH_LIMIT: isize = 100;
static mut G_MQTT_SUB_TOPIC_BUFFER_ID: c_int = 0;
-static mut G_MQTT_REASON_CODE_KW_ID: c_int = 0;
+static mut G_MQTT_REASON_CODE_KW_ID: u16 = 0;
static mut G_MQTT_REASON_CODE_BUFFER_ID: c_int = 0;
-static mut G_MQTT_QOS_KW_ID: c_int = 0;
+static mut G_MQTT_QOS_KW_ID: u16 = 0;
static mut G_MQTT_QOS_BUFFER_ID: c_int = 0;
static mut G_MQTT_PUB_TOPIC_BUFFER_ID: c_int = 0;
static mut G_MQTT_PUB_MSG_BUFFER_ID: c_int = 0;
-static mut G_MQTT_PROTOCOL_VERSION_KW_ID: c_int = 0;
+static mut G_MQTT_PROTOCOL_VERSION_KW_ID: u16 = 0;
static mut G_MQTT_PROTOCOL_VERSION_BUFFER_ID: c_int = 0;
-static mut G_MQTT_FLAGS_KW_ID: c_int = 0;
+static mut G_MQTT_FLAGS_KW_ID: u16 = 0;
static mut G_MQTT_FLAGS_BUFFER_ID: c_int = 0;
static mut G_MQTT_CONN_WILLTOPIC_BUFFER_ID: c_int = 0;
static mut G_MQTT_CONN_WILLMSG_BUFFER_ID: c_int = 0;
static mut G_MQTT_CONN_PROTOCOLSTRING_BUFFER_ID: c_int = 0;
static mut G_MQTT_CONN_PASSWORD_BUFFER_ID: c_int = 0;
static mut G_MQTT_CONN_CLIENTID_BUFFER_ID: c_int = 0;
-static mut G_MQTT_CONNACK_SESSIONPRESENT_KW_ID: c_int = 0;
+static mut G_MQTT_CONNACK_SESSIONPRESENT_KW_ID: u16 = 0;
static mut G_MQTT_CONNACK_SESSIONPRESENT_BUFFER_ID: c_int = 0;
-static mut G_MQTT_CONN_FLAGS_KW_ID: c_int = 0;
+static mut G_MQTT_CONN_FLAGS_KW_ID: u16 = 0;
static mut G_MQTT_CONN_FLAGS_BUFFER_ID: c_int = 0;
unsafe extern "C" fn unsub_topic_get_data(
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_MQTT_TYPE_KW_ID, ctx, G_MQTT_TYPE_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_MQTT_TYPE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_MQTT_TYPE_BUFFER_ID,
+ )
+ .is_null()
+ {
mqtt_type_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_MQTT_REASON_CODE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_MQTT_REASON_CODE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_MQTT_QOS_KW_ID, ctx, G_MQTT_QOS_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_MQTT_QOS_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_MQTT_QOS_BUFFER_ID,
+ )
+ .is_null()
+ {
mqtt_qos_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_MQTT_CONNACK_SESSIONPRESENT_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_MQTT_CONNACK_SESSIONPRESENT_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_MQTT_PROTOCOL_VERSION_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_MQTT_PROTOCOL_VERSION_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_MQTT_FLAGS_KW_ID, ctx, G_MQTT_FLAGS_BUFFER_ID).is_null() {
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_MQTT_FLAGS_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_MQTT_FLAGS_BUFFER_ID,
+ )
+ .is_null()
+ {
mqtt_flags_free(std::ptr::null_mut(), ctx);
return -1;
}
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_MQTT_CONN_FLAGS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_MQTT_CONN_FLAGS_BUFFER_ID,
)
.is_null()
use crate::detect::uint::{
detect_match_uint, detect_parse_uint_enum, DetectUintData, SCDetectU32Free, SCDetectU32Parse,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use std::ffi::CStr;
use std::os::raw::{c_int, c_void};
use std::ptr;
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchCtx, Signature,
+ SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt, SigMatchCtx,
+ Signature,
};
unsafe extern "C" fn rfb_name_get(
}
static mut G_RFB_NAME_BUFFER_ID: c_int = 0;
-static mut G_RFB_SEC_TYPE_KW_ID: c_int = 0;
+static mut G_RFB_SEC_TYPE_KW_ID: u16 = 0;
static mut G_RFB_SEC_TYPE_BUFFER_ID: c_int = 0;
-static mut G_RFB_SEC_RESULT_KW_ID: c_int = 0;
+static mut G_RFB_SEC_RESULT_KW_ID: u16 = 0;
static mut G_RFB_SEC_RESULT_BUFFER_ID: c_int = 0;
unsafe extern "C" fn rfb_name_setup(
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_RFB_SEC_TYPE_KW_ID, ctx, G_RFB_SEC_TYPE_BUFFER_ID).is_null()
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_RFB_SEC_TYPE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_RFB_SEC_TYPE_BUFFER_ID,
+ )
+ .is_null()
{
rfb_sec_type_free(std::ptr::null_mut(), ctx);
return -1;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_RFB_SEC_RESULT_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_RFB_SEC_RESULT_BUFFER_ID,
)
.is_null()
use super::snmp::{SNMPTransaction, ALPROTO_SNMP};
use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
use crate::detect::uint::{DetectUintData, SCDetectU32Free, SCDetectU32Match, SCDetectU32Parse};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use std::os::raw::{c_int, c_void};
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchCtx, Signature,
+ SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt, SigMatchCtx,
+ Signature,
};
-static mut G_SNMP_VERSION_KW_ID: c_int = 0;
+static mut G_SNMP_VERSION_KW_ID: u16 = 0;
static mut G_SNMP_VERSION_BUFFER_ID: c_int = 0;
-static mut G_SNMP_PDUTYPE_KW_ID: c_int = 0;
+static mut G_SNMP_PDUTYPE_KW_ID: u16 = 0;
static mut G_SNMP_PDUTYPE_BUFFER_ID: c_int = 0;
static mut G_SNMP_USM_BUFFER_ID: c_int = 0;
static mut G_SNMP_COMMUNITY_BUFFER_ID: c_int = 0;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_SNMP_VERSION_KW_ID, ctx, G_SNMP_VERSION_BUFFER_ID).is_null()
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_SNMP_VERSION_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_SNMP_VERSION_BUFFER_ID,
+ )
+ .is_null()
{
snmp_detect_version_free(std::ptr::null_mut(), ctx);
return -1;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(de, s, G_SNMP_PDUTYPE_KW_ID, ctx, G_SNMP_PDUTYPE_BUFFER_ID).is_null()
+ if SCSigMatchAppendSMToList(
+ de,
+ s,
+ G_SNMP_PDUTYPE_KW_ID,
+ ctx as *mut SigMatchCtx,
+ G_SNMP_PDUTYPE_BUFFER_ID,
+ )
+ .is_null()
{
snmp_detect_pdutype_free(std::ptr::null_mut(), ctx);
return -1;
detect_parse_uint, detect_parse_uint_enum, DetectUintData, DetectUintMode, SCDetectU32Free,
SCDetectU32Match, SCDetectU32Parse, SCDetectU8Free, SCDetectU8Match,
};
-use crate::detect::{
- helper_keyword_register_sticky_buffer, SigMatchAppendSMToList, SigTableElmtStickyBuffer,
-};
+use crate::detect::{helper_keyword_register_sticky_buffer, SigTableElmtStickyBuffer};
use crate::websocket::parser::WebSocketOpcode;
use suricata_sys::sys::{
DetectEngineCtx, DetectEngineThreadCtx, Flow, SCDetectBufferSetActiveList,
SCDetectHelperBufferMpmRegister, SCDetectHelperBufferRegister, SCDetectHelperKeywordRegister,
- SCDetectSignatureSetAppProto, SCSigTableAppLiteElmt, SigMatchCtx, Signature,
+ SCDetectSignatureSetAppProto, SCSigMatchAppendSMToList, SCSigTableAppLiteElmt, SigMatchCtx,
+ Signature,
};
use nom7::branch::alt;
return std::ptr::null_mut();
}
-static mut G_WEBSOCKET_OPCODE_KW_ID: c_int = 0;
+static mut G_WEBSOCKET_OPCODE_KW_ID: u16 = 0;
static mut G_WEBSOCKET_OPCODE_BUFFER_ID: c_int = 0;
-static mut G_WEBSOCKET_MASK_KW_ID: c_int = 0;
+static mut G_WEBSOCKET_MASK_KW_ID: u16 = 0;
static mut G_WEBSOCKET_MASK_BUFFER_ID: c_int = 0;
-static mut G_WEBSOCKET_FLAGS_KW_ID: c_int = 0;
+static mut G_WEBSOCKET_FLAGS_KW_ID: u16 = 0;
static mut G_WEBSOCKET_FLAGS_BUFFER_ID: c_int = 0;
static mut G_WEBSOCKET_PAYLOAD_BUFFER_ID: c_int = 0;
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_WEBSOCKET_OPCODE_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_WEBSOCKET_OPCODE_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_WEBSOCKET_MASK_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_WEBSOCKET_MASK_BUFFER_ID,
)
.is_null()
if ctx.is_null() {
return -1;
}
- if SigMatchAppendSMToList(
+ if SCSigMatchAppendSMToList(
de,
s,
G_WEBSOCKET_FLAGS_KW_ID,
- ctx,
+ ctx as *mut SigMatchCtx,
G_WEBSOCKET_FLAGS_BUFFER_ID,
)
.is_null()
) -> ::std::os::raw::c_int;
}
extern "C" {
- pub fn SCDetectHelperKeywordSetCleanCString(id: ::std::os::raw::c_int);
+ pub fn SCDetectHelperKeywordSetCleanCString(id: u16);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
_unused: [u8; 0],
}
pub type Signature = Signature_;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct SigMatch_ {
+ _unused: [u8; 0],
+}
+pub type SigMatch = SigMatch_;
extern "C" {
pub fn SCDetectBufferSetActiveList(
de_ctx: *mut DetectEngineCtx, s: *mut Signature, list: ::std::os::raw::c_int,
pub fn SCDetectHelperNewKeywordId() -> ::std::os::raw::c_int;
}
extern "C" {
- pub fn SCDetectHelperKeywordRegister(kw: *const SCSigTableAppLiteElmt)
- -> ::std::os::raw::c_int;
+ pub fn SCDetectHelperKeywordRegister(kw: *const SCSigTableAppLiteElmt) -> u16;
}
extern "C" {
- pub fn SCDetectHelperKeywordAliasRegister(
- kwid: ::std::os::raw::c_int, alias: *const ::std::os::raw::c_char,
- );
+ pub fn SCDetectHelperKeywordAliasRegister(kwid: u16, alias: *const ::std::os::raw::c_char);
}
extern "C" {
pub fn SCDetectHelperBufferRegister(
kw: *const SCTransformTableElmt,
) -> ::std::os::raw::c_int;
}
+extern "C" {
+ pub fn SCSigMatchAppendSMToList(
+ arg1: *mut DetectEngineCtx, arg2: *mut Signature, arg3: u16, arg4: *mut SigMatchCtx,
+ arg5: ::std::os::raw::c_int,
+ ) -> *mut SigMatch;
+}
extern "C" {
pub fn SCDetectSignatureSetAppProto(
s: *mut Signature, alproto: AppProto,
SCLogDebug("data->event_id %u", data->event_id);
if (event_type == APP_LAYER_EVENT_TYPE_PACKET) {
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_EVENT, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_EVENT, (SigMatchCtx *)data,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (SCDetectSignatureSetAppProto(s, data->alproto) != 0)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_EVENT, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_EVENT, (SigMatchCtx *)data,
g_applayer_events_list_id) == NULL) {
goto error;
}
}
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_PROTOCOL, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_PROTOCOL, (SigMatchCtx *)data,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
data->progress = (uint8_t)progress;
data->mode = (int8_t)mode;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_STATE, (SigMatchCtx *)data,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_APP_LAYER_STATE, (SigMatchCtx *)data,
g_applayer_state_list_id) == NULL) {
SCFree(data);
return -1;
if (ad == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ASN1, (SigMatchCtx *)ad, DETECT_SM_LIST_PMATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_ASN1, (SigMatchCtx *)ad, DETECT_SM_LIST_PMATCH) == NULL) {
DetectAsn1Free(de_ctx, ad);
return -1;
}
}
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BASE64_DECODE, (SigMatchCtx *)data, sm_list) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BASE64_DECODE, (SigMatchCtx *)data, sm_list) ==
NULL) {
goto error;
}
if (bsz == NULL)
SCReturnInt(-1);
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BSIZE, (SigMatchCtx *)bsz, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BSIZE, (SigMatchCtx *)bsz, list) == NULL) {
goto error;
}
}
s->flags |= SIG_FLAG_BYPASS;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BYPASS, NULL, DETECT_SM_LIST_POSTMATCH) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BYPASS, NULL, DETECT_SM_LIST_POSTMATCH) ==
+ NULL) {
return -1;
}
if (data->local_id > de_ctx->byte_extract_max_local_id)
de_ctx->byte_extract_max_local_id = data->local_id;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BYTE_EXTRACT, (SigMatchCtx *)data, sm_list) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BYTE_EXTRACT, (SigMatchCtx *)data, sm_list) ==
NULL) {
goto error;
}
offset = NULL;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BYTEJUMP, (SigMatchCtx *)data, sm_list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BYTEJUMP, (SigMatchCtx *)data, sm_list) ==
+ NULL) {
goto error;
}
de_ctx->byte_extract_max_local_id = data->local_id;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BYTEMATH, (SigMatchCtx *)data, sm_list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BYTEMATH, (SigMatchCtx *)data, sm_list) ==
+ NULL) {
goto error;
}
nbytes = NULL;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_BYTETEST, (SigMatchCtx *)data, sm_list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_BYTETEST, (SigMatchCtx *)data, sm_list) ==
+ NULL) {
goto error;
}
s->flags |= SIG_FLAG_APPLAYER;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_CONFIG, (SigMatchCtx *)fd, DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
}
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_CONTENT, (SigMatchCtx *)cd, sm_list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_CONTENT, (SigMatchCtx *)cd, sm_list) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_IPV4_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TCPV4_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TCPV6_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_UDPV4_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_UDPV6_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_ICMPV4_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (DetectCsumParseArg(csum_str, cd) == 0)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_ICMPV6_CSUM, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_DATAREP, (SigMatchCtx *)cd, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_DATAREP, (SigMatchCtx *)cd, list) == NULL) {
goto error;
}
return 0;
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_DATASET, (SigMatchCtx *)cd, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_DATASET, (SigMatchCtx *)cd, list) == NULL) {
goto error;
}
return 0;
return -1;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_DCE_IFACE, did, g_dce_generic_list_id) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_DCE_IFACE, did, g_dce_generic_list_id) == NULL) {
DetectDceIfaceFree(de_ctx, did);
return -1;
}
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_DCE_OPNUM, (SigMatchCtx *)dod, g_dce_generic_list_id) == NULL) {
DetectDceOpnumFree(de_ctx, dod);
return -1;
if (df == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_DETECTION_FILTER, (SigMatchCtx *)df,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_DETECTION_FILTER, (SigMatchCtx *)df,
DETECT_SM_LIST_THRESHOLD) == NULL) {
goto error;
}
}
dnp3->function_code = function_code;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_DNP3FUNC, (SigMatchCtx *)dnp3, g_dnp3_match_buffer_id) == NULL) {
goto error;
}
}
detect->ind_flags = flags;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_DNP3IND, (SigMatchCtx *)detect, g_dnp3_match_buffer_id) == NULL) {
goto error;
}
detect->obj_group = group;
detect->obj_variation = variation;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_DNP3OBJ, (SigMatchCtx *)detect, g_dnp3_match_buffer_id) == NULL) {
goto fail;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- SigMatch *sm = SigMatchAppendSMToList(
+ SigMatch *sm = SCSigMatchAppendSMToList(
de_ctx, s, DETECT_DSIZE, (SigMatchCtx *)dd, DETECT_SM_LIST_MATCH);
if (sm == NULL) {
SCDetectU16Free(dd);
SCLogDebug("rawstr %s %u", rawstr, de->event);
- if (SigMatchAppendSMToList(de_ctx, s, smtype, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, smtype, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) ==
NULL) {
SCFree(de);
return -1;
return DETECT_TBLSIZE_IDX - 1;
}
-int SCDetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw)
+uint16_t SCDetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw)
{
int keyword_id = SCDetectHelperNewKeywordId();
if (keyword_id < 0) {
(int (*)(DetectEngineCtx * de, Signature * s, const char *raw)) kw->Setup;
sigmatch_table[keyword_id].Free = (void (*)(DetectEngineCtx * de, void *ptr)) kw->Free;
- return keyword_id;
+ return (uint16_t)keyword_id;
}
-void SCDetectHelperKeywordAliasRegister(int kwid, const char *alias)
+void SCDetectHelperKeywordAliasRegister(uint16_t kwid, const char *alias)
{
sigmatch_table[kwid].alias = alias;
}
int SCDetectHelperNewKeywordId(void);
-int SCDetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw);
-void SCDetectHelperKeywordAliasRegister(int kwid, const char *alias);
+uint16_t SCDetectHelperKeywordRegister(const SCSigTableAppLiteElmt *kw);
+void SCDetectHelperKeywordAliasRegister(uint16_t kwid, const char *alias);
int SCDetectHelperBufferRegister(const char *name, AppProto alproto, uint8_t direction);
int SCDetectHelperBufferMpmRegister(const char *name, const char *desc, AppProto alproto,
SCDetectSigMatchNamesFree(&kw);
}
-void SCDetectHelperKeywordSetCleanCString(int id)
+void SCDetectHelperKeywordSetCleanCString(uint16_t id)
{
sigmatch_table[id].Cleanup = SigCleanCString;
}
int SCSigTablePreRegister(void (*KeywordsRegister)(void));
void SigTableRegisterTests(void);
bool SigTableHasKeyword(const char *keyword);
-void SCDetectHelperKeywordSetCleanCString(int id);
+void SCDetectHelperKeywordSetCleanCString(uint16_t id);
#endif /* SURICATA_DETECT_ENGINE_REGISTER_H */
sm_list = s->init_data->list;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ENTROPY, (SigMatchCtx *)ded, sm_list) != NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_ENTROPY, (SigMatchCtx *)ded, sm_list) != NULL) {
SCReturnInt(0);
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, type, (SigMatchCtx *)filehash, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, type, (SigMatchCtx *)filehash, list) == NULL) {
goto error;
}
if (fsd == NULL)
SCReturnInt(-1);
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FILESIZE, (SigMatchCtx *)fsd, g_file_match_list_id) == NULL) {
DetectFilesizeFree(de_ctx, fsd);
SCReturnInt(-1);
AppLayerHtpNeedFileInspection();
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FILESTORE, (SigMatchCtx *)fd, g_file_match_list_id) == NULL) {
DetectFilestoreFree(de_ctx, fd);
goto error;
}
s->filestore_ctx = fd;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FILESTORE_POSTMATCH, NULL, DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
if (du32 == NULL)
return -1;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_AGE, (SigMatchCtx *)du32, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowAgeFree(de_ctx, du32);
return -1;
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_PKTS, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowPktsFree(de_ctx, df);
return -1;
if (df == NULL) {
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_PKTS, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowPktsFree(de_ctx, df);
return -1;
if (df == NULL) {
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_PKTS, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowPktsFree(de_ctx, df);
return -1;
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_BYTES, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowBytesFree(de_ctx, df);
return -1;
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_BYTES, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowBytesFree(de_ctx, df);
return -1;
if (df == NULL) {
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW_BYTES, (SigMatchCtx *)df, DETECT_SM_LIST_MATCH) == NULL) {
DetectFlowBytesFree(de_ctx, df);
return -1;
}
if (appendsm) {
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOW, (SigMatchCtx *)fd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
case DETECT_FLOWBITS_CMD_ISNOTSET:
case DETECT_FLOWBITS_CMD_ISSET:
/* checks, so packet list */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLOWBITS, (SigMatchCtx *)cd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FLOWBITS, (SigMatchCtx *)cd,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
case DETECT_FLOWBITS_CMD_UNSET:
case DETECT_FLOWBITS_CMD_TOGGLE:
/* modifiers, only run when entire sig has matched */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLOWBITS, (SigMatchCtx *)cd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FLOWBITS, (SigMatchCtx *)cd,
DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
case FLOWINT_MODIFIER_SET:
case FLOWINT_MODIFIER_ADD:
case FLOWINT_MODIFIER_SUB:
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLOWINT, (SigMatchCtx *)sfd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FLOWINT, (SigMatchCtx *)sfd,
DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
case FLOWINT_MODIFIER_GT:
case FLOWINT_MODIFIER_ISSET:
case FLOWINT_MODIFIER_ISNOTSET:
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLOWINT, (SigMatchCtx *)sfd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FLOWINT, (SigMatchCtx *)sfd,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FLOWVAR, (SigMatchCtx *)fd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
fv->idx = idx;
fv->post_match = true;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLOWVAR_POSTMATCH, (SigMatchCtx *)fv,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FLOWVAR_POSTMATCH, (SigMatchCtx *)fv,
DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
if (de == NULL)
return -1;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_FRAGBITS, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
fragoff = DetectFragOffsetParse(de_ctx, fragoffsetstr);
if (fragoff == NULL) goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FRAGOFFSET, (SigMatchCtx *)fragoff,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FRAGOFFSET, (SigMatchCtx *)fragoff,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
}
SCLogDebug("low %u hi %u", fdp->arg1, fdp->arg2);
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FTP_DYNPORT, (SigMatchCtx *)fdp,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FTP_DYNPORT, (SigMatchCtx *)fdp,
g_ftp_dynport_buffer_id) == NULL) {
DetectFtpDynamicPortFree(de_ctx, fdp);
return -1;
if (ftpmoded == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FTP_MODE, (SigMatchCtx *)ftpmoded,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FTP_MODE, (SigMatchCtx *)ftpmoded,
g_ftp_mode_buffer_id) == NULL) {
DetectFtpModeFree(de_ctx, ftpmoded);
return -1;
return -1;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FTP_REPLY_RECEIVED, (SigMatchCtx *)frrd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FTP_REPLY_RECEIVED, (SigMatchCtx *)frrd,
g_ftp_reply_received_buffer_id) == NULL) {
DetectFtpReplyReceivedFree(de_ctx, frrd);
return -1;
* with a flow flag set lookup in the Match function.
*/
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FTPBOUNCE, NULL, g_ftp_request_list_id) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FTPBOUNCE, NULL, g_ftp_request_list_id) ==
+ NULL) {
return -1;
}
SCReturnInt(0);
if (ftpcommandd == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FTPDATA, (SigMatchCtx *)ftpcommandd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_FTPDATA, (SigMatchCtx *)ftpcommandd,
g_ftpdata_buffer_id) == NULL) {
DetectFtpdataFree(de_ctx, ftpcommandd);
return -1;
/* Get this into a SigMatch and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_GEOIP, (SigMatchCtx *)geoipdata, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
case DETECT_XBITS_CMD_ISNOTSET:
case DETECT_XBITS_CMD_ISSET:
/* checks, so packet list */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HOSTBITS, (SigMatchCtx *)cd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HOSTBITS, (SigMatchCtx *)cd,
DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
case DETECT_XBITS_CMD_UNSET:
case DETECT_XBITS_CMD_TOGGLE:
/* modifiers, only run when entire sig has matched */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HOSTBITS, (SigMatchCtx *)cd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HOSTBITS, (SigMatchCtx *)cd,
DETECT_SM_LIST_POSTMATCH) == NULL) {
goto error;
}
return -1;
*http2ft = frame_type;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_FRAMETYPE, (SigMatchCtx *)http2ft,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_FRAMETYPE, (SigMatchCtx *)http2ft,
g_http2_match_buffer_id) == NULL) {
DetectHTTP2frametypeFree(NULL, http2ft);
return -1;
return -1;
*http2ec = error_code;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_ERRORCODE, (SigMatchCtx *)http2ec,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_ERRORCODE, (SigMatchCtx *)http2ec,
g_http2_match_buffer_id) == NULL) {
DetectHTTP2errorcodeFree(NULL, http2ec);
return -1;
if (prio == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_PRIORITY, (SigMatchCtx *)prio,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_PRIORITY, (SigMatchCtx *)prio,
g_http2_match_buffer_id) == NULL) {
SCDetectU8Free(prio);
return -1;
if (wu == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_WINDOW, (SigMatchCtx *)wu,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_WINDOW, (SigMatchCtx *)wu,
g_http2_match_buffer_id) == NULL) {
SCDetectU32Free(wu);
return -1;
if (su == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_SIZEUPDATE, (SigMatchCtx *)su,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_SIZEUPDATE, (SigMatchCtx *)su,
g_http2_match_buffer_id) == NULL) {
DetectHTTP2settingsFree(NULL, su);
return -1;
if (http2set == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_SETTINGS, (SigMatchCtx *)http2set,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_SETTINGS, (SigMatchCtx *)http2set,
g_http2_match_buffer_id) == NULL) {
DetectHTTP2settingsFree(NULL, http2set);
return -1;
iid = DetectIcmpIdParse(de_ctx, icmpidstr);
if (iid == NULL) goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_ICMP_ID, (SigMatchCtx *)iid, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
iseq = DetectIcmpSeqParse(de_ctx, icmpseqstr);
if (iseq == NULL) goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_ICMP_SEQ, (SigMatchCtx *)iseq, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
if (icmpv6mtud == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ICMPV6MTU, (SigMatchCtx *)icmpv6mtud,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_ICMPV6MTU, (SigMatchCtx *)icmpv6mtud,
DETECT_SM_LIST_MATCH) == NULL) {
DetectICMPv6mtuFree(de_ctx, icmpv6mtud);
return -1;
if (icd == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ICODE, (SigMatchCtx *)icd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_ICODE, (SigMatchCtx *)icd, DETECT_SM_LIST_MATCH) == NULL) {
SCDetectU8Free(icd);
return -1;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ID, (SigMatchCtx *)id_d, DETECT_SM_LIST_MATCH) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_ID, (SigMatchCtx *)id_d, DETECT_SM_LIST_MATCH) ==
NULL) {
DetectIdFree(de_ctx, id_d);
return -1;
/* okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IKE_CHOSEN_SA, (SigMatchCtx *)dd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_IKE_CHOSEN_SA, (SigMatchCtx *)dd,
g_ike_chosen_sa_buffer_id) == NULL) {
goto error;
}
/* okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IKE_EXCH_TYPE, (SigMatchCtx *)ike_exch_type,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_IKE_EXCH_TYPE, (SigMatchCtx *)ike_exch_type,
g_ike_exch_type_buffer_id) == NULL) {
goto error;
}
/* okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IKE_KEY_EXCHANGE_PAYLOAD_LENGTH,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_IKE_KEY_EXCHANGE_PAYLOAD_LENGTH,
(SigMatchCtx *)key_exchange_payload_length,
g_ike_key_exch_payload_length_buffer_id) == NULL) {
goto error;
/* okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IKE_NONCE_PAYLOAD_LENGTH,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_IKE_NONCE_PAYLOAD_LENGTH,
(SigMatchCtx *)nonce_payload_length,
g_ike_nonce_payload_length_buffer_id) == NULL) {
goto error;
if (de == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IPOPTS, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_IPOPTS, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
break;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_IPPROTO, (SigMatchCtx *)data, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_IPREP, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_IPREP, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
dad->or_else = or_else;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ABSENT, (SigMatchCtx *)dad, s->init_data->list) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_ABSENT, (SigMatchCtx *)dad, s->init_data->list) == NULL) {
DetectAbsentFree(de_ctx, dad);
return -1;
}
goto end;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ISDATAAT, (SigMatchCtx *)idad, sm_list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_ISDATAAT, (SigMatchCtx *)idad, sm_list) ==
+ NULL) {
goto end;
}
if (itd == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ITYPE, (SigMatchCtx *)itd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_ITYPE, (SigMatchCtx *)itd, DETECT_SM_LIST_MATCH) == NULL) {
DetectITypeFree(de_ctx, itd);
return -1;
}
if (krb5d == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_ERRCODE, (SigMatchCtx *)krb5d,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_ERRCODE, (SigMatchCtx *)krb5d,
g_krb5_err_code_list_id) == NULL) {
goto error;
}
if (krb5d == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_MSGTYPE, (SigMatchCtx *)krb5d,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_MSGTYPE, (SigMatchCtx *)krb5d,
g_krb5_msg_type_list_id) == NULL) {
goto error;
}
if (krb5d == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_TICKET_ENCRYPTION, (SigMatchCtx *)krb5d,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_KRB5_TICKET_ENCRYPTION, (SigMatchCtx *)krb5d,
g_krb5_ticket_encryption_list_id) == NULL) {
goto error;
}
}
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_LUA, (SigMatchCtx *)lua, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_LUA, (SigMatchCtx *)lua, list) == NULL) {
goto error;
}
/* Append it to the list of post match, so the mark is set if the
* full signature matches. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_MARK, (SigMatchCtx *)data, DETECT_SM_LIST_POSTMATCH) == NULL) {
DetectMarkDataFree(de_ctx, data);
return -1;
}
/* Okay so far so good, lets get this into a SigMatch and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_MODBUS, (SigMatchCtx *)modbus, g_modbus_buffer_id) == NULL) {
goto error;
}
* and put it in the Signature. */
SCLogDebug("low %u hi %u", dd->arg1, dd->arg2);
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_NFS_PROCEDURE, (SigMatchCtx *)dd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_NFS_PROCEDURE, (SigMatchCtx *)dd,
g_nfs_request_buffer_id) == NULL) {
DetectNfsProcedureFree(de_ctx, dd);
return -1;
* and put it in the Signature. */
SCLogDebug("low %u hi %u", dd->arg1, dd->arg2);
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_NFS_VERSION, (SigMatchCtx *)dd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_NFS_VERSION, (SigMatchCtx *)dd,
g_nfs_request_buffer_id) == NULL) {
goto error;
}
* \param new The sig match to append.
* \param list The list to append to.
*/
-SigMatch *SigMatchAppendSMToList(
+SigMatch *SCSigMatchAppendSMToList(
DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
{
SigMatch *new = SigMatchAlloc();
Signature *DetectEngineAppendSig(DetectEngineCtx *, const char *);
Signature *DetectFirewallRuleAppendNew(DetectEngineCtx *, const char *);
-SigMatch *SigMatchAppendSMToList(DetectEngineCtx *, Signature *, uint16_t, SigMatchCtx *, int);
+SigMatch *SCSigMatchAppendSMToList(DetectEngineCtx *, Signature *, uint16_t, SigMatchCtx *, int);
void SigMatchRemoveSMFromList(Signature *, SigMatch *, int);
int SigMatchListSMBelongsTo(const Signature *, const SigMatch *);
if (sm_list == -1)
goto error;
- SigMatch *sm = SigMatchAppendSMToList(de_ctx, s, DETECT_PCRE, (SigMatchCtx *)pd, sm_list);
+ SigMatch *sm = SCSigMatchAppendSMToList(de_ctx, s, DETECT_PCRE, (SigMatchCtx *)pd, sm_list);
if (sm == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_PKTVAR, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_PKTVAR, (SigMatchCtx *)cd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
SCFree(content);
content = NULL;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_REPLACE, NULL, DETECT_SM_LIST_POSTMATCH) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_REPLACE, NULL, DETECT_SM_LIST_POSTMATCH) ==
+ NULL) {
goto error;
}
return 0;
rd = DetectRpcParse(de_ctx, rpcstr);
if (rd == NULL) goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_RPC, (SigMatchCtx *)rd, DETECT_SM_LIST_MATCH) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_RPC, (SigMatchCtx *)rd, DETECT_SM_LIST_MATCH) ==
NULL) {
goto error;
}
/* Get this into a SigMatch and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_SAMEIP, NULL, DETECT_SM_LIST_MATCH) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_SAMEIP, NULL, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_SMB_VERSION, (SigMatchCtx *)dod, g_smb_version_list_id) == NULL) {
DetectSmbVersionFree(de_ctx, dod);
return -1;
if (ssd == NULL)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_SSL_STATE, (SigMatchCtx *)ssd, g_tls_generic_list_id) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_SSL_VERSION, (SigMatchCtx *)ssl, g_tls_generic_list_id) == NULL) {
goto error;
}
if (sd == NULL)
return -1;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_STREAM_SIZE, (SigMatchCtx *)sd, DETECT_SM_LIST_MATCH) == NULL) {
DetectStreamSizeFree(de_ctx, sd);
return -1;
return -1;
/* Append it to the list of tags */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TAG, (SigMatchCtx *)td, DETECT_SM_LIST_TMATCH) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TAG, (SigMatchCtx *)td, DETECT_SM_LIST_TMATCH) ==
NULL) {
DetectTagDataFree(de_ctx, td);
return -1;
goto error;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_ACK, (SigMatchCtx *)data, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_ACK, (SigMatchCtx *)data, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
if (de == NULL)
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_FLAGS, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_FLAGS, (SigMatchCtx *)de, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
goto error;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_SEQ, (SigMatchCtx *)data, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_SEQ, (SigMatchCtx *)data, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_WINDOW, (SigMatchCtx *)wd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_WINDOW, (SigMatchCtx *)wd, DETECT_SM_LIST_MATCH) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_REQUIRE_PACKET;
if (tcpmssd == NULL)
return -1;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TCPMSS, (SigMatchCtx *)tcpmssd, DETECT_SM_LIST_MATCH) == NULL) {
DetectTcpmssFree(de_ctx, tcpmssd);
return -1;
if (templated == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TEMPLATE, (SigMatchCtx *)templated,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TEMPLATE, (SigMatchCtx *)templated,
DETECT_SM_LIST_MATCH) == NULL) {
DetectTemplateFree(de_ctx, templated);
return -1;
if (template2d == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TEMPLATE2, (SigMatchCtx *)template2d,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TEMPLATE2, (SigMatchCtx *)template2d,
DETECT_SM_LIST_MATCH) == NULL) {
DetectTemplate2Free(de_ctx, template2d);
return -1;
if (de == NULL)
goto error;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de, DETECT_SM_LIST_THRESHOLD) == NULL) {
goto error;
}
dd->epoch = 0;
dd->epoch2 = 0;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TLS_EXPIRED, (SigMatchCtx *)dd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TLS_EXPIRED, (SigMatchCtx *)dd,
g_tls_validity_buffer_id) == NULL) {
goto error;
}
dd->epoch = 0;
dd->epoch2 = 0;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TLS_VALID, (SigMatchCtx *)dd, g_tls_validity_buffer_id) == NULL) {
goto error;
}
goto error;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TLS_NOTAFTER, (SigMatchCtx *)dd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TLS_NOTAFTER, (SigMatchCtx *)dd,
g_tls_validity_buffer_id) == NULL) {
goto error;
}
return -1;
}
- if (SigMatchAppendSMToList(de_ctx, s, KEYWORD_ID, (SigMatchCtx *)dd, g_tls_cert_buffer_id) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, KEYWORD_ID, (SigMatchCtx *)dd, g_tls_cert_buffer_id) ==
NULL) {
SCDetectU32Free(dd);
return -1;
list = s->init_data->hook.sm_list;
}
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TLS_VERSION, (SigMatchCtx *)tls, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TLS_VERSION, (SigMatchCtx *)tls, list) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TLS_SUBJECT, (SigMatchCtx *)tls, g_tls_cert_list_id) == NULL) {
goto error;
}
/* Okay so far so good, lets get this into a SigMatch
* and put it in the Signature. */
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_TLS_ISSUERDN, (SigMatchCtx *)tls, g_tls_cert_list_id) == NULL) {
goto error;
}
s->flags |= SIG_FLAG_TLSSTORE;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TLS_STORE, NULL, DETECT_SM_LIST_POSTMATCH) ==
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_TLS_STORE, NULL, DETECT_SM_LIST_POSTMATCH) ==
NULL) {
return -1;
}
if (tosd == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TOS, (SigMatchCtx *)tosd, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_TOS, (SigMatchCtx *)tosd, DETECT_SM_LIST_MATCH) == NULL) {
DetectTosFree(de_ctx, tosd);
return -1;
}
if (ttld == NULL)
return -1;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_TTL, (SigMatchCtx *)ttld, DETECT_SM_LIST_MATCH) ==
- NULL) {
+ if (SCSigMatchAppendSMToList(
+ de_ctx, s, DETECT_TTL, (SigMatchCtx *)ttld, DETECT_SM_LIST_MATCH) == NULL) {
DetectTtlFree(de_ctx, ttld);
return -1;
}
goto error;
if (urilend->raw_buffer) {
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_URILEN, (SigMatchCtx *)urilend,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_URILEN, (SigMatchCtx *)urilend,
g_http_raw_uri_buffer_id) == NULL) {
goto error;
}
} else {
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_URILEN, (SigMatchCtx *)urilend,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_URILEN, (SigMatchCtx *)urilend,
g_http_uri_buffer_id) == NULL) {
goto error;
}
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_VLAN_ID, (SigMatchCtx *)vdata, DETECT_SM_LIST_MATCH) == NULL) {
DetectVlanIdFree(de_ctx, vdata);
return -1;
return -1;
}
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, DETECT_VLAN_LAYERS, (SigMatchCtx *)du8, DETECT_SM_LIST_MATCH) == NULL) {
DetectVlanLayersFree(de_ctx, du8);
return -1;
SCLogDebug("adding match/txmatch");
/* checks, so packet list */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_XBITS, (SigMatchCtx *)cd, list) == NULL) {
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_XBITS, (SigMatchCtx *)cd, list) ==
+ NULL) {
SCFree(cd);
return -1;
}
default:
SCLogDebug("adding post-match");
/* modifiers, only run when entire sig has matched */
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_XBITS, (SigMatchCtx *)cd,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_XBITS, (SigMatchCtx *)cd,
DETECT_SM_LIST_POSTMATCH) == NULL) {
SCFree(cd);
return -1;
if (unlikely(de == NULL))
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
DETECT_SM_LIST_SUPPRESS) == NULL) {
goto error;
}
if (unlikely(de == NULL))
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
DETECT_SM_LIST_SUPPRESS) == NULL) {
goto error;
}
if (unlikely(de == NULL))
goto error;
- if (SigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
+ if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_THRESHOLD, (SigMatchCtx *)de,
DETECT_SM_LIST_SUPPRESS) == NULL) {
goto error;
}
if (parsed_type == TYPE_RATE)
smtype = DETECT_DETECTION_FILTER;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, smtype, (SigMatchCtx *)de, DETECT_SM_LIST_THRESHOLD) == NULL) {
goto error;
}
if (parsed_type == TYPE_RATE)
smtype = DETECT_DETECTION_FILTER;
- if (SigMatchAppendSMToList(de_ctx, s, smtype, (SigMatchCtx *)de,
+ if (SCSigMatchAppendSMToList(de_ctx, s, smtype, (SigMatchCtx *)de,
DETECT_SM_LIST_THRESHOLD) == NULL) {
goto error;
}
if (parsed_type == TYPE_RATE)
smtype = DETECT_DETECTION_FILTER;
- if (SigMatchAppendSMToList(
+ if (SCSigMatchAppendSMToList(
de_ctx, s, smtype, (SigMatchCtx *)de, DETECT_SM_LIST_THRESHOLD) == NULL) {
goto error;
}