Go to the documentation of this file.
46 #define FTP_MPM mpm_default_matcher
48 static MpmCtx *ftp_mpm_ctx = NULL;
116 static void FTPParseMemcap(
void)
118 const char *conf_val;
121 if ((
ConfGet(
"app-layer.protocols.ftp.memcap", &conf_val)) == 1)
125 "from conf file - %s. Killing engine",
138 if ((
ConfGet(
"app-layer.protocols.ftp.max-tx", &conf_val)) == 1) {
141 "from conf file - %s.",
147 if ((
ConfGet(
"app-layer.protocols.ftp.max-line-length", &conf_val)) == 1) {
149 SCLogError(
"Error parsing ftp.max-line-length from conf file - %s.", conf_val);
155 static void FTPIncrMemuse(uint64_t size)
160 static void FTPDecrMemuse(uint64_t size)
193 static int FTPCheckMemcap(uint64_t size)
201 static void *FTPCalloc(
size_t n,
size_t size)
203 if (FTPCheckMemcap((uint32_t)(n * size)) == 0) {
215 FTPIncrMemuse((uint64_t)(n * size));
219 static void *FTPRealloc(
void *ptr,
size_t orig_size,
size_t size)
223 if (FTPCheckMemcap((uint32_t)(size - orig_size)) == 0) {
234 if (size > orig_size) {
235 FTPIncrMemuse(size - orig_size);
237 FTPDecrMemuse(orig_size - size);
243 static void FTPFree(
void *ptr,
size_t size)
247 FTPDecrMemuse((uint64_t)size);
258 FTPFree(
str->str,
str->len);
264 static void *FTPLocalStorageAlloc(
void)
273 if (td->
pmq == NULL) {
286 static void FTPLocalStorageFree(
void *ptr)
290 if (td->
pmq != NULL) {
321 SCLogDebug(
"new transaction %p (state tx cnt %"PRIu64
")", tx, state->
tx_cnt);
329 if (tx->
tx_data.de_state != NULL) {
347 FTPFree(tx,
sizeof(*tx));
357 static AppLayerResult FTPGetLineForDirection(
366 uint8_t *lf_idx = memchr(input->
buf + input->
consumed, 0x0a, input->
len);
368 if (lf_idx == NULL) {
370 *current_line_truncated =
true;
378 }
else if (*current_line_truncated) {
380 *current_line_truncated =
false;
390 uint32_t o_consumed = input->
consumed;
391 input->
consumed = (uint32_t)(lf_idx - input->
buf + 1);
396 line->
buf = input->
buf + o_consumed;
398 *current_line_truncated =
true;
423 static int FTPParseRequestCommand(
438 *cmd_descriptor = NULL;
453 static void FtpTransferCmdFree(
void *data)
458 if (
cmd->file_name) {
459 FTPFree(
cmd->file_name,
cmd->file_len + 1);
464 static uint32_t CopyCommandLine(uint8_t **dest,
FtpLineState *line)
467 uint8_t *where = FTPCalloc(line->
len + 1,
sizeof(
char));
471 memcpy(where, line->
buf, line->
len);
474 while (line->
len && isspace((
unsigned char)where[line->
len - 1])) {
478 where[line->
len] =
'\0';
482 return line->
len ? line->
len + 1 : 0;
495 StreamSlice stream_slice,
void *local_data)
505 const uint8_t *input = StreamSliceGetData(&stream_slice);
506 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
510 }
else if (input == NULL || input_len == 0) {
514 FtpInput ftpi = { .
buf = input, .len = input_len, .orig_len = input_len, .consumed = 0 };
515 FtpLineState line = { .
buf = NULL, .len = 0, .delim_len = 0, .lf_found =
false };
521 if (res.status == 1) {
523 }
else if (res.status == -1) {
528 if (!FTPParseRequestCommand(thread_data, &line, &cmd_descriptor)) {
594 data->
DFree = FtpTransferCmdFree;
600 #if SC_FILENAME_MAX > UINT16_MAX
601 #error SC_FILENAME_MAX is greater than UINT16_MAX
603 data->
file_name = FTPCalloc(file_name_len + 1,
sizeof(
char));
605 FtpTransferCmdFree(data);
609 data->
file_len = (uint16_t)file_name_len;
617 FtpTransferCmdFree(data);
621 SCLogDebug(
"Expectation created [direction: %s, dynamic port %"PRIu16
"].",
622 state->
active ?
"to server" :
"to client",
643 static int FTPParsePassiveResponse(
FtpState *state,
const uint8_t *input, uint32_t input_len)
645 uint16_t dyn_port = rs_ftp_pasv_response(input, input_len);
649 SCLogDebug(
"FTP passive mode (v4): dynamic port %"PRIu16
"", dyn_port);
658 static int FTPParsePassiveResponseV6(
FtpState *state,
const uint8_t *input, uint32_t input_len)
660 uint16_t dyn_port = rs_ftp_epsv_response(input, input_len);
664 SCLogDebug(
"FTP passive mode (v6): dynamic port %"PRIu16
"", dyn_port);
681 static inline bool FTPIsPPR(
const uint8_t *input, uint32_t input_len)
683 return input_len >= 4 && isdigit(input[0]) && input[0] ==
'1' &&
684 isdigit(input[1]) && isdigit(input[2]) && isspace(input[3]);
697 StreamSlice stream_slice,
void *local_data)
701 const uint8_t *input = StreamSliceGetData(&stream_slice);
702 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
707 FtpInput ftpi = { .
buf = input, .len = input_len, .orig_len = input_len, .consumed = 0 };
708 FtpLineState line = { .
buf = NULL, .len = 0, .delim_len = 0, .lf_found =
false };
714 if (res.status == 1) {
716 }
else if (res.status == -1) {
721 tx = FTPTransactionCreate(state);
751 SCLogDebug(
"FTP active mode (v6): dynamic port %" PRIu16
"", dyn_port);
763 SCLogDebug(
"FTP active mode (v4): dynamic port %" PRIu16
"", dyn_port);
768 FTPParsePassiveResponse(ftp_state, line.
buf, line.
len);
774 FTPParsePassiveResponseV6(ftp_state, line.
buf, line.
len);
784 response->
len = CopyCommandLine(&response->
str, &line);
788 &tx->
tx_data.events, FtpEventResponseCommandTooLong);
798 if (FTPIsPPR(line.
buf, line.
len)) {
816 static uint64_t ftp_state_memuse = 0;
817 static uint64_t ftp_state_memcnt = 0;
820 static void *FTPStateAlloc(
void *orig_state,
AppProto proto_orig)
822 void *s = FTPCalloc(1,
sizeof(
FtpState));
838 static void FTPStateFree(
void *s)
847 SCLogDebug(
"[%s] state %p id %" PRIu64
", Freeing %d bytes at %p",
850 FTPTransactionFree(tx);
873 SCLogDebug(
"NULL state object; no transactions available");
890 SCLogDebug(
"Returning OLDEST tx %p id %"PRIu64, lasttx, lasttx->
tx_id);
894 static void *FTPGetTx(
void *state, uint64_t tx_id)
900 if (ftp_state->
curr_tx == NULL)
906 if (tx->
tx_id == tx_id)
919 static AppLayerStateData *FTPGetStateData(
void *vstate)
925 static void FTPStateTransactionFree(
void *state, uint64_t tx_id)
930 if (tx_id < tx->tx_id)
932 else if (tx_id > tx->
tx_id)
938 FTPTransactionFree(tx);
943 static uint64_t FTPGetTxCnt(
void *state)
954 static int FTPGetAlstateProgress(
void *vtx, uint8_t
direction)
969 static AppProto FTPUserProbingParser(
970 Flow *f, uint8_t
direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
979 static AppProto FTPServerProbingParser(
980 Flow *f, uint8_t
direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
987 if (input[0] !=
'2' || input[1] !=
'2' || input[2] !=
'0') {
991 if (input[3] !=
' ' && input[3] !=
'-') {
997 if (memchr(input + 4,
'\n',
len - 4) != NULL) {
1004 static int FTPRegisterPatternsForProtocolDetection(
void)
1007 IPPROTO_TCP,
ALPROTO_FTP,
"220 (", 5, 0, STREAM_TOCLIENT) < 0) {
1011 IPPROTO_TCP,
ALPROTO_FTP,
"FEAT", 4, 0, STREAM_TOSERVER) < 0) {
1015 STREAM_TOSERVER, FTPUserProbingParser, 5, 5) < 0) {
1019 IPPROTO_TCP,
ALPROTO_FTP,
"PASS ", 5, 0, STREAM_TOSERVER) < 0) {
1023 IPPROTO_TCP,
ALPROTO_FTP,
"PORT ", 5, 0, STREAM_TOSERVER) < 0) {
1029 "tcp", IPPROTO_TCP,
"ftp",
ALPROTO_FTP, 0, 5, NULL, FTPServerProbingParser)) {
1033 FTPServerProbingParser);
1051 const uint8_t *input = StreamSliceGetData(&stream_slice);
1052 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
1053 const bool eof = (
direction & STREAM_TOSERVER)
1057 SCTxDataUpdateFileFlags(&ftpdata_state->
tx_data, ftpdata_state->
state_data.file_flags);
1058 if (ftpdata_state->
tx_data.file_tx == 0)
1059 ftpdata_state->
tx_data.file_tx =
direction & (STREAM_TOSERVER | STREAM_TOCLIENT);
1061 ftpdata_state->
tx_data.updated_ts =
true;
1063 ftpdata_state->
tx_data.updated_tc =
true;
1070 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient", eof ?
"true" :
"false");
1073 if (input_len && ftpdata_state->
files == NULL) {
1083 SCLogDebug(
"input %u not for our direction (%s): %s/%s", input_len,
1084 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1086 (data->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1091 if (ftpdata_state->
files == NULL) {
1102 switch (data->
cmd) {
1106 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1111 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1120 0ULL, (uint8_t *) ftpdata_state->
file_name,
1122 input, input_len,
flags) != 0) {
1127 ftpdata_state->
tx_data.files_opened = 1;
1138 SCLogDebug(
"input %u not for us (%s): %s/%s", input_len,
1139 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1141 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1144 if (input_len != 0) {
1148 SCLogDebug(
"FileAppendData() - file no longer being extracted");
1150 }
else if (ret < 0) {
1151 SCLogDebug(
"FileAppendData() failed: %d", ret);
1162 SCLogDebug(
"closed because of eof: state now FTPDATA_STATE_FINISHED");
1172 StreamSlice stream_slice,
void *local_data)
1174 return FTPDataParse(f, ftp_state, pstate, stream_slice, local_data, STREAM_TOSERVER);
1178 StreamSlice stream_slice,
void *local_data)
1180 return FTPDataParse(f, ftp_state, pstate, stream_slice, local_data, STREAM_TOCLIENT);
1185 static uint64_t ftpdata_state_memuse = 0;
1186 static uint64_t ftpdata_state_memcnt = 0;
1189 static void *FTPDataStateAlloc(
void *orig_state,
AppProto proto_orig)
1200 ftpdata_state_memcnt++;
1207 static void FTPDataStateFree(
void *s)
1211 if (fstate->
tx_data.de_state != NULL) {
1223 ftpdata_state_memcnt--;
1235 static AppLayerStateData *FTPDataGetStateData(
void *vstate)
1241 static void FTPDataStateTransactionFree(
void *state, uint64_t tx_id)
1246 static void *FTPDataGetTx(
void *state, uint64_t tx_id)
1252 static uint64_t FTPDataGetTxCnt(
void *state)
1258 static int FTPDataGetAlstateProgress(
void *tx, uint8_t
direction)
1262 return ftpdata_state->
state;
1267 static AppLayerGetFileState FTPDataStateGetTxFiles(
void *tx, uint8_t
direction)
1270 AppLayerGetFileState files = { .fc = NULL, .cfg = &sbcfg };
1273 files.fc = ftpdata_state->
files;
1278 static void FTPSetMpmState(
void)
1281 if (
unlikely(ftp_mpm_ctx == NULL)) {
1289 if (
cmd->command_length == 0)
1293 (uint8_t *)
cmd->command_name,
1294 cmd->command_length,
1303 static void FTPFreeMpmState(
void)
1305 if (ftp_mpm_ctx != NULL) {
1316 static AppLayerGetTxIterTuple FTPGetTxIterator(
const uint8_t ipproto,
const AppProto alproto,
1320 AppLayerGetTxIterTuple no_tuple = { NULL, 0,
false };
1323 if (state->
un.
ptr == NULL) {
1329 while (tx_ptr->
tx_id < min_tx_id) {
1335 if (tx_ptr->
tx_id >= max_tx_id) {
1339 AppLayerGetTxIterTuple tuple = {
1342 .has_next = (state->
un.
ptr != NULL),
1352 const char *proto_name =
"ftp";
1353 const char *proto_data_name =
"ftp-data";
1358 if (FTPRegisterPatternsForProtocolDetection() < 0 )
1379 FTPLocalStorageFree);
1389 FTPDataParseRequest);
1391 FTPDataParseResponse);
1416 sbcfg.
Calloc = FTPCalloc;
1418 sbcfg.
Free = FTPFree;
1422 SCLogInfo(
"Parser disabled for %s protocol. Protocol detection still on.", proto_name);
1451 if (!buffer || *buffer ==
'\0') {
1455 char *c = strchr(buffer,
'\n');
1456 return c == NULL ?
len : (uint16_t)(c - buffer + 1);
1462 jb_open_object(jb,
"ftp_data");
1465 jb_set_string_from_bytes(jb,
"filename", ftp_state->
file_name, ftp_state->
file_len);
1494 static int FTPParserTest01(
void)
1497 uint8_t ftpbuf[] =
"PORT 192,168,1,1,0,80\r\n";
1498 uint32_t ftplen =
sizeof(ftpbuf) - 1;
1502 memset(&f, 0,
sizeof(f));
1503 memset(&ssn, 0,
sizeof(ssn));
1506 f.
proto = IPPROTO_TCP;
1512 STREAM_TOSERVER | STREAM_EOF, ftpbuf, ftplen);
1525 static int FTPParserTest11(
void)
1528 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1529 uint8_t ftpbuf2[] =
"RETR\r\n";
1530 uint8_t ftpbuf3[] =
"227 OK\r\n";
1535 memset(&f, 0,
sizeof(f));
1536 memset(&ssn, 0,
sizeof(ssn));
1539 f.
proto = IPPROTO_TCP;
1545 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1546 sizeof(ftpbuf1) - 1);
1553 sizeof(ftpbuf3) - 1);
1557 STREAM_TOSERVER, ftpbuf2,
1558 sizeof(ftpbuf2) - 1);
1572 static int FTPParserTest12(
void)
1575 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1576 uint8_t ftpbuf2[] =
"STOR\r\n";
1577 uint8_t ftpbuf3[] =
"227 OK\r\n";
1582 memset(&f, 0,
sizeof(f));
1583 memset(&ssn, 0,
sizeof(ssn));
1586 f.
proto = IPPROTO_TCP;
1592 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1593 sizeof(ftpbuf1) - 1);
1600 sizeof(ftpbuf3) - 1);
1604 STREAM_TOSERVER, ftpbuf2,
1605 sizeof(ftpbuf2) - 1);
void MpmInitThreadCtx(MpmThreadCtx *mpm_thread_ctx, uint16_t matcher)
void PmqReset(PrefilterRuleStore *pmq)
Reset a Pmq for reusage. Meant to be called after a single search.
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int(*StateGetProgress)(void *alstate, uint8_t direction))
const FtpCommand * command_descriptor
int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, uint8_t ipproto, const char *alproto_name, AppProto alproto, uint16_t min_depth, uint16_t max_depth, ProbingParserFPtr ProbingParserTs, ProbingParserFPtr ProbingParserTc)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
int AppLayerProtoDetectPMRegisterPatternCI(uint8_t ipproto, AppProto alproto, const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction)
Registers a case-insensitive pattern for protocol detection.
@ FTPDATA_STATE_IN_PROGRESS
void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto alproto, void *(*LocalStorageAlloc)(void), void(*LocalStorageFree)(void *))
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
const FtpCommand FtpCommands[FTP_COMMAND_MAX+1]
FileContainer * FileContainerAlloc(void)
allocate a FileContainer
void *(* Calloc)(size_t n, size_t size)
struct FtpState_ FtpState
bool AppLayerRequestProtocolTLSUpgrade(Flow *f)
request applayer to wrap up this protocol and rerun protocol detection with expectation of TLS....
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
FlowStorageId AppLayerExpectationGetFlowId(void)
structure for storing potential rule matches
int ParseSizeStringU64(const char *size, uint64_t *res)
struct HtpBodyChunk_ * next
FtpRequestCommand command
int AppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name)
check if a parser is enabled in the config Returns enabled always if: were running unittests
#define STREAMING_BUFFER_CONFIG_INITIALIZER
void FileContainerFree(FileContainer *ffc, const StreamingBufferConfig *cfg)
Free a FileContainer.
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
void AppLayerParserRegisterStateProgressCompletionStatus(AppProto alproto, const int ts, const int tc)
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto, uint8_t direction)
bool current_line_truncated_tc
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
#define TAILQ_FOREACH(var, head, field)
FtpRequestCommand command
uint64_t FTPMemuseGlobalCounter(void)
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
void AppLayerDecoderEventsFreeEvents(AppLayerDecoderEvents **events)
FtpRequestCommand command
#define SCMUTEX_INITIALIZER
const char * command_name
#define TAILQ_INSERT_TAIL(head, elm, field)
#define APP_LAYER_PARSER_EOF_TS
SC_ATOMIC_DECLARE(uint64_t, ftp_memuse)
void FTPParserCleanup(void)
Free memory allocated for global FTP parser state.
bool EveFTPDataAddMetadata(void *vtx, JsonBuilder *jb)
void MpmInitCtx(MpmCtx *mpm_ctx, uint8_t matcher)
void AppLayerProtoDetectPPRegister(uint8_t ipproto, const char *portstr, AppProto alproto, uint16_t min_depth, uint16_t max_depth, uint8_t direction, ProbingParserFPtr ProbingParser1, ProbingParserFPtr ProbingParser2)
register parser at a port
uint32_t ftp_max_line_len
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
void StreamTcpInitConfig(bool)
To initialize the stream global configuration data.
#define APP_LAYER_INCOMPLETE(c, n)
#define TAILQ_REMOVE(head, elm, field)
void MpmDestroyThreadCtx(MpmThreadCtx *mpm_thread_ctx, const uint16_t matcher)
#define JB_SET_STRING(jb, key, val)
#define TAILQ_FIRST(head)
#define PASS
Pass the test.
#define SCMutexUnlock(mut)
AppLayerStateData state_data
AppLayerParserThreadCtx * alp_tctx
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
int AppLayerProtoDetectPMRegisterPatternCSwPP(uint8_t ipproto, AppProto alproto, const char *pattern, uint16_t depth, uint16_t offset, uint8_t direction, ProbingParserFPtr PPFunc, uint16_t pp_min_depth, uint16_t pp_max_depth)
void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfo)(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type))
AppLayerStateData state_data
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
void FTPParserRegisterTests(void)
void RegisterFTPParsers(void)
void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto, void(*RegisterUnittests)(void))
int AppLayerExpectationCreate(Flow *f, int direction, Port src, Port dst, AppProto alproto, void *data)
#define APP_LAYER_PARSER_EOF_TC
uint64_t ftp_config_memcap
void AppLayerRegisterExpectationProto(uint8_t proto, AppProto alproto)
int(* Prepare)(struct MpmCtx_ *)
int FileOpenFileWithId(FileContainer *ffc, const StreamingBufferConfig *sbcfg, uint32_t track_id, const uint8_t *name, uint16_t name_len, const uint8_t *data, uint32_t data_len, uint16_t flags)
Open a new File.
void AppLayerParserRegisterGetTxFilesFunc(uint8_t ipproto, AppProto alproto, AppLayerGetFileState(*GetTxFiles)(void *, uint8_t))
void AppLayerProtoDetectRegisterProtocol(AppProto alproto, const char *alproto_name)
Registers a protocol for protocol detection phase.
struct FtpDataState_ FtpDataState
int FileAppendData(FileContainer *ffc, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len)
Store/handle a chunk of file data in the File structure The last file in the FileContainer will be us...
uint64_t FTPMemcapGlobalCounter(void)
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
struct FtpInput_ FtpInput
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void * FlowGetStorageById(const Flow *f, FlowStorageId id)
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, AppLayerParserFPtr Parser)
Register app layer parser for the protocol.
void DetectEngineStateFree(DetectEngineState *state)
Frees a DetectEngineState object.
#define SCRealloc(ptr, sz)
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
struct AppLayerTxData AppLayerTxData
#define SCReturnStruct(x)
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
void StreamTcpFreeConfig(bool quiet)
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
uint32_t ftp_config_maxtx
void AppLayerDecoderEventsSetEventRaw(AppLayerDecoderEvents **sevents, uint8_t event)
Set an app layer decoder event.
#define TAILQ_NEXT(elm, field)
void AppLayerParserRegisterStateDataFunc(uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state))
void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto, AppLayerTxData *(*GetTxData)(void *tx))
int ParseSizeStringU32(const char *size, uint32_t *res)
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
int FTPSetMemcap(uint64_t size)
void AppLayerParserRegisterGetTxIterator(uint8_t ipproto, AppProto alproto, AppLayerGetTxIteratorFunc Func)
#define SCLogError(...)
Macro used to log ERROR messages.
void(* DestroyCtx)(struct MpmCtx_ *)
void FlowFreeStorageById(Flow *f, FlowStorageId id)
int FileCloseFile(FileContainer *ffc, const StreamingBufferConfig *sbcfg, const uint8_t *data, uint32_t data_len, uint16_t flags)
Close a File.
void(* Free)(void *ptr, size_t size)
bool current_line_truncated_ts
thread_local SCError sc_errno
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))
void PmqFree(PrefilterRuleStore *pmq)
Cleanup and free a Pmq.
void AppLayerParserRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfoById)(uint8_t event_id, const char **event_name, AppLayerEventType *event_type))
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
uint16_t JsonGetNextLineFromBuffer(const char *buffer, const uint16_t len)
uint16_t FileFlowFlagsToFlags(const uint16_t flow_file_flags, uint8_t direction)
struct FTPThreadCtx_ FTPThreadCtx
uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
AppProto alproto
application level protocol
union AppLayerGetTxIterState::@11 un
int MpmAddPatternCI(struct MpmCtx_ *mpm_ctx, uint8_t *pat, uint16_t patlen, uint16_t offset, uint16_t depth, uint32_t pid, SigIntId sid, uint8_t flags)
#define SCMemcmp(a, b, c)
int AppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto, const char *alproto)
Given a protocol name, checks if proto detection is enabled in the conf file.
MpmThreadCtx * ftp_mpm_thread_ctx
#define DEBUG_VALIDATE_BUG_ON(exp)
int PmqSetup(PrefilterRuleStore *pmq)
Setup a pmq.
void *(* Realloc)(void *ptr, size_t orig_size, size_t size)