int OutputRegisterStreamingLogger(const char *name, StreamingLogger LogFunc, OutputCtx *output_ctx, enum OutputStreamingType type ) { int module_id = TmModuleGetIdByName(name); if (module_id < 0) return -1; OutputStreamingLogger *op = SCMalloc(sizeof(*op)); if (op == NULL) return -1; memset(op, 0x00, sizeof(*op)); op->LogFunc = LogFunc; op->output_ctx = output_ctx; op->name = name; op->module_id = (TmmId) module_id; op->type = type; if (list == NULL) list = op; else { OutputStreamingLogger *t = list; while (t->next) t = t->next; t->next = op; } SCLogDebug("OutputRegisterTxLogger happy"); return 0; }
int OutputRegisterTxLogger(const char *name, AppProto alproto, TxLogger LogFunc, OutputCtx *output_ctx) { int module_id = TmModuleGetIdByName(name); if (module_id < 0) return -1; OutputTxLogger *op = SCMalloc(sizeof(*op)); if (op == NULL) return -1; memset(op, 0x00, sizeof(*op)); op->alproto = alproto; op->LogFunc = LogFunc; op->output_ctx = output_ctx; op->name = name; op->module_id = (TmmId) module_id; if (list == NULL) list = op; else { OutputTxLogger *t = list; while (t->next) t = t->next; t->next = op; } SCLogDebug("OutputRegisterTxLogger happy"); return 0; }
int OutputRegisterTxLogger(const char *name, AppProto alproto, TxLogger LogFunc, OutputCtx *output_ctx, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition) { int module_id = TmModuleGetIdByName(name); if (module_id < 0) return -1; OutputTxLogger *op = SCMalloc(sizeof(*op)); if (op == NULL) return -1; memset(op, 0x00, sizeof(*op)); op->alproto = alproto; op->LogFunc = LogFunc; op->LogCondition = LogCondition; op->output_ctx = output_ctx; op->name = name; op->module_id = (TmmId) module_id; if (tc_log_progress) { op->tc_log_progress = tc_log_progress; } else { op->tc_log_progress = AppLayerParserGetStateProgressCompletionStatus(alproto, STREAM_TOCLIENT); } if (ts_log_progress) { op->ts_log_progress = ts_log_progress; } else { op->ts_log_progress = AppLayerParserGetStateProgressCompletionStatus(alproto, STREAM_TOSERVER); } if (list == NULL) { op->id = 1; list = op; } else { OutputTxLogger *t = list; while (t->next) t = t->next; if (t->id * 2 > UINT32_MAX) { SCLogError(SC_ERR_FATAL, "Too many loggers registered."); exit(EXIT_FAILURE); } op->id = t->id * 2; t->next = op; } SCLogDebug("OutputRegisterTxLogger happy"); return 0; }