Go to the documentation of this file.
62 static bool DetectHttpRawHeaderValidateCallback(
64 static int g_http_raw_header_buffer_id = 0;
65 static int g_http2_thread_id = 0;
69 const uint8_t flow_flags,
void *txv,
const int list_id);
87 "content modifier to match the raw HTTP header buffer";
110 PrefilterMpmHttpHeaderRawRequestRegister, NULL,
ALPROTO_HTTP1,
113 PrefilterMpmHttpHeaderRawResponseRegister, NULL,
ALPROTO_HTTP1,
132 DetectHttpRawHeaderValidateCallback);
134 "http2.raw_header", SCDetectThreadBufDataInit, NULL, SCDetectThreadBufDataFree);
176 static bool DetectHttpRawHeaderValidateCallback(
180 *sigerror =
"http_raw_header signature "
181 "without a flow direction. Use flow:to_server for "
182 "inspecting request headers or flow:to_client for "
183 "inspecting response headers.";
193 const uint8_t flow_flags,
void *txv,
const int list_id)
197 htp_tx_t *tx = (htp_tx_t *)txv;
201 const bool ts = ((flow_flags & STREAM_TOSERVER) != 0);
202 const uint8_t *data =
ts ?
206 const uint32_t data_len =
ts ?
210 det_ctx, list_id, buffer, data, data_len, transforms);
223 const uint8_t *b = NULL;
226 if (thread_buf == NULL)
228 if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len, thread_buf) != 1)
230 if (b == NULL || b_len == 0)
262 const int list_id =
ctx->list_id;
265 flags, txv, list_id);
270 const uint8_t *data = buffer->
inspect;
275 if (data != NULL && data_len >= mpm_ctx->
minlen) {
277 mpm_ctx, &det_ctx->
mtc, &det_ctx->
pmq, data, data_len);
294 PrefilterMpmHttpHeaderRaw(det_ctx, pectx,
p, f, txv, idx, _txd,
flags);
298 static void PrefilterMpmHttpHeaderRawFree(
void *ptr)
317 HTP_REQUEST_PROGRESS_HEADERS + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
324 pectx =
SCCalloc(1,
sizeof(*pectx));
332 HTP_REQUEST_PROGRESS_TRAILER + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
353 HTP_RESPONSE_PROGRESS_HEADERS, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
360 pectx =
SCCalloc(1,
sizeof(*pectx));
368 HTP_RESPONSE_PROGRESS_TRAILER, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
SigTableElmt * sigmatch_table
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
InspectionBuffer * SCInspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
uint32_t request_headers_raw_len
Container for matching data for a signature group.
void * SCDetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
Retrieve thread local keyword ctx by id.
struct DetectBufferMpmRegistry_::@90::@92 app_v2
main detection engine ctx
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror, const DetectBufferType *))
void SCInspectionBufferSetupAndApplyTransforms(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len, const DetectEngineTransforms *transforms)
setup the buffer with our initial data
one time registration of keywords at start up
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
DetectEngineTransforms transforms
void DetectAppLayerMpmRegisterSubState(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, uint8_t sub_state, uint8_t tx_min_progress)
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, uint8_t progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
char pname[DETECT_PROFILE_NAME_LEN]
uint8_t response_has_trailers
uint8_t * request_headers_raw
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
uint8_t request_has_trailers
#define SIGMATCH_INFO_CONTENT_MODIFIER
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
@ DETECT_HTTP_RAW_HEADER_CM
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)
uint8_t * response_headers_raw
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, uint8_t tx_min_progress)
register an app layer keyword for mpm
void DetectAppLayerInspectEngineRegisterSubState(const char *name, AppProto alproto, uint32_t dir, uint8_t sub_state, uint8_t progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
register an app inspection engine for a tx type
#define SCLogError(...)
Macro used to log ERROR messages.
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, const int8_t tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
#define SIGMATCH_INFO_STICKY_BUFFER
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
uint32_t response_headers_raw_len
int SCDetectRegisterThreadCtxGlobalFuncs(const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *))
Register Thread keyword context Funcs (Global)
void(* RegisterTests)(void)