Go to the documentation of this file.
96 SCLogDebug(
"OutputRegisterStreamingLogger happy");
108 static int Streamer(
void *cbdata,
Flow *f,
const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t
flags)
116 Packet *p = streamer_cbdata->
p;
121 while (logger && store) {
124 if (logger->
type == streamer_cbdata->
type) {
131 logger = logger->
next;
150 static int HttpBodyIterator(
Flow *f,
int close,
void *cbdata, uint8_t iflags)
152 SCLogDebug(
"called with %p, %d, %p, %02x", f, close, cbdata, iflags);
155 if (s == NULL || s->
conn == NULL) {
159 const int tx_progress_done_value_ts =
161 const int tx_progress_done_value_tc =
166 for (tx_id = 0; tx_id < total_txs; tx_id++) {
176 if (tx_progress_ts >= tx_progress_done_value_ts) {
179 if (tx_progress_tc >= tx_progress_done_value_tc) {
198 if (body->
first == NULL) {
209 for ( ; chunk != NULL; chunk = chunk->
next) {
216 if (chunk->
sbseg.stream_offset == 0)
220 if ((tx_done || close) && chunk->
next == NULL) {
224 const uint8_t *data = NULL;
225 uint32_t data_len = 0;
229 Streamer(cbdata, f, data, data_len, tx_id,
flags);
239 if (tx_logged == 0 && (close||tx_done)) {
240 Streamer(cbdata, f, NULL, 0, tx_id,
254 static int StreamLogFunc(
255 void *cb_data,
const uint8_t *data,
const uint32_t data_len,
const uint64_t _offset)
270 uint8_t
flags = iflags;
278 StreamLogFunc, &log_data,
279 progress, &progress, eof);
339 SCLogDebug(
"close ? %s", close ?
"yes" :
"no");
354 SCLogDebug(
"close ? %s", close ?
"yes" :
"no");
366 static TmEcode OutputStreamingLogThreadInit(
ThreadVars *
tv,
const void *initdata,
void **data) {
373 SCLogDebug(
"OutputStreamingLogThreadInit happy (*data %p)", *data);
384 ts->thread_data = retptr;
386 if (td->
store == NULL) {
390 while (tmp->
next != NULL)
401 logger = logger->
next;
413 while (logger && store) {
420 logger = logger->
next;
428 static void OutputStreamingLogExitPrintStats(
ThreadVars *
tv,
void *thread_data) {
434 while (logger && store) {
439 logger = logger->
next;
444 static uint32_t OutputStreamingLoggerGetActiveCount(
void)
455 OutputStreamingLogThreadDeinit, OutputStreamingLogExitPrintStats,
456 OutputStreamingLog, OutputStreamingLoggerGetActiveCount);
465 logger = next_logger;
#define PKT_IS_TOCLIENT(p)
int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc, OutputCtx *output_ctx, enum OutputStreamingType type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
void OutputStreamingShutdown(void)
bool StreamTcpInlineMode(void)
See if stream engine is operating in inline mode.
ThreadExitPrintStatsFunc ThreadExitPrintStats
uint32_t log_progress_rel
struct HtpBodyChunk_ * next
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t flags)
get the progress value for a tx/protocol
OutputStreamingLogger * logger
int(* StreamingLogger)(ThreadVars *, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags)
struct StreamerCallbackData_ StreamerCallbackData
OutputLoggerThreadStore * store
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
struct OutputLoggerThreadStore_ * next
TcpStreamCnf stream_config
#define OUTPUT_STREAMING_FLAG_TRANSACTION
ThreadInitFunc ThreadInit
enum OutputStreamingType type
#define STREAM_LOG_PROGRESS(stream)
void OutputStreamingLoggerRegister(void)
#define PKT_IS_TOSERVER(p)
#define PKT_PSEUDO_STREAM_END
Per thread variable structure.
TmEcode(* ThreadInitFunc)(ThreadVars *, const void *, void **)
enum OutputStreamingType type
struct OutputStreamingLogger_ OutputStreamingLogger
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
ThreadDeinitFunc ThreadDeinit
struct OutputStreamingLoggerThreadData_ OutputStreamingLoggerThreadData
#define PACKET_PROFILING_LOGGER_END(p, id)
#define OUTPUT_STREAMING_FLAG_OPEN
struct OutputStreamingLogger_ * next
void(* ThreadExitPrintStatsFunc)(ThreadVars *, void *)
struct HtpBodyChunk_ * next
#define OUTPUT_STREAMING_FLAG_TOSERVER
OutputLoggerThreadStore * store
#define PACKET_PROFILING_LOGGER_START(p, id)
void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc)
#define OUTPUT_STREAMING_FLAG_CLOSE
#define OUTPUT_STREAMING_FLAG_TOCLIENT
uint8_t FlowGetDisruptionFlags(const Flow *f, uint8_t flags)
get 'disruption' flags: GAP/DEPTH/PASS
void StreamingBufferSegmentGetData(const StreamingBuffer *sb, const StreamingBufferSegment *seg, const uint8_t **data, uint32_t *data_len)
AppProto alproto
application level protocol
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)
uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
StreamingBufferSegment sbseg
#define DEBUG_VALIDATE_BUG_ON(exp)
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)