51 #include "rust-snmp-log-gen.h" 63 static int JsonSNMPLogger(
ThreadVars *tv,
void *thread_data,
77 snmpjs = rs_snmp_log_json_response(state, snmptx);
81 json_object_set_new(js,
"snmp", snmpjs);
94 static void OutputSNMPLogDeInitCtxSub(
OutputCtx *output_ctx)
108 if (
unlikely(snmplog_ctx == NULL)) {
112 snmplog_ctx->
cfg = ajt->
cfg;
119 output_ctx->
data = snmplog_ctx;
120 output_ctx->
DeInit = OutputSNMPLogDeInitCtxSub;
122 SCLogDebug(
"SNMP log sub-module initialized.");
126 result.
ctx = output_ctx;
131 static TmEcode JsonSNMPLogThreadInit(
ThreadVars *t,
const void *initdata,
void **data)
138 if (initdata == NULL) {
139 SCLogDebug(
"Error getting context for EveLogSNMP. \"initdata\" is NULL.");
151 *data = (
void *)thread;
159 if (thread == NULL) {
162 if (thread->
buffer != NULL) {
174 JsonSNMPLogger, JsonSNMPLogThreadInit,
175 JsonSNMPLogThreadDeinit, NULL);
MemBuffer * MemBufferCreateNew(uint32_t size)
#define JSON_OUTPUT_BUFFER_SIZE
json_t * CreateJSONHeader(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type)
OutputJsonCommonSettings cfg
int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer **buffer)
#define MemBufferReset(mem_buffer)
Reset the mem buffer.
void(* DeInit)(struct OutputCtx_ *)
void JsonAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, json_t *js)
struct LogSNMPFileCtx_ LogSNMPFileCtx
OutputJsonCommonSettings cfg
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
void OutputRegisterTxSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
LogSNMPFileCtx * snmplog_ctx
void JsonSNMPLogRegister(void)
Per thread variable structure.
struct LogSNMPLogThread_ LogSNMPLogThread
struct SNMPTransaction_ SNMPTransaction
void MemBufferFree(MemBuffer *buffer)