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);
750 SCLogDebug(
"FTP active mode (v6): dynamic port %" PRIu16
"", dyn_port);
762 SCLogDebug(
"FTP active mode (v4): dynamic port %" PRIu16
"", dyn_port);
767 FTPParsePassiveResponse(ftp_state, line.
buf, line.
len);
773 FTPParsePassiveResponseV6(ftp_state, line.
buf, line.
len);
783 response->
len = CopyCommandLine(&response->
str, &line);
787 &tx->
tx_data.events, FtpEventResponseCommandTooLong);
797 if (FTPIsPPR(line.
buf, line.
len)) {
815 static uint64_t ftp_state_memuse = 0;
816 static uint64_t ftp_state_memcnt = 0;
819 static void *FTPStateAlloc(
void *orig_state,
AppProto proto_orig)
821 void *s = FTPCalloc(1,
sizeof(
FtpState));
837 static void FTPStateFree(
void *s)
846 SCLogDebug(
"[%s] state %p id %" PRIu64
", Freeing %d bytes at %p",
849 FTPTransactionFree(tx);
872 SCLogDebug(
"NULL state object; no transactions available");
889 SCLogDebug(
"Returning OLDEST tx %p id %"PRIu64, lasttx, lasttx->
tx_id);
893 static void *FTPGetTx(
void *state, uint64_t tx_id)
899 if (ftp_state->
curr_tx == NULL)
905 if (tx->
tx_id == tx_id)
918 static AppLayerStateData *FTPGetStateData(
void *vstate)
924 static void FTPStateTransactionFree(
void *state, uint64_t tx_id)
929 if (tx_id < tx->tx_id)
931 else if (tx_id > tx->
tx_id)
937 FTPTransactionFree(tx);
942 static uint64_t FTPGetTxCnt(
void *state)
953 static int FTPGetAlstateProgress(
void *vtx, uint8_t
direction)
968 static AppProto FTPUserProbingParser(
969 Flow *f, uint8_t
direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
978 static AppProto FTPServerProbingParser(
979 Flow *f, uint8_t
direction,
const uint8_t *input, uint32_t
len, uint8_t *rdir)
986 if (input[0] !=
'2' || input[1] !=
'2' || input[2] !=
'0') {
990 if (input[3] !=
' ' && input[3] !=
'-') {
996 if (memchr(input + 4,
'\n',
len - 4) != NULL) {
1003 static int FTPRegisterPatternsForProtocolDetection(
void)
1006 IPPROTO_TCP,
ALPROTO_FTP,
"220 (", 5, 0, STREAM_TOCLIENT) < 0) {
1010 IPPROTO_TCP,
ALPROTO_FTP,
"FEAT", 4, 0, STREAM_TOSERVER) < 0) {
1014 STREAM_TOSERVER, FTPUserProbingParser, 5, 5) < 0) {
1018 IPPROTO_TCP,
ALPROTO_FTP,
"PASS ", 5, 0, STREAM_TOSERVER) < 0) {
1022 IPPROTO_TCP,
ALPROTO_FTP,
"PORT ", 5, 0, STREAM_TOSERVER) < 0) {
1028 "tcp", IPPROTO_TCP,
"ftp",
ALPROTO_FTP, 0, 5, NULL, FTPServerProbingParser)) {
1032 FTPServerProbingParser);
1050 const uint8_t *input = StreamSliceGetData(&stream_slice);
1051 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
1052 const bool eof = (
direction & STREAM_TOSERVER)
1056 SCTxDataUpdateFileFlags(&ftpdata_state->
tx_data, ftpdata_state->
state_data.file_flags);
1057 if (ftpdata_state->
tx_data.file_tx == 0)
1058 ftpdata_state->
tx_data.file_tx =
direction & (STREAM_TOSERVER | STREAM_TOCLIENT);
1065 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient", eof ?
"true" :
"false");
1068 if (input_len && ftpdata_state->
files == NULL) {
1078 SCLogDebug(
"input %u not for our direction (%s): %s/%s", input_len,
1079 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1081 (data->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1086 if (ftpdata_state->
files == NULL) {
1097 switch (data->
cmd) {
1101 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1106 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1115 0ULL, (uint8_t *) ftpdata_state->
file_name,
1117 input, input_len,
flags) != 0) {
1122 ftpdata_state->
tx_data.files_opened = 1;
1133 SCLogDebug(
"input %u not for us (%s): %s/%s", input_len,
1134 (
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
1136 (ftpdata_state->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1139 if (input_len != 0) {
1143 SCLogDebug(
"FileAppendData() - file no longer being extracted");
1145 }
else if (ret < 0) {
1146 SCLogDebug(
"FileAppendData() failed: %d", ret);
1157 SCLogDebug(
"closed because of eof: state now FTPDATA_STATE_FINISHED");
1167 StreamSlice stream_slice,
void *local_data)
1169 return FTPDataParse(f, ftp_state, pstate, stream_slice, local_data, STREAM_TOSERVER);
1173 StreamSlice stream_slice,
void *local_data)
1175 return FTPDataParse(f, ftp_state, pstate, stream_slice, local_data, STREAM_TOCLIENT);
1180 static uint64_t ftpdata_state_memuse = 0;
1181 static uint64_t ftpdata_state_memcnt = 0;
1184 static void *FTPDataStateAlloc(
void *orig_state,
AppProto proto_orig)
1195 ftpdata_state_memcnt++;
1202 static void FTPDataStateFree(
void *s)
1206 if (fstate->
tx_data.de_state != NULL) {
1218 ftpdata_state_memcnt--;
1230 static AppLayerStateData *FTPDataGetStateData(
void *vstate)
1236 static void FTPDataStateTransactionFree(
void *state, uint64_t tx_id)
1241 static void *FTPDataGetTx(
void *state, uint64_t tx_id)
1247 static uint64_t FTPDataGetTxCnt(
void *state)
1253 static int FTPDataGetAlstateProgress(
void *tx, uint8_t
direction)
1257 return ftpdata_state->
state;
1262 static AppLayerGetFileState FTPDataStateGetTxFiles(
void *tx, uint8_t
direction)
1265 AppLayerGetFileState files = { .fc = NULL, .cfg = &sbcfg };
1268 files.fc = ftpdata_state->
files;
1273 static void FTPSetMpmState(
void)
1276 if (
unlikely(ftp_mpm_ctx == NULL)) {
1284 if (
cmd->command_length == 0)
1288 (uint8_t *)
cmd->command_name,
1289 cmd->command_length,
1298 static void FTPFreeMpmState(
void)
1300 if (ftp_mpm_ctx != NULL) {
1311 static AppLayerGetTxIterTuple FTPGetTxIterator(
const uint8_t ipproto,
const AppProto alproto,
1315 AppLayerGetTxIterTuple no_tuple = { NULL, 0,
false };
1318 if (state->
un.
ptr == NULL) {
1324 while (tx_ptr->
tx_id < min_tx_id) {
1330 if (tx_ptr->
tx_id >= max_tx_id) {
1334 AppLayerGetTxIterTuple tuple = {
1337 .has_next = (state->
un.
ptr != NULL),
1347 const char *proto_name =
"ftp";
1348 const char *proto_data_name =
"ftp-data";
1353 if (FTPRegisterPatternsForProtocolDetection() < 0 )
1374 FTPLocalStorageFree);
1384 FTPDataParseRequest);
1386 FTPDataParseResponse);
1411 sbcfg.
Calloc = FTPCalloc;
1413 sbcfg.
Free = FTPFree;
1417 SCLogInfo(
"Parser disabled for %s protocol. Protocol detection still on.", proto_name);
1446 if (!buffer || *buffer ==
'\0') {
1450 char *c = strchr(buffer,
'\n');
1451 return c == NULL ?
len : (uint16_t)(c - buffer + 1);
1457 jb_open_object(jb,
"ftp_data");
1460 jb_set_string_from_bytes(jb,
"filename", ftp_state->
file_name, ftp_state->
file_len);
1489 static int FTPParserTest01(
void)
1492 uint8_t ftpbuf[] =
"PORT 192,168,1,1,0,80\r\n";
1493 uint32_t ftplen =
sizeof(ftpbuf) - 1;
1497 memset(&f, 0,
sizeof(f));
1498 memset(&ssn, 0,
sizeof(ssn));
1501 f.
proto = IPPROTO_TCP;
1507 STREAM_TOSERVER | STREAM_EOF, ftpbuf, ftplen);
1520 static int FTPParserTest11(
void)
1523 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1524 uint8_t ftpbuf2[] =
"RETR\r\n";
1525 uint8_t ftpbuf3[] =
"227 OK\r\n";
1530 memset(&f, 0,
sizeof(f));
1531 memset(&ssn, 0,
sizeof(ssn));
1534 f.
proto = IPPROTO_TCP;
1540 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1541 sizeof(ftpbuf1) - 1);
1548 sizeof(ftpbuf3) - 1);
1552 STREAM_TOSERVER, ftpbuf2,
1553 sizeof(ftpbuf2) - 1);
1567 static int FTPParserTest12(
void)
1570 uint8_t ftpbuf1[] =
"PORT 192,168,1,1,0,80\r\n";
1571 uint8_t ftpbuf2[] =
"STOR\r\n";
1572 uint8_t ftpbuf3[] =
"227 OK\r\n";
1577 memset(&f, 0,
sizeof(f));
1578 memset(&ssn, 0,
sizeof(ssn));
1581 f.
proto = IPPROTO_TCP;
1587 STREAM_TOSERVER | STREAM_START, ftpbuf1,
1588 sizeof(ftpbuf1) - 1);
1595 sizeof(ftpbuf3) - 1);
1599 STREAM_TOSERVER, ftpbuf2,
1600 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)