62static bool DetectHttpRawHeaderValidateCallback(
64static int g_http_raw_header_buffer_id = 0;
67 const uint8_t flow_flags,
void *txv,
const int list_id);
85 "content modifier to match the raw HTTP header buffer";
87 "/rules/http-keywords.html#http-header-and-http-raw-header";
109 PrefilterMpmHttpHeaderRawRequestRegister, NULL,
ALPROTO_HTTP1,
112 PrefilterMpmHttpHeaderRawResponseRegister, NULL,
ALPROTO_HTTP1,
129 DetectHttpRawHeaderValidateCallback);
171static bool DetectHttpRawHeaderValidateCallback(
175 *sigerror =
"http_raw_header signature "
176 "without a flow direction. Use flow:to_server for "
177 "inspecting request headers or flow:to_client for "
178 "inspecting response headers.";
188 const uint8_t flow_flags,
void *txv,
const int list_id)
192 htp_tx_t *tx = (htp_tx_t *)txv;
196 const bool ts = ((flow_flags & STREAM_TOSERVER) != 0);
197 const uint8_t *data =
ts ?
201 const uint32_t data_len =
ts ?
205 det_ctx, list_id, buffer, data, data_len, transforms);
218 const uint8_t *b = NULL;
220 if (SCHttp2TxGetHeadersRaw(txv, flow_flags, &b, &b_len) != 1)
222 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);
286 PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, _txd,
flags);
290static void PrefilterMpmHttpHeaderRawFree(
void *ptr)
309 HTP_REQUEST_PROGRESS_HEADERS + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
316 pectx =
SCCalloc(1,
sizeof(*pectx));
324 HTP_REQUEST_PROGRESS_TRAILER + 1, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
345 HTP_RESPONSE_PROGRESS_HEADERS, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
352 pectx =
SCCalloc(1,
sizeof(*pectx));
360 HTP_RESPONSE_PROGRESS_TRAILER, pectx, PrefilterMpmHttpHeaderRawFree, mpm_reg->
pname);
struct AppLayerTxData AppLayerTxData
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
void InspectionBufferSetupAndApplyTransforms(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
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const 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
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
@ DETECT_HTTP_RAW_HEADER_CM
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
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.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror, const DetectBufferType *))
int DetectBufferTypeGetByName(const char *name)
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
SigTableElmt * sigmatch_table
#define SIG_FLAG_TOCLIENT
#define SIGMATCH_INFO_STICKY_BUFFER
#define SIG_FLAG_TOSERVER
#define SIGMATCH_INFO_CONTENT_MODIFIER
one time registration of keywords at start up
DetectEngineTransforms transforms
struct DetectBufferMpmRegistry_::@98::@100 app_v2
main detection engine ctx
uint32_t request_headers_raw_len
uint8_t request_has_trailers
uint8_t * request_headers_raw
uint8_t * response_headers_raw
uint8_t response_has_trailers
uint32_t response_headers_raw_len
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
Container for matching data for a signature group.
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
void(* RegisterTests)(void)
#define SCLogError(...)
Macro used to log ERROR messages.
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)