detect: clean up inspect engine registration

pull/2310/head
Victor Julien 10 years ago
parent a24870f29f
commit 58ac4027ef

@ -101,9 +101,8 @@ 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,
void DetectAppLayerInspectEngineRegister(AppProto alproto,
uint32_t dir, int32_t sm_list,
int (*Callback)(ThreadVars *tv,
DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
@ -112,7 +111,7 @@ void DetectEngineRegisterAppInspectionEngine(AppProto alproto,
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)

@ -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,

Loading…
Cancel
Save