Go to the documentation of this file.
24 #ifndef SURICATA_DETECT_ENGINE_H
25 #define SURICATA_DETECT_ENGINE_H
43 const uint8_t *data,
const uint32_t data_len);
63 bool (*ValidateCallback)(
const Signature *,
const char **sigerror));
68 const int direction,
const AppProto alproto,
const uint8_t frame_type);
84 const uint8_t *content, uint16_t content_len,
const char **namestr);
98 void *(*InitFunc)(
void *),
void *data,
void (*FreeFunc)(
void *));
105 #define DetectEngineGetMaxSigId(de_ctx) ((de_ctx)->signum)
147 void *alstate,
void *txv, uint64_t tx_id);
151 const Signature *s,
Flow *f, uint8_t
flags,
void *alstate,
void *txv, uint64_t tx_id);
187 uint8_t *alert_flags);
205 const Signature *s, uint32_t inspect_flags, uint8_t flow_flags,
206 const uint16_t file_no_match);
int DetectEngineMultiTenantSetup(const bool unix_socket)
setup multi-detect / multi-tenancy
int DetectEngineReloadIsIdle(void)
int DetectBufferTypeRegister(const char *name)
int DetectEngineBufferTypeRegister(DetectEngineCtx *de_ctx, const char *name)
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
Container for matching data for a signature group.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback2, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
int DetectBufferTypeGetByName(const char *name)
bool DetectEnginePktInspectionRun(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, const Signature *s, Flow *f, Packet *p, uint8_t *alert_flags)
InspectionBuffer * InspectionBufferMultipleForListGet(DetectEngineThreadCtx *det_ctx, const int list_id, uint32_t local_id)
for a InspectionBufferMultipleForList get a InspectionBuffer
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectEngineBufferTypeSupportsFrames(DetectEngineCtx *de_ctx, const char *name)
InspectionBuffer *(* InspectionMultiBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv, const int list_id, const uint32_t local_id)
int DetectEngineTenantUnregisterPcapFile(uint32_t tenant_id)
uint8_t DetectEngineInspectGenericList(DetectEngineCtx *, DetectEngineThreadCtx *, const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *, void *, uint64_t)
Do the content inspection & validation for a signature.
void InspectionBufferFree(InspectionBuffer *buffer)
DetectEngineCtx * DetectEngineReference(DetectEngineCtx *)
InspectionBuffer *(* InspectionBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv, const int list_id)
int DetectEngineAppInspectionEngine2Signature(DetectEngineCtx *de_ctx, Signature *s)
void * DetectThreadCtxGetGlobalKeywordThreadCtx(DetectEngineThreadCtx *det_ctx, int id)
Retrieve thread local keyword ctx by id.
main detection engine ctx
void * InspectionBufferCheckAndExpand(InspectionBuffer *buffer, uint32_t min_size)
make sure that the buffer has at least 'min_size' bytes Expand the buffer if necessary
const char * DetectEngineBufferTypeGetDescriptionById(const DetectEngineCtx *de_ctx, const int id)
int DetectEngineReloadIsStart(void)
void DetectEngineResetMaxSigId(DetectEngineCtx *)
void InspectionBufferClean(DetectEngineThreadCtx *det_ctx)
InspectionBuffer *(* InspectionBufferGetPktDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Packet *p, const int list_id)
DetectEngineCtx * DetectEngineCtxInitWithPrefix(const char *prefix, uint32_t tenant_id)
bool DetectEngineBufferTypeSupportsMultiInstanceGetById(const DetectEngineCtx *de_ctx, const int id)
int DetectEnginePktInspectionSetup(Signature *s)
int DetectEngineReload(const SCInstance *suri)
Reload the detection engine.
int DetectEngineLoadTenantBlocking(uint32_t tenant_id, const char *yaml)
Load a tenant and wait for loading to complete.
DetectEngineCtx * DetectEngineCtxInit(void)
int DetectEngineTenantRegisterLivedev(uint32_t tenant_id, int device_id)
void DetectEnginePruneFreeList(void)
void DetectEngineBufferTypeSupportsMpm(DetectEngineCtx *de_ctx, const char *name)
const char * DetectBufferTypeGetDescriptionByName(const char *name)
void DetectBufferTypeRegisterSetupCallback(const char *name, void(*Callback)(const DetectEngineCtx *, Signature *))
void InspectionBufferTruncate(InspectionBuffer *buffer, uint32_t buf_len)
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
void DetectRunStoreStateTx(const SigGroupHead *sgh, Flow *f, void *tx, uint64_t tx_id, const Signature *s, uint32_t inspect_flags, uint8_t flow_flags, const uint16_t file_no_match)
DetectEngineCtx * DetectEngineGetByTenantId(uint32_t tenant_id)
int DetectEngineTenantUnregisterVlanId(uint32_t tenant_id, uint16_t vlan_id)
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
void DetectBufferTypeSupportsFrames(const char *name)
void DetectEngineUnsetParseMetadata(void)
void InspectionBufferSetup(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
int(* InspectionBufferPktInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEnginePktInspectionEngine *engine, const struct Signature_ *s, Packet *p, uint8_t *alert_flags)
void DetectEngineBufferTypeSupportsTransformations(DetectEngineCtx *de_ctx, const char *name)
bool DetectEngineBufferTypeSupportsMpmGetById(const DetectEngineCtx *de_ctx, const int id)
const char * DetectSigmatchListEnumToString(enum DetectSigmatchListEnum type)
int DetectEngineBufferTypeGetByIdTransforms(DetectEngineCtx *de_ctx, const int id, TransformData *transforms, int transform_cnt)
bool DetectEngineBufferTypeSupportsFramesGetById(const DetectEngineCtx *de_ctx, const int id)
int DetectEngineReloadTenantBlocking(uint32_t tenant_id, const char *yaml, int reload_cnt)
Reload a tenant and wait for loading to complete.
void InspectionBufferCopy(InspectionBuffer *buffer, uint8_t *buf, uint32_t buf_len)
void DetectEngineReloadSetIdle(void)
DetectEngineCtx * DetectEngineGetCurrent(void)
DetectEngineCtx * DetectEngineCtxInitStubForMT(void)
const char * DetectEngineBufferTypeGetNameById(const DetectEngineCtx *de_ctx, const int id)
Per thread variable structure.
void InspectionBufferApplyTransforms(InspectionBuffer *buffer, const DetectEngineTransforms *transforms)
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
bool DetectEngineBufferRunValidateCallback(const DetectEngineCtx *de_ctx, const int id, const Signature *s, const char **sigerror)
void DetectEngineClearMaster(void)
void DetectEngineDeReference(DetectEngineCtx **de_ctx)
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
int DetectEngineMustParseMetadata(void)
uint8_t DetectEngineInspectMultiBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
void InspectionBufferSetupMulti(InspectionBuffer *buffer, const DetectEngineTransforms *transforms, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
void DetectEngineFrameInspectEngineRegister(DetectEngineCtx *de_ctx, const char *name, int dir, InspectionBufferFrameInspectFunc Callback, AppProto alproto, uint8_t type)
register inspect engine at start up time
uint32_t DetectEngineGetVersion(void)
int DetectEngineTenantRegisterVlanId(uint32_t tenant_id, uint16_t vlan_id)
int DetectBufferGetActiveList(DetectEngineCtx *de_ctx, Signature *s)
void DetectBufferTypeSupportsTransformations(const char *name)
int(* InspectionBufferFrameInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s, Packet *p, const struct Frames *frames, const struct Frame *frame)
int DetectEngineReloadStart(void)
void DetectBufferTypeSupportsPacket(const char *name)
void InspectionBufferInit(InspectionBuffer *buffer, uint32_t initial_size)
void InspectionBufferSetupMultiEmpty(InspectionBuffer *buffer)
setup the buffer empty
int DetectEngineAddToMaster(DetectEngineCtx *de_ctx)
bool DetectEngineBufferTypeSupportsPacketGetById(const DetectEngineCtx *de_ctx, const int id)
SigMatch * DetectBufferGetFirstSigMatch(const Signature *s, const uint32_t buf_id)
DetectEngineThreadCtx * DetectEngineThreadCtxInitForReload(ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt)
void DetectEngineStateResetTxs(Flow *f)
Reset de state for active tx' To be used on detect engine reload.
uint8_t(* InspectEngineFuncPtr)(struct DetectEngineCtx_ *de_ctx, struct DetectEngineThreadCtx_ *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
void DetectPktInspectEngineRegister(const char *name, InspectionBufferGetPktDataPtr GetPktData, InspectionBufferPktInspectFunc Callback)
register inspect engine at start up time
int DetectBufferTypeMaxId(void)
void DetectEngineSetParseMetadata(void)
void DetectEngineBufferTypeSupportsPacket(DetectEngineCtx *de_ctx, const char *name)
void DetectEngineBufferRunSetupCallback(const DetectEngineCtx *de_ctx, const int id, Signature *s)
int DetectEngineEnabled(void)
Check if detection is enabled.
DetectEngineCtx * DetectEngineCtxInitStubForDD(void)
SigMatch * DetectBufferGetLastSigMatch(const Signature *s, const uint32_t buf_id)
void DetectBufferTypeCloseRegistration(void)
int DetectRegisterThreadCtxGlobalFuncs(const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *))
Register Thread keyword context Funcs (Global)
int DetectEngineMultiTenantEnabled(void)
int DetectEngineMoveToFreeList(DetectEngineCtx *de_ctx)
a single match condition for a signature
int DetectEngineMTApply(void)
void DetectEngineRegisterTests(void)
int DetectEngineReloadTenantsBlocking(const int reload_cnt)
Reload all tenants and wait for loading to complete.
int DetectEngineBufferTypeRegisterWithFrameEngines(DetectEngineCtx *de_ctx, const char *name, const int direction, const AppProto alproto, const uint8_t frame_type)
bool DetectEngineBufferTypeValidateTransform(DetectEngineCtx *de_ctx, int sm_list, const uint8_t *content, uint16_t content_len, const char **namestr)
Check content byte array compatibility with transforms.
int DetectEngineInspectPktBufferGeneric(DetectEngineThreadCtx *det_ctx, const DetectEnginePktInspectionEngine *engine, const Signature *s, Packet *p, uint8_t *alert_flags)
Do the content inspection & validation for a signature.
bool DetectBufferIsPresent(const Signature *s, const uint32_t buf_id)
void DetectBufferTypeSupportsMpm(const char *name)
void DetectEngineBumpVersion(void)
void DeStateRegisterTests(void)
void DetectEngineAppInspectionEngineSignatureFree(DetectEngineCtx *, Signature *s)
free app inspect engines for a signature
void DetectAppLayerMultiRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectionMultiBufferGetDataPtr GetData, int priority, int tx_min_progress)
int DetectEngineTenantRegisterPcapFile(uint32_t tenant_id)
int WARN_UNUSED DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
const DetectBufferType * DetectEngineBufferTypeGetById(const DetectEngineCtx *de_ctx, const int id)
void DetectBufferTypeSupportsMultiInstance(const char *name)
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror))