Go to the documentation of this file.
65 JsonBuilder *js_resplist = NULL;
67 js_resplist = jb_new_array();
76 jb_set_string_from_bytes(jb,
78 (
const uint8_t *)tx->
request + min_length,
83 int resp_code_cnt = 0;
86 bool is_cc_array_open =
false;
89 uint8_t *where = response->
str;
97 if (isdigit(where[0]) && isdigit(where[1]) && isdigit(where[2])) {
98 if (!is_cc_array_open) {
99 jb_open_array(jb,
"completion_code");
100 is_cc_array_open =
true;
102 jb_append_string_from_bytes(jb, (
const uint8_t *)where, 3);
109 jb_append_string_from_bytes(js_resplist, (
const uint8_t *)where +
offset, pos -
offset);
118 if (is_cc_array_open) {
122 jb_close(js_resplist);
123 jb_set_object(jb,
"reply", js_resplist);
125 jb_free(js_resplist);
129 jb_set_uint(jb,
"dynamic_port", tx->
dyn_port);
149 static int JsonFTPLogger(
ThreadVars *
tv,
void *thread_data,
150 const Packet *p,
Flow *f,
void *state,
void *vtx, uint64_t tx_id)
154 const char *event_type;
156 event_type =
"ftp_data";
167 jb_open_object(jb, event_type);
171 EveFTPLogCommand(f, tx, jb);
190 static void OutputFTPLogDeInitCtxSub(
OutputCtx *output_ctx)
209 ftplog_ctx->
cfg = ajt->
cfg;
216 output_ctx->
data = ftplog_ctx;
217 output_ctx->
DeInit = OutputFTPLogDeInitCtxSub;
219 SCLogDebug(
"FTP log sub-module initialized.");
224 result.
ctx = output_ctx;
229 static TmEcode JsonFTPLogThreadInit(
ThreadVars *t,
const void *initdata,
void **data)
236 if (initdata == NULL) {
237 SCLogDebug(
"Error getting context for EveLogFTP. \"initdata\" is NULL.");
252 *data = (
void *)thread;
257 if (thread->
buffer != NULL) {
267 if (thread == NULL) {
270 if (thread->
buffer != NULL) {
283 "eve-log.ftp", OutputFTPLogInitSub,
285 JsonFTPLogThreadInit, JsonFTPLogThreadDeinit,
288 "eve-log.ftp", OutputFTPLogInitSub,
290 JsonFTPLogThreadInit, JsonFTPLogThreadDeinit,
const uint8_t command_length
const FtpCommand * command_descriptor
OutputJsonCommonSettings cfg
struct LogFTPLogThread_ LogFTPLogThread
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)
FtpRequestCommand command
void EveAddCommonOptions(const OutputJsonCommonSettings *cfg, const Packet *p, const Flow *f, JsonBuilder *js)
const char * command_name
LogFTPFileCtx * ftplog_ctx
#define JB_SET_STRING(jb, key, val)
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.
OutputJsonCommonSettings cfg
#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)
struct LogFTPFileCtx_ LogFTPFileCtx
JsonBuilder * CreateEveHeaderWithTxId(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, uint64_t tx_id)
void JsonFTPLogRegister(void)
void EveFTPDataAddMetadata(const Flow *f, JsonBuilder *jb)
uint16_t JsonGetNextLineFromBuffer(const char *buffer, const uint16_t len)
AppProto alproto
application level protocol
MemBuffer * MemBufferCreateNew(uint32_t size)