From: Anoop Saldanha Date: Thu, 27 Sep 2012 09:10:07 +0000 (+0530) Subject: Introduce utility flow macros to help referencing/dereferencing flows. X-Git-Tag: suricata-1.4beta2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=88e89d630232d0fa3d22f76179f237318fe9a217;p=thirdparty%2Fsuricata.git Introduce utility flow macros to help referencing/dereferencing flows. --- diff --git a/src/flow-util.h b/src/flow-util.h index e93b013a6a..a44a553a8d 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -127,6 +127,16 @@ #define FLOW_CHECK_MEMCAP(size) \ ((((uint64_t)SC_ATOMIC_GET(flow_memuse) + (uint64_t)(size)) <= flow_config.memcap)) +#define FlowReference(dst_f_ptr, f) do { \ + FlowIncrUsecnt((f)); \ + *(dst_f_ptr) = f; \ + } while (0) + +#define FlowDeReference(src_f_ptr) do { \ + FlowDecrUsecnt(*(src_f_ptr)); \ + *(src_f_ptr) = NULL; \ + } while (0) + Flow *FlowAlloc(void); Flow *FlowAllocDirect(void); void FlowFree(Flow *);