Go to the documentation of this file.
99 static int g_http2_match_buffer_id = 0;
100 static int g_http2_header_name_buffer_id = 0;
181 PrefilterMpmHttp2HeaderNameRegister, NULL,
185 DetectEngineInspectHttp2HeaderName, NULL);
187 PrefilterMpmHttp2HeaderNameRegister, NULL,
191 DetectEngineInspectHttp2HeaderName, NULL);
194 "HTTP2 header name");
217 uint8_t *detect = (uint8_t *)ctx;
219 return rs_http2_tx_has_frametype(txv,
flags, *detect);
222 static int DetectHTTP2FuncParseFrameType(
const char *
str, uint8_t *ft)
230 int r = rs_http2_parse_frametype(
str);
231 if (r >= 0 && r <= UINT8_MAX) {
256 if (!DetectHTTP2FuncParseFrameType(
str, &frame_type)) {
257 SCLogError(
"Invalid argument \"%s\" supplied to http2.frametype keyword.",
str);
261 uint8_t *http2ft =
SCCalloc(1,
sizeof(uint8_t));
264 *http2ft = frame_type;
301 uint32_t *detect = (uint32_t *)ctx;
303 return rs_http2_tx_has_errorcode(txv,
flags, *detect);
307 static int DetectHTTP2FuncParseErrorCode(
const char *
str, uint32_t *ec)
315 int r = rs_http2_parse_errorcode(
str);
341 if (!DetectHTTP2FuncParseErrorCode(
str, &error_code)) {
342 SCLogError(
"Invalid argument \"%s\" supplied to http2.errorcode keyword.",
str);
346 uint32_t *http2ec =
SCCalloc(1,
sizeof(uint32_t));
349 *http2ec = error_code;
387 int value = rs_http2_tx_get_next_priority(txv,
flags, nb);
394 value = rs_http2_tx_get_next_priority(txv,
flags, nb);
420 rs_detect_u8_free(prio);
439 rs_detect_u8_free(ptr);
454 int value = rs_http2_tx_get_next_window(txv,
flags, nb);
461 value = rs_http2_tx_get_next_window(txv,
flags, nb);
487 rs_detect_u32_free(wu);
506 rs_detect_u32_free(ptr);
520 return rs_http2_detect_sizeupdatectx_match(ctx, txv,
flags);
538 void *su = rs_detect_u64_parse(
str);
563 rs_detect_u64_free(ptr);
577 return rs_http2_detect_settingsctx_match(ctx, txv,
flags);
595 void *http2set = rs_http2_detect_settingsctx_parse(
str);
596 if (http2set == NULL)
620 rs_http2_detect_settingsctx_free(ptr);
634 static void PrefilterMpmHttp2HNameFree(
void *ptr)
653 const uint8_t *b = NULL;
655 if (rs_http2_tx_get_header_name(cbdata->
txv,
flags, cbdata->
local_id, &b, &b_len) != 1) {
659 if (b == NULL || b_len == 0) {
676 const int list_id = ctx->
list_id;
678 uint32_t local_id = 0;
685 GetHttp2HNameData(det_ctx,
flags, ctx->
transforms, f, &cbdata, list_id);
712 mpm_reg->
app_v2.alproto, mpm_reg->
app_v2.tx_min_progress,
713 pectx, PrefilterMpmHttp2HNameFree, mpm_reg->
name);
731 GetHttp2HNameData(det_ctx,
flags, transforms, f, &cbdata, engine->
sm_list);
733 if (buffer == NULL || buffer->
inspect == NULL)
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
void DetectAppLayerMpmRegister2(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register a MPM engine
#define SIGMATCH_INFO_STICKY_BUFFER
void SigMatchAppendSMToList(Signature *s, SigMatch *new, const int list)
Append a SigMatch to the list type.
void DetectHTTP2priorityRegisterTests(void)
int DetectU32Match(const uint32_t parg, const DetectUintData_u32 *du32)
void(* Free)(DetectEngineCtx *, void *)
Container for matching data for a signature group.
void DetectHTTP2RegisterTests(void)
DetectUintData_u32 * DetectU32Parse(const char *u32str)
This function is used to parse u32 options passed via some u32 keyword.
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
void DetectHTTP2priorityFree(DetectEngineCtx *, void *)
this function will free memory associated with uint32_t
main detection engine ctx
@ DETECT_HTTP2_SIZEUPDATE
void DetectBufferTypeSupportsMultiInstance(const char *name)
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
one time registration of keywords at start up
int ByteExtractStringUint32(uint32_t *res, int base, size_t len, const char *str)
void DetectHTTP2sizeUpdateFree(DetectEngineCtx *, void *)
this function will free memory associated with uint32_t
@ DETECT_HTTP2_HEADERNAME
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
DetectEngineTransforms transforms
int DetectBufferTypeGetByName(const char *name)
DetectUintData_u8 * DetectU8Parse(const char *u8str)
This function is used to parse u8 options passed via some u8 keyword.
#define SIG_FLAG_TOSERVER
void InspectionBufferSetupMultiEmpty(InspectionBuffer *buffer)
setup the buffer empty
void DetectHTTP2sizeUpdateRegisterTests(void)
#define DETECT_ENGINE_INSPECT_SIG_MATCH
void DetectHTTP2settingsFree(DetectEngineCtx *, void *)
this function will free memory associated with rust signature context
DetectUintData_u8 DetectU8Data
const DetectEngineTransforms * transforms
void DetectHTTP2settingsRegisterTests(void)
void DetectAppLayerInspectEngineRegister2(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr2 Callback2, InspectionBufferGetDataPtr GetData)
register inspect engine at start up time
#define SCReturnPtr(x, type)
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
void DetectHTTP2windowRegisterTests(void)
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
SigMatch * SigMatchAlloc(void)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
uint16_t discontinue_matching
uint8_t DetectEngineContentInspection(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const Signature *s, const SigMatchData *smd, Packet *p, Flow *f, const uint8_t *buffer, uint32_t buffer_len, uint32_t stream_start_offset, uint8_t flags, uint8_t inspection_mode)
Run the actual payload match functions.
int ByteExtractStringUint8(uint8_t *res, int base, size_t len, const char *str)
struct AppLayerTxData AppLayerTxData
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)
int DetectU8Match(const uint8_t parg, const DetectUintData_u8 *du8)
#define DETECT_CI_FLAGS_SINGLE
int DetectBufferTypeRegister(const char *name)
void DetectHTTP2windowFree(DetectEngineCtx *, void *)
this function will free memory associated with uint32_t
struct DetectBufferMpmRegistry_::@86::@88 app_v2
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
int inspection_recursion_counter
DetectUintData_u32 DetectU32Data
void DetectHttp2Register(void)
Registration function for HTTP2 keywords.
void InspectionBufferSetupMulti(InspectionBuffer *buffer, const DetectEngineTransforms *transforms, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
uint8_t DetectEngineInspectGenericList(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct 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.
#define DETECT_ENGINE_INSPECT_SIG_NO_MATCH
struct DetectEngineAppInspectionEngine_::@83 v2
#define SCLogError(...)
Macro used to log ERROR messages.
void DetectHTTP2errorCodeRegisterTests(void)
a single match condition for a signature
const DetectEngineTransforms * transforms
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
InspectionBuffer * InspectionBufferMultipleForListGet(DetectEngineThreadCtx *det_ctx, const int list_id, const uint32_t local_id)
for a InspectionBufferMultipleForList get a InspectionBuffer
@ DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectHTTP2frameTypeRegisterTests(void)
this function registers unit tests for DetectHTTP2frameType
void DetectHTTP2errorcodeFree(DetectEngineCtx *, void *)
this function will free memory associated with uint32_t
void DetectHTTP2frametypeFree(DetectEngineCtx *, void *)
this function will free memory associated with uint8_t
void(* RegisterTests)(void)