rust: bindgen detect ThreadCtx keyword functions

pull/15835/head
Philippe Antoine 2 months ago committed by Victor Julien
parent 5fe920ec42
commit 7d024a840c

@ -648,6 +648,12 @@ pub struct DetectEngineCtx_ {
pub type DetectEngineCtx = DetectEngineCtx_; pub type DetectEngineCtx = DetectEngineCtx_;
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct DetectEngineThreadCtx_ {
_unused: [u8; 0],
}
pub type DetectEngineThreadCtx = DetectEngineThreadCtx_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Signature_ { pub struct Signature_ {
_unused: [u8; 0], _unused: [u8; 0],
} }
@ -668,6 +674,21 @@ extern "C" {
s: *mut Signature, transform: ::std::os::raw::c_int, options: *mut ::std::os::raw::c_void, s: *mut Signature, transform: ::std::os::raw::c_int, options: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int; ) -> ::std::os::raw::c_int;
} }
extern "C" {
pub fn SCDetectRegisterThreadCtxGlobalFuncs(
name: *const ::std::os::raw::c_char,
InitFunc: ::std::option::Option<
unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void,
>,
data: *mut ::std::os::raw::c_void,
FreeFunc: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn SCDetectThreadCtxGetGlobalKeywordThreadCtx(
det_ctx: *mut DetectEngineThreadCtx, id: ::std::os::raw::c_int,
) -> *mut ::std::os::raw::c_void;
}
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct InspectionBuffer { pub struct InspectionBuffer {
@ -699,12 +720,6 @@ impl Default for InspectionBuffer {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct DetectEngineThreadCtx_ {
_unused: [u8; 0],
}
pub type DetectEngineThreadCtx = DetectEngineThreadCtx_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DetectEngineTransforms { pub struct DetectEngineTransforms {
_unused: [u8; 0], _unused: [u8; 0],
} }

@ -27,6 +27,7 @@
// types from detect.h with only forward declarations for bindgen // types from detect.h with only forward declarations for bindgen
// could be #ifndef SURICATA_BINDGEN_H #include "detect.h" #endif // could be #ifndef SURICATA_BINDGEN_H #include "detect.h" #endif
typedef struct DetectEngineCtx_ DetectEngineCtx; typedef struct DetectEngineCtx_ DetectEngineCtx;
typedef struct DetectEngineThreadCtx_ DetectEngineThreadCtx;
typedef struct Signature_ Signature; typedef struct Signature_ Signature;
typedef struct SigMatch_ SigMatch; typedef struct SigMatch_ SigMatch;
@ -36,4 +37,10 @@ SigMatch *DetectBufferGetFirstSigMatch(const Signature *s, const uint32_t buf_id
SigMatch *DetectBufferGetLastSigMatch(const Signature *s, const uint32_t buf_id); SigMatch *DetectBufferGetLastSigMatch(const Signature *s, const uint32_t buf_id);
int SCDetectSignatureAddTransform(Signature *s, int transform, void *options); int SCDetectSignatureAddTransform(Signature *s, int transform, void *options);
// Declared here for bindgen
// But defined in detect-engine.c to access g_master_de_ctx
int SCDetectRegisterThreadCtxGlobalFuncs(
const char *name, void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *));
void *SCDetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id);
#endif /* SURICATA_DETECT_ENGINE_BUFFER_H */ #endif /* SURICATA_DETECT_ENGINE_BUFFER_H */

@ -40,6 +40,7 @@
#include "detect-engine-sigorder.h" #include "detect-engine-sigorder.h"
#include "detect-engine-build.h" #include "detect-engine-build.h"
#include "detect-engine-buffer.h"
#include "detect-engine-siggroup.h" #include "detect-engine-siggroup.h"
#include "detect-engine-address.h" #include "detect-engine-address.h"
#include "detect-engine-port.h" #include "detect-engine-port.h"
@ -3895,8 +3896,8 @@ void *DetectThreadCtxGetKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
* \retval id for retrieval of ctx at runtime * \retval id for retrieval of ctx at runtime
* \retval -1 on error * \retval -1 on error
*/ */
int DetectRegisterThreadCtxGlobalFuncs(const char *name, int SCDetectRegisterThreadCtxGlobalFuncs(
void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *)) const char *name, void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *))
{ {
int id; int id;
BUG_ON(InitFunc == NULL || FreeFunc == NULL); BUG_ON(InitFunc == NULL || FreeFunc == NULL);
@ -3939,7 +3940,7 @@ int DetectRegisterThreadCtxGlobalFuncs(const char *name,
* *
* \retval ctx or NULL on error * \retval ctx or NULL on error
*/ */
void *DetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id) void *SCDetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
{ {
if (id < 0 || id > det_ctx->global_keyword_ctxs_size || if (id < 0 || id > det_ctx->global_keyword_ctxs_size ||
det_ctx->global_keyword_ctxs_array == NULL) { det_ctx->global_keyword_ctxs_array == NULL) {

@ -80,10 +80,6 @@ DetectEngineCtx *DetectEngineCtxInitStubForMT(void);
void DetectEngineCtxFree(DetectEngineCtx *); void DetectEngineCtxFree(DetectEngineCtx *);
int DetectEngineThreadCtxGetJsonContext(DetectEngineThreadCtx *det_ctx); int DetectEngineThreadCtxGetJsonContext(DetectEngineThreadCtx *det_ctx);
int DetectRegisterThreadCtxGlobalFuncs(const char *name,
void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *));
void *DetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id);
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **); TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **);
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *); TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *);
bool DetectEngineMpmCachingEnabled(void); bool DetectEngineMpmCachingEnabled(void);

@ -132,7 +132,7 @@ void DetectHttpCookieRegister(void)
DetectBufferTypeSetDescriptionByName("http_cookie", DetectBufferTypeSetDescriptionByName("http_cookie",
"http cookie header"); "http cookie header");
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http_cookie", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http_cookie", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_http_cookie_buffer_id = DetectBufferTypeGetByName("http_cookie"); g_http_cookie_buffer_id = DetectBufferTypeGetByName("http_cookie");
@ -238,7 +238,7 @@ static InspectionBuffer *GetRequestData2(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetCookie(txv, STREAM_TOSERVER, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetCookie(txv, STREAM_TOSERVER, &b, &b_len, thread_buf) != 1)
@ -261,7 +261,7 @@ static InspectionBuffer *GetResponseData2(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetCookie(txv, STREAM_TOCLIENT, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetCookie(txv, STREAM_TOCLIENT, &b, &b_len, thread_buf) != 1)

@ -28,6 +28,7 @@
#include "detect.h" #include "detect.h"
#include "detect-parse.h" #include "detect-parse.h"
#include "detect-engine.h" #include "detect-engine.h"
#include "detect-engine-buffer.h"
#include "detect-engine-mpm.h" #include "detect-engine-mpm.h"
#include "detect-engine-state.h" #include "detect-engine-state.h"
#include "detect-engine-prefilter.h" #include "detect-engine-prefilter.h"
@ -101,8 +102,7 @@ HttpHeaderBuffer *HttpHeaderGetBufferSpace(DetectEngineThreadCtx *det_ctx, uint8
{ {
*ret_hdr_td = NULL; *ret_hdr_td = NULL;
HttpHeaderThreadData *hdr_td = HttpHeaderThreadData *hdr_td = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, keyword_id);
DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, keyword_id);
if (hdr_td == NULL) if (hdr_td == NULL)
return NULL; return NULL;
*ret_hdr_td = hdr_td; *ret_hdr_td = hdr_td;

@ -170,7 +170,7 @@ static InspectionBuffer *GetBuffer2ForTX(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
@ -249,10 +249,10 @@ void DetectHttpHeaderNamesRegister(void)
g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME); g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME);
g_keyword_thread_id = DetectRegisterThreadCtxGlobalFuncs(KEYWORD_NAME, g_keyword_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree); KEYWORD_NAME, HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree);
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http2.header_names", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http2.header_names", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
SCLogDebug("keyword %s registered. Thread id %d. " SCLogDebug("keyword %s registered. Thread id %d. "

@ -152,7 +152,7 @@ static InspectionBuffer *GetBuffer2ForTX(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetHeaders(txv, flow_flags, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetHeaders(txv, flow_flags, &b, &b_len, thread_buf) != 1)
@ -413,9 +413,9 @@ void DetectHttpHeaderRegister(void)
g_http_header_buffer_id = DetectBufferTypeGetByName("http_header"); g_http_header_buffer_id = DetectBufferTypeGetByName("http_header");
g_keyword_thread_id = DetectRegisterThreadCtxGlobalFuncs("http_header", g_keyword_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree); "http_header", HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree);
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http2.header", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http2.header", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
} }
@ -472,7 +472,7 @@ static bool GetHttp2HeaderData(DetectEngineThreadCtx *det_ctx, const void *txv,
} else { } else {
kw_thread_id = g_h2_response_header_thread_id; kw_thread_id = g_h2_response_header_thread_id;
} }
void *hdr_td = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, kw_thread_id); void *hdr_td = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, kw_thread_id);
if (unlikely(hdr_td == NULL)) { if (unlikely(hdr_td == NULL)) {
return false; return false;
} }
@ -491,7 +491,7 @@ static bool GetHttp1HeaderData(DetectEngineThreadCtx *det_ctx, const void *txv,
kw_thread_id = g_response_header_thread_id; kw_thread_id = g_response_header_thread_id;
} }
HttpMultiBufHeaderThreadData *hdr_td = HttpMultiBufHeaderThreadData *hdr_td =
DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, kw_thread_id); SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, kw_thread_id);
if (unlikely(hdr_td == NULL)) { if (unlikely(hdr_td == NULL)) {
return false; return false;
} }
@ -582,9 +582,9 @@ void DetectHttpRequestHeaderRegister(void)
DetectBufferTypeSetDescriptionByName("http_request_header", "HTTP header name and value"); DetectBufferTypeSetDescriptionByName("http_request_header", "HTTP header name and value");
g_http_request_header_buffer_id = DetectBufferTypeGetByName("http_request_header"); g_http_request_header_buffer_id = DetectBufferTypeGetByName("http_request_header");
DetectBufferTypeSupportsMultiInstance("http_request_header"); DetectBufferTypeSupportsMultiInstance("http_request_header");
g_request_header_thread_id = DetectRegisterThreadCtxGlobalFuncs("http_request_header", g_request_header_thread_id = SCDetectRegisterThreadCtxGlobalFuncs("http_request_header",
HttpMultiBufHeaderThreadDataInit, NULL, HttpMultiBufHeaderThreadDataFree); HttpMultiBufHeaderThreadDataInit, NULL, HttpMultiBufHeaderThreadDataFree);
g_h2_request_header_thread_id = DetectRegisterThreadCtxGlobalFuncs("http2_request_header", g_h2_request_header_thread_id = SCDetectRegisterThreadCtxGlobalFuncs("http2_request_header",
SCHttp2ThreadMultiBufDataInit, NULL, SCHttp2ThreadMultiBufDataFree); SCHttp2ThreadMultiBufDataInit, NULL, SCHttp2ThreadMultiBufDataFree);
} }
@ -618,9 +618,9 @@ void DetectHttpResponseHeaderRegister(void)
DetectBufferTypeSetDescriptionByName("http_response_header", "HTTP header name and value"); DetectBufferTypeSetDescriptionByName("http_response_header", "HTTP header name and value");
g_http_response_header_buffer_id = DetectBufferTypeGetByName("http_response_header"); g_http_response_header_buffer_id = DetectBufferTypeGetByName("http_response_header");
DetectBufferTypeSupportsMultiInstance("http_response_header"); DetectBufferTypeSupportsMultiInstance("http_response_header");
g_response_header_thread_id = DetectRegisterThreadCtxGlobalFuncs("http_response_header", g_response_header_thread_id = SCDetectRegisterThreadCtxGlobalFuncs("http_response_header",
HttpMultiBufHeaderThreadDataInit, NULL, HttpMultiBufHeaderThreadDataFree); HttpMultiBufHeaderThreadDataInit, NULL, HttpMultiBufHeaderThreadDataFree);
g_h2_response_header_thread_id = DetectRegisterThreadCtxGlobalFuncs("http2_response_header", g_h2_response_header_thread_id = SCDetectRegisterThreadCtxGlobalFuncs("http2_response_header",
SCHttp2ThreadMultiBufDataInit, NULL, SCHttp2ThreadMultiBufDataFree); SCHttp2ThreadMultiBufDataInit, NULL, SCHttp2ThreadMultiBufDataFree);
} }

@ -86,7 +86,7 @@ static InspectionBuffer *GetRequestData2(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetHeaderValue(txv, STREAM_TOSERVER, HEADER_NAME, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetHeaderValue(txv, STREAM_TOSERVER, HEADER_NAME, &b, &b_len, thread_buf) != 1)
@ -143,7 +143,7 @@ static InspectionBuffer *GetResponseData2(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetHeaderValue(txv, STREAM_TOCLIENT, HEADER_NAME, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetHeaderValue(txv, STREAM_TOCLIENT, HEADER_NAME, &b, &b_len, thread_buf) != 1)
@ -221,7 +221,7 @@ static void DetectHttpHeadersRegisterStub(void)
DetectBufferTypeSetDescriptionByName(BUFFER_NAME, BUFFER_DESC); DetectBufferTypeSetDescriptionByName(BUFFER_NAME, BUFFER_DESC);
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
BUFFER_NAME, SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); BUFFER_NAME, SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME); g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME);

@ -127,7 +127,7 @@ void DetectHttpHHRegister(void)
DetectBufferTypeSetDescriptionByName("http_host", DetectBufferTypeSetDescriptionByName("http_host",
"http host"); "http host");
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_http_host_buffer_id = DetectBufferTypeGetByName("http_host"); g_http_host_buffer_id = DetectBufferTypeGetByName("http_host");
@ -163,7 +163,7 @@ void DetectHttpHHRegister(void)
DetectBufferTypeSetDescriptionByName("http_raw_host", DetectBufferTypeSetDescriptionByName("http_raw_host",
"http raw host header"); "http raw host header");
g_http2_raw_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_raw_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http_raw_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http_raw_host", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_http_raw_host_buffer_id = DetectBufferTypeGetByName("http_raw_host"); g_http_raw_host_buffer_id = DetectBufferTypeGetByName("http_raw_host");
@ -275,7 +275,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
if (buffer->inspect == NULL) { if (buffer->inspect == NULL) {
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetHostNorm(txv, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetHostNorm(txv, &b, &b_len, thread_buf) != 1)
@ -297,7 +297,8 @@ static InspectionBuffer *GetRawData2(DetectEngineThreadCtx *det_ctx,
if (buffer->inspect == NULL) { if (buffer->inspect == NULL) {
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_raw_thread_id); void *thread_buf =
SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_raw_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;

@ -128,7 +128,7 @@ void DetectHttpRawHeaderRegister(void)
DetectBufferTypeRegisterValidateCallback("http_raw_header", DetectBufferTypeRegisterValidateCallback("http_raw_header",
DetectHttpRawHeaderValidateCallback); DetectHttpRawHeaderValidateCallback);
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http2.raw_header", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http2.raw_header", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_http_raw_header_buffer_id = DetectBufferTypeGetByName("http_raw_header"); g_http_raw_header_buffer_id = DetectBufferTypeGetByName("http_raw_header");
@ -220,7 +220,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len, thread_buf) != 1)

@ -203,8 +203,8 @@ void DetectHttpStartRegister(void)
g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME); g_buffer_id = DetectBufferTypeGetByName(BUFFER_NAME);
g_keyword_thread_id = DetectRegisterThreadCtxGlobalFuncs(KEYWORD_NAME, g_keyword_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree); KEYWORD_NAME, HttpHeaderThreadDataInit, &g_td_config, HttpHeaderThreadDataFree);
SCLogDebug("keyword %s registered. Thread id %d. " SCLogDebug("keyword %s registered. Thread id %d. "
"Buffer %s registered. Buffer id %d", "Buffer %s registered. Buffer id %d",

@ -116,7 +116,7 @@ void DetectHttpUARegister(void)
DetectBufferTypeSetDescriptionByName("http_user_agent", DetectBufferTypeSetDescriptionByName("http_user_agent",
"http user agent"); "http user agent");
g_http2_thread_id = DetectRegisterThreadCtxGlobalFuncs( g_http2_thread_id = SCDetectRegisterThreadCtxGlobalFuncs(
"http_user_agent", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree); "http_user_agent", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
g_http_ua_buffer_id = DetectBufferTypeGetByName("http_user_agent"); g_http_ua_buffer_id = DetectBufferTypeGetByName("http_user_agent");
@ -196,7 +196,7 @@ static InspectionBuffer *GetData2(DetectEngineThreadCtx *det_ctx,
if (buffer->inspect == NULL) { if (buffer->inspect == NULL) {
uint32_t b_len = 0; uint32_t b_len = 0;
const uint8_t *b = NULL; const uint8_t *b = NULL;
void *thread_buf = DetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id); void *thread_buf = SCDetectThreadCtxGetGlobalKeywordThreadCtx(det_ctx, g_http2_thread_id);
if (thread_buf == NULL) if (thread_buf == NULL)
return NULL; return NULL;
if (SCHttp2TxGetUserAgent(txv, &b, &b_len, thread_buf) != 1) if (SCHttp2TxGetUserAgent(txv, &b, &b_len, thread_buf) != 1)

Loading…
Cancel
Save