Go to the documentation of this file.
61 static bool DetectHttpRawHeaderValidateCallback(
const Signature *s,
const char **sigerror);
62 static int g_http_raw_header_buffer_id = 0;
65 const uint8_t flow_flags,
void *txv,
const int list_id);
83 "content modifier to match the raw HTTP header buffer";
85 "/rules/http-keywords.html#http-header-and-http-raw-header";
107 PrefilterMpmHttpHeaderRawRequestRegister, NULL,
ALPROTO_HTTP1,
110 PrefilterMpmHttpHeaderRawResponseRegister, NULL,
ALPROTO_HTTP1,
127 DetectHttpRawHeaderValidateCallback);
169 static bool DetectHttpRawHeaderValidateCallback(
const Signature *s,
const char **sigerror)
172 *sigerror =
"http_raw_header signature "
173 "without a flow direction. Use flow:to_server for "
174 "inspecting request headers or flow:to_client for "
175 "inspecting response headers.";
185 const uint8_t flow_flags,
void *txv,
const int list_id)
189 htp_tx_t *tx = (htp_tx_t *)txv;
195 const bool ts = ((flow_flags & STREAM_TOSERVER) != 0);
196 const uint8_t *data =
ts ?
200 const uint32_t data_len =
ts ?
217 const uint8_t *b = NULL;
219 if (rs_http2_tx_get_headers_raw(txv, flow_flags, &b, &b_len) != 1)
221 if (b == NULL || b_len == 0)
254 const int list_id =
ctx->list_id;
257 flags, txv, list_id);
262 const uint8_t *data = buffer->
inspect;
267 if (data != NULL && data_len >= mpm_ctx->
minlen) {
269 mpm_ctx, &det_ctx->
mtc, &det_ctx->
pmq, data, data_len);
287 PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, _txd,
flags);
291 static void PrefilterMpmHttpHeaderRawFree(
void *ptr)
317 pectx =
SCCalloc(1,
sizeof(*pectx));
353 pectx =
SCCalloc(1,
sizeof(*pectx));
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define SIGMATCH_INFO_STICKY_BUFFER
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.
#define SIGMATCH_INFO_CONTENT_MODIFIER
uint32_t request_headers_raw_len
Container for matching data for a signature group.
#define HTP_RESPONSE_PROGRESS_HEADERS
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
struct DetectBufferMpmRegistry_::@84::@86 app_v2
main detection engine ctx
one time registration of keywords at start up
#define SIG_FLAG_TOCLIENT
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
DetectEngineTransforms transforms
#define HTP_REQUEST_PROGRESS_TRAILER
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror))
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)
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
uint8_t request_has_trailers
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
struct AppLayerTxData AppLayerTxData
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)
uint8_t * response_headers_raw
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
#define HTP_REQUEST_PROGRESS_HEADERS
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
#define SCLogError(...)
Macro used to log ERROR messages.
void InspectionBufferSetup(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
#define HTP_RESPONSE_PROGRESS_TRAILER
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
uint32_t response_headers_raw_len
void(* RegisterTests)(void)