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 
38 #include "util-debug.h"
39 
40 #include "output.h"
41 #include "util-privs.h"
42 #include "util-buffer.h"
43 #include "util-device-private.h"
44 #include "util-proto-name.h"
45 #include "util-logopenfile.h"
46 #include "output-json.h"
47 #include "output-json-flow.h"
48 
49 #include "stream-tcp.h"
50 #include "stream-tcp-private.h"
51 #include "flow-storage.h"
52 #include "util-exception-policy.h"
53 
54 static SCJsonBuilder *CreateEveHeaderFromFlow(const Flow *f, OutputJsonCommonSettings *cfg)
55 {
56  char timebuf[64];
57  char srcip[46] = {0}, dstip[46] = {0};
58  Port sp, dp;
59 
60  SCJsonBuilder *jb = SCJbNewObject();
61  if (unlikely(jb == NULL)) {
62  return NULL;
63  }
64 
65  SCTime_t ts = TimeGet();
66 
67  CreateIsoTimeString(ts, timebuf, sizeof(timebuf));
68 
69  if ((f->flags & FLOW_DIR_REVERSED) == 0) {
70  if (FLOW_IS_IPV4(f)) {
71  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), srcip, sizeof(srcip));
72  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), dstip, sizeof(dstip));
73  } else if (FLOW_IS_IPV6(f)) {
75  (const void *)&(f->src.address), srcip, sizeof(srcip), cfg->compress_ipv6);
77  (const void *)&(f->dst.address), dstip, sizeof(dstip), cfg->compress_ipv6);
78  }
79  sp = f->sp;
80  dp = f->dp;
81  } else {
82  if (FLOW_IS_IPV4(f)) {
83  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), srcip, sizeof(srcip));
84  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), dstip, sizeof(dstip));
85  } else if (FLOW_IS_IPV6(f)) {
87  (const void *)&(f->dst.address), srcip, sizeof(srcip), cfg->compress_ipv6);
89  (const void *)&(f->src.address), dstip, sizeof(dstip), cfg->compress_ipv6);
90  }
91  sp = f->dp;
92  dp = f->sp;
93  }
94 
95  /* time */
96  SCJbSetString(jb, "timestamp", timebuf);
97 
98  CreateEveFlowId(jb, (const Flow *)f);
99 
100 #if 0 // TODO
101  /* sensor id */
102  if (sensor_id >= 0)
103  json_object_set_new(js, "sensor_id", json_integer(sensor_id));
104 #endif
105 
106  /* input interface */
108  if (dev) {
109  SCJbSetString(jb, "in_iface", dev->dev);
110  }
111 
112  JB_SET_STRING(jb, "event_type", "flow");
113 
114  /* vlan */
115  if (f->vlan_idx > 0) {
116  SCJbOpenArray(jb, "vlan");
117  SCJbAppendUint(jb, f->vlan_id[0]);
118  if (f->vlan_idx > 1) {
119  SCJbAppendUint(jb, f->vlan_id[1]);
120  }
121  if (f->vlan_idx > 2) {
122  SCJbAppendUint(jb, f->vlan_id[2]);
123  }
124  SCJbClose(jb);
125  }
126 
127  /* tuple */
128  SCJbSetString(jb, "src_ip", srcip);
129  switch(f->proto) {
130  case IPPROTO_ICMP:
131  break;
132  case IPPROTO_UDP:
133  case IPPROTO_TCP:
134  case IPPROTO_SCTP:
135  SCJbSetUint(jb, "src_port", sp);
136  break;
137  }
138  SCJbSetString(jb, "dest_ip", dstip);
139  switch(f->proto) {
140  case IPPROTO_ICMP:
141  break;
142  case IPPROTO_UDP:
143  case IPPROTO_TCP:
144  case IPPROTO_SCTP:
145  SCJbSetUint(jb, "dest_port", dp);
146  break;
147  }
148 
149  /* ip version */
150  if (FLOW_IS_IPV4(f)) {
151  SCJbSetUint(jb, "ip_v", 4);
152  } else if (FLOW_IS_IPV6(f)) {
153  SCJbSetUint(jb, "ip_v", 6);
154  }
155 
156  if (SCProtoNameValid(f->proto)) {
157  SCJbSetString(jb, "proto", known_proto[f->proto]);
158  } else {
159  char proto[4];
160  snprintf(proto, sizeof(proto), "%"PRIu8"", f->proto);
161  SCJbSetString(jb, "proto", proto);
162  }
163 
164  switch (f->proto) {
165  case IPPROTO_ICMP:
166  case IPPROTO_ICMPV6:
167  SCJbSetUint(jb, "icmp_type", f->icmp_s.type);
168  SCJbSetUint(jb, "icmp_code", f->icmp_s.code);
169  if (f->tosrcpktcnt) {
170  SCJbSetUint(jb, "response_icmp_type", f->icmp_d.type);
171  SCJbSetUint(jb, "response_icmp_code", f->icmp_d.code);
172  }
173  break;
174  case IPPROTO_ESP:
175  SCJbSetUint(jb, "spi", f->esp.spi);
176  break;
177  }
178  return jb;
179 }
180 
182 {
183  if (f->alproto) {
184  SCJbSetString(js, "app_proto", AppProtoToString(f->alproto));
185  }
186  if (f->alproto_ts && f->alproto_ts != f->alproto) {
187  SCJbSetString(js, "app_proto_ts", AppProtoToString(f->alproto_ts));
188  }
189  if (f->alproto_tc && f->alproto_tc != f->alproto) {
190  SCJbSetString(js, "app_proto_tc", AppProtoToString(f->alproto_tc));
191  }
193  SCJbSetString(js, "app_proto_orig", AppProtoToString(f->alproto_orig));
194  }
196  SCJbSetString(js, "app_proto_expected", AppProtoToString(f->alproto_expect));
197  }
198 
199 }
200 
202 {
204  if (fc) {
205  SCJbSetUint(js, "pkts_toserver", f->todstpktcnt + fc->todstpktcnt);
206  SCJbSetUint(js, "pkts_toclient", f->tosrcpktcnt + fc->tosrcpktcnt);
207  SCJbSetUint(js, "bytes_toserver", f->todstbytecnt + fc->todstbytecnt);
208  SCJbSetUint(js, "bytes_toclient", f->tosrcbytecnt + fc->tosrcbytecnt);
209 
210  SCJbOpenObject(js, "bypassed");
211  SCJbSetUint(js, "pkts_toserver", fc->todstpktcnt);
212  SCJbSetUint(js, "pkts_toclient", fc->tosrcpktcnt);
213  SCJbSetUint(js, "bytes_toserver", fc->todstbytecnt);
214  SCJbSetUint(js, "bytes_toclient", fc->tosrcbytecnt);
215  SCJbClose(js);
216  } else {
217  SCJbSetUint(js, "pkts_toserver", f->todstpktcnt);
218  SCJbSetUint(js, "pkts_toclient", f->tosrcpktcnt);
219  SCJbSetUint(js, "bytes_toserver", f->todstbytecnt);
220  SCJbSetUint(js, "bytes_toclient", f->tosrcbytecnt);
221  }
222 
223  char timebuf1[64];
224  CreateIsoTimeString(f->startts, timebuf1, sizeof(timebuf1));
225  SCJbSetString(js, "start", timebuf1);
226 }
227 
228 static void EveExceptionPolicyLog(SCJsonBuilder *js, uint16_t flag)
229 {
231  SCJbStartObject(js);
232  SCJbSetString(js, "target",
234  SCJbSetString(js, "policy",
237  SCJbClose(js);
238  }
240  SCJbStartObject(js);
241  SCJbSetString(js, "target",
243  SCJbSetString(js, "policy",
246  SCJbClose(js);
247  }
249  SCJbStartObject(js);
250  SCJbSetString(js, "target",
252  SCJbSetString(js, "policy",
255  true));
256  SCJbClose(js);
257  }
259  SCJbStartObject(js);
260  SCJbSetString(
262  SCJbSetString(js, "policy",
265  SCJbClose(js);
266  }
267  if (flag & EXCEPTION_TARGET_FLAG_MIDSTREAM) {
268  SCJbStartObject(js);
269  SCJbSetString(
271  SCJbSetString(js, "policy",
274  SCJbClose(js);
275  }
277  SCJbStartObject(js);
278  SCJbSetString(js, "target",
280  SCJbSetString(js, "policy",
283  SCJbClose(js);
284  }
285 }
286 
287 /* Eve format logging */
288 static void EveFlowLogJSON(OutputJsonThreadCtx *aft, SCJsonBuilder *jb, Flow *f)
289 {
290  EveAddAppProto(f, jb);
291  SCJbOpenObject(jb, "flow");
292  EveAddFlow(f, jb);
293 
294  char timebuf2[64];
295  CreateIsoTimeString(f->lastts, timebuf2, sizeof(timebuf2));
296  SCJbSetString(jb, "end", timebuf2);
297 
298  uint64_t age = (SCTIME_SECS(f->lastts) - SCTIME_SECS(f->startts));
299  SCJbSetUint(jb, "age", age);
300 
302  JB_SET_TRUE(jb, "emergency");
303 
304  const int flow_state = f->flow_state;
305  switch (flow_state) {
306  case FLOW_STATE_NEW:
307  JB_SET_STRING(jb, "state", "new");
308  break;
310  JB_SET_STRING(jb, "state", "established");
311  break;
312  case FLOW_STATE_CLOSED:
313  JB_SET_STRING(jb, "state", "closed");
314  break;
316  JB_SET_STRING(jb, "state", "bypassed");
317  JB_SET_STRING(jb, "bypass", "local");
318  break;
319 #ifdef CAPTURE_OFFLOAD
320  case FLOW_STATE_CAPTURE_BYPASSED:
321  JB_SET_STRING(jb, "state", "bypassed");
322  JB_SET_STRING(jb, "bypass", "capture");
323  break;
324 #endif
325  case FLOW_STATE_SIZE:
327  SCLogDebug("invalid flow state: %d, contact developers", flow_state);
328  }
329 
330  const char *reason = NULL;
332  reason = "tcp_reuse";
334  reason = "forced";
336  reason = "shutdown";
338  reason = "timeout";
339  else
340  reason = "unknown";
341 
342  SCJbSetString(jb, "reason", reason);
343 
344  SCJbSetBool(jb, "alerted", FlowHasAlerts(f));
345  if (f->flags & FLOW_WRONG_THREAD)
346  JB_SET_TRUE(jb, "wrong_thread");
347 
349  JB_SET_TRUE(jb, "elephant");
350  SCJbOpenArray(jb, "elephant_direction");
352  SCJbAppendString(jb, "toserver");
354  SCJbAppendString(jb, "toclient");
355 
356  SCJbClose(jb);
357  }
358 
359  if (f->flags & FLOW_ACTION_DROP) {
360  JB_SET_STRING(jb, "action", "drop");
361  } else if (f->flags & FLOW_ACTION_ACCEPT) {
362  JB_SET_STRING(jb, "action", "accept");
363  } else if (f->flags & FLOW_ACTION_PASS) {
364  JB_SET_STRING(jb, "action", "pass");
365  }
366  if (f->applied_exception_policy != 0) {
367  SCJbOpenArray(jb, "exception_policy");
368  EveExceptionPolicyLog(jb, f->applied_exception_policy);
369  SCJbClose(jb); /* close array */
370  }
371 
372  if (f->alstate) {
373  uint64_t tx_id = AppLayerParserGetTxCnt(f, f->alstate);
374  if (tx_id) {
375  SCJbSetUint(jb, "tx_cnt", tx_id);
376  }
377  }
378 
379  /* Close flow. */
380  SCJbClose(jb);
381 
382  EveAddCommonOptions(&aft->ctx->cfg, NULL, f, jb, LOG_DIR_FLOW);
383 
384  /* TCP */
385  if (f->proto == IPPROTO_TCP) {
386  SCJbOpenObject(jb, "tcp");
387 
388  TcpSession *ssn = f->protoctx;
389 
390  char hexflags[3];
391  snprintf(hexflags, sizeof(hexflags), "%02x",
392  ssn ? ssn->tcp_packet_flags : 0);
393  SCJbSetString(jb, "tcp_flags", hexflags);
394 
395  snprintf(hexflags, sizeof(hexflags), "%02x",
396  ssn ? ssn->client.tcp_flags : 0);
397  SCJbSetString(jb, "tcp_flags_ts", hexflags);
398 
399  snprintf(hexflags, sizeof(hexflags), "%02x",
400  ssn ? ssn->server.tcp_flags : 0);
401  SCJbSetString(jb, "tcp_flags_tc", hexflags);
402 
403  EveTcpFlags(ssn ? ssn->tcp_packet_flags : 0, jb);
404 
405  if (ssn) {
406  const char *tcp_state = StreamTcpStateAsString(ssn->state);
407  if (tcp_state != NULL)
408  SCJbSetString(jb, "state", tcp_state);
410  JB_SET_TRUE(jb, "tc_gap");
411  }
413  JB_SET_TRUE(jb, "ts_gap");
414  }
415 
416  SCJbSetUint(jb, "ts_max_regions", ssn->client.sb.max_regions);
417  SCJbSetUint(jb, "tc_max_regions", ssn->server.sb.max_regions);
418 
419  if (ssn->urg_offset_ts)
420  SCJbSetUint(jb, "ts_urgent_oob_data", ssn->urg_offset_ts);
421  if (ssn->urg_offset_tc)
422  SCJbSetUint(jb, "tc_urgent_oob_data", ssn->urg_offset_tc);
423  }
424 
425  /* Close tcp. */
426  SCJbClose(jb);
427  }
428 }
429 
430 static int JsonFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
431 {
432  SCEnter();
433  OutputJsonThreadCtx *thread = thread_data;
434 
435  /* reset */
436  MemBufferReset(thread->buffer);
437 
438  SCJsonBuilder *jb = CreateEveHeaderFromFlow(f, &thread->ctx->cfg);
439  if (unlikely(jb == NULL)) {
441  }
442 
443  EveFlowLogJSON(thread, jb, f);
444 
445  OutputJsonBuilderBuffer(tv, NULL, f, jb, thread);
446  SCJbFree(jb);
447 
449 }
450 
452 {
453  /* register as child of eve-log */
454  OutputRegisterFlowSubModule(LOGGER_JSON_FLOW, "eve-log", "JsonFlowLog", "eve-log.flow",
456 }
SCJsonBuilder
struct SCJsonBuilder SCJsonBuilder
Definition: detect-engine-helper.h:83
util-device-private.h
tm-threads.h
ts
uint64_t ts
Definition: source-erf-file.c:68
FLOW_IS_IPV6
#define FLOW_IS_IPV6(f)
Definition: flow.h:175
Flow_::flags
uint64_t flags
Definition: flow.h:408
FLOW_STATE_ESTABLISHED
@ FLOW_STATE_ESTABLISHED
Definition: flow.h:510
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:201
Flow_::startts
SCTime_t startts
Definition: flow.h:498
stream-tcp.h
OutputJsonCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json.h:80
FlowBypassInfo_
Definition: flow.h:534
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
SCFlowGetStorageById
void * SCFlowGetStorageById(const Flow *f, SCFlowStorageId id)
Definition: flow-storage.c:37
FLOW_IS_ELEPHANT_TOCLIENT
#define FLOW_IS_ELEPHANT_TOCLIENT
Definition: flow.h:60
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
Flow_::proto
uint8_t proto
Definition: flow.h:381
EveAddAppProto
void EveAddAppProto(Flow *f, SCJsonBuilder *js)
Definition: output-json-flow.c:181
ssn
TcpSession ssn
Definition: fuzz_dataset.c:31
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:359
OutputJsonCommonSettings_
Definition: output-json.h:62
Flow_::esp
struct Flow_::@126::@133 esp
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its normalized string equivalent.
Definition: app-layer-protos.c:53
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:461
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:449
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:444
FlowBypassInfo_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:539
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:39
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:1018
proto
uint8_t proto
Definition: decode-template.h:0
Flow_::livedev_id
uint16_t livedev_id
Definition: flow.h:404
CreateEveFlowId
void CreateEveFlowId(SCJsonBuilder *js, const Flow *f)
Definition: output-json.c:682
Flow_::dp
Port dp
Definition: flow.h:375
Flow_::protoctx
void * protoctx
Definition: flow.h:438
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:451
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
Flow_::flow_state
FlowStateType flow_state
Definition: flow.h:425
OutputJsonThreadCtx_
Definition: output-json.h:85
LOGGER_JSON_FLOW
@ LOGGER_JSON_FLOW
Definition: suricata-common.h:507
Flow_::icmp_d
struct Flow_::@128::@134 icmp_d
Flow_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:503
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:362
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:500
FLOW_STATE_LOCAL_BYPASSED
@ FLOW_STATE_LOCAL_BYPASSED
Definition: flow.h:512
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:541
EveAddCommonOptions
void EveAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, SCJsonBuilder *js, enum SCOutputJsonLogDirection dir)
Definition: output-json.c:392
Flow_::todstpktcnt
uint32_t todstpktcnt
Definition: flow.h:500
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:423
util-print.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:284
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
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:452
pkt-var.h
TcpSession_::state
uint8_t state
Definition: stream-tcp-private.h:285
FlowBypassInfo_::todstpktcnt
uint64_t todstpktcnt
Definition: flow.h:540
FLOW_WRONG_THREAD
#define FLOW_WRONG_THREAD
Definition: flow.h:109
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:502
FLOW_IS_IPV4
#define FLOW_IS_IPV4(f)
Definition: flow.h:173
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:249
conf.h
Port
uint16_t Port
Definition: decode.h:219
FLOW_END_FLAG_EMERGENCY
#define FLOW_END_FLAG_EMERGENCY
Definition: flow.h:245
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:385
util-proto-name.h
FlowBypassInfo_::tosrcpktcnt
uint64_t tosrcpktcnt
Definition: flow.h:538
Flow_::alproto_expect
AppProto alproto_expect
Definition: flow.h:464
FLOW_STATE_SIZE
#define FLOW_STATE_SIZE
Definition: flow.h:520
Flow_::src
FlowAddress src
Definition: flow.h:362
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
Flow_::icmp_s
struct Flow_::@126::@132 icmp_s
OutputJsonThreadCtx_::buffer
MemBuffer * buffer
Definition: output-json.h:88
Flow_::applied_exception_policy
uint8_t applied_exception_policy
Definition: flow.h:478
FLOW_STATE_NEW
@ FLOW_STATE_NEW
Definition: flow.h:509
suricata-common.h
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:34
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:511
ExceptionPolicyEnumToString
const char * ExceptionPolicyEnumToString(enum ExceptionPolicy policy, bool is_json)
Definition: util-exception-policy.c:39
Flow_::alproto_ts
AppProto alproto_ts
Definition: flow.h:456
util-logopenfile.h
Flow_::alstate
void * alstate
Definition: flow.h:484
util-buffer.h
FlowAddress_::address
union FlowAddress_::@125 address
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
FLOW_END_FLAG_SHUTDOWN
#define FLOW_END_FLAG_SHUTDOWN
Definition: flow.h:248
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:7312
Flow_::vlan_id
uint16_t vlan_id[VLAN_MAX_LAYERS]
Definition: flow.h:383
FlowHasAlerts
int FlowHasAlerts(const Flow *f)
Check if flow has alerts.
Definition: flow.c:162
FLOW_END_FLAG_TIMEOUT
#define FLOW_END_FLAG_TIMEOUT
Definition: flow.h:246
IPPROTO_SCTP
#define IPPROTO_SCTP
Definition: decode.h:1273
Flow_::sp
Port sp
Definition: flow.h:364
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:457
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:455
FLOW_END_FLAG_FORCED
#define FLOW_END_FLAG_FORCED
Definition: flow.h:247
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:1212
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:109
Flow_::tosrcpktcnt
uint32_t tosrcpktcnt
Definition: flow.h:501
FLOW_IS_ELEPHANT_TOSERVER
#define FLOW_IS_ELEPHANT_TOSERVER
Definition: flow.h:59
output.h
f
Flow f
Definition: fuzz_dataset.c:32