⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flow.h

📁 snort-2.1.0入侵检测
💻 H
字号:
#ifndef _FLOW_H#define _FLOW_H#include <stdint.h>#include "flow_error.h"#include "util_math.h"#include "common_defs.h"#include "flow_print.h"#include "flow_packet.h"#define FROM_INITIATOR 1#define FROM_RESPONDER 2/* flow flags */#define FLOW_REVERSED 0x00000001 /**< this flow was swapped */#define FLOW_CLOSEME  0x00000002 /**< shutdown this flow ASAP */typedef void * FLOWDATA;  /**< @todo have a flow datastructure for everything */typedef enum {    FLOW_NEW, /**< first packet in flow */    FLOW_FIRST_BIDIRECTIONAL,  /**< first response packet in flow */    FLOW_ADDITIONAL, /**< additional data on an existing flow */    FLOW_SHUTDOWN,  /**< shutdown of a existing flow due to timeout or protocol layer */    FLOW_MAX /** this should not be used and should always be the                 biggest in the enum for flow_callbacks() */} FLOW_POSITION;typedef struct _FLOWKEY{    uint32_t init_address;    uint32_t resp_address;    uint16_t init_port;    uint16_t resp_port;    uint8_t  protocol;} FLOWKEY;typedef struct _FLOWSTATS{    time_t first_packet;    time_t last_packet;    uint32_t packets_sent;    uint32_t packets_recv;    uint32_t bytes_sent;    uint32_t bytes_recv;    uint32_t flow_flags; /* normal, timeout, etc. */        char first_talker;    char last_talker;        uint16_t alerts_seen;} FLOWSTATS;typedef struct _FLOW{    FLOWKEY key;     FLOWSTATS stats;    FLOWDATA data;} FLOW;typedef enum {    HASH1 = 1,    HASH2 = 2} FLOWHASHID;    int flow_init(FLOW *flow, char protocol,              uint32_t init_address, uint16_t init_port,              uint32_t resp_address, uint16_t resp_port);int flow_alloc(int family, FLOW **flow, int *size);/**  * Mark a flow with a particular flag *  * @param flow  * @param flags  */static INLINE void flow_mark(FLOW *flow, int flags){    flow->stats.flow_flags |= flags;}/**  * Check to see if a particular flag exists *  * @param flow  * @param flags  */static INLINE int flow_checkflag(FLOW *flow, int flags){    return ((flow->stats.flow_flags & flags) == flags);}int flowkey_reverse(FLOWKEY *key);int flowkey_make(FLOWKEY *key, FLOWPACKET *p);int flowkey_print(FLOWKEY *key);int flowkey_normalize(FLOWKEY *dst, const FLOWKEY *src);int flowkeycmp_fcn(const void *s1, const void *s2, size_t n);#endif /* _FLOW_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -