]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
format/clang: Apply clang-format
authorJeff Lucovsky <jlucovsky@oisf.net>
Wed, 18 Jan 2023 13:09:25 +0000 (08:09 -0500)
committerVictor Julien <vjulien@oisf.net>
Tue, 24 Jan 2023 09:44:49 +0000 (10:44 +0100)
Issue: 5718

src/flow-util.h

index c2f858709f983d275ce9128295864576aa18d6bd..874eaf07ac24a5114948f46be53da7e7928daa5a 100644 (file)
 #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 RESET_COUNTERS(f) do { \
-        (f)->todstpktcnt = 0; \
-        (f)->tosrcpktcnt = 0; \
-        (f)->todstbytecnt = 0; \
-        (f)->tosrcbytecnt = 0; \
+#define COPY_TIMESTAMP(src, dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec)
+
+#define RESET_COUNTERS(f)                                                                          \
+    do {                                                                                           \
+        (f)->todstpktcnt = 0;                                                                      \
+        (f)->tosrcpktcnt = 0;                                                                      \
+        (f)->todstbytecnt = 0;                                                                     \
+        (f)->tosrcbytecnt = 0;                                                                     \
     } while (0)
 
-#define FLOW_INITIALIZE(f) do { \
-        (f)->sp = 0; \
-        (f)->dp = 0; \
-        (f)->proto = 0; \
-        (f)->livedev = NULL; \
-        (f)->timeout_at = 0; \
-        (f)->timeout_policy = 0; \
-        (f)->vlan_idx = 0; \
-        (f)->next = NULL; \
-        (f)->flow_state = 0; \
-        (f)->use_cnt = 0; \
-        (f)->tenant_id = 0; \
-        (f)->parent_id = 0; \
-        (f)->probing_parser_toserver_alproto_masks = 0; \
-        (f)->probing_parser_toclient_alproto_masks = 0; \
-        (f)->flags = 0; \
-        (f)->file_flags = 0; \
-        (f)->protodetect_dp = 0; \
-        (f)->lastts.tv_sec = 0; \
-        (f)->lastts.tv_usec = 0; \
-        FLOWLOCK_INIT((f)); \
-        (f)->protoctx = NULL; \
-        (f)->flow_end_flags = 0; \
-        (f)->alproto = 0; \
-        (f)->alproto_ts = 0; \
-        (f)->alproto_tc = 0; \
-        (f)->alproto_orig = 0; \
-        (f)->alproto_expect = 0; \
-        (f)->de_ctx_version = 0; \
-        (f)->thread_id[0] = 0; \
-        (f)->thread_id[1] = 0; \
-        (f)->alparser = NULL; \
-        (f)->alstate = NULL; \
-        (f)->sgh_toserver = NULL; \
-        (f)->sgh_toclient = NULL; \
-        (f)->flowvar = NULL; \
-        RESET_COUNTERS((f)); \
+#define FLOW_INITIALIZE(f)                                                                         \
+    do {                                                                                           \
+        (f)->sp = 0;                                                                               \
+        (f)->dp = 0;                                                                               \
+        (f)->proto = 0;                                                                            \
+        (f)->livedev = NULL;                                                                       \
+        (f)->timeout_at = 0;                                                                       \
+        (f)->timeout_policy = 0;                                                                   \
+        (f)->vlan_idx = 0;                                                                         \
+        (f)->next = NULL;                                                                          \
+        (f)->flow_state = 0;                                                                       \
+        (f)->use_cnt = 0;                                                                          \
+        (f)->tenant_id = 0;                                                                        \
+        (f)->parent_id = 0;                                                                        \
+        (f)->probing_parser_toserver_alproto_masks = 0;                                            \
+        (f)->probing_parser_toclient_alproto_masks = 0;                                            \
+        (f)->flags = 0;                                                                            \
+        (f)->file_flags = 0;                                                                       \
+        (f)->protodetect_dp = 0;                                                                   \
+        (f)->lastts.tv_sec = 0;                                                                    \
+        (f)->lastts.tv_usec = 0;                                                                   \
+        FLOWLOCK_INIT((f));                                                                        \
+        (f)->protoctx = NULL;                                                                      \
+        (f)->flow_end_flags = 0;                                                                   \
+        (f)->alproto = 0;                                                                          \
+        (f)->alproto_ts = 0;                                                                       \
+        (f)->alproto_tc = 0;                                                                       \
+        (f)->alproto_orig = 0;                                                                     \
+        (f)->alproto_expect = 0;                                                                   \
+        (f)->de_ctx_version = 0;                                                                   \
+        (f)->thread_id[0] = 0;                                                                     \
+        (f)->thread_id[1] = 0;                                                                     \
+        (f)->alparser = NULL;                                                                      \
+        (f)->alstate = NULL;                                                                       \
+        (f)->sgh_toserver = NULL;                                                                  \
+        (f)->sgh_toclient = NULL;                                                                  \
+        (f)->flowvar = NULL;                                                                       \
+        RESET_COUNTERS((f));                                                                       \
     } while (0)
 
 /** \brief macro to recycle a flow before it goes into the spare queue for reuse.
  *  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 { \
-        FlowCleanupAppLayer((f)); \
-        (f)->sp = 0; \
-        (f)->dp = 0; \
-        (f)->proto = 0; \
-        (f)->livedev = NULL; \
-        (f)->vlan_idx = 0; \
-        (f)->ffr = 0; \
-        (f)->next = NULL; \
-        (f)->timeout_at = 0; \
-        (f)->timeout_policy = 0; \
-        (f)->flow_state = 0; \
-        (f)->use_cnt = 0; \
-        (f)->tenant_id = 0; \
-        (f)->parent_id = 0; \
-        (f)->probing_parser_toserver_alproto_masks = 0; \
-        (f)->probing_parser_toclient_alproto_masks = 0; \
-        (f)->flags = 0; \
-        (f)->file_flags = 0; \
-        (f)->protodetect_dp = 0; \
-        (f)->lastts.tv_sec = 0; \
-        (f)->lastts.tv_usec = 0; \
-        (f)->protoctx = NULL; \
-        (f)->flow_end_flags = 0; \
-        (f)->alparser = NULL; \
-        (f)->alstate = NULL; \
-        (f)->alproto = 0; \
-        (f)->alproto_ts = 0; \
-        (f)->alproto_tc = 0; \
-        (f)->alproto_orig = 0; \
-        (f)->alproto_expect = 0; \
-        (f)->de_ctx_version = 0; \
-        (f)->thread_id[0] = 0; \
-        (f)->thread_id[1] = 0; \
-        (f)->sgh_toserver = NULL; \
-        (f)->sgh_toclient = NULL; \
-        GenericVarFree((f)->flowvar); \
-        (f)->flowvar = NULL; \
-        if (MacSetFlowStorageEnabled()) { \
-            MacSet *ms = FlowGetStorageById((f), MacSetGetFlowStorageID()); \
-            if (ms != NULL) { \
-                MacSetReset(ms); \
-            } \
-        } \
-        RESET_COUNTERS((f)); \
-    } while(0)
+#define FLOW_RECYCLE(f)                                                                            \
+    do {                                                                                           \
+        FlowCleanupAppLayer((f));                                                                  \
+        (f)->sp = 0;                                                                               \
+        (f)->dp = 0;                                                                               \
+        (f)->proto = 0;                                                                            \
+        (f)->livedev = NULL;                                                                       \
+        (f)->vlan_idx = 0;                                                                         \
+        (f)->ffr = 0;                                                                              \
+        (f)->next = NULL;                                                                          \
+        (f)->timeout_at = 0;                                                                       \
+        (f)->timeout_policy = 0;                                                                   \
+        (f)->flow_state = 0;                                                                       \
+        (f)->use_cnt = 0;                                                                          \
+        (f)->tenant_id = 0;                                                                        \
+        (f)->parent_id = 0;                                                                        \
+        (f)->probing_parser_toserver_alproto_masks = 0;                                            \
+        (f)->probing_parser_toclient_alproto_masks = 0;                                            \
+        (f)->flags = 0;                                                                            \
+        (f)->file_flags = 0;                                                                       \
+        (f)->protodetect_dp = 0;                                                                   \
+        (f)->lastts.tv_sec = 0;                                                                    \
+        (f)->lastts.tv_usec = 0;                                                                   \
+        (f)->protoctx = NULL;                                                                      \
+        (f)->flow_end_flags = 0;                                                                   \
+        (f)->alparser = NULL;                                                                      \
+        (f)->alstate = NULL;                                                                       \
+        (f)->alproto = 0;                                                                          \
+        (f)->alproto_ts = 0;                                                                       \
+        (f)->alproto_tc = 0;                                                                       \
+        (f)->alproto_orig = 0;                                                                     \
+        (f)->alproto_expect = 0;                                                                   \
+        (f)->de_ctx_version = 0;                                                                   \
+        (f)->thread_id[0] = 0;                                                                     \
+        (f)->thread_id[1] = 0;                                                                     \
+        (f)->sgh_toserver = NULL;                                                                  \
+        (f)->sgh_toclient = NULL;                                                                  \
+        GenericVarFree((f)->flowvar);                                                              \
+        (f)->flowvar = NULL;                                                                       \
+        if (MacSetFlowStorageEnabled()) {                                                          \
+            MacSet *ms = FlowGetStorageById((f), MacSetGetFlowStorageID());                        \
+            if (ms != NULL) {                                                                      \
+                MacSetReset(ms);                                                                   \
+            }                                                                                      \
+        }                                                                                          \
+        RESET_COUNTERS((f));                                                                       \
+    } while (0)
 
-#define FLOW_DESTROY(f) do { \
-        FlowCleanupAppLayer((f)); \
-        \
-        FLOWLOCK_DESTROY((f)); \
-        GenericVarFree((f)->flowvar); \
-    } while(0)
+#define FLOW_DESTROY(f)                                                                            \
+    do {                                                                                           \
+        FlowCleanupAppLayer((f));                                                                  \
+                                                                                                   \
+        FLOWLOCK_DESTROY((f));                                                                     \
+        GenericVarFree((f)->flowvar);                                                              \
+    } while (0)
 
 /** \brief check if a memory alloc would fit in the memcap
  *
  *  \retval 1 it fits
  *  \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)))
+#define FLOW_CHECK_MEMCAP(size)                                                                    \
+    ((((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__ */
-