* logging, etc. */
#define FLOW_PKT_LAST_PSEUDO 0x80
-#define FLOW_END_FLAG_STATE_NEW 0x01
-#define FLOW_END_FLAG_STATE_ESTABLISHED 0x02
-#define FLOW_END_FLAG_STATE_CLOSED 0x04
-#define FLOW_END_FLAG_EMERGENCY 0x08
-#define FLOW_END_FLAG_TIMEOUT 0x10
-#define FLOW_END_FLAG_FORCED 0x20
-#define FLOW_END_FLAG_SHUTDOWN 0x40
-#define FLOW_END_FLAG_STATE_BYPASSED 0x80
+#define FLOW_END_FLAG_EMERGENCY 0x01
+#define FLOW_END_FLAG_TIMEOUT 0x02
+#define FLOW_END_FLAG_FORCED 0x04
+#define FLOW_END_FLAG_SHUTDOWN 0x08
/** Mutex or RWLocks for the flow. */
//#define FLOWLOCK_RWLOCK
return id;
}
-static inline void FlowSetEndFlags(Flow *f)
-{
- const int state = f->flow_state;
- if (state == FLOW_STATE_NEW)
- f->flow_end_flags |= FLOW_END_FLAG_STATE_NEW;
- else if (state == FLOW_STATE_ESTABLISHED)
- f->flow_end_flags |= FLOW_END_FLAG_STATE_ESTABLISHED;
- else if (state == FLOW_STATE_CLOSED)
- f->flow_end_flags |= FLOW_END_FLAG_STATE_CLOSED;
- else if (state == FLOW_STATE_LOCAL_BYPASSED)
- f->flow_end_flags |= FLOW_END_FLAG_STATE_BYPASSED;
-#ifdef CAPTURE_OFFLOAD
- else if (state == FLOW_STATE_CAPTURE_BYPASSED)
- f->flow_end_flags = FLOW_END_FLAG_STATE_BYPASSED;
-#endif
-}
-
static inline bool FlowIsBypassed(const Flow *f)
{
if (
if (f->flow_end_flags & FLOW_END_FLAG_EMERGENCY)
JB_SET_TRUE(jb, "emergency");
- const char *state = NULL;
- if (f->flow_end_flags & FLOW_END_FLAG_STATE_NEW)
- state = "new";
- else if (f->flow_end_flags & FLOW_END_FLAG_STATE_ESTABLISHED)
- state = "established";
- else if (f->flow_end_flags & FLOW_END_FLAG_STATE_CLOSED)
- state = "closed";
- else if (f->flow_end_flags & FLOW_END_FLAG_STATE_BYPASSED) {
- state = "bypassed";
- int flow_state = f->flow_state;
- switch (flow_state) {
- case FLOW_STATE_LOCAL_BYPASSED:
- JB_SET_STRING(jb, "bypass", "local");
- break;
+
+ const int flow_state = f->flow_state;
+ switch (flow_state) {
+ case FLOW_STATE_NEW:
+ JB_SET_STRING(jb, "state", "new");
+ break;
+ case FLOW_STATE_ESTABLISHED:
+ JB_SET_STRING(jb, "state", "established");
+ break;
+ case FLOW_STATE_CLOSED:
+ JB_SET_STRING(jb, "state", "closed");
+ break;
+ case FLOW_STATE_LOCAL_BYPASSED:
+ JB_SET_STRING(jb, "state", "bypassed");
+ JB_SET_STRING(jb, "bypass", "local");
+ break;
#ifdef CAPTURE_OFFLOAD
- case FLOW_STATE_CAPTURE_BYPASSED:
- JB_SET_STRING(jb, "bypass", "capture");
- break;
+ case FLOW_STATE_CAPTURE_BYPASSED:
+ JB_SET_STRING(jb, "state", "bypassed");
+ JB_SET_STRING(jb, "bypass", "capture");
+ break;
#endif
- default:
- SCLogError("Invalid flow state: %d, contact developers", flow_state);
- }
+ default:
+ SCLogError("Invalid flow state: %d, contact developers", flow_state);
}
- jb_set_string(jb, "state", state);
-
const char *reason = NULL;
if (f->flow_end_flags & FLOW_END_FLAG_FORCED)
reason = "forced";