suricata
output-streaming.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 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  * Logger for streaming data
24  */
25 
26 #include "suricata-common.h"
27 #include "tm-modules.h"
28 #include "output.h"
29 #include "output-streaming.h"
30 #include "app-layer.h"
31 #include "app-layer-parser.h"
32 #include "app-layer-htp.h"
33 #include "util-print.h"
34 #include "conf.h"
35 #include "util-profiling.h"
36 #include "stream-tcp.h"
37 #include "stream-tcp-inline.h"
38 #include "stream-tcp-reassemble.h"
39 #include "util-validate.h"
40 
41 /** per thread data for this module, contains a list of per thread
42  * data for the packet loggers. */
45  uint32_t loggers;
47 
48 /* logger instance, a module + a output ctx,
49  * it's perfectly valid that have multiple instances of the same
50  * log module (e.g. http.log) with different output ctx'. */
51 typedef struct OutputStreamingLogger_ {
55  const char *name;
62 
63 static OutputStreamingLogger *list = NULL;
64 
70 {
71  OutputStreamingLogger *op = SCMalloc(sizeof(*op));
72  if (op == NULL)
73  return -1;
74  memset(op, 0x00, sizeof(*op));
75 
76  op->LogFunc = LogFunc;
77  op->output_ctx = output_ctx;
78  op->name = name;
79  op->logger_id = id;
80  op->type = type;
81  op->ThreadInit = ThreadInit;
84 
85  if (list == NULL)
86  list = op;
87  else {
88  OutputStreamingLogger *t = list;
89  while (t->next)
90  t = t->next;
91  t->next = op;
92  }
93 
94  if (op->type == STREAMING_TCP_DATA) {
96  }
97 
98  SCLogDebug("OutputRegisterStreamingLogger happy");
99  return 0;
100 }
101 
102 typedef struct StreamerCallbackData_ {
109 
110 static int Streamer(void *cbdata, Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
111 {
112  StreamerCallbackData *streamer_cbdata = (StreamerCallbackData *)cbdata;
113  DEBUG_VALIDATE_BUG_ON(streamer_cbdata == NULL);
114  OutputStreamingLogger *logger = streamer_cbdata->logger;
115  OutputLoggerThreadStore *store = streamer_cbdata->store;
116  ThreadVars *tv = streamer_cbdata->tv;
117 #ifdef PROFILING
118  Packet *p = streamer_cbdata->p;
119 #endif
120  DEBUG_VALIDATE_BUG_ON(logger == NULL);
121  DEBUG_VALIDATE_BUG_ON(store == NULL);
122 
123  while (logger && store) {
124  DEBUG_VALIDATE_BUG_ON(logger->LogFunc == NULL);
125 
126  if (logger->type == streamer_cbdata->type) {
127  SCLogDebug("logger %p", logger);
129  logger->LogFunc(tv, store->thread_data, (const Flow *)f, data, data_len, tx_id, flags);
131  }
132 
133  logger = logger->next;
134  store = store->next;
135 
136  DEBUG_VALIDATE_BUG_ON(logger == NULL && store != NULL);
137  DEBUG_VALIDATE_BUG_ON(logger != NULL && store == NULL);
138  }
139 
140  return 0;
141 }
142 
143 /** \brief Http Body Iterator for logging
144  *
145  * Global logic:
146  *
147  * - For each tx
148  * - For each body chunk
149  * - Invoke Streamer
150  */
151 
152 static int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags)
153 {
154  SCLogDebug("called with %p, %d, %p, %02x", f, close, cbdata, iflags);
155 
156  HtpState *s = f->alstate;
157  if (s == NULL || s->conn == NULL) {
158  return 0;
159  }
160 
161  const int tx_progress_done_value_ts =
163  const int tx_progress_done_value_tc =
165  const uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate);
166 
167  uint64_t tx_id = 0;
168  for (tx_id = 0; tx_id < total_txs; tx_id++) { // TODO optimization store log tx
169  htp_tx_t *tx = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, tx_id);
170  if (tx == NULL) {
171  continue;
172  }
173 
174  int tx_done = 0;
175  int tx_logged = 0;
176  int tx_progress_ts = AppLayerParserGetStateProgress(
177  IPPROTO_TCP, ALPROTO_HTTP1, tx, FlowGetDisruptionFlags(f, STREAM_TOSERVER));
178  if (tx_progress_ts >= tx_progress_done_value_ts) {
179  int tx_progress_tc = AppLayerParserGetStateProgress(
180  IPPROTO_TCP, ALPROTO_HTTP1, tx, FlowGetDisruptionFlags(f, STREAM_TOCLIENT));
181  if (tx_progress_tc >= tx_progress_done_value_tc) {
182  tx_done = 1;
183  }
184  }
185 
186  SCLogDebug("tx %p", tx);
187  HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
188  if (htud != NULL) {
189  SCLogDebug("htud %p", htud);
190  HtpBody *body = NULL;
191  if (iflags & OUTPUT_STREAMING_FLAG_TOSERVER)
192  body = &htud->request_body;
193  else if (iflags & OUTPUT_STREAMING_FLAG_TOCLIENT)
194  body = &htud->response_body;
195 
196  if (body == NULL) {
197  SCLogDebug("no body");
198  goto next;
199  }
200  if (body->first == NULL) {
201  SCLogDebug("no body chunks");
202  goto next;
203  }
204  if (body->last->logged == 1) {
205  SCLogDebug("all logged already");
206  goto next;
207  }
208 
209  // for each chunk
210  HtpBodyChunk *chunk = body->first;
211  for ( ; chunk != NULL; chunk = chunk->next) {
212  if (chunk->logged) {
213  SCLogDebug("logged %d", chunk->logged);
214  continue;
215  }
216 
217  uint8_t flags = iflags | OUTPUT_STREAMING_FLAG_TRANSACTION;
218  if (chunk->sbseg.stream_offset == 0)
220  /* if we need to close and we're at the last segment in the list
221  * we add the 'close' flag so the logger can close up. */
222  if ((tx_done || close) && chunk->next == NULL) {
224  }
225 
226  const uint8_t *data = NULL;
227  uint32_t data_len = 0;
228  StreamingBufferSegmentGetData(body->sb, &chunk->sbseg, &data, &data_len);
229 
230  // invoke Streamer
231  Streamer(cbdata, f, data, data_len, tx_id, flags);
232  //PrintRawDataFp(stdout, data, data_len);
233  chunk->logged = 1;
234  tx_logged = 1;
235  }
236 
237  next:
238  /* if we need to close we need to invoke the Streamer for sure. If we
239  * logged no chunks, we call the Streamer with NULL data so it can
240  * close up. */
241  if (tx_logged == 0 && (close||tx_done)) {
242  Streamer(cbdata, f, NULL, 0, tx_id,
244  }
245  }
246  }
247  return 0;
248 }
249 
251  uint8_t flags;
253  Flow *f;
254 };
255 
256 static int StreamLogFunc(
257  void *cb_data, const uint8_t *data, const uint32_t data_len, const uint64_t _offset)
258 {
259  struct StreamLogData *log = cb_data;
260 
261  Streamer(log->streamer_cbdata, log->f, data, data_len, 0, log->flags);
262 
263  /* hack: unset open flag after first run */
265 
266  return 0;
267 }
268 
269 static int TcpDataLogger (Flow *f, TcpSession *ssn, TcpStream *stream,
270  bool eof, uint8_t iflags, void *streamer_cbdata)
271 {
272  uint8_t flags = iflags;
273  uint64_t progress = STREAM_LOG_PROGRESS(stream);
274 
275  if (progress == 0)
277 
278  struct StreamLogData log_data = { flags, streamer_cbdata, f };
279  StreamReassembleLog(ssn, stream,
280  StreamLogFunc, &log_data,
281  progress, &progress, eof);
282 
283  if (progress > STREAM_LOG_PROGRESS(stream)) {
284  uint32_t slide = progress - STREAM_LOG_PROGRESS(stream);
285  stream->log_progress_rel += slide;
286  }
287 
288  if (eof) {
289  Streamer(streamer_cbdata, f, NULL, 0, 0, flags|OUTPUT_STREAMING_FLAG_CLOSE);
290  }
291  return 0;
292 }
293 
294 static TmEcode OutputStreamingLog(ThreadVars *tv, Packet *p, void *thread_data)
295 {
296  DEBUG_VALIDATE_BUG_ON(thread_data == NULL);
297 
298  if (list == NULL) {
299  /* No child loggers. */
300  return TM_ECODE_OK;
301  }
302 
303  OutputStreamingLoggerThreadData *op_thread_data =
304  (OutputStreamingLoggerThreadData *)thread_data;
305  OutputStreamingLogger *logger = list;
306  OutputLoggerThreadStore *store = op_thread_data->store;
307 
308  StreamerCallbackData streamer_cbdata = { logger, store, tv, p , 0};
309 
310  DEBUG_VALIDATE_BUG_ON(logger == NULL && store != NULL);
311  DEBUG_VALIDATE_BUG_ON(logger != NULL && store == NULL);
312  DEBUG_VALIDATE_BUG_ON(logger == NULL && store == NULL);
313 
314  uint8_t flags = 0;
315  Flow * const f = p->flow;
316 
317  /* no flow, no streaming */
318  if (f == NULL) {
320  }
321 
322  if (!(StreamTcpInlineMode())) {
323  if (PKT_IS_TOCLIENT(p)) {
325  } else {
327  }
328  } else {
329  if (PKT_IS_TOSERVER(p)) {
331  } else {
333  }
334  }
335 
336  if (op_thread_data->loggers & (1<<STREAMING_TCP_DATA)) {
337  TcpSession *ssn = f->protoctx;
338  if (ssn) {
339  int close = (ssn->state >= TCP_CLOSED);
340  close |= ((p->flags & PKT_PSEUDO_STREAM_END) ? 1 : 0);
341  SCLogDebug("close ? %s", close ? "yes" : "no");
342 
343  TcpStream *stream = flags & OUTPUT_STREAMING_FLAG_TOSERVER ? &ssn->client : &ssn->server;
345  TcpDataLogger(f, ssn, stream, close, flags, (void *)&streamer_cbdata);
346  }
347  }
348  if (op_thread_data->loggers & (1<<STREAMING_HTTP_BODIES)) {
349  if (f->alproto == ALPROTO_HTTP1 && f->alstate != NULL) {
350  int close = 0;
351  TcpSession *ssn = f->protoctx;
352  if (ssn) {
353  close = (ssn->state >= TCP_CLOSED);
354  close |= ((p->flags & PKT_PSEUDO_STREAM_END) ? 1 : 0);
355  }
356  SCLogDebug("close ? %s", close ? "yes" : "no");
358  HttpBodyIterator(f, close, (void *)&streamer_cbdata, flags);
359  }
360  }
361 
362  return TM_ECODE_OK;
363 }
364 
365 /** \brief thread init for the tx logger
366  * This will run the thread init functions for the individual registered
367  * loggers */
368 static TmEcode OutputStreamingLogThreadInit(ThreadVars *tv, const void *initdata, void **data) {
369  OutputStreamingLoggerThreadData *td = SCMalloc(sizeof(*td));
370  if (td == NULL)
371  return TM_ECODE_FAILED;
372  memset(td, 0x00, sizeof(*td));
373 
374  *data = (void *)td;
375 
376  SCLogDebug("OutputStreamingLogThreadInit happy (*data %p)", *data);
377 
378  OutputStreamingLogger *logger = list;
379  while (logger) {
380  if (logger->ThreadInit) {
381  void *retptr = NULL;
382  if (logger->ThreadInit(tv, (void *)logger->output_ctx, &retptr) == TM_ECODE_OK) {
383  OutputLoggerThreadStore *ts = SCMalloc(sizeof(*ts));
384 /* todo */ BUG_ON(ts == NULL);
385  memset(ts, 0x00, sizeof(*ts));
386 
387  /* store thread handle */
388  ts->thread_data = retptr;
389 
390  if (td->store == NULL) {
391  td->store = ts;
392  } else {
393  OutputLoggerThreadStore *tmp = td->store;
394  while (tmp->next != NULL)
395  tmp = tmp->next;
396  tmp->next = ts;
397  }
398 
399  SCLogInfo("%s is now set up", logger->name);
400  }
401  }
402 
403  td->loggers |= (1<<logger->type);
404 
405  logger = logger->next;
406  }
407 
408  return TM_ECODE_OK;
409 }
410 
411 static TmEcode OutputStreamingLogThreadDeinit(ThreadVars *tv, void *thread_data) {
412  OutputStreamingLoggerThreadData *op_thread_data =
413  (OutputStreamingLoggerThreadData *)thread_data;
414  OutputLoggerThreadStore *store = op_thread_data->store;
415  OutputStreamingLogger *logger = list;
416 
417  while (logger && store) {
418  if (logger->ThreadDeinit) {
419  logger->ThreadDeinit(tv, store->thread_data);
420  }
421 
422  OutputLoggerThreadStore *next_store = store->next;
423  SCFree(store);
424  logger = logger->next;
425  store = next_store;
426  }
427 
428  SCFree(op_thread_data);
429  return TM_ECODE_OK;
430 }
431 
432 static void OutputStreamingLogExitPrintStats(ThreadVars *tv, void *thread_data) {
433  OutputStreamingLoggerThreadData *op_thread_data =
434  (OutputStreamingLoggerThreadData *)thread_data;
435  OutputLoggerThreadStore *store = op_thread_data->store;
436  OutputStreamingLogger *logger = list;
437 
438  while (logger && store) {
439  if (logger->ThreadExitPrintStats) {
440  logger->ThreadExitPrintStats(tv, store->thread_data);
441  }
442 
443  logger = logger->next;
444  store = store->next;
445  }
446 }
447 
448 static uint32_t OutputStreamingLoggerGetActiveCount(void)
449 {
450  uint32_t cnt = 0;
451  for (OutputStreamingLogger *p = list; p != NULL; p = p->next) {
452  cnt++;
453  }
454  return cnt;
455 }
456 
458  OutputRegisterRootLogger(OutputStreamingLogThreadInit,
459  OutputStreamingLogThreadDeinit, OutputStreamingLogExitPrintStats,
460  OutputStreamingLog, OutputStreamingLoggerGetActiveCount);
461 }
462 
464 {
465  OutputStreamingLogger *logger = list;
466  while (logger) {
467  OutputStreamingLogger *next_logger = logger->next;
468  SCFree(logger);
469  logger = next_logger;
470  }
471  list = NULL;
472 }
PKT_IS_TOCLIENT
#define PKT_IS_TOCLIENT(p)
Definition: decode.h:260
OutputRegisterStreamingLogger
int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc, OutputCtx *output_ctx, enum OutputStreamingType type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-streaming.c:65
TcpStream_
Definition: stream-tcp-private.h:106
ts
uint64_t ts
Definition: source-erf-file.c:55
OutputLoggerThreadStore_
Definition: output-stats.c:31
OutputStreamingShutdown
void OutputStreamingShutdown(void)
Definition: output-streaming.c:463
OutputLoggerThreadStore_::next
struct OutputLoggerThreadStore_ * next
Definition: output-stats.c:33
stream-tcp-inline.h
stream-tcp.h
HtpBody_::sb
StreamingBuffer * sb
Definition: app-layer-htp.h:192
OutputStreamingLogger_::ThreadExitPrintStats
ThreadExitPrintStatsFunc ThreadExitPrintStats
Definition: output-streaming.c:60
OutputStreamingLogger_::output_ctx
OutputCtx * output_ctx
Definition: output-streaming.c:53
TcpStream_::log_progress_rel
uint32_t log_progress_rel
Definition: stream-tcp-private.h:128
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:296
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
Flow_::proto
uint8_t proto
Definition: flow.h:375
AppLayerParserGetStateProgress
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t flags)
get the progress value for a tx/protocol
Definition: app-layer-parser.c:1103
StreamTcpInlineMode
int StreamTcpInlineMode(void)
See if stream engine is operating in inline mode.
Definition: stream-tcp.c:6531
output-streaming.h
Packet_::flags
uint32_t flags
Definition: decode.h:468
Flow_
Flow data structure.
Definition: flow.h:353
StreamerCallbackData_::logger
OutputStreamingLogger * logger
Definition: output-streaming.c:103
StreamingLogger
int(* StreamingLogger)(ThreadVars *, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
Definition: output-streaming.h:42
StreamerCallbackData
struct StreamerCallbackData_ StreamerCallbackData
LoggerId
LoggerId
Definition: suricata-common.h:437
StreamerCallbackData_::store
OutputLoggerThreadStore * store
Definition: output-streaming.c:104
AppLayerParserGetStateProgressCompletionStatus
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
Definition: app-layer-parser.c:1131
HtpBody_::last
HtpBodyChunk * last
Definition: app-layer-htp.h:190
HtpTxUserData_::request_body
HtpBody request_body
Definition: app-layer-htp.h:226
StreamLogData::streamer_cbdata
void * streamer_cbdata
Definition: output-streaming.c:252
tm-modules.h
stream-tcp-reassemble.h
TcpStreamCnf_::streaming_log_api
bool streaming_log_api
Definition: stream-tcp.h:66
stream_config
TcpStreamCnf stream_config
Definition: stream-tcp.c:114
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:83
Flow_::protoctx
void * protoctx
Definition: flow.h:451
OUTPUT_STREAMING_FLAG_TRANSACTION
#define OUTPUT_STREAMING_FLAG_TRANSACTION
Definition: output-streaming.h:34
HtpBody_::first
HtpBodyChunk * first
Definition: app-layer-htp.h:189
HtpState_
Definition: app-layer-htp.h:244
OutputStreamingLoggerThreadData_
Definition: output-streaming.c:43
OutputStreamingLogger_::ThreadInit
ThreadInitFunc ThreadInit
Definition: output-streaming.c:58
OutputStreamingLogger_::type
enum OutputStreamingType type
Definition: output-streaming.c:57
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:82
OutputLoggerThreadStore_::thread_data
void * thread_data
Definition: output-stats.c:32
STREAM_LOG_PROGRESS
#define STREAM_LOG_PROGRESS(stream)
Definition: stream-tcp-private.h:146
OutputCtx_
Definition: tm-modules.h:78
app-layer-htp.h
OutputStreamingLogger_::name
const char * name
Definition: output-streaming.c:55
type
uint8_t type
Definition: decode-icmpv4.h:0
OutputStreamingLoggerRegister
void OutputStreamingLoggerRegister(void)
Definition: output-streaming.c:457
StreamerCallbackData_::tv
ThreadVars * tv
Definition: output-streaming.c:105
PKT_IS_TOSERVER
#define PKT_IS_TOSERVER(p)
Definition: decode.h:259
PKT_PSEUDO_STREAM_END
#define PKT_PSEUDO_STREAM_END
Definition: decode.h:1178
OutputStreamingLogger_::LogFunc
StreamingLogger LogFunc
Definition: output-streaming.c:52
StreamerCallbackData_
Definition: output-streaming.c:102
StreamReassembleLog
int StreamReassembleLog(TcpSession *ssn, TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, uint64_t progress_in, uint64_t *progress_out, bool eof)
Definition: stream-tcp-reassemble.c:1890
util-print.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:56
HtpState_::conn
htp_conn_t * conn
Definition: app-layer-htp.h:248
OutputStreamingLogger_::logger_id
LoggerId logger_id
Definition: output-streaming.c:56
ThreadInitFunc
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
Definition: tm-modules.h:39
TcpSession_::state
uint8_t state
Definition: stream-tcp-private.h:273
app-layer-parser.h
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:281
util-profiling.h
Packet_
Definition: decode.h:433
conf.h
TmEcode
TmEcode
Definition: tm-threads-common.h:81
StreamerCallbackData_::type
enum OutputStreamingType type
Definition: output-streaming.c:107
OutputStreamingLogger
struct OutputStreamingLogger_ OutputStreamingLogger
HtpTxUserData_::response_body
HtpBody response_body
Definition: app-layer-htp.h:227
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:215
HtpBodyChunk_::logged
int logged
Definition: app-layer-htp.h:182
AppLayerParserGetTx
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Definition: app-layer-parser.c:1124
OutputStreamingLogger_::ThreadDeinit
ThreadDeinitFunc ThreadDeinit
Definition: output-streaming.c:59
OutputStreamingLoggerThreadData
struct OutputStreamingLoggerThreadData_ OutputStreamingLoggerThreadData
TCP_CLOSED
@ TCP_CLOSED
Definition: stream-tcp-private.h:161
PACKET_PROFILING_LOGGER_END
#define PACKET_PROFILING_LOGGER_END(p, id)
Definition: util-profiling.h:258
Packet_::flow
struct Flow_ * flow
Definition: decode.h:470
StreamLogData::f
Flow * f
Definition: output-streaming.c:253
HtpBody_
Definition: app-layer-htp.h:188
flags
uint8_t flags
Definition: decode-gre.h:0
suricata-common.h
OUTPUT_STREAMING_FLAG_OPEN
#define OUTPUT_STREAMING_FLAG_OPEN
Definition: output-streaming.h:30
STREAMING_HTTP_BODIES
@ STREAMING_HTTP_BODIES
Definition: output-streaming.h:38
HtpBodyChunk_
Definition: app-layer-htp.h:180
ALPROTO_HTTP1
@ ALPROTO_HTTP1
Definition: app-layer-protos.h:30
OutputStreamingLogger_::next
struct OutputStreamingLogger_ * next
Definition: output-streaming.c:54
ThreadExitPrintStatsFunc
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
Definition: tm-modules.h:41
TcpSession_::client
TcpStream client
Definition: stream-tcp-private.h:284
HtpTxUserData_
Definition: app-layer-htp.h:211
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:31
util-validate.h
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
Packet_::next
struct Packet_ * next
Definition: decode.h:603
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:283
HtpBodyChunk_::next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:181
OutputStreamingType
OutputStreamingType
Definition: output-streaming.h:36
OUTPUT_STREAMING_FLAG_TOSERVER
#define OUTPUT_STREAMING_FLAG_TOSERVER
Definition: output-streaming.h:32
SCFree
#define SCFree(p)
Definition: util-mem.h:61
OutputStreamingLoggerThreadData_::store
OutputLoggerThreadStore * store
Definition: output-streaming.c:44
Flow_::alstate
void * alstate
Definition: flow.h:486
OutputStreamingLogger_
Definition: output-streaming.c:51
StreamLogData::flags
uint8_t flags
Definition: output-streaming.c:251
StreamLogData
Definition: output-streaming.c:250
StreamerCallbackData_::p
Packet * p
Definition: output-streaming.c:106
PACKET_PROFILING_LOGGER_START
#define PACKET_PROFILING_LOGGER_START(p, id)
Definition: util-profiling.h:251
OutputRegisterRootLogger
void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
Definition: output.c:965
OUTPUT_STREAMING_FLAG_CLOSE
#define OUTPUT_STREAMING_FLAG_CLOSE
Definition: output-streaming.h:31
OUTPUT_STREAMING_FLAG_TOCLIENT
#define OUTPUT_STREAMING_FLAG_TOCLIENT
Definition: output-streaming.h:33
OutputStreamingLoggerThreadData_::loggers
uint32_t loggers
Definition: output-streaming.c:45
STREAMING_TCP_DATA
@ STREAMING_TCP_DATA
Definition: output-streaming.h:37
FlowGetDisruptionFlags
uint8_t FlowGetDisruptionFlags(const Flow *f, uint8_t flags)
get 'disruption' flags: GAP/DEPTH/PASS
Definition: flow.c:1141
TcpSession_
Definition: stream-tcp-private.h:271
StreamingBufferSegmentGetData
void StreamingBufferSegmentGetData(const StreamingBuffer *sb, const StreamingBufferSegment *seg, const uint8_t **data, uint32_t *data_len)
Definition: util-streaming-buffer.c:783
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:460
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:302
AppLayerParserGetTxCnt
uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
Definition: app-layer-parser.c:1117
HtpBodyChunk_::sbseg
StreamingBufferSegment sbseg
Definition: app-layer-htp.h:183
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:111
output.h
ThreadDeinitFunc
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)
Definition: tm-modules.h:40
app-layer.h