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