suricata
output-json-flow.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2025 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Implements Flow JSON logging portion of the engine.
24  */
25 
26 #include "suricata-common.h"
27 #include "detect.h"
28 #include "pkt-var.h"
29 #include "conf.h"
30 #include "app-layer-parser.h"
31 
32 #include "threads.h"
33 #include "threadvars.h"
34 #include "tm-threads.h"
35 
36 #include "util-print.h"
37 #include "util-unittest.h"
38 
39 #include "util-debug.h"
40 
41 #include "output.h"
42 #include "util-privs.h"
43 #include "util-buffer.h"
44 #include "util-device-private.h"
45 #include "util-proto-name.h"
46 #include "util-logopenfile.h"
47 #include "util-time.h"
48 #include "output-json.h"
49 #include "output-json-flow.h"
50 
51 #include "stream-tcp.h"
52 #include "stream-tcp-private.h"
53 #include "flow-storage.h"
54 #include "util-exception-policy.h"
55 
56 static SCJsonBuilder *CreateEveHeaderFromFlow(const Flow *f, OutputJsonCommonSettings *cfg)
57 {
58  char timebuf[64];
59  char srcip[46] = {0}, dstip[46] = {0};
60  Port sp, dp;
61 
62  SCJsonBuilder *jb = SCJbNewObject();
63  if (unlikely(jb == NULL)) {
64  return NULL;
65  }
66 
67  SCTime_t ts = TimeGet();
68 
69  CreateIsoTimeString(ts, timebuf, sizeof(timebuf));
70 
71  if ((f->flags & FLOW_DIR_REVERSED) == 0) {
72  if (FLOW_IS_IPV4(f)) {
73  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), srcip, sizeof(srcip));
74  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), dstip, sizeof(dstip));
75  } else if (FLOW_IS_IPV6(f)) {
77  (const void *)&(f->src.address), srcip, sizeof(srcip), cfg->compress_ipv6);
79  (const void *)&(f->dst.address), dstip, sizeof(dstip), cfg->compress_ipv6);
80  }
81  sp = f->sp;
82  dp = f->dp;
83  } else {
84  if (FLOW_IS_IPV4(f)) {
85  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), srcip, sizeof(srcip));
86  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), dstip, sizeof(dstip));
87  } else if (FLOW_IS_IPV6(f)) {
89  (const void *)&(f->dst.address), srcip, sizeof(srcip), cfg->compress_ipv6);
91  (const void *)&(f->src.address), dstip, sizeof(dstip), cfg->compress_ipv6);
92  }
93  sp = f->dp;
94  dp = f->sp;
95  }
96 
97  /* time */
98  SCJbSetString(jb, "timestamp", timebuf);
99 
100  CreateEveFlowId(jb, (const Flow *)f);
101 
102 #if 0 // TODO
103  /* sensor id */
104  if (sensor_id >= 0)
105  json_object_set_new(js, "sensor_id", json_integer(sensor_id));
106 #endif
107 
108  /* input interface */
110  if (dev) {
111  SCJbSetString(jb, "in_iface", dev->dev);
112  }
113 
114  JB_SET_STRING(jb, "event_type", "flow");
115 
116  /* vlan */
117  if (f->vlan_idx > 0) {
118  SCJbOpenArray(jb, "vlan");
119  SCJbAppendUint(jb, f->vlan_id[0]);
120  if (f->vlan_idx > 1) {
121  SCJbAppendUint(jb, f->vlan_id[1]);
122  }
123  if (f->vlan_idx > 2) {
124  SCJbAppendUint(jb, f->vlan_id[2]);
125  }
126  SCJbClose(jb);
127  }
128 
129  /* tuple */
130  SCJbSetString(jb, "src_ip", srcip);
131  switch(f->proto) {
132  case IPPROTO_ICMP:
133  break;
134  case IPPROTO_UDP:
135  case IPPROTO_TCP:
136  case IPPROTO_SCTP:
137  SCJbSetUint(jb, "src_port", sp);
138  break;
139  }
140  SCJbSetString(jb, "dest_ip", dstip);
141  switch(f->proto) {
142  case IPPROTO_ICMP:
143  break;
144  case IPPROTO_UDP:
145  case IPPROTO_TCP:
146  case IPPROTO_SCTP:
147  SCJbSetUint(jb, "dest_port", dp);
148  break;
149  }
150 
151  /* ip version */
152  if (FLOW_IS_IPV4(f)) {
153  SCJbSetUint(jb, "ip_v", 4);
154  } else if (FLOW_IS_IPV6(f)) {
155  SCJbSetUint(jb, "ip_v", 6);
156  }
157 
158  if (SCProtoNameValid(f->proto)) {
159  SCJbSetString(jb, "proto", known_proto[f->proto]);
160  } else {
161  char proto[4];
162  snprintf(proto, sizeof(proto), "%"PRIu8"", f->proto);
163  SCJbSetString(jb, "proto", proto);
164  }
165 
166  switch (f->proto) {
167  case IPPROTO_ICMP:
168  case IPPROTO_ICMPV6:
169  SCJbSetUint(jb, "icmp_type", f->icmp_s.type);
170  SCJbSetUint(jb, "icmp_code", f->icmp_s.code);
171  if (f->tosrcpktcnt) {
172  SCJbSetUint(jb, "response_icmp_type", f->icmp_d.type);
173  SCJbSetUint(jb, "response_icmp_code", f->icmp_d.code);
174  }
175  break;
176  case IPPROTO_ESP:
177  SCJbSetUint(jb, "spi", f->esp.spi);
178  break;
179  }
180  return jb;
181 }
182 
183 void EveAddAppProto(Flow *f, SCJsonBuilder *js)
184 {
185  if (f->alproto) {
186  SCJbSetString(js, "app_proto", AppProtoToString(f->alproto));
187  }
188  if (f->alproto_ts && f->alproto_ts != f->alproto) {
189  SCJbSetString(js, "app_proto_ts", AppProtoToString(f->alproto_ts));
190  }
191  if (f->alproto_tc && f->alproto_tc != f->alproto) {
192  SCJbSetString(js, "app_proto_tc", AppProtoToString(f->alproto_tc));
193  }
194  if (f->alproto_orig != f->alproto && f->alproto_orig != ALPROTO_UNKNOWN) {
195  SCJbSetString(js, "app_proto_orig", AppProtoToString(f->alproto_orig));
196  }
197  if (f->alproto_expect != f->alproto && f->alproto_expect != ALPROTO_UNKNOWN) {
198  SCJbSetString(js, "app_proto_expected", AppProtoToString(f->alproto_expect));
199  }
200 
201 }
202 
203 void EveAddFlow(Flow *f, SCJsonBuilder *js)
204 {
206  if (fc) {
207  SCJbSetUint(js, "pkts_toserver", f->todstpktcnt + fc->todstpktcnt);
208  SCJbSetUint(js, "pkts_toclient", f->tosrcpktcnt + fc->tosrcpktcnt);
209  SCJbSetUint(js, "bytes_toserver", f->todstbytecnt + fc->todstbytecnt);
210  SCJbSetUint(js, "bytes_toclient", f->tosrcbytecnt + fc->tosrcbytecnt);
211 
212  SCJbOpenObject(js, "bypassed");
213  SCJbSetUint(js, "pkts_toserver", fc->todstpktcnt);
214  SCJbSetUint(js, "pkts_toclient", fc->tosrcpktcnt);
215  SCJbSetUint(js, "bytes_toserver", fc->todstbytecnt);
216  SCJbSetUint(js, "bytes_toclient", fc->tosrcbytecnt);
217  SCJbClose(js);
218  } else {
219  SCJbSetUint(js, "pkts_toserver", f->todstpktcnt);
220  SCJbSetUint(js, "pkts_toclient", f->tosrcpktcnt);
221  SCJbSetUint(js, "bytes_toserver", f->todstbytecnt);
222  SCJbSetUint(js, "bytes_toclient", f->tosrcbytecnt);
223  }
224 
225  char timebuf1[64];
226  CreateIsoTimeString(f->startts, timebuf1, sizeof(timebuf1));
227  SCJbSetString(js, "start", timebuf1);
228 }
229 
230 static void EveExceptionPolicyLog(SCJsonBuilder *js, uint16_t flag)
231 {
233  SCJbStartObject(js);
234  SCJbSetString(js, "target",
236  SCJbSetString(js, "policy",
239  SCJbClose(js);
240  }
242  SCJbStartObject(js);
243  SCJbSetString(js, "target",
245  SCJbSetString(js, "policy",
248  SCJbClose(js);
249  }
251  SCJbStartObject(js);
252  SCJbSetString(js, "target",
254  SCJbSetString(js, "policy",
257  true));
258  SCJbClose(js);
259  }
261  SCJbStartObject(js);
262  SCJbSetString(
264  SCJbSetString(js, "policy",
267  SCJbClose(js);
268  }
269  if (flag & EXCEPTION_TARGET_FLAG_MIDSTREAM) {
270  SCJbStartObject(js);
271  SCJbSetString(
273  SCJbSetString(js, "policy",
276  SCJbClose(js);
277  }
279  SCJbStartObject(js);
280  SCJbSetString(js, "target",
282  SCJbSetString(js, "policy",
285  SCJbClose(js);
286  }
287 }
288 
289 /* Eve format logging */
290 static void EveFlowLogJSON(OutputJsonThreadCtx *aft, SCJsonBuilder *jb, Flow *f)
291 {
292  EveAddAppProto(f, jb);
293  SCJbOpenObject(jb, "flow");
294  EveAddFlow(f, jb);
295 
296  char timebuf2[64];
297  CreateIsoTimeString(f->lastts, timebuf2, sizeof(timebuf2));
298  SCJbSetString(jb, "end", timebuf2);
299 
300  uint64_t age = (SCTIME_SECS(f->lastts) - SCTIME_SECS(f->startts));
301  SCJbSetUint(jb, "age", age);
302 
304  JB_SET_TRUE(jb, "emergency");
305 
306  const int flow_state = f->flow_state;
307  switch (flow_state) {
308  case FLOW_STATE_NEW:
309  JB_SET_STRING(jb, "state", "new");
310  break;
312  JB_SET_STRING(jb, "state", "established");
313  break;
314  case FLOW_STATE_CLOSED:
315  JB_SET_STRING(jb, "state", "closed");
316  break;
318  JB_SET_STRING(jb, "state", "bypassed");
319  JB_SET_STRING(jb, "bypass", "local");
320  break;
321 #ifdef CAPTURE_OFFLOAD
322  case FLOW_STATE_CAPTURE_BYPASSED:
323  JB_SET_STRING(jb, "state", "bypassed");
324  JB_SET_STRING(jb, "bypass", "capture");
325  break;
326 #endif
327  case FLOW_STATE_SIZE:
329  SCLogDebug("invalid flow state: %d, contact developers", flow_state);
330  }
331 
332  const char *reason = NULL;
334  reason = "tcp_reuse";
335  else if (f->flow_end_flags & FLOW_END_FLAG_FORCED)
336  reason = "forced";
338  reason = "shutdown";
340  reason = "timeout";
341  else
342  reason = "unknown";
343 
344  SCJbSetString(jb, "reason", reason);
345 
346  SCJbSetBool(jb, "alerted", FlowHasAlerts(f));
347  if (f->flags & FLOW_WRONG_THREAD)
348  JB_SET_TRUE(jb, "wrong_thread");
349 
351  JB_SET_TRUE(jb, "elephant");
352  SCJbOpenArray(jb, "elephant_direction");
354  SCJbAppendString(jb, "toserver");
356  SCJbAppendString(jb, "toclient");
357 
358  SCJbClose(jb);
359  }
360 
361  if (f->flags & FLOW_ACTION_DROP) {
362  JB_SET_STRING(jb, "action", "drop");
363  } else if (f->flags & FLOW_ACTION_ACCEPT) {
364  JB_SET_STRING(jb, "action", "accept");
365  } else if (f->flags & FLOW_ACTION_PASS) {
366  JB_SET_STRING(jb, "action", "pass");
367  }
368  if (f->applied_exception_policy != 0) {
369  SCJbOpenArray(jb, "exception_policy");
370  EveExceptionPolicyLog(jb, f->applied_exception_policy);
371  SCJbClose(jb); /* close array */
372  }
373 
374  if (f->alstate) {
375  uint64_t tx_id = AppLayerParserGetTxCnt(f, f->alstate);
376  if (tx_id) {
377  SCJbSetUint(jb, "tx_cnt", tx_id);
378  }
379  }
380 
381  /* Close flow. */
382  SCJbClose(jb);
383 
384  EveAddCommonOptions(&aft->ctx->cfg, NULL, f, jb, LOG_DIR_FLOW);
385 
386  /* TCP */
387  if (f->proto == IPPROTO_TCP) {
388  SCJbOpenObject(jb, "tcp");
389 
390  TcpSession *ssn = f->protoctx;
391 
392  char hexflags[3];
393  snprintf(hexflags, sizeof(hexflags), "%02x",
394  ssn ? ssn->tcp_packet_flags : 0);
395  SCJbSetString(jb, "tcp_flags", hexflags);
396 
397  snprintf(hexflags, sizeof(hexflags), "%02x",
398  ssn ? ssn->client.tcp_flags : 0);
399  SCJbSetString(jb, "tcp_flags_ts", hexflags);
400 
401  snprintf(hexflags, sizeof(hexflags), "%02x",
402  ssn ? ssn->server.tcp_flags : 0);
403  SCJbSetString(jb, "tcp_flags_tc", hexflags);
404 
405  EveTcpFlags(ssn ? ssn->tcp_packet_flags : 0, jb);
406 
407  if (ssn) {
408  const char *tcp_state = StreamTcpStateAsString(ssn->state);
409  if (tcp_state != NULL)
410  SCJbSetString(jb, "state", tcp_state);
412  JB_SET_TRUE(jb, "tc_gap");
413  }
415  JB_SET_TRUE(jb, "ts_gap");
416  }
417 
418  SCJbSetUint(jb, "ts_max_regions", ssn->client.sb.max_regions);
419  SCJbSetUint(jb, "tc_max_regions", ssn->server.sb.max_regions);
420 
421  if (ssn->urg_offset_ts)
422  SCJbSetUint(jb, "ts_urgent_oob_data", ssn->urg_offset_ts);
423  if (ssn->urg_offset_tc)
424  SCJbSetUint(jb, "tc_urgent_oob_data", ssn->urg_offset_tc);
425  }
426 
427  /* Close tcp. */
428  SCJbClose(jb);
429  }
430 }
431 
432 static int JsonFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
433 {
434  SCEnter();
435  OutputJsonThreadCtx *thread = thread_data;
436 
437  /* reset */
438  MemBufferReset(thread->buffer);
439 
440  SCJsonBuilder *jb = CreateEveHeaderFromFlow(f, &thread->ctx->cfg);
441  if (unlikely(jb == NULL)) {
443  }
444 
445  EveFlowLogJSON(thread, jb, f);
446 
447  OutputJsonBuilderBuffer(tv, NULL, f, jb, thread);
448  SCJbFree(jb);
449 
451 }
452 
454 {
455  /* register as child of eve-log */
456  OutputRegisterFlowSubModule(LOGGER_JSON_FLOW, "eve-log", "JsonFlowLog", "eve-log.flow",
458 }
util-device-private.h
tm-threads.h
ts
uint64_t ts
Definition: source-erf-file.c:55
FLOW_IS_IPV6
#define FLOW_IS_IPV6(f)
Definition: flow.h:163
Flow_::flags
uint64_t flags
Definition: flow.h:396
FLOW_STATE_ESTABLISHED
@ FLOW_STATE_ESTABLISHED
Definition: flow.h:498
CreateIsoTimeString
void CreateIsoTimeString(const SCTime_t ts, char *str, size_t size)
Definition: util-time.c:209
OutputJsonThreadCtx_::ctx
OutputJsonCtx * ctx
Definition: output-json.h:86
EveAddFlow
void EveAddFlow(Flow *f, SCJsonBuilder *js)
Definition: output-json-flow.c:203
Flow_::startts
SCTime_t startts
Definition: flow.h:486
stream-tcp.h
OutputJsonCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json.h:80
FlowBypassInfo_
Definition: flow.h:522
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
SCFlowGetStorageById
void * SCFlowGetStorageById(const Flow *f, SCFlowStorageId id)
Definition: flow-storage.c:40
FLOW_IS_ELEPHANT_TOCLIENT
#define FLOW_IS_ELEPHANT_TOCLIENT
Definition: flow.h:60
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
Flow_::esp
struct Flow_::@121::@128 esp
Flow_::proto
uint8_t proto
Definition: flow.h:369
EveAddAppProto
void EveAddAppProto(Flow *f, SCJsonBuilder *js)
Definition: output-json-flow.c:183
JsonLogThreadInit
TmEcode JsonLogThreadInit(ThreadVars *t, const void *initdata, void **data)
Definition: output-json-common.c:90
threads.h
PrintInetIPv6
const char * PrintInetIPv6(const void *src, char *dst, socklen_t size, bool compress_ipv6)
Definition: util-print.c:209
Flow_
Flow data structure.
Definition: flow.h:347
OutputJsonCommonSettings_
Definition: output-json.h:62
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:41
LiveDevice_
Definition: util-device-private.h:32
EXCEPTION_TARGET_FLAG_APPLAYER_ERROR
#define EXCEPTION_TARGET_FLAG_APPLAYER_ERROR
Definition: util-exception-policy-types.h:52
LiveDeviceGetById
LiveDevice * LiveDeviceGetById(const int id)
Definition: util-device.c:460
Flow_::alproto_orig
AppProto alproto_orig
Definition: flow.h:449
SCProtoNameValid
bool SCProtoNameValid(uint16_t proto)
Function to check if the received protocol number is valid and do we have corresponding name entry fo...
Definition: util-proto-name.c:450
StreamingBuffer_::max_regions
uint16_t max_regions
Definition: util-streaming-buffer.h:114
EveTcpFlags
void EveTcpFlags(const uint8_t flags, SCJsonBuilder *js)
jsonify tcp flags field Only add 'true' fields in an attempt to keep things reasonably compact.
Definition: output-json.c:447
FlowBypassInfo_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:527
TcpSession_::urg_offset_ts
uint16_t urg_offset_ts
Definition: stream-tcp-private.h:291
util-privs.h
known_proto
const char * known_proto[256]
Definition: util-proto-name.c:40
FLOW_ACTION_DROP
#define FLOW_ACTION_DROP
Definition: flow.h:69
TcpStream_::flags
uint16_t flags
Definition: stream-tcp-private.h:107
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:995
proto
uint8_t proto
Definition: decode-template.h:0
Flow_::livedev_id
uint16_t livedev_id
Definition: flow.h:392
CreateEveFlowId
void CreateEveFlowId(SCJsonBuilder *js, const Flow *f)
Definition: output-json.c:685
Flow_::dp
Port dp
Definition: flow.h:363
Flow_::protoctx
void * protoctx
Definition: flow.h:426
GetFlowBypassInfoID
SCFlowStorageId GetFlowBypassInfoID(void)
Definition: flow-util.c:223
ExceptionPolicyTargetFlagToString
const char * ExceptionPolicyTargetFlagToString(uint8_t target_flag)
Definition: util-exception-policy.c:97
JsonFlowLogRegister
void JsonFlowLogRegister(void)
Definition: output-json-flow.c:453
util-unittest.h
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
Flow_::flow_state
FlowStateType flow_state
Definition: flow.h:413
OutputJsonThreadCtx_
Definition: output-json.h:85
LOGGER_JSON_FLOW
@ LOGGER_JSON_FLOW
Definition: suricata-common.h:503
Flow_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:491
OutputJsonLogInitSub
OutputInitResult OutputJsonLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
Definition: output-json-common.c:73
FLOW_ACTION_PASS
#define FLOW_ACTION_PASS
Definition: flow.h:116
Flow_::dst
FlowAddress dst
Definition: flow.h:350
OutputRegisterFlowSubModule
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a flow output sub-module.
Definition: output.c:491
FLOW_STATE_LOCAL_BYPASSED
@ FLOW_STATE_LOCAL_BYPASSED
Definition: flow.h:500
EXCEPTION_TARGET_FLAG_DEFRAG_MEMCAP
#define EXCEPTION_TARGET_FLAG_DEFRAG_MEMCAP
Definition: util-exception-policy-types.h:47
ExceptionPolicyTargetPolicy
enum ExceptionPolicy ExceptionPolicyTargetPolicy(uint8_t target_flag)
Definition: util-exception-policy.c:117
util-debug.h
JB_SET_STRING
#define JB_SET_STRING(jb, key, val)
Definition: rust.h:36
output-json-flow.h
FlowBypassInfo_::todstbytecnt
uint64_t todstbytecnt
Definition: flow.h:529
EveAddCommonOptions
void EveAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, SCJsonBuilder *js, enum SCOutputJsonLogDirection dir)
Definition: output-json.c:395
Flow_::todstpktcnt
uint32_t todstpktcnt
Definition: flow.h:488
output-json.h
util-exception-policy.h
TcpSession_::urg_offset_tc
uint16_t urg_offset_tc
Definition: stream-tcp-private.h:292
Flow_::lastts
SCTime_t lastts
Definition: flow.h:411
util-print.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:284
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
PrintInet
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
Definition: util-print.c:238
Flow_::flow_end_flags
uint8_t flow_end_flags
Definition: flow.h:440
pkt-var.h
TcpSession_::state
uint8_t state
Definition: stream-tcp-private.h:285
FlowBypassInfo_::todstpktcnt
uint64_t todstpktcnt
Definition: flow.h:528
FLOW_WRONG_THREAD
#define FLOW_WRONG_THREAD
Definition: flow.h:109
util-time.h
JB_SET_TRUE
#define JB_SET_TRUE(jb, key)
Definition: rust.h:37
LiveDevice_::dev
char * dev
Definition: util-device-private.h:33
TcpSession_::tcp_packet_flags
uint8_t tcp_packet_flags
Definition: stream-tcp-private.h:290
LOG_DIR_FLOW
@ LOG_DIR_FLOW
Definition: output-eve-bindgen.h:35
app-layer-parser.h
Flow_::todstbytecnt
uint64_t todstbytecnt
Definition: flow.h:490
FLOW_IS_IPV4
#define FLOW_IS_IPV4(f)
Definition: flow.h:161
TimeGet
SCTime_t TimeGet(void)
Definition: util-time.c:152
stream-tcp-private.h
FLOW_END_FLAG_TCPREUSE
#define FLOW_END_FLAG_TCPREUSE
Definition: flow.h:237
conf.h
Port
uint16_t Port
Definition: decode.h:219
FLOW_END_FLAG_EMERGENCY
#define FLOW_END_FLAG_EMERGENCY
Definition: flow.h:233
SCTime_t
Definition: util-time.h:40
STREAMTCP_STREAM_FLAG_HAS_GAP
#define STREAMTCP_STREAM_FLAG_HAS_GAP
Definition: stream-tcp-private.h:217
EXCEPTION_TARGET_FLAG_REASSEMBLY_MEMCAP
#define EXCEPTION_TARGET_FLAG_REASSEMBLY_MEMCAP
Definition: util-exception-policy-types.h:49
Flow_::vlan_idx
uint8_t vlan_idx
Definition: flow.h:373
util-proto-name.h
FlowBypassInfo_::tosrcpktcnt
uint64_t tosrcpktcnt
Definition: flow.h:526
Flow_::alproto_expect
AppProto alproto_expect
Definition: flow.h:452
FLOW_STATE_SIZE
#define FLOW_STATE_SIZE
Definition: flow.h:508
Flow_::src
FlowAddress src
Definition: flow.h:350
OutputJsonCommonSettings_::compress_ipv6
bool compress_ipv6
Definition: output-json.h:66
EXCEPTION_TARGET_FLAG_MIDSTREAM
#define EXCEPTION_TARGET_FLAG_MIDSTREAM
Definition: util-exception-policy-types.h:51
flow-storage.h
OutputJsonThreadCtx_::buffer
MemBuffer * buffer
Definition: output-json.h:88
Flow_::applied_exception_policy
uint8_t applied_exception_policy
Definition: flow.h:466
FLOW_STATE_NEW
@ FLOW_STATE_NEW
Definition: flow.h:497
suricata-common.h
Flow_::icmp_d
struct Flow_::@123::@129 icmp_d
EXCEPTION_TARGET_FLAG_SESSION_MEMCAP
#define EXCEPTION_TARGET_FLAG_SESSION_MEMCAP
Definition: util-exception-policy-types.h:48
TcpStream_::sb
StreamingBuffer sb
Definition: stream-tcp-private.h:135
SCTIME_SECS
#define SCTIME_SECS(t)
Definition: util-time.h:57
TcpSession_::client
TcpStream client
Definition: stream-tcp-private.h:297
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:33
FLOW_ACTION_ACCEPT
#define FLOW_ACTION_ACCEPT
Definition: flow.h:63
threadvars.h
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:296
FLOW_STATE_CLOSED
@ FLOW_STATE_CLOSED
Definition: flow.h:499
ExceptionPolicyEnumToString
const char * ExceptionPolicyEnumToString(enum ExceptionPolicy policy, bool is_json)
Definition: util-exception-policy.c:39
FlowAddress_::address
union FlowAddress_::@120 address
Flow_::alproto_ts
AppProto alproto_ts
Definition: flow.h:444
util-logopenfile.h
Flow_::alstate
void * alstate
Definition: flow.h:472
util-buffer.h
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
FLOW_END_FLAG_SHUTDOWN
#define FLOW_END_FLAG_SHUTDOWN
Definition: flow.h:236
EXCEPTION_TARGET_FLAG_FLOW_MEMCAP
#define EXCEPTION_TARGET_FLAG_FLOW_MEMCAP
Definition: util-exception-policy-types.h:50
StreamTcpStateAsString
const char * StreamTcpStateAsString(const enum TcpState state)
Definition: stream-tcp.c:7291
Flow_::vlan_id
uint16_t vlan_id[VLAN_MAX_LAYERS]
Definition: flow.h:371
FlowHasAlerts
int FlowHasAlerts(const Flow *f)
Check if flow has alerts.
Definition: flow.c:165
FLOW_END_FLAG_TIMEOUT
#define FLOW_END_FLAG_TIMEOUT
Definition: flow.h:234
IPPROTO_SCTP
#define IPPROTO_SCTP
Definition: decode.h:1257
Flow_::icmp_s
struct Flow_::@121::@127 icmp_s
Flow_::sp
Port sp
Definition: flow.h:352
JsonLogThreadDeinit
TmEcode JsonLogThreadDeinit(ThreadVars *t, void *data)
Definition: output-json-common.c:123
TcpSession_
Definition: stream-tcp-private.h:283
Flow_::alproto_tc
AppProto alproto_tc
Definition: flow.h:445
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:443
FLOW_END_FLAG_FORCED
#define FLOW_END_FLAG_FORCED
Definition: flow.h:235
FLOW_DIR_REVERSED
#define FLOW_DIR_REVERSED
Definition: flow.h:111
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:288
AppLayerParserGetTxCnt
uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
Definition: app-layer-parser.c:1126
TcpStream_::tcp_flags
uint8_t tcp_flags
Definition: stream-tcp-private.h:111
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:102
Flow_::tosrcpktcnt
uint32_t tosrcpktcnt
Definition: flow.h:489
FLOW_IS_ELEPHANT_TOSERVER
#define FLOW_IS_ELEPHANT_TOSERVER
Definition: flow.h:59
output.h