diff --git a/src/detect-engine.c b/src/detect-engine.c index 8aeda61049..0a74031e2b 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -101,18 +101,17 @@ static uint32_t DetectEngineTentantGetIdFromPcap(const void *ctx, const Packet * static DetectEngineAppInspectionEngine *g_app_inspect_engines = NULL; -void DetectEngineRegisterAppInspectionEngine(AppProto alproto, - uint16_t dir, - int32_t sm_list, - int (*Callback)(ThreadVars *tv, - DetectEngineCtx *de_ctx, - DetectEngineThreadCtx *det_ctx, - Signature *sig, Flow *f, - uint8_t flags, void *alstate, - void *tx, uint64_t tx_id)) +void DetectAppLayerInspectEngineRegister(AppProto alproto, + uint32_t dir, int32_t sm_list, + int (*Callback)(ThreadVars *tv, + DetectEngineCtx *de_ctx, + DetectEngineThreadCtx *det_ctx, + Signature *sig, Flow *f, + uint8_t flags, void *alstate, + void *tx, uint64_t tx_id)) { if ((alproto >= ALPROTO_FAILED) || - (dir > 1) || + (!(dir == SIG_FLAG_TOSERVER || dir == SIG_FLAG_TOCLIENT)) || (sm_list < DETECT_SM_LIST_MATCH || sm_list >= DETECT_SM_LIST_MAX) || (Callback == NULL)) { @@ -120,13 +119,20 @@ void DetectEngineRegisterAppInspectionEngine(AppProto alproto, exit(EXIT_FAILURE); } + int direction; + if (dir == SIG_FLAG_TOSERVER) { + direction = 0; + } else { + direction = 1; + } + DetectEngineAppInspectionEngine *new_engine = SCMalloc(sizeof(DetectEngineAppInspectionEngine)); if (unlikely(new_engine == NULL)) { exit(EXIT_FAILURE); } memset(new_engine, 0, sizeof(*new_engine)); new_engine->alproto = alproto; - new_engine->dir = dir; + new_engine->dir = direction; new_engine->sm_list = sm_list; new_engine->Callback = Callback; @@ -140,28 +146,6 @@ void DetectEngineRegisterAppInspectionEngine(AppProto alproto, t->next = new_engine; } - return; -} - -void DetectAppLayerInspectEngineRegister(AppProto alproto, - uint32_t dir, int32_t sm_list, - int (*Callback)(ThreadVars *tv, - DetectEngineCtx *de_ctx, - DetectEngineThreadCtx *det_ctx, - Signature *sig, Flow *f, - uint8_t flags, void *alstate, - void *tx, uint64_t tx_id)) -{ - BUG_ON(!(dir == SIG_FLAG_TOSERVER || dir == SIG_FLAG_TOCLIENT)); - - int direction; - if (dir == SIG_FLAG_TOSERVER) { - direction = 0; - } else { - direction = 1; - } - - DetectEngineRegisterAppInspectionEngine(alproto, direction, sm_list, Callback); } int DetectEngineAppInspectionEngine2Signature(Signature *s) diff --git a/src/detect-engine.h b/src/detect-engine.h index 4646a5099e..608f0685d8 100644 --- a/src/detect-engine.h +++ b/src/detect-engine.h @@ -78,23 +78,11 @@ int DetectEngineInspectGenericList(ThreadVars *, const DetectEngineCtx *, * \brief Registers an app inspection engine. * * \param alproto App layer protocol for which we will register the engine. - * \param direction The direction for the engine. 0 - toserver; 1- toclient. + * \param direction The direction for the engine: SIG_FLAG_TOSERVER or + * SIG_FLAG_TOCLIENT * \param sm_list The SigMatch list against which the engine works. - * \param inspect_flags The inspection flags to be used by de_state - * against the engine. - * \param match_flags The match flags to be used by de_state in tandem with - * the inpsect_flags. * \param Callback The engine callback. */ -void DetectEngineRegisterAppInspectionEngine(AppProto alproto, - uint16_t dir, - int32_t sm_list, - int (*Callback)(ThreadVars *tv, - DetectEngineCtx *de_ctx, - DetectEngineThreadCtx *det_ctx, - Signature *sig, Flow *f, - uint8_t flags, void *alstate, - void *tx, uint64_t tx_id)); void DetectAppLayerInspectEngineRegister(AppProto alproto, uint32_t dir, int32_t sm_list,