diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index ee78ae4519..a93eb28eed 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -71,8 +71,8 @@ AlpProtoDetectCtx alp_proto_ctx; void AlpProtoInit(AlpProtoDetectCtx *ctx) { memset(ctx, 0x00, sizeof(AlpProtoDetectCtx)); - MpmInitCtx(&ctx->toserver.mpm_ctx, MPM_B2G, -1); - MpmInitCtx(&ctx->toclient.mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&ctx->toserver.mpm_ctx, MPM_B2G); + MpmInitCtx(&ctx->toclient.mpm_ctx, MPM_B2G); memset(&ctx->toserver.map, 0x00, sizeof(ctx->toserver.map)); memset(&ctx->toclient.map, 0x00, sizeof(ctx->toclient.map)); diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index a309369a7a..b058cebc62 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -821,7 +821,7 @@ static void SMTPSetMpmState(void) } memset(smtp_mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - mpm_table[SMTP_MPM].InitCtx(smtp_mpm_ctx, -1); + mpm_table[SMTP_MPM].InitCtx(smtp_mpm_ctx); mpm_table[SMTP_MPM].InitThreadCtx(smtp_mpm_ctx, smtp_mpm_thread_ctx, 0); uint32_t i = 0; diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index 592a1bd13f..e1994c6a27 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -846,7 +846,7 @@ void PatternMatchDestroy(MpmCtx *mpm_ctx, uint16_t mpm_matcher) { void PatternMatchPrepare(MpmCtx *mpm_ctx, uint16_t mpm_matcher) { SCLogDebug("mpm_ctx %p, mpm_matcher %"PRIu16"", mpm_ctx, mpm_matcher); - MpmInitCtx(mpm_ctx, mpm_matcher, -1); + MpmInitCtx(mpm_ctx, mpm_matcher); } void PatternMatchThreadPrint(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matcher) { @@ -2163,8 +2163,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) SCLogDebug("sh->mpm_proto_tcp_ctx == NULL. This should never happen"); exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_proto_tcp_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_proto_tcp_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_proto_tcp_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_proto_tcp_ctx_tc, de_ctx->mpm_matcher); if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) { sh->mpm_proto_udp_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx, de_ctx->sgh_mpm_context_proto_udp_packet, 0); @@ -2177,8 +2177,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) SCLogDebug("sh->mpm_proto_udp_ctx == NULL. This should never happen"); exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_proto_udp_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_proto_udp_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_proto_udp_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_proto_udp_ctx_tc, de_ctx->mpm_matcher); if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) { sh->mpm_proto_other_ctx = @@ -2191,7 +2191,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) SCLogDebug("sh->mpm_proto_other_ctx == NULL. This should never happen"); exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_proto_other_ctx, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_proto_other_ctx, de_ctx->mpm_matcher); } /* if (has_co_packet) */ if (has_co_stream) { @@ -2206,8 +2206,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) SCLogDebug("sh->mpm_stream_ctx == NULL. This should never happen"); exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_stream_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_stream_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_stream_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_stream_ctx_tc, de_ctx->mpm_matcher); } if (has_co_uri) { @@ -2223,8 +2223,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_uri_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_uri_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_uri_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_uri_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hcbd) { @@ -2240,8 +2240,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hcbd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hcbd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hcbd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hcbd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hsbd) { @@ -2257,8 +2257,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hsbd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hsbd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hsbd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hsbd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hhd) { @@ -2274,8 +2274,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hhd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hhd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hhd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hhd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hrhd) { @@ -2291,8 +2291,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hrhd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hrhd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hrhd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hrhd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hmd) { @@ -2308,8 +2308,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hmd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hmd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hmd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hmd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hcd) { @@ -2325,8 +2325,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hcd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hcd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hcd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hcd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hrud) { @@ -2342,8 +2342,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hrud_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hrud_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hrud_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hrud_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hsmd) { @@ -2359,8 +2359,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hsmd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hsmd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hsmd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hsmd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hscd) { @@ -2376,8 +2376,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hscd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hscd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hscd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hscd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_huad) { @@ -2393,8 +2393,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_huad_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_huad_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_huad_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_huad_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hhhd) { @@ -2410,8 +2410,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hhhd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hhhd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hhhd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hhhd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_hrhhd) { @@ -2427,8 +2427,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_hrhhd_ctx_ts, de_ctx->mpm_matcher, -1); - MpmInitCtx(sh->mpm_hrhhd_ctx_tc, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_hrhhd_ctx_ts, de_ctx->mpm_matcher); + MpmInitCtx(sh->mpm_hrhhd_ctx_tc, de_ctx->mpm_matcher); } if (has_co_dnsquery) { @@ -2442,7 +2442,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh) exit(EXIT_FAILURE); } - MpmInitCtx(sh->mpm_dnsquery_ctx_ts, de_ctx->mpm_matcher, -1); + MpmInitCtx(sh->mpm_dnsquery_ctx_ts, de_ctx->mpm_matcher); } if (has_co_packet || diff --git a/src/util-mpm-ac-bs.c b/src/util-mpm-ac-bs.c index 44ff034816..84fbc23f61 100644 --- a/src/util-mpm-ac-bs.c +++ b/src/util-mpm-ac-bs.c @@ -56,7 +56,7 @@ #include "util-unittest.h" #include "util-memcmp.h" -void SCACBSInitCtx(MpmCtx *, int); +void SCACBSInitCtx(MpmCtx *); void SCACBSInitThreadCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void SCACBSDestroyCtx(MpmCtx *); void SCACBSDestroyThreadCtx(MpmCtx *, MpmThreadCtx *); @@ -1286,7 +1286,7 @@ void SCACBSInitThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t * \param module_handle Cuda module handle from the cuda handler API. We don't * have to worry about this here. */ -void SCACBSInitCtx(MpmCtx *mpm_ctx, int module_handle) +void SCACBSInitCtx(MpmCtx *mpm_ctx) { if (mpm_ctx->ctx != NULL) return; @@ -1710,7 +1710,7 @@ static int SCACBSTest01(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1744,7 +1744,7 @@ static int SCACBSTest02(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1777,7 +1777,7 @@ static int SCACBSTest03(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1814,7 +1814,7 @@ static int SCACBSTest04(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1848,7 +1848,7 @@ static int SCACBSTest05(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -1882,7 +1882,7 @@ static int SCACBSTest06(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1914,7 +1914,7 @@ static int SCACBSTest07(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* should match 30 times */ @@ -1959,7 +1959,7 @@ static int SCACBSTest08(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1991,7 +1991,7 @@ static int SCACBSTest09(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2023,7 +2023,7 @@ static int SCACBSTest10(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2060,7 +2060,7 @@ static int SCACBSTest11(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); if (SCACBSAddPatternCS(&mpm_ctx, (uint8_t *)"he", 2, 0, 0, 1, 0, 0) == -1) @@ -2107,7 +2107,7 @@ static int SCACBSTest12(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2142,7 +2142,7 @@ static int SCACBSTest13(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2176,7 +2176,7 @@ static int SCACBSTest14(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2210,7 +2210,7 @@ static int SCACBSTest15(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2244,7 +2244,7 @@ static int SCACBSTest16(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2278,7 +2278,7 @@ static int SCACBSTest17(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2312,7 +2312,7 @@ static int SCACBSTest18(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2346,7 +2346,7 @@ static int SCACBSTest19(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2379,7 +2379,7 @@ static int SCACBSTest20(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2413,7 +2413,7 @@ static int SCACBSTest21(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2445,7 +2445,7 @@ static int SCACBSTest22(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2480,7 +2480,7 @@ static int SCACBSTest23(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2512,7 +2512,7 @@ static int SCACBSTest24(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2544,7 +2544,7 @@ static int SCACBSTest25(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -2578,7 +2578,7 @@ static int SCACBSTest26(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCI(&mpm_ctx, (uint8_t *)"Works", 5, 0, 0, 0, 0, 0); @@ -2611,7 +2611,7 @@ static int SCACBSTest27(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ @@ -2644,7 +2644,7 @@ static int SCACBSTest28(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ @@ -2677,7 +2677,7 @@ static int SCACBSTest29(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_BS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_BS); SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACBSAddPatternCS(&mpm_ctx, (uint8_t *)"abcde", 5, 0, 0, 0, 0, 0); diff --git a/src/util-mpm-ac-gfbs.c b/src/util-mpm-ac-gfbs.c index 0f18c451ea..0f66f2b6f0 100644 --- a/src/util-mpm-ac-gfbs.c +++ b/src/util-mpm-ac-gfbs.c @@ -50,7 +50,7 @@ #include "util-debug.h" #include "util-unittest.h" -void SCACGfbsInitCtx(MpmCtx *, int); +void SCACGfbsInitCtx(MpmCtx *); void SCACGfbsInitThreadCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void SCACGfbsDestroyCtx(MpmCtx *); void SCACGfbsDestroyThreadCtx(MpmCtx *, MpmThreadCtx *); @@ -1158,7 +1158,7 @@ void SCACGfbsInitThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, * \param module_handle Cuda module handle from the cuda handler API. We don't * have to worry about this here. */ -void SCACGfbsInitCtx(MpmCtx *mpm_ctx, int module_handle) +void SCACGfbsInitCtx(MpmCtx *mpm_ctx) { if (mpm_ctx->ctx != NULL) return; @@ -1668,7 +1668,7 @@ static int SCACGfbsTest01(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1701,7 +1701,7 @@ static int SCACGfbsTest02(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1734,7 +1734,7 @@ static int SCACGfbsTest03(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1771,7 +1771,7 @@ static int SCACGfbsTest04(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACGfbsAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1805,7 +1805,7 @@ static int SCACGfbsTest05(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACGfbsAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -1839,7 +1839,7 @@ static int SCACGfbsTest06(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACGfbsAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1871,7 +1871,7 @@ static int SCACGfbsTest07(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* should match 30 times */ @@ -1916,7 +1916,7 @@ static int SCACGfbsTest08(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1948,7 +1948,7 @@ static int SCACGfbsTest09(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -1980,7 +1980,7 @@ static int SCACGfbsTest10(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2017,7 +2017,7 @@ static int SCACGfbsTest11(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); if (SCACGfbsAddPatternCS(&mpm_ctx, (uint8_t *)"he", 2, 0, 0, 1, 0, 0) == -1) @@ -2064,7 +2064,7 @@ static int SCACGfbsTest12(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2099,7 +2099,7 @@ static int SCACGfbsTest13(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2133,7 +2133,7 @@ static int SCACGfbsTest14(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2167,7 +2167,7 @@ static int SCACGfbsTest15(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2201,7 +2201,7 @@ static int SCACGfbsTest16(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2235,7 +2235,7 @@ static int SCACGfbsTest17(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2269,7 +2269,7 @@ static int SCACGfbsTest18(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2303,7 +2303,7 @@ static int SCACGfbsTest19(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2337,7 +2337,7 @@ static int SCACGfbsTest20(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2371,7 +2371,7 @@ static int SCACGfbsTest21(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2403,7 +2403,7 @@ static int SCACGfbsTest22(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2438,7 +2438,7 @@ static int SCACGfbsTest23(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2470,7 +2470,7 @@ static int SCACGfbsTest24(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2502,7 +2502,7 @@ static int SCACGfbsTest25(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACGfbsAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -2536,7 +2536,7 @@ static int SCACGfbsTest26(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACGfbsAddPatternCI(&mpm_ctx, (uint8_t *)"Works", 5, 0, 0, 0, 0, 0); @@ -2568,7 +2568,7 @@ static int SCACGfbsTest27(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ @@ -2600,7 +2600,7 @@ static int SCACGfbsTest28(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_GFBS, -1); + MpmInitCtx(&mpm_ctx, MPM_AC_GFBS); SCACGfbsInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ diff --git a/src/util-mpm-ac.c b/src/util-mpm-ac.c index a8562a5236..8c218a0896 100644 --- a/src/util-mpm-ac.c +++ b/src/util-mpm-ac.c @@ -66,7 +66,7 @@ #include "util-cuda-handlers.h" #endif /* __SC_CUDA_SUPPORT__ */ -void SCACInitCtx(MpmCtx *, int); +void SCACInitCtx(MpmCtx *); void SCACInitThreadCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void SCACDestroyCtx(MpmCtx *); void SCACDestroyThreadCtx(MpmCtx *, MpmThreadCtx *); @@ -1085,10 +1085,8 @@ void SCACInitThreadCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t m * \brief Initialize the AC context. * * \param mpm_ctx Mpm context. - * \param module_handle Cuda module handle from the cuda handler API. We don't - * have to worry about this here. */ -void SCACInitCtx(MpmCtx *mpm_ctx, int module_handle) +void SCACInitCtx(MpmCtx *mpm_ctx) { if (mpm_ctx->ctx != NULL) return; @@ -2196,7 +2194,7 @@ static int SCACTest01(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2230,7 +2228,7 @@ static int SCACTest02(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2263,7 +2261,7 @@ static int SCACTest03(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2300,7 +2298,7 @@ static int SCACTest04(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -2334,7 +2332,7 @@ static int SCACTest05(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -2368,7 +2366,7 @@ static int SCACTest06(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -2400,7 +2398,7 @@ static int SCACTest07(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* should match 30 times */ @@ -2445,7 +2443,7 @@ static int SCACTest08(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2477,7 +2475,7 @@ static int SCACTest09(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2509,7 +2507,7 @@ static int SCACTest10(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2546,7 +2544,7 @@ static int SCACTest11(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); if (SCACAddPatternCS(&mpm_ctx, (uint8_t *)"he", 2, 0, 0, 1, 0, 0) == -1) @@ -2593,7 +2591,7 @@ static int SCACTest12(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2628,7 +2626,7 @@ static int SCACTest13(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2662,7 +2660,7 @@ static int SCACTest14(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2696,7 +2694,7 @@ static int SCACTest15(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2730,7 +2728,7 @@ static int SCACTest16(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2764,7 +2762,7 @@ static int SCACTest17(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2798,7 +2796,7 @@ static int SCACTest18(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2832,7 +2830,7 @@ static int SCACTest19(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2866,7 +2864,7 @@ static int SCACTest20(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2900,7 +2898,7 @@ static int SCACTest21(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2932,7 +2930,7 @@ static int SCACTest22(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 match */ @@ -2967,7 +2965,7 @@ static int SCACTest23(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -2999,7 +2997,7 @@ static int SCACTest24(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 1 */ @@ -3031,7 +3029,7 @@ static int SCACTest25(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -3065,7 +3063,7 @@ static int SCACTest26(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); SCACAddPatternCI(&mpm_ctx, (uint8_t *)"Works", 5, 0, 0, 0, 0, 0); @@ -3098,7 +3096,7 @@ static int SCACTest27(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ @@ -3131,7 +3129,7 @@ static int SCACTest28(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC, -1); + MpmInitCtx(&mpm_ctx, MPM_AC); SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx, 0); /* 0 match */ diff --git a/src/util-mpm-b2g.c b/src/util-mpm-b2g.c index 293f01ee87..f262672bfe 100644 --- a/src/util-mpm-b2g.c +++ b/src/util-mpm-b2g.c @@ -60,7 +60,7 @@ static void *b2g_func; #define B2G_HASH16(a,b) (((a) << b2g_hash_shift) | (b)) -void B2gInitCtx (MpmCtx *, int); +void B2gInitCtx (MpmCtx *); void B2gThreadInitCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void B2gDestroyCtx(MpmCtx *); void B2gThreadDestroyCtx(MpmCtx *, MpmThreadCtx *); @@ -758,7 +758,7 @@ static void B2gGetConfig() } } -void B2gInitCtx (MpmCtx *mpm_ctx, int module_handle) { +void B2gInitCtx (MpmCtx *mpm_ctx) { SCLogDebug("mpm_ctx %p, ctx %p", mpm_ctx, mpm_ctx->ctx); if (mpm_ctx->ctx != NULL) @@ -1249,7 +1249,7 @@ static int B2gTestInit01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1269,7 +1269,7 @@ static int B2gTestInit01 (void) { static int B2gTestS0Init01 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1288,7 +1288,7 @@ static int B2gTestS0Init01 (void) { static int B2gTestS0Init02 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1308,7 +1308,7 @@ static int B2gTestS0Init02 (void) { static int B2gTestS0Init03 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1328,7 +1328,7 @@ static int B2gTestS0Init03 (void) { static int B2gTestS0Init04 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abab", 4, 0, 0, 0, 0); /* 1 match */ @@ -1347,7 +1347,7 @@ static int B2gTestS0Init04 (void) { static int B2gTestS0Init05 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcab", 5, 0, 0, 0, 0); /* 1 match */ @@ -1369,7 +1369,7 @@ static int B2gTestSearch01 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1394,7 +1394,7 @@ static int B2gTestSearch02 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abce", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1419,7 +1419,7 @@ static int B2gTestSearch03 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1447,7 +1447,7 @@ static int B2gTestSearch04 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1475,7 +1475,7 @@ static int B2gTestSearch05 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1502,7 +1502,7 @@ static int B2gTestSearch05a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1532,7 +1532,7 @@ static int B2gTestSearch06 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1557,7 +1557,7 @@ static int B2gTestSearch07 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -1588,7 +1588,7 @@ static int B2gTestSearch08 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1613,7 +1613,7 @@ static int B2gTestSearch09 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"ab", 2, 0, 0, 0, 0, 0); /* 1 match */ @@ -1638,7 +1638,7 @@ static int B2gTestSearch10 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefgh", 8, 0, 0, 0, 0, 0); /* 1 match */ @@ -1668,7 +1668,7 @@ static int B2gTestSearch11 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1694,7 +1694,7 @@ static int B2gTestSearch12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"wxyz", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1720,7 +1720,7 @@ static int B2gTestSearch13 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCD", 30, 0, 0, 0, 0, 0); /* 1 match */ @@ -1745,7 +1745,7 @@ static int B2gTestSearch14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDE", 31, 0, 0, 0, 0, 0); /* 1 match */ @@ -1770,7 +1770,7 @@ static int B2gTestSearch15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDEF", 32, 0, 0, 0, 0, 0); /* 1 match */ @@ -1795,7 +1795,7 @@ static int B2gTestSearch16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABC", 29, 0, 0, 0, 0, 0); /* 1 match */ @@ -1820,7 +1820,7 @@ static int B2gTestSearch17 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzAB", 28, 0, 0, 0, 0, 0); /* 1 match */ @@ -1845,7 +1845,7 @@ static int B2gTestSearch18 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"abcde""fghij""klmno""pqrst""uvwxy""z", 26, 0, 0, 0, 0, 0); /* 1 match */ @@ -1870,7 +1870,7 @@ static int B2gTestSearch19 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 30, 0, 0, 0, 0, 0); /* 1 */ @@ -1895,7 +1895,7 @@ static int B2gTestSearch20 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA", 32, 0, 0, 0, 0, 0); /* 1 */ @@ -1922,7 +1922,7 @@ static int B2gTestSearch21 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; B2gAddPatternCS(&mpm_ctx, (uint8_t *)"AA", 2, 0, 0, 0, 0, 0); /* 1 */ @@ -1948,7 +1948,7 @@ static int B2gTestSearchXX (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2G, -1); + MpmInitCtx(&mpm_ctx, MPM_B2G); B2gCtx *ctx = (B2gCtx *)mpm_ctx.ctx; FILE *fp = fopen("/usr/share/dict/words", "r"); diff --git a/src/util-mpm-b2gc.c b/src/util-mpm-b2gc.c index f7ab47c979..e9799a50da 100644 --- a/src/util-mpm-b2gc.c +++ b/src/util-mpm-b2gc.c @@ -67,7 +67,7 @@ static void *b2g_func; /* align pattern storage to these bytes. 1 disables. */ #define B2GC_ALIGN_PATTERNS 2 -void B2gcInitCtx (MpmCtx *, int); +void B2gcInitCtx (MpmCtx *); void B2gcThreadInitCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void B2gcDestroyCtx(MpmCtx *); void B2gcThreadDestroyCtx(MpmCtx *, MpmThreadCtx *); @@ -901,7 +901,7 @@ static void B2gcGetConfig() } } -void B2gcInitCtx (MpmCtx *mpm_ctx, int module_handle) { +void B2gcInitCtx (MpmCtx *mpm_ctx) { SCLogDebug("mpm_ctx %p, ctx %p", mpm_ctx, mpm_ctx->ctx); if (mpm_ctx->ctx != NULL) @@ -1288,7 +1288,7 @@ static int B2gcTestInit01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1308,7 +1308,7 @@ static int B2gcTestInit01 (void) { static int B2gcTestS0Init01 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1327,7 +1327,7 @@ static int B2gcTestS0Init01 (void) { static int B2gcTestS0Init02 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1347,7 +1347,7 @@ static int B2gcTestS0Init02 (void) { static int B2gcTestS0Init03 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1367,7 +1367,7 @@ static int B2gcTestS0Init03 (void) { static int B2gcTestS0Init04 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abab", 4, 0, 0, 0, 0); /* 1 match */ @@ -1386,7 +1386,7 @@ static int B2gcTestS0Init04 (void) { static int B2gcTestS0Init05 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcab", 5, 0, 0, 0, 0); /* 1 match */ @@ -1408,7 +1408,7 @@ static int B2gcTestSearch01 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1433,7 +1433,7 @@ static int B2gcTestSearch02 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abce", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1458,7 +1458,7 @@ static int B2gcTestSearch03 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1486,7 +1486,7 @@ static int B2gcTestSearch04 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1514,7 +1514,7 @@ static int B2gcTestSearch05 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1541,7 +1541,7 @@ static int B2gcTestSearch05a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1571,7 +1571,7 @@ static int B2gcTestSearch05b (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1601,7 +1601,7 @@ static int B2gcTestSearch05c (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCI(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1627,7 +1627,7 @@ static int B2gcTestSearch05d (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCI(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1653,7 +1653,7 @@ static int B2gcTestSearch06 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1678,7 +1678,7 @@ static int B2gcTestSearch06a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); /* 1 match */ @@ -1703,7 +1703,7 @@ static int B2gcTestSearch07 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -1737,7 +1737,7 @@ static int B2gcTestSearch07a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -1762,7 +1762,7 @@ static int B2gcTestSearch08 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1787,7 +1787,7 @@ static int B2gcTestSearch09 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"ab", 2, 0, 0, 0, 0, 0); /* 1 match */ @@ -1812,7 +1812,7 @@ static int B2gcTestSearch10 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefgh", 8, 0, 0, 0, 0, 0); /* 1 match */ @@ -1842,7 +1842,7 @@ static int B2gcTestSearch11 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1868,7 +1868,7 @@ static int B2gcTestSearch12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"wxyz", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1894,7 +1894,7 @@ static int B2gcTestSearch13 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCD", 30, 0, 0, 0, 0, 0); /* 1 match */ @@ -1919,7 +1919,7 @@ static int B2gcTestSearch14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDE", 31, 0, 0, 0, 0, 0); /* 1 match */ @@ -1944,7 +1944,7 @@ static int B2gcTestSearch15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDEF", 32, 0, 0, 0, 0, 0); /* 1 match */ @@ -1969,7 +1969,7 @@ static int B2gcTestSearch16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABC", 29, 0, 0, 0, 0, 0); /* 1 match */ @@ -1994,7 +1994,7 @@ static int B2gcTestSearch17 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzAB", 28, 0, 0, 0, 0, 0); /* 1 match */ @@ -2019,7 +2019,7 @@ static int B2gcTestSearch18 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"abcde""fghij""klmno""pqrst""uvwxy""z", 26, 0, 0, 0, 0, 0); /* 1 match */ @@ -2044,7 +2044,7 @@ static int B2gcTestSearch19 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 30, 0, 0, 0, 0, 0); /* 1 */ @@ -2069,7 +2069,7 @@ static int B2gcTestSearch20 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA", 32, 0, 0, 0, 0, 0); /* 1 */ @@ -2096,7 +2096,7 @@ static int B2gcTestSearch21 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; B2gcAddPatternCS(&mpm_ctx, (uint8_t *)"AA", 2, 0, 0, 0, 0, 0); /* 1 */ @@ -2122,7 +2122,7 @@ static int B2gcTestSearchXX (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GC, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GC); B2gcCtx *ctx = (B2gcCtx *)mpm_ctx.ctx; FILE *fp = fopen("/usr/share/dict/words", "r"); diff --git a/src/util-mpm-b2gm.c b/src/util-mpm-b2gm.c index 9217310178..649b3ec5a6 100644 --- a/src/util-mpm-b2gm.c +++ b/src/util-mpm-b2gm.c @@ -58,7 +58,7 @@ static void *b2g_func; #define B2GM_HASH16(a,b) (((a) << b2gm_hash_shift) | (b)) -void B2gmInitCtx (MpmCtx *, int); +void B2gmInitCtx (MpmCtx *); void B2gmThreadInitCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void B2gmDestroyCtx(MpmCtx *); void B2gmThreadDestroyCtx(MpmCtx *, MpmThreadCtx *); @@ -810,7 +810,7 @@ static void B2gmGetConfig() } } -void B2gmInitCtx (MpmCtx *mpm_ctx, int module_handle) { +void B2gmInitCtx (MpmCtx *mpm_ctx) { SCLogDebug("mpm_ctx %p, ctx %p", mpm_ctx, mpm_ctx->ctx); BUG_ON(mpm_ctx->ctx != NULL); @@ -1190,7 +1190,7 @@ static int B2gmTestInit01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1210,7 +1210,7 @@ static int B2gmTestInit01 (void) { static int B2gmTestS0Init01 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1229,7 +1229,7 @@ static int B2gmTestS0Init01 (void) { static int B2gmTestS0Init02 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1249,7 +1249,7 @@ static int B2gmTestS0Init02 (void) { static int B2gmTestS0Init03 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1269,7 +1269,7 @@ static int B2gmTestS0Init03 (void) { static int B2gmTestS0Init04 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abab", 4, 0, 0, 0, 0); /* 1 match */ @@ -1288,7 +1288,7 @@ static int B2gmTestS0Init04 (void) { static int B2gmTestS0Init05 (void) { int result = 0; MpmCtx mpm_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcab", 5, 0, 0, 0, 0); /* 1 match */ @@ -1310,7 +1310,7 @@ static int B2gmTestSearch01 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1335,7 +1335,7 @@ static int B2gmTestSearch02 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abce", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1360,7 +1360,7 @@ static int B2gmTestSearch02a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); /* 1 match */ @@ -1385,7 +1385,7 @@ static int B2gmTestSearch02b (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCI(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* 1 match */ @@ -1410,7 +1410,7 @@ static int B2gmTestSearch03 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1437,7 +1437,7 @@ static int B2gmTestSearch03a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); /* 1 match */ @@ -1465,7 +1465,7 @@ static int B2gmTestSearch04 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1493,7 +1493,7 @@ static int B2gmTestSearch05 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1520,7 +1520,7 @@ static int B2gmTestSearch05a (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1550,7 +1550,7 @@ static int B2gmTestSearch06 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1575,7 +1575,7 @@ static int B2gmTestSearch07 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -1609,7 +1609,7 @@ static int B2gmTestSearch08 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1634,7 +1634,7 @@ static int B2gmTestSearch09 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"ab", 2, 0, 0, 0, 0, 0); /* 1 match */ @@ -1659,7 +1659,7 @@ static int B2gmTestSearch10 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefgh", 8, 0, 0, 0, 0, 0); /* 1 match */ @@ -1689,7 +1689,7 @@ static int B2gmTestSearch11 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1715,7 +1715,7 @@ static int B2gmTestSearch12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"wxyz", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1741,7 +1741,7 @@ static int B2gmTestSearch13 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCD", 30, 0, 0, 0, 0, 0); /* 1 match */ @@ -1766,7 +1766,7 @@ static int B2gmTestSearch14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDE", 31, 0, 0, 0, 0, 0); /* 1 match */ @@ -1791,7 +1791,7 @@ static int B2gmTestSearch15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABCDEF", 32, 0, 0, 0, 0, 0); /* 1 match */ @@ -1816,7 +1816,7 @@ static int B2gmTestSearch16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzABC", 29, 0, 0, 0, 0, 0); /* 1 match */ @@ -1841,7 +1841,7 @@ static int B2gmTestSearch17 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefghijklmnopqrstuvwxyzAB", 28, 0, 0, 0, 0, 0); /* 1 match */ @@ -1866,7 +1866,7 @@ static int B2gmTestSearch18 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"abcde""fghij""klmno""pqrst""uvwxy""z", 26, 0, 0, 0, 0, 0); /* 1 match */ @@ -1891,7 +1891,7 @@ static int B2gmTestSearch19 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 30, 0, 0, 0, 0, 0); /* 1 */ @@ -1916,7 +1916,7 @@ static int B2gmTestSearch20 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA", 32, 0, 0, 0, 0, 0); /* 1 */ @@ -1943,7 +1943,7 @@ static int B2gmTestSearch21 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; B2gmAddPatternCS(&mpm_ctx, (uint8_t *)"AA", 2, 0, 0, 0, 0, 0); /* 1 */ @@ -1969,7 +1969,7 @@ static int B2gmTestSearchXX (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B2GM, -1); + MpmInitCtx(&mpm_ctx, MPM_B2GM); B2gmCtx *ctx = (B2gmCtx *)mpm_ctx.ctx; FILE *fp = fopen("/usr/share/dict/words", "r"); diff --git a/src/util-mpm-b3g.c b/src/util-mpm-b3g.c index 73985e8c1c..1434c416ac 100644 --- a/src/util-mpm-b3g.c +++ b/src/util-mpm-b3g.c @@ -55,7 +55,7 @@ static void *b3g_func; #define B3G_HASH(a,b,c) (((a) << b3g_hash_shift) | (b) << (b3g_hash_shift2) |(c)) -void B3gInitCtx (MpmCtx *, int); +void B3gInitCtx (MpmCtx *); void B3gThreadInitCtx(MpmCtx *, MpmThreadCtx *, uint32_t); void B3gDestroyCtx(MpmCtx *); void B3gThreadDestroyCtx(MpmCtx *, MpmThreadCtx *); @@ -703,7 +703,7 @@ void B3gGetConfig() } } -void B3gInitCtx (MpmCtx *mpm_ctx, int module_handle) { +void B3gInitCtx (MpmCtx *mpm_ctx) { //printf("B3gInitCtx: mpm_ctx %p\n", mpm_ctx); mpm_ctx->ctx = SCMalloc(sizeof(B3gCtx)); @@ -1230,7 +1230,7 @@ static int B3gTestInit01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1251,7 +1251,7 @@ static int B3gTestS0Init01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1271,7 +1271,7 @@ static int B3gTestS0Init02 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1292,7 +1292,7 @@ static int B3gTestS0Init03 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0); /* 1 match */ @@ -1313,7 +1313,7 @@ static int B3gTestS0Init04 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abab", 4, 0, 0, 0, 0); /* 1 match */ @@ -1333,7 +1333,7 @@ static int B3gTestS0Init05 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcab", 5, 0, 0, 0, 0); /* 1 match */ @@ -1355,7 +1355,7 @@ static int B3gTestSearch01 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1380,7 +1380,7 @@ static int B3gTestSearch02 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abce", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1405,7 +1405,7 @@ static int B3gTestSearch03 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1433,7 +1433,7 @@ static int B3gTestSearch04 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1461,7 +1461,7 @@ static int B3gTestSearch05 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1488,7 +1488,7 @@ static int B3gTestSearch06 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1513,7 +1513,7 @@ static int B3gTestSearch07 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -1544,7 +1544,7 @@ static int B3gTestSearch08 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1569,7 +1569,7 @@ static int B3gTestSearch09 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"ab", 2, 0, 0, 0, 0, 0); /* 1 match */ @@ -1594,7 +1594,7 @@ static int B3gTestSearch10 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcdefgh", 8, 0, 0, 0, 0, 0); /* 1 match */ @@ -1619,7 +1619,7 @@ static int B3gTestSearch11 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); /* 1 match */ @@ -1645,7 +1645,7 @@ static int B3gTestSearch12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_B3G, -1); + MpmInitCtx(&mpm_ctx, MPM_B3G); B3gCtx *ctx = (B3gCtx *)mpm_ctx.ctx; B3gAddPatternCS(&mpm_ctx, (uint8_t *)"wxyz", 4, 0, 0, 0, 0, 0); /* 1 match */ diff --git a/src/util-mpm-wumanber.c b/src/util-mpm-wumanber.c index 9ecf8237ec..f621990115 100644 --- a/src/util-mpm-wumanber.c +++ b/src/util-mpm-wumanber.c @@ -59,7 +59,7 @@ static uint32_t wm_hash_size = 0; static uint32_t wm_bloom_size = 0; -void WmInitCtx (MpmCtx *mpm_ctx, int); +void WmInitCtx (MpmCtx *mpm_ctx); void WmThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t); void WmDestroyCtx(MpmCtx *mpm_ctx); void WmThreadDestroyCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx); @@ -1301,7 +1301,7 @@ void WmGetConfig() } } -void WmInitCtx (MpmCtx *mpm_ctx, int module_handle) { +void WmInitCtx (MpmCtx *mpm_ctx) { SCLogDebug("mpm_ctx %p", mpm_ctx); mpm_ctx->ctx = SCMalloc(sizeof(WmCtx)); @@ -1459,7 +1459,7 @@ int WmTestInitCtx01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - WmInitCtx(&mpm_ctx, -1); + WmInitCtx(&mpm_ctx); if (mpm_ctx.ctx != NULL) result = 1; @@ -1472,7 +1472,7 @@ int WmTestInitCtx02 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - WmInitCtx(&mpm_ctx, -1); + WmInitCtx(&mpm_ctx); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1487,7 +1487,7 @@ int WmTestInitCtx03 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); if (mpm_table[MPM_WUMANBER].Search == WmSearch) result = 1; @@ -1503,7 +1503,7 @@ int WmTestThreadInitCtx01 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); if (mpm_thread_ctx.memory_cnt == 2) @@ -1526,7 +1526,7 @@ int WmTestThreadInitCtx02 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmThreadCtx *tctx = (WmThreadCtx *)mpm_thread_ctx.ctx; @@ -1548,7 +1548,7 @@ int WmTestInitAddPattern01 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); int ret = WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 1234, 0, 0); @@ -1566,7 +1566,7 @@ int WmTestInitAddPattern02 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1585,7 +1585,7 @@ int WmTestInitAddPattern03 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1607,7 +1607,7 @@ int WmTestInitAddPattern04 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1629,7 +1629,7 @@ int WmTestInitAddPattern05 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1651,7 +1651,7 @@ int WmTestInitAddPattern06 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; @@ -1671,7 +1671,7 @@ int WmTestPrepare01 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); @@ -1688,7 +1688,7 @@ int WmTestPrepare02 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); WmPreparePatterns(&mpm_ctx); @@ -1705,7 +1705,7 @@ int WmTestPrepare03 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); WmPreparePatterns(&mpm_ctx); @@ -1724,7 +1724,7 @@ int WmTestPrepare04 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); @@ -1741,7 +1741,7 @@ int WmTestPrepare05 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); WmPreparePatterns(&mpm_ctx); @@ -1758,7 +1758,7 @@ int WmTestPrepare06 (void) { int result = 0; MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); WmPreparePatterns(&mpm_ctx); @@ -1779,7 +1779,7 @@ int WmTestSearch01 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1805,7 +1805,7 @@ int WmTestSearch01Hash12 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1833,7 +1833,7 @@ int WmTestSearch01Hash14 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1861,7 +1861,7 @@ int WmTestSearch01Hash15 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1889,7 +1889,7 @@ int WmTestSearch01Hash16 (void) { memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1916,7 +1916,7 @@ int WmTestSearch02 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1938,7 +1938,7 @@ int WmTestSearch03 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1961,7 +1961,7 @@ int WmTestSearch04 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"bcde", 4, 0, 0, 0, 0, 0); @@ -1983,7 +1983,7 @@ int WmTestSearch05 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"efgh", 4, 0, 0, 0, 0, 0); @@ -2005,7 +2005,7 @@ int WmTestSearch06 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"eFgH", 4, 0, 0, 0, 0, MPM_PATTERN_FLAG_NOCASE); @@ -2027,7 +2027,7 @@ int WmTestSearch07 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -2050,7 +2050,7 @@ int WmTestSearch08 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"abcde", 5, 0, 0, 0, 0, 0); @@ -2073,7 +2073,7 @@ int WmTestSearch09 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"ab", 2, 0, 0, 0, 0, 0); @@ -2095,7 +2095,7 @@ int WmTestSearch10 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"bc", 2, 0, 0, 0, 0, 0); WmAddPattern(&mpm_ctx, (uint8_t *)"gh", 2, 0, 0, 1, 0, 0); @@ -2118,7 +2118,7 @@ int WmTestSearch11 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmAddPattern(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); WmAddPattern(&mpm_ctx, (uint8_t *)"d", 1, 0, 0, 1, 0, 0); @@ -2142,7 +2142,7 @@ int WmTestSearch12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, MPM_PATTERN_FLAG_NOCASE); @@ -2168,7 +2168,7 @@ int WmTestSearch13 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"a", 1, 0, 0, 0, 0, 0); @@ -2194,7 +2194,7 @@ int WmTestSearch14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, MPM_PATTERN_FLAG_NOCASE); @@ -2220,7 +2220,7 @@ int WmTestSearch15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 1, 1, 0, 0, 0); @@ -2247,7 +2247,7 @@ int WmTestSearch16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPattern(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 1, 1, 0, 0, 0); @@ -2274,7 +2274,7 @@ int WmTestSearch17 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2299,7 +2299,7 @@ int WmTestSearch18Hash12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2324,7 +2324,7 @@ int WmTestSearch18Hash14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2349,7 +2349,7 @@ int WmTestSearch18Hash15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2374,7 +2374,7 @@ int WmTestSearch18 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2400,7 +2400,7 @@ int WmTestSearch18Hash16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2426,7 +2426,7 @@ int WmTestSearch19 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCI(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2451,7 +2451,7 @@ int WmTestSearch19Hash12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCI(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2477,7 +2477,7 @@ int WmTestSearch19Hash14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCI(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2503,7 +2503,7 @@ int WmTestSearch19Hash15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCI(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2529,7 +2529,7 @@ int WmTestSearch19Hash16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCI(&mpm_ctx, (uint8_t *)"/VideoAccessCodecInstall.exe", 28, 0, 0, 0, 0, 0); @@ -2555,7 +2555,7 @@ int WmTestSearch20 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2580,7 +2580,7 @@ int WmTestSearch20Hash12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2605,7 +2605,7 @@ int WmTestSearch20Hash14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2631,7 +2631,7 @@ int WmTestSearch20Hash15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2657,7 +2657,7 @@ int WmTestSearch20Hash16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2683,7 +2683,7 @@ int WmTestSearch21 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2708,7 +2708,7 @@ static int WmTestSearch21Hash12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2734,7 +2734,7 @@ static int WmTestSearch21Hash14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2760,7 +2760,7 @@ static int WmTestSearch21Hash15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2786,7 +2786,7 @@ static int WmTestSearch21Hash16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"/videoaccesscodecinstall.exe", 28, 0, 0, 0, 0, 0); @@ -2812,7 +2812,7 @@ static int WmTestSearch22Hash9 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -2845,7 +2845,7 @@ static int WmTestSearch22Hash12 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -2878,7 +2878,7 @@ static int WmTestSearch22Hash14 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -2911,7 +2911,7 @@ static int WmTestSearch22Hash15 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ @@ -2944,7 +2944,7 @@ static int WmTestSearch22Hash16 (void) { MpmCtx mpm_ctx; memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); MpmThreadCtx mpm_thread_ctx; - MpmInitCtx(&mpm_ctx, MPM_WUMANBER, -1); + MpmInitCtx(&mpm_ctx, MPM_WUMANBER); WmCtx *ctx = (WmCtx *)mpm_ctx.ctx; WmAddPatternCS(&mpm_ctx, (uint8_t *)"A", 1, 0, 0, 0, 0, 0); /* should match 30 times */ diff --git a/src/util-mpm.c b/src/util-mpm.c index 3f2d11b513..904b6702a5 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -548,9 +548,9 @@ void MpmInitThreadCtx(MpmThreadCtx *mpm_thread_ctx, uint16_t matcher, uint32_t m mpm_table[matcher].InitThreadCtx(NULL, mpm_thread_ctx, max_id); } -void MpmInitCtx (MpmCtx *mpm_ctx, uint16_t matcher, int module_handle) { +void MpmInitCtx (MpmCtx *mpm_ctx, uint16_t matcher) { mpm_ctx->mpm_type = matcher; - mpm_table[matcher].InitCtx(mpm_ctx, module_handle); + mpm_table[matcher].InitCtx(mpm_ctx); } void MpmTableSetup(void) { diff --git a/src/util-mpm.h b/src/util-mpm.h index 6b3c266760..605b9c6ff6 100644 --- a/src/util-mpm.h +++ b/src/util-mpm.h @@ -151,7 +151,7 @@ typedef struct MpmCtxFactoryContainer_ { typedef struct MpmTableElmt_ { char *name; uint8_t max_pattern_length; - void (*InitCtx)(struct MpmCtx_ *, int); + void (*InitCtx)(struct MpmCtx_ *); void (*InitThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *, uint32_t); void (*DestroyCtx)(struct MpmCtx_ *); void (*DestroyThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *); @@ -235,7 +235,7 @@ void MpmRegisterTests(void); int32_t MpmMatcherGetMaxPatternLength(uint16_t); int MpmVerifyMatch(MpmThreadCtx *, PatternMatcherQueue *, uint32_t); -void MpmInitCtx (MpmCtx *mpm_ctx, uint16_t matcher, int module_handle); +void MpmInitCtx(MpmCtx *mpm_ctx, uint16_t matcher); void MpmInitThreadCtx(MpmThreadCtx *mpm_thread_ctx, uint16_t, uint32_t); uint32_t MpmGetHashSize(const char *); uint32_t MpmGetBloomSize(const char *);