detect: use InspectEngineFuncPtr in inspect engines

Replace explicit function pointer use by InspectEngineFuncPtr typedef
pull/2559/head
Victor Julien 9 years ago
parent 5f7e096be4
commit cf42fbf51f

@ -102,13 +102,7 @@ static uint32_t DetectEngineTentantGetIdFromPcap(const void *ctx, const Packet *
static DetectEngineAppInspectionEngine *g_app_inspect_engines = NULL; static DetectEngineAppInspectionEngine *g_app_inspect_engines = NULL;
void DetectAppLayerInspectEngineRegister(AppProto alproto, void DetectAppLayerInspectEngineRegister(AppProto alproto,
uint32_t dir, int32_t sm_list, uint32_t dir, int32_t sm_list, InspectEngineFuncPtr Callback)
int (*Callback)(ThreadVars *tv,
DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
const Signature *sig, Flow *f,
uint8_t flags, void *alstate,
void *tx, uint64_t tx_id))
{ {
if ((alproto >= ALPROTO_FAILED) || if ((alproto >= ALPROTO_FAILED) ||
(!(dir == SIG_FLAG_TOSERVER || dir == SIG_FLAG_TOCLIENT)) || (!(dir == SIG_FLAG_TOSERVER || dir == SIG_FLAG_TOCLIENT)) ||

@ -84,14 +84,7 @@ int DetectEngineInspectGenericList(ThreadVars *, const DetectEngineCtx *,
* \param Callback The engine callback. * \param Callback The engine callback.
*/ */
void DetectAppLayerInspectEngineRegister(AppProto alproto, void DetectAppLayerInspectEngineRegister(AppProto alproto,
uint32_t dir, uint32_t dir, int32_t sm_list, InspectEngineFuncPtr Callback);
int32_t sm_list,
int (*Callback)(ThreadVars *tv,
DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
const Signature *sig, Flow *f,
uint8_t flags, void *alstate,
void *tx, uint64_t tx_id));
int DetectEngineAppInspectionEngine2Signature(Signature *s); int DetectEngineAppInspectionEngine2Signature(Signature *s);

@ -375,6 +375,11 @@ typedef struct SigMatchData_ {
struct DetectEngineThreadCtx_;// DetectEngineThreadCtx; struct DetectEngineThreadCtx_;// DetectEngineThreadCtx;
typedef int (*InspectEngineFuncPtr)(ThreadVars *tv,
struct DetectEngineCtx_ *de_ctx, struct DetectEngineThreadCtx_ *det_ctx,
const struct Signature_ *sig, Flow *f, uint8_t flags, void *alstate,
void *tx, uint64_t tx_id);
typedef struct DetectEngineAppInspectionEngine_ { typedef struct DetectEngineAppInspectionEngine_ {
AppProto alproto; AppProto alproto;
uint8_t dir; uint8_t dir;
@ -387,10 +392,7 @@ typedef struct DetectEngineAppInspectionEngine_ {
* 3 Special value used by filestore sigs to indicate disabling * 3 Special value used by filestore sigs to indicate disabling
* filestore for the tx. * filestore for the tx.
*/ */
int (*Callback)(ThreadVars *tv, InspectEngineFuncPtr Callback;
struct DetectEngineCtx_ *de_ctx, struct DetectEngineThreadCtx_ *det_ctx,
const struct Signature_ *sig, Flow *f, uint8_t flags, void *alstate,
void *tx, uint64_t tx_id);
struct DetectEngineAppInspectionEngine_ *next; struct DetectEngineAppInspectionEngine_ *next;
} DetectEngineAppInspectionEngine; } DetectEngineAppInspectionEngine;

Loading…
Cancel
Save