suricata的InspectEngine

1.结构

//报文检测引擎,有检测指针,检测模式等等信息,是链表节点
typedef struct DetectEnginePktInspectionEngine {
    SigMatchData *smd;
    bool mpm;
    uint16_t sm_list;
    uint16_t sm_list_base;
    struct {
        InspectionBufferGetPktDataPtr GetData;
        InspectionBufferPktInspectFunc Callback;
        /** pointer to the transforms in the 'DetectBuffer entry for this list */
        const DetectEngineTransforms *transforms;
    } v1;
    struct DetectEnginePktInspectionEngine *next;
} DetectEnginePktInspectionEngine;
// 存放着检测该流的应用层一切的信息,包括该报文的检测回调函数
// 检测模式,是什么协议等等,是一个链表节点
typedef struct DetectEngineAppInspectionEngine_ {
    AppProto alproto;
    uint8_t dir; // 方向
    uint8_t id;     /**< per sig id used in state keeping */
    bool mpm;
    bool stream;
    uint16_t sm_list;
    uint16_t sm_list_base; /**< base buffer being transformed */
    int16_t progress;

    /* \retval 0 No match.  Don't discontinue matching yet.  We need more data.
     *         1 Match.
     *         2 Sig can't match.
     *         3 Special value used by filestore sigs to indicate disabling
     *           filestore for the tx.
     */
    InspectEngineFuncPtr Callback;

    struct {
        InspectionBufferGetDataPtr GetData;
        InspectEngineFuncPtr2 Callback;
        /** pointer to the transforms in the 'DetectBuffer entry for this list */
        const DetectEngineTransforms *transforms;
    } v2;

    SigMatchData *smd;

    struct DetectEngineAppInspectionEngine_ *next;
} DetectEngineAppInspectionEngine;
// 里面放着检测函数指针,要检测的id,要检测的内容等等,是一个节点
typedef struct DetectBufferType_ {
    const char *string;
    const char *description;
    int id;
    int parent_id;
    bool mpm;
    bool packet; /**< compat to packet matches */
    bool supports_transforms;
    void (*SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *);
    bool (*ValidateCallback)(const struct Signature_ *, const char **sigerror);
    DetectEngineTransforms transforms;
} DetectBufferType;

这个检测节点作为data放在HashListTable *g_buffer_type_hash,这个hash链表中。

2.操作函数

// 增加一个名字为name新DetectEnginePktInspectionEngine节点,放在老的

// DetectEnginePktInspectionEngine链表末尾

// 这个节点的回调函数Callback,就要包的检测函数

DetectPktInspectEngineRegister

DetectAppLayerInspectEngineRegister

DetectAppLayerInspectEngineRegister2

DetectAppLayerInspectEngineCopy

DetectAppLayerInspectEngineCopyListToDetectCtx

DetectPktInspectEngineCopyListToDetectCtx        

AppendStreamInspectEngine

DetectEngineAppInspectionEngine2Signature

DetectEngineAppInspectionEngineSignatureFree

3.解释

InspectEngine的功能及作用?

这是检测引擎,一些注册之类的操作。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值