Packet *, const Signature *, const SigMatchCtx *);
static void DetectAckRegisterTests(void);
static void DetectAckFree(void *);
-static int PrefilterSetupTcpAck(SigGroupHead *sgh);
+static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTcpAckIsPrefilterable(const Signature *s);
void DetectAckRegister(void)
return FALSE;
}
-static int PrefilterSetupTcpAck(SigGroupHead *sgh)
+static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_ACK,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ACK,
PrefilterPacketAckSet,
PrefilterPacketAckCompare,
PrefilterPacketAckMatch);
return FALSE;
}
-static int PrefilterSetupAppProto(SigGroupHead *sgh)
+static int PrefilterSetupAppProto(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_AL_APP_LAYER_PROTOCOL,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_AL_APP_LAYER_PROTOCOL,
PrefilterPacketAppProtoSet,
PrefilterPacketAppProtoCompare,
PrefilterPacketAppProtoMatch);
}
}
-static int PrefilterTxDceStubDataRequestRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxDceStubDataRequestRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
ALPROTO_DCERPC, 0,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
if (r == 0) {
- r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
+ r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
ALPROTO_SMB, 0,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
}
}
}
-static int PrefilterTxDceStubDataResponseRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxDceStubDataResponseRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
ALPROTO_DCERPC, 0,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
if (r == 0) {
- r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
+ r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
ALPROTO_SMB, 0,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
}
static void DsizeRegisterTests(void);
static void DetectDsizeFree(void *);
-static int PrefilterSetupDsize(SigGroupHead *sgh);
+static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterDsizeIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupDsize(SigGroupHead *sgh)
+static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_DSIZE,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_DSIZE,
PrefilterPacketDsizeSet,
PrefilterPacketDsizeCompare,
PrefilterPacketDsizeMatch);
#endif
}
-int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxDnsQuery,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDnsQuery,
ALPROTO_DNS, 1,
mpm_ctx, NULL, "dns_query");
}
#ifndef __DETECT_ENGINE_DNS_H__
#define __DETECT_ENGINE_DNS_H__
-int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectDnsQueryName(ThreadVars *,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
#ifndef __DETECT_ENGINE_FILEDATA_H__
#define __DETECT_ENGINE_FILEDATA_H__
+int PrefilterMpmFiledataRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx,
+ const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx,
const void *pectx,
Packet *p, Flow *f, void *txv,
}
}
-int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestBody,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestBody,
ALPROTO_HTTP, HTP_REQUEST_BODY,
mpm_ctx, NULL, "http_client_body");
}
#include "app-layer-htp.h"
-int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpClientBody(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxRequestCookie,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestCookie,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_cookie (request)");
}
}
}
-int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxResponseCookie,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseCookie,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, "http_cookie (response)");
}
#include "app-layer-htp.h"
-int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpCookie(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHostname,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostname,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_host");
}
#include "app-layer-htp.h"
-int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpHH(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
- return PrefilterAppendTxEngine(sgh, PrefilterTxMethod,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxMethod,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_method");
}
const Signature *s, const SigMatchData *smd,
Flow *f, uint8_t flags, void *alstate, void *tx, uint64_t tx_id);
-int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
void DetectEngineHttpMethodRegisterTests(void);
}
}
-int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
ALPROTO_HTTP, HTP_REQUEST_HEADERS+1, /* inspect when headers complete */
mpm_ctx, NULL, "http_raw_header (request)");
if (r != 0)
return r;
- return PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
ALPROTO_HTTP, HTP_REQUEST_TRAILER+1, /* inspect when trailer complete */
mpm_ctx, NULL, "http_raw_header (request)");
}
}
}
-int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS+1, /* inspect when headers complete */
mpm_ctx, NULL, "http_raw_header (response)");
if (r != 0)
return r;
- return PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
ALPROTO_HTTP, HTP_RESPONSE_TRAILER+1, /* inspect when trailer complete */
mpm_ctx, NULL, "http_raw_header (response)");
}
#include "app-layer-htp.h"
-int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpRawHeader(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHostnameRaw,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostnameRaw,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_raw_host");
}
#include "app-layer-htp.h"
-int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpHRH(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxRawUri,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRawUri,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_raw_uri");
}
#include "app-layer-htp.h"
-int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpRawUri(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseBody,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseBody,
ALPROTO_HTTP, HTP_RESPONSE_BODY,
mpm_ctx, NULL, "file_data (http response)");
}
#include "app-layer-htp.h"
-int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpServerBody(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatCode,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatCode,
ALPROTO_HTTP,
HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
mpm_ctx, NULL, "http_stat_code");
#include "app-layer-htp.h"
-int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpStatCode(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatMsg,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatMsg,
ALPROTO_HTTP,
HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
mpm_ctx, NULL, "http_stat_msg");
#include "app-layer-htp.h"
-int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpStatMsg(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxUA,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUA,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_user_agent");
}
#include "app-layer-htp.h"
-int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpUA(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
*/
void DetectAppLayerMpmRegister2(const char *name,
int direction, int priority,
- int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+ int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
InspectionBufferGetDataPtr GetData,
AppProto alproto, int tx_min_progress)
void DetectAppLayerMpmRegister(const char *name,
int direction, int priority,
- int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx))
+ int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx))
{
SCLogDebug("registering %s/%d/%d/%p",
name, direction, priority, PrefilterRegister);
if (SGH_DIRECTION_TS(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TS);
if (mpm_store != NULL) {
- PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TS);
if (mpm_store != NULL) {
- PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
SetRawReassemblyFlag(de_ctx, sh);
if (SGH_DIRECTION_TC(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TC);
if (mpm_store != NULL) {
- PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TC);
if (mpm_store != NULL) {
- PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
SetRawReassemblyFlag(de_ctx, sh);
if (SGH_DIRECTION_TS(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TS);
if (mpm_store != NULL) {
- PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
if (SGH_DIRECTION_TC(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TC);
if (mpm_store != NULL) {
- PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
} else {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_OTHERIP);
if (mpm_store != NULL) {
- PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+ PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
/* if we have just certain types of negated patterns,
* mpm_ctx can be NULL */
if (a->reg->v2.PrefilterRegisterWithListId && mpm_store->mpm_ctx) {
- BUG_ON(a->reg->v2.PrefilterRegisterWithListId(sh, mpm_store->mpm_ctx,
+ BUG_ON(a->reg->v2.PrefilterRegisterWithListId(de_ctx,
+ sh, mpm_store->mpm_ctx,
a->reg, a->reg->sm_list) != 0);
SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
}
else if (a->reg->PrefilterRegister && mpm_store->mpm_ctx) {
- BUG_ON(a->reg->PrefilterRegister(sh, mpm_store->mpm_ctx) != 0);
+ BUG_ON(a->reg->PrefilterRegister(de_ctx, sh, mpm_store->mpm_ctx) != 0);
SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
}
}
*/
void DetectAppLayerMpmRegister(const char *name,
int direction, int priority,
- int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx));
+ int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx));
void DetectAppLayerMpmRegister2(const char *name,
int direction, int priority,
- int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+ int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
InspectionBufferGetDataPtr GetData,
AppProto alproto, int tx_min_progress);
}
}
-int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
- return PrefilterAppendPayloadEngine(sgh, PrefilterPktStream, mpm_ctx, NULL, "stream");
+ return PrefilterAppendPayloadEngine(de_ctx, sgh,
+ PrefilterPktStream, mpm_ctx, NULL, "stream");
}
static void PrefilterPktPayload(DetectEngineThreadCtx *det_ctx,
p->payload, p->payload_len);
}
-int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
- return PrefilterAppendPayloadEngine(sgh, PrefilterPktPayload, mpm_ctx, NULL, "payload");
+ return PrefilterAppendPayloadEngine(de_ctx, sgh,
+ PrefilterPktPayload, mpm_ctx, NULL, "payload");
}
#ifndef __DETECT_ENGINE_PAYLOAD_H__
#define __DETECT_ENGINE_PAYLOAD_H__
-int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectPacketPayload(DetectEngineCtx *,
DetectEngineThreadCtx *, const Signature *, Flow *, Packet *);
/** \internal
*/
static int
-SetupEngineForPacketHeader(SigGroupHead *sgh, int sm_type,
- PrefilterPacketHeaderHashCtx *hctx,
+SetupEngineForPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
+ int sm_type, PrefilterPacketHeaderHashCtx *hctx,
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
{
SCLogDebug("%s: ctx %p extra type %u extra value %u, sig cnt %u",
sigmatch_table[sm_type].name, ctx, ctx->type, ctx->value,
ctx->sigs_cnt);
- PrefilterAppendEngine(sgh, Match, ctx, PrefilterPacketHeaderFree,
- sigmatch_table[sm_type].name);
+ PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
+ PrefilterPacketHeaderFree, sigmatch_table[sm_type].name);
return 0;
}
* \todo deduplicate sigs arrays
*/
static int
-SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_type,
- uint32_t *counts,
+SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type, uint32_t *counts,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
}
if (cnt) {
- PrefilterAppendEngine(sgh, Match, ctx,
+ PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
PrefilterPacketU8HashCtxFree,
sigmatch_table[sm_type].name);
} else {
/** \internal
* \brief setup a engine for each unique value
*/
-static void SetupSingle(HashListTable *hash_table,
+static void SetupSingle(DetectEngineCtx *de_ctx, HashListTable *hash_table,
SigGroupHead *sgh, int sm_type,
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
for ( ; hb != NULL; hb = HashListTableGetListNext(hb)) {
PrefilterPacketHeaderHashCtx *ctx = HashListTableGetListData(hb);
- SetupEngineForPacketHeader(sgh, sm_type,
+ SetupEngineForPacketHeader(de_ctx, sgh, sm_type,
ctx, Compare, Match);
}
}
/** \internal
* \brief setup a single engine with a hash map for u8 values
*/
-static void SetupU8Hash(HashListTable *hash_table,
+static void SetupU8Hash(DetectEngineCtx *de_ctx, HashListTable *hash_table,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
}
}
- SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(sgh, sm_type,
+ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(de_ctx, sgh, sm_type,
counts, Set, Compare, Match);
}
-static int PrefilterSetupPacketHeaderCommon(SigGroupHead *sgh, int sm_type,
+static int PrefilterSetupPacketHeaderCommon(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
}
if (u8hash == FALSE) {
- SetupSingle(hash_table, sgh, sm_type, Compare, Match);
+ SetupSingle(de_ctx, hash_table, sgh, sm_type, Compare, Match);
} else {
- SetupU8Hash(hash_table, sgh, sm_type, Set, Compare, Match);
+ SetupU8Hash(de_ctx, hash_table, sgh, sm_type, Set, Compare, Match);
}
HashListTableFree(hash_table);
return -1;
}
-int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx))
{
- return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
+ return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
Set, Compare, Match, TRUE);
}
-int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx))
{
- return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
+ return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
Set, Compare, Match, FALSE);
}
#define PREFILTER_U8HASH_MODE_GT 2
#define PREFILTER_U8HASH_MODE_RA 3
-int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx));
-int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
#include "util-profiling.h"
-static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *));
+static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
+ const char *name, void (*FreeFunc)(void *));
static const PrefilterStore *PrefilterStoreGetStore(const uint32_t id);
static inline void QuickSortSigIntId(SigIntId *sids, uint32_t n)
}
}
-int PrefilterAppendEngine(SigGroupHead *sgh,
+int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name)
}
e->name = name;
- e->gid = PrefilterStoreGetId(e->name, e->Free);
+ e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
-int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
+int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name)
}
e->name = name;
- e->gid = PrefilterStoreGetId(e->name, e->Free);
+ e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
-int PrefilterAppendTxEngine(SigGroupHead *sgh,
+int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterTxFunc)(DetectEngineThreadCtx *det_ctx, const void *pectx,
Packet *p, Flow *f, void *tx,
const uint64_t idx, const uint8_t flags),
}
e->name = name;
- e->gid = PrefilterStoreGetId(e->name, e->Free);
+ e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
for (i = 0; i < DETECT_TBLSIZE; i++)
{
if (sigmatch_table[i].SetupPrefilter != NULL) {
- sigmatch_table[i].SetupPrefilter(sgh);
+ sigmatch_table[i].SetupPrefilter(de_ctx, sgh);
}
}
}
SCMutexUnlock(&g_prefilter_mutex);
}
-static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *))
+static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
+ const char *name, void (*FreeFunc)(void *))
{
PrefilterStore ctx = { name, FreeFunc, 0 };
SCFree(ptr);
}
-int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id)
{
SCEnter();
pectx->mpm_ctx = mpm_ctx;
pectx->transforms = &mpm_reg->v2.transforms;
- int r = PrefilterAppendTxEngine(sgh, PrefilterMpm,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterMpm,
mpm_reg->v2.alproto, mpm_reg->v2.tx_min_progress,
pectx, PrefilterGenericMpmFree, mpm_reg->pname);
if (r != 0) {
void Prefilter(DetectEngineThreadCtx *, const SigGroupHead *, Packet *p,
const uint8_t flags);
-int PrefilterAppendEngine(SigGroupHead *sgh,
+int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name);
-int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
+int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name);
-int PrefilterAppendTxEngine(SigGroupHead *sgh,
+int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx,
Packet *p, Flow *f, void *tx,
const uint64_t idx, const uint8_t flags),
const char *PrefilterStoreGetName(const uint32_t id);
#endif
-int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
#endif
}
}
-int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSni,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSni,
ALPROTO_TLS, 0, // TODO a special 'cert ready' state might be good to add
mpm_ctx, NULL, "tls_sni");
}
}
}
-int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxTlsIssuer,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsIssuer,
ALPROTO_TLS, TLS_STATE_CERT_READY,
mpm_ctx, NULL, "tls_cert_issuer");
}
}
}
-int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSubject,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSubject,
ALPROTO_TLS, TLS_STATE_CERT_READY,
mpm_ctx, NULL, "tls_cert_subject");
}
}
}
-int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
TLS_STATE_CERT_READY, mpm_ctx, NULL,
"tls_cert_serial");
}
}
}
-int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
TLS_STATE_CERT_READY, mpm_ctx, NULL,
"tls_cert_fingerprint");
}
#ifndef __DETECT_ENGINE_TLS_H__
#define __DETECT_ENGINE_TLS_H__
-int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectTlsSni(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
}
}
-int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxUri,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUri,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_uri");
}
#ifndef __DETECT_ENGINE_URICONTENT_H__
#define __DETECT_ENGINE_URICONTENT_H__
-int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpUri(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
static void DetectFiledataSetupCallback(Signature *s);
static int g_file_data_buffer_id = 0;
-static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
/**
* \brief Registration function for keyword: file_data
g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
}
-static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxFiledata,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxFiledata,
ALPROTO_SMTP, 0,
mpm_ctx, NULL, "file_data (smtp)");
}
static void DetectFlagsFree(void *);
static _Bool PrefilterTcpFlagsIsPrefilterable(const Signature *s);
-static int PrefilterSetupTcpFlags(SigGroupHead *sgh);
+static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
/**
* \brief Registration function for flags: keyword
return FALSE;
}
-static int PrefilterSetupTcpFlags(SigGroupHead *sgh)
+static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_FLAGS,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLAGS,
PrefilterPacketFlagsSet,
PrefilterPacketFlagsCompare,
PrefilterPacketFlagsMatch);
void DetectFlowRegisterTests(void);
void DetectFlowFree(void *);
-static int PrefilterSetupFlow(SigGroupHead *sgh);
+static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFlowIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupFlow(SigGroupHead *sgh)
+static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_FLOW,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLOW,
PrefilterPacketFlowSet,
PrefilterPacketFlowCompare,
PrefilterPacketFlowMatch);
static int DetectFragBitsSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectFragBitsFree(void *);
-static int PrefilterSetupFragBits(SigGroupHead *sgh);
+static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFragBitsIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupFragBits(SigGroupHead *sgh)
+static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_FRAGBITS,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGBITS,
PrefilterPacketFragBitsSet,
PrefilterPacketFragBitsCompare,
PrefilterPacketFragBitsMatch);
void DetectFragOffsetRegisterTests(void);
void DetectFragOffsetFree(void *);
-static int PrefilterSetupFragOffset(SigGroupHead *sgh);
+static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFragOffsetIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupFragOffset(SigGroupHead *sgh)
+static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_FRAGOFFSET,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGOFFSET,
PrefilterPacketFragOffsetSet,
PrefilterPacketFragOffsetCompare,
PrefilterPacketFragOffsetMatch);
}
}
#endif
-static int PrefilterTxHttpRequestHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeaderNamesRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaderNames,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaderNames,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
#endif
-static int PrefilterTxHttpResponseHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeaderNamesRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaderNames,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaderNames,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
}
}
-static int PrefilterTxHttpRequestHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeadersRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaders,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaders,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_header (request)");
if (r != 0)
return r;
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestTrailers,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestTrailers,
ALPROTO_HTTP, HTP_REQUEST_TRAILER,
mpm_ctx, NULL, "http_header (request trailer)");
}
}
}
-static int PrefilterTxHttpResponseHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeadersRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaders,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaders,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, "http_header (response)");
if (r != 0)
return r;
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseTrailers,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseTrailers,
ALPROTO_HTTP, HTP_RESPONSE_TRAILER,
mpm_ctx, NULL, "http_header (response trailer)");
}
}
}
#endif
-static int PrefilterTxHttpRequestHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeaderRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeader,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeader,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
#endif
-static int PrefilterTxHttpResponseHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeaderRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeader,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeader,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
}
}
-static int PrefilterTxHttpRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestProtocolRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestProtocol,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestProtocol,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
-static int PrefilterTxHttpResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseProtocolRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseProtocol,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseProtocol,
ALPROTO_HTTP, HTP_RESPONSE_LINE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
static int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectHttpRequestLineRegisterTests(void);
-static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int DetectEngineInspectHttpRequestLine(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
const Signature *s, const SigMatchData *smd,
}
}
-static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestLine,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestLine,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_request_line");
}
static int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectHttpResponseLineRegisterTests(void);
-static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int DetectEngineInspectHttpResponseLine(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
const Signature *s, const SigMatchData *smd,
}
}
-static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseLine,
+ return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseLine,
ALPROTO_HTTP, HTP_RESPONSE_LINE,
mpm_ctx, NULL, "http_response_line");
}
}
}
-static int PrefilterTxHttpRequestStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestStartRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestStart,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestStart,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
-static int PrefilterTxHttpResponseStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseStartRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseStart,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseStart,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpIdRegisterTests(void);
void DetectIcmpIdFree(void *);
-static int PrefilterSetupIcmpId(SigGroupHead *sgh);
+static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupIcmpId(SigGroupHead *sgh)
+static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_ID,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_ID,
PrefilterPacketIcmpIdSet,
PrefilterPacketIcmpIdCompare,
PrefilterPacketIcmpIdMatch);
static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpSeqRegisterTests(void);
void DetectIcmpSeqFree(void *);
-static int PrefilterSetupIcmpSeq(SigGroupHead *sgh);
+static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupIcmpSeq(SigGroupHead *sgh)
+static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_SEQ,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_SEQ,
PrefilterPacketIcmpSeqSet,
PrefilterPacketIcmpSeqCompare,
PrefilterPacketIcmpSeqMatch);
void DetectICodeRegisterTests(void);
void DetectICodeFree(void *);
-static int PrefilterSetupICode(SigGroupHead *sgh);
+static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterICodeIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupICode(SigGroupHead *sgh)
+static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ICODE,
+ return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ICODE,
PrefilterPacketICodeSet,
PrefilterPacketICodeCompare,
PrefilterPacketICodeMatch);
void DetectIdRegisterTests(void);
void DetectIdFree(void *);
-static int PrefilterSetupId(SigGroupHead *sgh);
+static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIdIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupId(SigGroupHead *sgh)
+static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_ID,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ID,
PrefilterPacketIdSet,
PrefilterPacketIdCompare,
PrefilterPacketIdMatch);
void DetectITypeRegisterTests(void);
void DetectITypeFree(void *);
-static int PrefilterSetupIType(SigGroupHead *sgh);
+static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterITypeIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupIType(SigGroupHead *sgh)
+static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ITYPE,
+ return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ITYPE,
PrefilterPacketITypeSet,
PrefilterPacketITypeCompare,
PrefilterPacketITypeMatch);
Packet *, const Signature *, const SigMatchCtx *);
static void DetectSeqRegisterTests(void);
static void DetectSeqFree(void *);
-static int PrefilterSetupTcpSeq(SigGroupHead *sgh);
+static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTcpSeqIsPrefilterable(const Signature *s);
void DetectSeqRegister(void)
return FALSE;
}
-static int PrefilterSetupTcpSeq(SigGroupHead *sgh)
+static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_SEQ,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_SEQ,
PrefilterPacketSeqSet,
PrefilterPacketSeqCompare,
PrefilterPacketSeqMatch);
}
}
-static int PrefilterTxSshRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshRequestProtocolRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestProtocol,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestProtocol,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
-static int PrefilterTxSshResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshResponseProtocolRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseProtocol,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseProtocol,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
}
}
-static int PrefilterTxSshRequestSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshRequestSoftwareRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestSoftware,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestSoftware,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
}
}
-static int PrefilterTxSshResponseSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshResponseSoftwareRegister(DetectEngineCtx *de_ctx,
+ SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
- int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseSoftware,
+ int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseSoftware,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;
void DetectTtlFree (void *);
void DetectTtlRegisterTests (void);
-static int PrefilterSetupTtl(SigGroupHead *sgh);
+static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTtlIsPrefilterable(const Signature *s);
/**
return FALSE;
}
-static int PrefilterSetupTtl(SigGroupHead *sgh)
+static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
- return PrefilterSetupPacketHeader(sgh, DETECT_TTL,
+ return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_TTL,
PrefilterPacketTtlSet,
PrefilterPacketTtlCompare,
PrefilterPacketTtlMatch);
int direction; /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
int sm_list;
- int (*PrefilterRegister)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
+ int (*PrefilterRegister)(struct DetectEngineCtx_ *de_ctx,
+ struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
int priority;
struct {
- int (*PrefilterRegisterWithListId)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
+ int (*PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx,
+ struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
const struct DetectMpmAppLayerRegistery_ *mpm_reg, int list_id);
InspectionBufferGetDataPtr GetData;
AppProto alproto;
int (*Setup)(DetectEngineCtx *, Signature *, const char *);
_Bool (*SupportsPrefilter)(const Signature *s);
- int (*SetupPrefilter)(struct SigGroupHead_ *sgh);
+ int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh);
void (*Free)(void *);
void (*RegisterTests)(void);