|
|
|
@ -27,16 +27,18 @@
|
|
|
|
|
#include "flow.h"
|
|
|
|
|
#include "stream-tcp-private.h"
|
|
|
|
|
|
|
|
|
|
#define COPY_TIMESTAMP(src,dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec)
|
|
|
|
|
#define COPY_TIMESTAMP(src, dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec)
|
|
|
|
|
|
|
|
|
|
#define RESET_COUNTERS(f) do { \
|
|
|
|
|
#define RESET_COUNTERS(f) \
|
|
|
|
|
do { \
|
|
|
|
|
(f)->todstpktcnt = 0; \
|
|
|
|
|
(f)->tosrcpktcnt = 0; \
|
|
|
|
|
(f)->todstbytecnt = 0; \
|
|
|
|
|
(f)->tosrcbytecnt = 0; \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
#define FLOW_INITIALIZE(f) do { \
|
|
|
|
|
#define FLOW_INITIALIZE(f) \
|
|
|
|
|
do { \
|
|
|
|
|
(f)->sp = 0; \
|
|
|
|
|
(f)->dp = 0; \
|
|
|
|
|
(f)->proto = 0; \
|
|
|
|
@ -80,7 +82,8 @@
|
|
|
|
|
* Note that the lnext, lprev, hnext fields are untouched, those are
|
|
|
|
|
* managed by the queueing code. Same goes for fb (FlowBucket ptr) field.
|
|
|
|
|
*/
|
|
|
|
|
#define FLOW_RECYCLE(f) do { \
|
|
|
|
|
#define FLOW_RECYCLE(f) \
|
|
|
|
|
do { \
|
|
|
|
|
FlowCleanupAppLayer((f)); \
|
|
|
|
|
(f)->sp = 0; \
|
|
|
|
|
(f)->dp = 0; \
|
|
|
|
@ -125,14 +128,15 @@
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
RESET_COUNTERS((f)); \
|
|
|
|
|
} while(0)
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
#define FLOW_DESTROY(f) do { \
|
|
|
|
|
#define FLOW_DESTROY(f) \
|
|
|
|
|
do { \
|
|
|
|
|
FlowCleanupAppLayer((f)); \
|
|
|
|
|
\
|
|
|
|
|
FLOWLOCK_DESTROY((f)); \
|
|
|
|
|
GenericVarFree((f)->flowvar); \
|
|
|
|
|
} while(0)
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
/** \brief check if a memory alloc would fit in the memcap
|
|
|
|
|
*
|
|
|
|
@ -142,7 +146,8 @@
|
|
|
|
|
* \retval 0 no fit
|
|
|
|
|
*/
|
|
|
|
|
#define FLOW_CHECK_MEMCAP(size) \
|
|
|
|
|
((((uint64_t)SC_ATOMIC_GET(flow_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(flow_config.memcap)))
|
|
|
|
|
((((uint64_t)SC_ATOMIC_GET(flow_memuse) + (uint64_t)(size)) <= \
|
|
|
|
|
SC_ATOMIC_GET(flow_config.memcap)))
|
|
|
|
|
|
|
|
|
|
Flow *FlowAlloc(void);
|
|
|
|
|
Flow *FlowAllocDirect(void);
|
|
|
|
@ -174,4 +179,3 @@ static inline void FlowEndCountersUpdate(ThreadVars *tv, FlowEndCounters *fec, F
|
|
|
|
|
void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec);
|
|
|
|
|
|
|
|
|
|
#endif /* __FLOW_UTIL_H__ */
|
|
|
|
|
|
|
|
|
|