Go to the documentation of this file.
73 memset(op, 0x00,
sizeof(*op));
97 SCLogDebug(
"OutputRegisterStreamingLogger happy");
109 static int Streamer(
void *cbdata,
Flow *f,
const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t
flags)
117 Packet *p = streamer_cbdata->
p;
122 while (logger && store) {
125 if (logger->
type == streamer_cbdata->
type) {
132 logger = logger->
next;
151 static int HttpBodyIterator(
Flow *f,
int close,
void *cbdata, uint8_t iflags)
153 SCLogDebug(
"called with %p, %d, %p, %02x", f, close, cbdata, iflags);
156 if (s == NULL || s->
conn == NULL) {
160 const int tx_progress_done_value_ts =
162 const int tx_progress_done_value_tc =
167 for (tx_id = 0; tx_id < total_txs; tx_id++) {
177 if (tx_progress_ts >= tx_progress_done_value_ts) {
180 if (tx_progress_tc >= tx_progress_done_value_tc) {
199 if (body->
first == NULL) {
210 for ( ; chunk != NULL; chunk = chunk->
next) {
217 if (chunk->
sbseg.stream_offset == 0)
221 if ((tx_done || close) && chunk->
next == NULL) {
225 const uint8_t *data = NULL;
226 uint32_t data_len = 0;
230 Streamer(cbdata, f, data, data_len, tx_id,
flags);
240 if (tx_logged == 0 && (close||tx_done)) {
241 Streamer(cbdata, f, NULL, 0, tx_id,
255 static int StreamLogFunc(
256 void *cb_data,
const uint8_t *data,
const uint32_t data_len,
const uint64_t _offset)
271 uint8_t
flags = iflags;
279 StreamLogFunc, &log_data,
280 progress, &progress, eof);
340 SCLogDebug(
"close ? %s", close ?
"yes" :
"no");
355 SCLogDebug(
"close ? %s", close ?
"yes" :
"no");
367 static TmEcode OutputStreamingLogThreadInit(
ThreadVars *
tv,
const void *initdata,
void **data) {
371 memset(td, 0x00,
sizeof(*td));
375 SCLogDebug(
"OutputStreamingLogThreadInit happy (*data %p)", *data);
384 memset(
ts, 0x00,
sizeof(*
ts));
387 ts->thread_data = retptr;
389 if (td->
store == NULL) {
393 while (tmp->
next != NULL)
404 logger = logger->
next;
416 while (logger && store) {
423 logger = logger->
next;
431 static void OutputStreamingLogExitPrintStats(
ThreadVars *
tv,
void *thread_data) {
437 while (logger && store) {
442 logger = logger->
next;
447 static uint32_t OutputStreamingLoggerGetActiveCount(
void)
458 OutputStreamingLogThreadDeinit, OutputStreamingLogExitPrintStats,
459 OutputStreamingLog, OutputStreamingLoggerGetActiveCount);
468 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)
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
int StreamTcpInlineMode(void)
See if stream engine is operating in inline mode.
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
int StreamReassembleLog(TcpSession *ssn, TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, uint64_t progress_in, uint64_t *progress_out, bool eof)
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
uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
StreamingBufferSegment sbseg
#define DEBUG_VALIDATE_BUG_ON(exp)
TmEcode(* ThreadDeinitFunc)(ThreadVars *, void *)