suricata
output-json-flow.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2020 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 "debug.h"
28 #include "detect.h"
29 #include "pkt-var.h"
30 #include "conf.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-proto-name.h"
45 #include "util-logopenfile.h"
46 #include "util-time.h"
47 #include "output-json.h"
48 #include "output-json-flow.h"
49 
50 #include "stream-tcp.h"
51 #include "stream-tcp-private.h"
52 #include "flow-storage.h"
53 
54 typedef struct LogJsonFileCtx_ {
56  uint32_t flags; /** Store mode */
59 
60 typedef struct JsonFlowLogThread_ {
62  /** LogFileCtx has the pointer to the file and a mutex to allow multithreading */
66 
67 static JsonBuilder *CreateEveHeaderFromFlow(const Flow *f)
68 {
69  char timebuf[64];
70  char srcip[46] = {0}, dstip[46] = {0};
71  Port sp, dp;
72 
73  JsonBuilder *jb = jb_new_object();
74  if (unlikely(jb == NULL)) {
75  return NULL;
76  }
77 
78  struct timeval tv;
79  memset(&tv, 0x00, sizeof(tv));
80  TimeGet(&tv);
81 
82  CreateIsoTimeString(&tv, timebuf, sizeof(timebuf));
83 
84  if ((f->flags & FLOW_DIR_REVERSED) == 0) {
85  if (FLOW_IS_IPV4(f)) {
86  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), srcip, sizeof(srcip));
87  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), dstip, sizeof(dstip));
88  } else if (FLOW_IS_IPV6(f)) {
89  PrintInet(AF_INET6, (const void *)&(f->src.address), srcip, sizeof(srcip));
90  PrintInet(AF_INET6, (const void *)&(f->dst.address), dstip, sizeof(dstip));
91  }
92  sp = f->sp;
93  dp = f->dp;
94  } else {
95  if (FLOW_IS_IPV4(f)) {
96  PrintInet(AF_INET, (const void *)&(f->dst.addr_data32[0]), srcip, sizeof(srcip));
97  PrintInet(AF_INET, (const void *)&(f->src.addr_data32[0]), dstip, sizeof(dstip));
98  } else if (FLOW_IS_IPV6(f)) {
99  PrintInet(AF_INET6, (const void *)&(f->dst.address), srcip, sizeof(srcip));
100  PrintInet(AF_INET6, (const void *)&(f->src.address), dstip, sizeof(dstip));
101  }
102  sp = f->dp;
103  dp = f->sp;
104  }
105 
106  /* time */
107  jb_set_string(jb, "timestamp", timebuf);
108 
109  CreateEveFlowId(jb, (const Flow *)f);
110 
111 #if 0 // TODO
112  /* sensor id */
113  if (sensor_id >= 0)
114  json_object_set_new(js, "sensor_id", json_integer(sensor_id));
115 #endif
116 
117  /* input interface */
118  if (f->livedev) {
119  jb_set_string(jb, "in_iface", f->livedev->dev);
120  }
121 
122  JB_SET_STRING(jb, "event_type", "flow");
123 
124  /* vlan */
125  if (f->vlan_idx > 0) {
126  jb_open_array(jb, "vlan");
127  jb_append_uint(jb, f->vlan_id[0]);
128  if (f->vlan_idx > 1) {
129  jb_append_uint(jb, f->vlan_id[1]);
130  }
131  jb_close(jb);
132  }
133 
134  /* tuple */
135  jb_set_string(jb, "src_ip", srcip);
136  switch(f->proto) {
137  case IPPROTO_ICMP:
138  break;
139  case IPPROTO_UDP:
140  case IPPROTO_TCP:
141  case IPPROTO_SCTP:
142  jb_set_uint(jb, "src_port", sp);
143  break;
144  }
145  jb_set_string(jb, "dest_ip", dstip);
146  switch(f->proto) {
147  case IPPROTO_ICMP:
148  break;
149  case IPPROTO_UDP:
150  case IPPROTO_TCP:
151  case IPPROTO_SCTP:
152  jb_set_uint(jb, "dest_port", dp);
153  break;
154  }
155 
156  if (SCProtoNameValid(f->proto)) {
157  jb_set_string(jb, "proto", known_proto[f->proto]);
158  } else {
159  char proto[4];
160  snprintf(proto, sizeof(proto), "%"PRIu8"", f->proto);
161  jb_set_string(jb, "proto", proto);
162  }
163 
164  switch (f->proto) {
165  case IPPROTO_ICMP:
166  case IPPROTO_ICMPV6:
167  jb_set_uint(jb, "icmp_type", f->icmp_s.type);
168  jb_set_uint(jb, "icmp_code", f->icmp_s.code);
169  if (f->tosrcpktcnt) {
170  jb_set_uint(jb, "response_icmp_type", f->icmp_d.type);
171  jb_set_uint(jb, "response_icmp_code", f->icmp_d.code);
172  }
173  break;
174  }
175  return jb;
176 }
177 
178 void EveAddAppProto(Flow *f, JsonBuilder *js)
179 {
180  if (f->alproto) {
181  jb_set_string(js, "app_proto", AppProtoToString(f->alproto));
182  }
183  if (f->alproto_ts && f->alproto_ts != f->alproto) {
184  jb_set_string(js, "app_proto_ts", AppProtoToString(f->alproto_ts));
185  }
186  if (f->alproto_tc && f->alproto_tc != f->alproto) {
187  jb_set_string(js, "app_proto_tc", AppProtoToString(f->alproto_tc));
188  }
189  if (f->alproto_orig != f->alproto && f->alproto_orig != ALPROTO_UNKNOWN) {
190  jb_set_string(js, "app_proto_orig", AppProtoToString(f->alproto_orig));
191  }
192  if (f->alproto_expect != f->alproto && f->alproto_expect != ALPROTO_UNKNOWN) {
193  jb_set_string(js, "app_proto_expected",
195  }
196 
197 }
198 
199 void EveAddFlow(Flow *f, JsonBuilder *js)
200 {
202  if (fc) {
203  jb_set_uint(js, "pkts_toserver", f->todstpktcnt + fc->todstpktcnt);
204  jb_set_uint(js, "pkts_toclient", f->tosrcpktcnt + fc->tosrcpktcnt);
205  jb_set_uint(js, "bytes_toserver", f->todstbytecnt + fc->todstbytecnt);
206  jb_set_uint(js, "bytes_toclient", f->tosrcbytecnt + fc->tosrcbytecnt);
207 
208  jb_open_object(js, "bypassed");
209  jb_set_uint(js, "pkts_toserver", fc->todstpktcnt);
210  jb_set_uint(js, "pkts_toclient", fc->tosrcpktcnt);
211  jb_set_uint(js, "bytes_toserver", fc->todstbytecnt);
212  jb_set_uint(js, "bytes_toclient", fc->tosrcbytecnt);
213  jb_close(js);
214  } else {
215  jb_set_uint(js, "pkts_toserver", f->todstpktcnt);
216  jb_set_uint(js, "pkts_toclient", f->tosrcpktcnt);
217  jb_set_uint(js, "bytes_toserver", f->todstbytecnt);
218  jb_set_uint(js, "bytes_toclient", f->tosrcbytecnt);
219  }
220 
221  char timebuf1[64];
222  CreateIsoTimeString(&f->startts, timebuf1, sizeof(timebuf1));
223  jb_set_string(js, "start", timebuf1);
224 }
225 
226 /* Eve format logging */
227 static void EveFlowLogJSON(JsonFlowLogThread *aft, JsonBuilder *jb, Flow *f)
228 {
229  LogJsonFileCtx *flow_ctx = aft->flowlog_ctx;
230 
231  EveAddAppProto(f, jb);
232  jb_open_object(jb, "flow");
233  EveAddFlow(f, jb);
234 
235  char timebuf2[64];
236  CreateIsoTimeString(&f->lastts, timebuf2, sizeof(timebuf2));
237  jb_set_string(jb, "end", timebuf2);
238 
239  int32_t age = f->lastts.tv_sec - f->startts.tv_sec;
240  jb_set_uint(jb, "age", age);
241 
243  JB_SET_TRUE(jb, "emergency");
244  const char *state = NULL;
246  state = "new";
248  state = "established";
250  state = "closed";
252  state = "bypassed";
253  int flow_state = f->flow_state;
254  switch (flow_state) {
256  JB_SET_STRING(jb, "bypass", "local");
257  break;
258 #ifdef CAPTURE_OFFLOAD
259  case FLOW_STATE_CAPTURE_BYPASSED:
260  JB_SET_STRING(jb, "bypass", "capture");
261  break;
262 #endif
263  default:
265  "Invalid flow state: %d, contact developers",
266  flow_state);
267  }
268  }
269 
270  jb_set_string(jb, "state", state);
271 
272  const char *reason = NULL;
274  reason = "forced";
276  reason = "shutdown";
278  reason = "timeout";
279  else
280  reason = "unknown";
281 
282  jb_set_string(jb, "reason", reason);
283 
284  jb_set_bool(jb, "alerted", FlowHasAlerts(f));
285  if (f->flags & FLOW_WRONG_THREAD)
286  JB_SET_TRUE(jb, "wrong_thread");
287 
288  /* Close flow. */
289  jb_close(jb);
290 
291  EveAddCommonOptions(&flow_ctx->cfg, NULL, f, jb);
292 
293  /* TCP */
294  if (f->proto == IPPROTO_TCP) {
295  jb_open_object(jb, "tcp");
296 
297  TcpSession *ssn = f->protoctx;
298 
299  char hexflags[3];
300  snprintf(hexflags, sizeof(hexflags), "%02x",
301  ssn ? ssn->tcp_packet_flags : 0);
302  jb_set_string(jb, "tcp_flags", hexflags);
303 
304  snprintf(hexflags, sizeof(hexflags), "%02x",
305  ssn ? ssn->client.tcp_flags : 0);
306  jb_set_string(jb, "tcp_flags_ts", hexflags);
307 
308  snprintf(hexflags, sizeof(hexflags), "%02x",
309  ssn ? ssn->server.tcp_flags : 0);
310  jb_set_string(jb, "tcp_flags_tc", hexflags);
311 
312  EveTcpFlags(ssn ? ssn->tcp_packet_flags : 0, jb);
313 
314  if (ssn) {
315  const char *tcp_state = StreamTcpStateAsString(ssn->state);
316  if (tcp_state != NULL)
317  jb_set_string(jb, "state", tcp_state);
319  JB_SET_TRUE(jb, "gap_ts");
321  JB_SET_TRUE(jb, "gap_tc");
322  }
323 
324  /* Close tcp. */
325  jb_close(jb);
326  }
327 }
328 
329 static int JsonFlowLogger(ThreadVars *tv, void *thread_data, Flow *f)
330 {
331  SCEnter();
332  JsonFlowLogThread *jhl = (JsonFlowLogThread *)thread_data;
333 
334  /* reset */
335  MemBufferReset(jhl->buffer);
336 
337  JsonBuilder *jb = CreateEveHeaderFromFlow(f);
338  if (unlikely(jb == NULL)) {
340  }
341 
342  EveFlowLogJSON(jhl, jb, f);
343 
344  OutputJsonBuilderBuffer(jb, jhl->file_ctx, &jhl->buffer);
345  jb_free(jb);
346 
348 }
349 
350 static void OutputFlowLogDeinitSub(OutputCtx *output_ctx)
351 {
352  LogJsonFileCtx *flow_ctx = output_ctx->data;
353  SCFree(flow_ctx);
354  SCFree(output_ctx);
355 }
356 
357 static OutputInitResult OutputFlowLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
358 {
359  OutputInitResult result = { NULL, false };
360  OutputJsonCtx *ojc = parent_ctx->data;
361 
362  LogJsonFileCtx *flow_ctx = SCMalloc(sizeof(LogJsonFileCtx));
363  if (unlikely(flow_ctx == NULL))
364  return result;
365 
366  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
367  if (unlikely(output_ctx == NULL)) {
368  SCFree(flow_ctx);
369  return result;
370  }
371 
372  flow_ctx->file_ctx = ojc->file_ctx;
373  flow_ctx->cfg = ojc->cfg;
374 
375  output_ctx->data = flow_ctx;
376  output_ctx->DeInit = OutputFlowLogDeinitSub;
377 
378  result.ctx = output_ctx;
379  result.ok = true;
380  return result;
381 }
382 
383 static TmEcode JsonFlowLogThreadInit(ThreadVars *t, const void *initdata, void **data)
384 {
385  JsonFlowLogThread *aft = SCCalloc(1, sizeof(JsonFlowLogThread));
386  if (unlikely(aft == NULL))
387  return TM_ECODE_FAILED;
388 
389  if(initdata == NULL)
390  {
391  SCLogDebug("Error getting context for EveLogFlow. \"initdata\" argument NULL");
392  goto error_exit;
393  }
394 
395  /* Use the Outptut Context (file pointer and mutex) */
396  aft->flowlog_ctx = ((OutputCtx *)initdata)->data; //TODO
397 
399  if (aft->buffer == NULL) {
400  goto error_exit;
401  }
402 
404  if (!aft->file_ctx) {
405  goto error_exit;
406  }
407 
408  *data = (void *)aft;
409  return TM_ECODE_OK;
410 
411 error_exit:
412  if (aft->buffer != NULL) {
413  MemBufferFree(aft->buffer);
414  }
415  SCFree(aft);
416  return TM_ECODE_FAILED;
417 }
418 
419 static TmEcode JsonFlowLogThreadDeinit(ThreadVars *t, void *data)
420 {
421  JsonFlowLogThread *aft = (JsonFlowLogThread *)data;
422  if (aft == NULL) {
423  return TM_ECODE_OK;
424  }
425 
426  MemBufferFree(aft->buffer);
427  /* clear memory */
428  memset(aft, 0, sizeof(JsonFlowLogThread));
429 
430  SCFree(aft);
431  return TM_ECODE_OK;
432 }
433 
435 {
436  /* register as child of eve-log */
437  OutputRegisterFlowSubModule(LOGGER_JSON_FLOW, "eve-log", "JsonFlowLog",
438  "eve-log.flow", OutputFlowLogInitSub, JsonFlowLogger,
439  JsonFlowLogThreadInit, JsonFlowLogThreadDeinit, NULL);
440 }
Flow_::icmp_d
struct Flow_::@122::@127 icmp_d
tm-threads.h
LogJsonFileCtx_::flags
uint32_t flags
Definition: output-json-flow.c:56
JsonFlowLogThread_::file_ctx
LogFileCtx * file_ctx
Definition: output-json-flow.c:63
FLOW_IS_IPV6
#define FLOW_IS_IPV6(f)
Definition: flow.h:154
JsonFlowLogThread_
Definition: output-json-flow.c:60
SC_ERR_INVALID_VALUE
@ SC_ERR_INVALID_VALUE
Definition: util-error.h:160
CreateIsoTimeString
void CreateIsoTimeString(const struct timeval *ts, char *str, size_t size)
Definition: util-time.c:213
Flow_::startts
struct timeval startts
Definition: flow.h:490
stream-tcp.h
OutputJsonCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json.h:104
FLOW_END_FLAG_STATE_NEW
#define FLOW_END_FLAG_STATE_NEW
Definition: flow.h:230
FlowBypassInfo_
Definition: flow.h:519
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
LogJsonFileCtx
struct LogJsonFileCtx_ LogJsonFileCtx
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
Flow_::proto
uint8_t proto
Definition: flow.h:365
JSON_OUTPUT_BUFFER_SIZE
#define JSON_OUTPUT_BUFFER_SIZE
Definition: output-json.h:63
threads.h
OutputJsonCtx_
Definition: output-json.h:101
Flow_
Flow data structure.
Definition: flow.h:347
OutputJsonCommonSettings_
Definition: output-json.h:91
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:30
LogFileCtx_
Definition: util-logopenfile.h:60
FLOW_END_FLAG_STATE_ESTABLISHED
#define FLOW_END_FLAG_STATE_ESTABLISHED
Definition: flow.h:231
Flow_::alproto_orig
AppProto alproto_orig
Definition: flow.h:456
Flow_::vlan_id
uint16_t vlan_id[2]
Definition: flow.h:367
FLOW_END_FLAG_STATE_BYPASSED
#define FLOW_END_FLAG_STATE_BYPASSED
Definition: flow.h:237
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:98
FlowBypassInfo_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:524
OutputJsonBuilderBuffer
int OutputJsonBuilderBuffer(JsonBuilder *js, LogFileCtx *file_ctx, MemBuffer **buffer)
Definition: output-json.c:978
util-privs.h
EveAddCommonOptions
void EveAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, JsonBuilder *js)
Definition: output-json.c:444
TcpStream_::flags
uint16_t flags
Definition: stream-tcp-private.h:95
proto
uint8_t proto
Definition: decode-template.h:0
Flow_::dp
Port dp
Definition: flow.h:359
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:81
Flow_::protoctx
void * protoctx
Definition: flow.h:441
JsonFlowLogRegister
void JsonFlowLogRegister(void)
Definition: output-json-flow.c:434
util-unittest.h
OutputCtx_::data
void * data
Definition: tm-modules.h:81
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:80
Flow_::flow_state
FlowStateType flow_state
Definition: flow.h:412
OutputCtx_
Definition: tm-modules.h:78
LogJsonFileCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json-flow.c:55
LOGGER_JSON_FLOW
@ LOGGER_JSON_FLOW
Definition: suricata-common.h:484
Flow_::tosrcbytecnt
uint64_t tosrcbytecnt
Definition: flow.h:495
Flow_::dst
FlowAddress dst
Definition: flow.h:350
FLOW_STATE_LOCAL_BYPASSED
@ FLOW_STATE_LOCAL_BYPASSED
Definition: flow.h:502
util-debug.h
JB_SET_STRING
#define JB_SET_STRING(jb, key, val)
Definition: rust.h:24
output-json-flow.h
FlowBypassInfo_::todstbytecnt
uint64_t todstbytecnt
Definition: flow.h:526
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:44
Flow_::todstpktcnt
uint32_t todstpktcnt
Definition: flow.h:492
output-json.h
util-print.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:300
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:271
Flow_::flow_end_flags
uint8_t flow_end_flags
Definition: flow.h:447
pkt-var.h
JsonFlowLogThread
struct JsonFlowLogThread_ JsonFlowLogThread
LogFileEnsureExists
LogFileCtx * LogFileEnsureExists(LogFileCtx *parent_ctx, int thread_id)
LogFileEnsureExists() Ensure a log file context for the thread exists.
Definition: util-logopenfile.c:659
EveTcpFlags
void EveTcpFlags(const uint8_t flags, JsonBuilder *js)
jsonify tcp flags field Only add 'true' fields in an attempt to keep things reasonably compact.
Definition: output-json.c:488
TcpSession_::state
uint8_t state
Definition: stream-tcp-private.h:263
FlowBypassInfo_::todstpktcnt
uint64_t todstpktcnt
Definition: flow.h:525
FLOW_WRONG_THREAD
#define FLOW_WRONG_THREAD
Definition: flow.h:105
LogJsonFileCtx_
Definition: output-json-flow.c:54
util-time.h
JB_SET_TRUE
#define JB_SET_TRUE(jb, key)
Definition: rust.h:25
OutputInitResult_::ok
bool ok
Definition: output.h:45
LiveDevice_::dev
char * dev
Definition: util-device.h:41
TcpSession_::tcp_packet_flags
uint8_t tcp_packet_flags
Definition: stream-tcp-private.h:268
Flow_::todstbytecnt
uint64_t todstbytecnt
Definition: flow.h:494
ThreadVars_::id
int id
Definition: threadvars.h:87
FLOW_IS_IPV4
#define FLOW_IS_IPV4(f)
Definition: flow.h:152
JsonFlowLogThread_::buffer
MemBuffer * buffer
Definition: output-json-flow.c:64
stream-tcp-private.h
conf.h
JsonFlowLogThread_::flowlog_ctx
LogJsonFileCtx * flowlog_ctx
Definition: output-json-flow.c:61
Port
uint16_t Port
Definition: decode.h:241
FLOW_END_FLAG_EMERGENCY
#define FLOW_END_FLAG_EMERGENCY
Definition: flow.h:233
TmEcode
TmEcode
Definition: tm-threads-common.h:79
Flow_::vlan_idx
uint8_t vlan_idx
Definition: flow.h:375
util-proto-name.h
FlowBypassInfo_::tosrcpktcnt
uint64_t tosrcpktcnt
Definition: flow.h:523
FlowAddress_::address
union FlowAddress_::@119 address
MemBuffer_
Definition: util-buffer.h:27
Flow_::alproto_expect
AppProto alproto_expect
Definition: flow.h:459
Flow_::src
FlowAddress src
Definition: flow.h:350
Flow_::lastts
struct timeval lastts
Definition: flow.h:404
MemBufferReset
#define MemBufferReset(mem_buffer)
Reset the mem buffer.
Definition: util-buffer.h:42
flow-storage.h
OutputInitResult_
Definition: output.h:43
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
MemBufferFree
void MemBufferFree(MemBuffer *buffer)
Definition: util-buffer.c:82
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:257
EveAddAppProto
void EveAddAppProto(Flow *f, JsonBuilder *js)
Definition: output-json-flow.c:178
FLOW_END_FLAG_STATE_CLOSED
#define FLOW_END_FLAG_STATE_CLOSED
Definition: flow.h:232
TcpSession_::client
TcpStream client
Definition: stream-tcp-private.h:273
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
Flow_::livedev
struct LiveDevice_ * livedev
Definition: flow.h:396
LogJsonFileCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json-flow.c:57
threadvars.h
CreateEveFlowId
void CreateEveFlowId(JsonBuilder *js, const Flow *f)
Definition: output-json.c:760
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:272
OutputRegisterFlowSubModule
void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, FlowLogger FlowLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a flow output sub-module.
Definition: output.c:585
SCFree
#define SCFree(p)
Definition: util-mem.h:61
Flow_::alproto_ts
AppProto alproto_ts
Definition: flow.h:451
ConfNode_
Definition: conf.h:32
util-logopenfile.h
Flow_::flags
uint32_t flags
Definition: flow.h:421
util-buffer.h
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
TimeGet
void TimeGet(struct timeval *tv)
Definition: util-time.c:153
OutputJsonCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json.h:102
FlowGetStorageById
void * FlowGetStorageById(Flow *f, int id)
Definition: flow-storage.c:39
FLOW_END_FLAG_SHUTDOWN
#define FLOW_END_FLAG_SHUTDOWN
Definition: flow.h:236
StreamTcpStateAsString
const char * StreamTcpStateAsString(const enum TcpState state)
Definition: stream-tcp.c:6259
known_proto
char * known_proto[256]
Definition: util-proto-name.c:33
FlowHasAlerts
int FlowHasAlerts(const Flow *f)
Check if flow has alerts.
Definition: flow.c:180
FLOW_END_FLAG_TIMEOUT
#define FLOW_END_FLAG_TIMEOUT
Definition: flow.h:234
STREAMTCP_STREAM_FLAG_GAP
#define STREAMTCP_STREAM_FLAG_GAP
Definition: stream-tcp-private.h:199
Flow_::sp
Port sp
Definition: flow.h:352
TcpSession_
Definition: stream-tcp-private.h:261
Flow_::alproto_tc
AppProto alproto_tc
Definition: flow.h:452
GetFlowBypassInfoID
int GetFlowBypassInfoID(void)
Definition: flow-util.c:218
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:450
FLOW_END_FLAG_FORCED
#define FLOW_END_FLAG_FORCED
Definition: flow.h:235
FLOW_DIR_REVERSED
#define FLOW_DIR_REVERSED
Definition: flow.h:107
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
Flow_::icmp_s
struct Flow_::@120::@126 icmp_s
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:304
TcpStream_::tcp_flags
uint8_t tcp_flags
Definition: stream-tcp-private.h:99
Flow_::tosrcpktcnt
uint32_t tosrcpktcnt
Definition: flow.h:493
MemBufferCreateNew
MemBuffer * MemBufferCreateNew(uint32_t size)
Definition: util-buffer.c:32
debug.h
output.h
EveAddFlow
void EveAddFlow(Flow *f, JsonBuilder *js)
Definition: output-json-flow.c:199