Go to the documentation of this file.
24 #ifndef SURICATA_FLOW_UTIL_H
25 #define SURICATA_FLOW_UTIL_H
30 #define RESET_COUNTERS(f) \
32 (f)->todstpktcnt = 0; \
33 (f)->tosrcpktcnt = 0; \
34 (f)->todstbytecnt = 0; \
35 (f)->tosrcbytecnt = 0; \
38 #define FLOW_INITIALIZE(f) \
43 (f)->livedev = NULL; \
44 (f)->timeout_at = 0; \
45 (f)->timeout_policy = 0; \
48 (f)->flow_state = 0; \
51 (f)->probing_parser_toserver_alproto_masks = 0; \
52 (f)->probing_parser_toclient_alproto_masks = 0; \
54 (f)->file_flags = 0; \
55 (f)->protodetect_dp = 0; \
56 SCTIME_INIT((f)->lastts); \
58 (f)->protoctx = NULL; \
59 (f)->flow_end_flags = 0; \
61 (f)->alproto_ts = 0; \
62 (f)->alproto_tc = 0; \
63 (f)->alproto_orig = 0; \
64 (f)->alproto_expect = 0; \
65 (f)->de_ctx_version = 0; \
66 (f)->thread_id[0] = 0; \
67 (f)->thread_id[1] = 0; \
68 (f)->alparser = NULL; \
69 (f)->alstate = NULL; \
70 (f)->sgh_toserver = NULL; \
71 (f)->sgh_toclient = NULL; \
72 (f)->flowvar = NULL; \
73 RESET_COUNTERS((f)); \
81 #define FLOW_RECYCLE(f) \
83 FlowCleanupAppLayer((f)); \
87 (f)->livedev = NULL; \
91 (f)->timeout_at = 0; \
92 (f)->timeout_policy = 0; \
93 (f)->flow_state = 0; \
96 (f)->probing_parser_toserver_alproto_masks = 0; \
97 (f)->probing_parser_toclient_alproto_masks = 0; \
99 (f)->file_flags = 0; \
100 (f)->protodetect_dp = 0; \
101 SCTIME_INIT((f)->lastts); \
102 (f)->protoctx = NULL; \
103 (f)->flow_end_flags = 0; \
104 (f)->alparser = NULL; \
105 (f)->alstate = NULL; \
107 (f)->alproto_ts = 0; \
108 (f)->alproto_tc = 0; \
109 (f)->alproto_orig = 0; \
110 (f)->alproto_expect = 0; \
111 (f)->de_ctx_version = 0; \
112 (f)->thread_id[0] = 0; \
113 (f)->thread_id[1] = 0; \
114 (f)->sgh_toserver = NULL; \
115 (f)->sgh_toclient = NULL; \
116 GenericVarFree((f)->flowvar); \
117 (f)->flowvar = NULL; \
118 RESET_COUNTERS((f)); \
121 #define FLOW_DESTROY(f) \
123 FlowCleanupAppLayer((f)); \
125 FLOWLOCK_DESTROY((f)); \
126 GenericVarFree((f)->flowvar); \
136 #define FLOW_CHECK_MEMCAP(size) \
137 ((((uint64_t)SC_ATOMIC_GET(flow_memuse) + (uint64_t)(size)) <= \
138 SC_ATOMIC_GET(flow_config.memcap)))
void StatsIncr(ThreadVars *tv, uint16_t id)
Increments the local counter.
uint8_t FlowGetProtoMapping(uint8_t)
Function to map the protocol to the defined FLOW_PROTO_* enumeration.
uint16_t flow_tcp_liberal
uint16_t flow_state[FLOW_STATE_SIZE]
Flow * FlowAlloc(void)
allocate a flow
#define STREAMTCP_FLAG_LOSSY_BE_LIBERAL
uint16_t flow_tcp_state[TCP_CLOSED+1]
void FlowInit(ThreadVars *, Flow *, const Packet *)
struct FlowEndCounters_ FlowEndCounters
Per thread variable structure.
void FlowFree(Flow *)
cleanup & free the memory of a flow
void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec)
uint8_t FlowGetReverseProtoMapping(uint8_t rproto)