Go to the documentation of this file.
55 static void EveSmtpDataLogger(
const Flow *f,
void *state,
void *vtx, uint64_t tx_id, JsonBuilder *js)
60 jb_set_string(js,
"helo", (
const char *)((
SMTPState *)state)->helo);
63 jb_set_string(js,
"mail_from", (
const char *)tx->
mail_from);
66 jb_open_array(js,
"rcpt_to");
68 jb_append_string(js, (
char *)rcptto_str->
str);
74 static int JsonSmtpLogger(
ThreadVars *
tv,
void *thread_data,
const Packet *p,
Flow *f,
void *state,
void *tx, uint64_t tx_id)
87 jb_open_object(jb,
"smtp");
88 EveSmtpDataLogger(f, state, tx, tx_id, jb);
107 EveSmtpDataLogger(f, smtp_state, tx, tx_id, js);
115 static void OutputSmtpLogDeInitCtxSub(
OutputCtx *output_ctx)
117 SCLogDebug(
"cleaning up sub output_ctx %p", output_ctx);
119 if (email_ctx != NULL) {
144 output_ctx->
data = email_ctx;
145 output_ctx->
DeInit = OutputSmtpLogDeInitCtxSub;
150 result.
ctx = output_ctx;
155 static TmEcode JsonSmtpLogThreadInit(
ThreadVars *t,
const void *initdata,
void **data)
161 if(initdata == NULL) {
162 SCLogDebug(
"Error getting context for EveLogSMTP. \"initdata\" argument NULL");
170 if (aft->
buffer == NULL) {
182 if (aft->
buffer != NULL) {
207 "eve-log.smtp", OutputSmtpLogInitSub,
ALPROTO_SMTP, JsonSmtpLogger,
208 JsonSmtpLogThreadInit, JsonSmtpLogThreadDeinit, NULL);
bool EveSMTPAddMetadata(const Flow *f, uint64_t tx_id, JsonBuilder *js)
TmEcode EveEmailLogJson(JsonEmailLogThread *aft, JsonBuilder *js, const Packet *p, Flow *f, void *state, void *vtx, uint64_t tx_id)
struct HtpBodyChunk_ * next
#define JSON_OUTPUT_BUFFER_SIZE
#define TAILQ_EMPTY(head)
#define TAILQ_FOREACH(var, head, field)
int OutputJsonBuilderBuffer(JsonBuilder *js, LogFileCtx *file_ctx, MemBuffer **buffer)
void * FlowGetAppState(const Flow *f)
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Per thread variable structure.
LogFileCtx * LogFileEnsureExists(LogFileCtx *parent_ctx, int thread_id)
LogFileEnsureExists() Ensure a log file context for the thread exists.
JsonBuilder * CreateEveHeaderWithTxId(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, uint64_t tx_id, OutputJsonCtx *eve_ctx)
void OutputEmailInitConf(ConfNode *conf, OutputJsonEmailCtx *email_ctx)
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
#define MemBufferReset(mem_buffer)
Reset the mem buffer.
void(* DeInit)(struct OutputCtx_ *)
void MemBufferFree(MemBuffer *buffer)
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)
void JsonSmtpLogRegister(void)
OutputJsonEmailCtx * emaillog_ctx
MemBuffer * MemBufferCreateNew(uint32_t size)