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