Go to the documentation of this file.
62 static int g_http_method_buffer_id = 0;
69 static bool DetectHttpMethodValidateCallback(
const Signature *s,
const char **sigerror);
72 const uint8_t _flow_flags,
void *txv,
const int list_id);
114 "http request method");
117 DetectHttpMethodValidateCallback);
121 SCLogDebug(
"registering http_method rule option");
165 static bool DetectHttpMethodValidateCallback(
const Signature *s,
const char **sigerror)
168 for ( ; sm != NULL; sm = sm->
next) {
174 *sigerror =
"http_method pattern with trailing space";
177 }
else if (cd->
content[0] == 0x20) {
178 *sigerror =
"http_method pattern with leading space";
182 *sigerror =
"http_method pattern with trailing tab";
185 }
else if (cd->
content[0] == 0x09) {
186 *sigerror =
"http_method pattern with leading tab";
197 const uint8_t _flow_flags,
void *txv,
const int list_id)
201 htp_tx_t *tx = (htp_tx_t *)txv;
203 if (tx->request_method == NULL)
206 const uint32_t data_len = bstr_len(tx->request_method);
207 const uint8_t *data = bstr_ptr(tx->request_method);
223 const uint8_t *b = NULL;
225 if (rs_http2_tx_get_method(txv, &b, &b_len) != 1)
227 if (b == NULL || b_len == 0)
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define SIGMATCH_INFO_STICKY_BUFFER
#define SIGMATCH_INFO_CONTENT_MODIFIER
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id)
main detection engine ctx
@ SC_ERR_INVALID_SIGNATURE
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
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))
void DetectHttpMethodRegisterTests(void)
this function registers unit tests for DetectHttpMethod
int 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.
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
void DetectAppLayerInspectEngineRegister2(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr2 Callback2, InspectionBufferGetDataPtr GetData)
register inspect engine at start up time
SignatureInitData * init_data
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
struct SigMatch_ ** smlists
void DetectHttpMethodFree(void *)
void DetectAppLayerMpmRegister2(const char *name, int direction, int priority, int(*PrefilterRegister)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistery *mpm_reg, int list_id), InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register a MPM engine
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Handle HTTP method match.
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
a single match condition for a signature
int DetectBufferSetActiveList(Signature *s, const int list)
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectHttpMethodRegister(void)
Registration function for keyword: http_method.
void(* RegisterTests)(void)