Go to the documentation of this file.
40 #define TFTP_DEFAULT_PORT "69"
44 #define TFTP_MIN_FRAME_LEN 4
46 static void *TFTPStateAlloc(
void *orig_state,
AppProto proto_orig)
48 return SCTftpStateAlloc();
51 static void TFTPStateFree(
void *state)
53 SCTftpStateFree(state);
62 static void TFTPStateTxFree(
void *state, uint64_t tx_id)
64 SCTftpStateTxFree(state, tx_id);
67 static int TFTPStateGetEventInfo(
80 const Flow *
f, uint8_t direction,
const uint8_t *input, uint32_t input_len, uint8_t *rdir)
89 SCLogDebug(
"Protocol not detected as ALPROTO_TFTP.");
96 const uint8_t *input = StreamSliceGetData(&stream_slice);
97 uint32_t input_len = StreamSliceGetDataLen(&stream_slice);
99 SCLogDebug(
"Parsing tftp request: len=%" PRIu32, input_len);
102 if ((input == NULL || input_len == 0) &&
109 if (input == NULL || input_len == 0) {
113 int64_t res = SCTftpParseRequest(state, input, input_len);
129 static uint64_t TFTPGetTxCnt(
void *state)
131 return SCTftpGetTxCnt(state);
134 static void *TFTPGetTx(
void *state, uint64_t tx_id)
136 return SCTftpGetTx(state, tx_id);
152 static int TFTPGetStateProgress(
void *tx, uint8_t direction)
159 const char *proto_name =
"tftp";
165 SCLogDebug(
"TFTP UDP protocol detection enabled.");
170 SCLogDebug(
"Unittest mode, registering default configuration.");
176 SCLogDebug(
"No tftp app-layer configuration, enabling tftp"
177 " detection UDP detection on port %s.",
185 SCLogDebug(
"Protocol detector and parser disabled for TFTP.");
191 SCLogDebug(
"Registering TFTP protocol parser.");
196 TFTPStateAlloc, TFTPStateFree);
200 STREAM_TOSERVER, TFTPParseRequest);
204 STREAM_TOCLIENT, TFTPParseResponse);
219 TFTPGetStateProgress);
224 TFTPStateGetEventInfo);
229 SCLogDebug(
"TFTP protocol parsing disabled.");
void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int(*StateGetProgress)(void *alstate, uint8_t direction))
uint16_t SCAppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
void AppLayerParserRegisterStateProgressCompletionStatus(AppProto alproto, const int ts, const int tc)
void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, void(*StateTransactionFree)(void *, uint64_t))
int SCAppLayerProtoDetectConfProtoDetectionEnabled(const char *ipproto, const char *alproto)
Given a protocol name, checks if proto detection is enabled in the conf file.
int SCAppLayerParserConfParserEnabled(const char *ipproto, const char *alproto_name)
check if a parser is enabled in the config Returns enabled always if: were running unittests
void SCAppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, void *(*StateAlloc)(void *, AppProto), void(*StateFree)(void *))
void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto, int(*StateGetEventInfo)(const char *event_name, uint8_t *event_id, AppLayerEventType *event_type))
void RegisterTFTPParsers(void)
#define TFTP_DEFAULT_PORT
void AppLayerProtoDetectRegisterProtocol(AppProto alproto, const char *alproto_name)
Registers a protocol for protocol detection phase.
int RunmodeIsUnittests(void)
#define TFTP_MIN_FRAME_LEN
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto, uint8_t direction, AppLayerParserFPtr Parser)
Register app layer parser for the protocol.
void SCAppLayerProtoDetectPPRegister(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
void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto, void *(StateGetTx)(void *alstate, uint64_t tx_id))
#define SCReturnStruct(x)
void AppLayerParserRegisterStateDataFunc(uint8_t ipproto, AppProto alproto, AppLayerStateData *(*GetStateData)(void *state))
void AppLayerParserRegisterTxDataFunc(uint8_t ipproto, AppProto alproto, AppLayerTxData *(*GetTxData)(void *tx))
int SCAppLayerProtoDetectPPParseConfPorts(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)
void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto, uint64_t(*StateGetTxCnt)(void *alstate))