};
static uint32_t FragmentDataParser(Flow *f, void *dcerpcudp_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate,
+ uint8_t *input, uint32_t input_len)
{
SCEnter();
DCERPCUDPState *sstate = (DCERPCUDPState *) dcerpcudp_state;
* fragmented packets.
*/
static int DCERPCUDPParseHeader(Flow *f, void *dcerpcudp_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate,
+ uint8_t *input, uint32_t input_len)
{
SCEnter();
uint8_t *p = input;
}
static int DCERPCUDPParse(Flow *f, void *dcerpc_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
}
static int DCERPCParse(Flow *f, void *dcerpc_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data, int dir) {
SCEnter();
}
static int DCERPCParseRequest(Flow *f, void *dcerpc_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
}
static int DCERPCParseResponse(Flow *f, void *dcerpc_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
#ifndef __APP_LAYER_DETECT_PROTO__H__
#define __APP_LAYER_DETECT_PROTO__H__
+typedef struct AppLayerProtoDetectThreadCtx_ AppLayerProtoDetectThreadCtx;
+
typedef uint16_t (*ProbingParserFPtr)(uint8_t *input, uint32_t input_len,
uint32_t *offset);
* \brief Parse DNS request packet
*/
static int DNSTCPRequestParse(Flow *f, void *dstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
*
*/
static int DNSTCPResponseParse(Flow *f, void *dstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
* \brief Parse DNS request packet
*/
static int DNSUDPRequestParse(Flow *f, void *dstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
*
*/
static int DNSUDPResponseParse(Flow *f, void *dstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
* \retval 1 when the command is parsed, 0 otherwise
*/
static int FTPParseRequest(Flow *f, void *ftp_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
*
* \retval 1 when the command is parsed, 0 otherwise
*/
-static int FTPParseResponse(Flow *f, void *ftp_state, void *pstate,
+static int FTPParseResponse(Flow *f, void *ftp_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
* \retval On success returns 1 or on failure returns -1.
*/
static int HTPHandleRequestData(Flow *f, void *htp_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
* \retval On success returns 1 or on failure returns -1
*/
static int HTPHandleResponseData(Flow *f, void *htp_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
memset(&hstate, 0x00, sizeof(hstate));
Flow flow;
memset(&flow, 0x00, sizeof(flow));
- void *parser = AppLayerParserStateAlloc();
+ AppLayerParserState *parser = AppLayerParserStateAlloc();
htp_tx_t tx;
memset(&tx, 0, sizeof(tx));
{
/* 0 - to_server, 1 - to_client. */
int (*Parser[2])(Flow *f, void *protocol_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_storage);
char logger;
static AppLayerParserCtx alp_ctx;
static void AppLayerParserTransactionsCleanup(uint8_t ipproto, AppProto alproto,
- void *alstate, void *pstate)
+ void *alstate, AppLayerParserState *parser_state_store)
{
SCEnter();
- AppLayerParserState *parser_state_store = pstate;
uint64_t inspect = 0, log = 0;
uint64_t min;
AppLayerParserProtoCtx *ctx = &alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto];
SCReturn;
}
-void *AppLayerParserStateAlloc(void)
+AppLayerParserState *AppLayerParserStateAlloc(void)
{
SCEnter();
memset(pstate, 0, sizeof(*pstate));
end:
- SCReturnPtr(pstate, "pstate");
+ SCReturnPtr(pstate, "AppLayerParserState");
}
-void AppLayerParserStateFree(void *pstate)
+void AppLayerParserStateFree(AppLayerParserState *pstate)
{
SCEnter();
- if (((AppLayerParserState *)pstate)->decoder_events != NULL)
- AppLayerDecoderEventsFreeEvents(((AppLayerParserState *)pstate)->decoder_events);
+ if (pstate->decoder_events != NULL)
+ AppLayerDecoderEventsFreeEvents(pstate->decoder_events);
SCFree(pstate);
SCReturn;
SCReturnInt(0);
}
-void *AppLayerParserThreadCtxAlloc(void)
+AppLayerParserThreadCtx *AppLayerParserThreadCtxAlloc(void)
{
SCEnter();
SCReturnPtr(tctx, "void *");
}
-void AppLayerParserThreadCtxFree(void *alpd_tctx)
+void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
{
SCEnter();
AppProto i = 0;
int j = 0;
- AppLayerParserThreadCtx *tctx = (AppLayerParserThreadCtx *)alpd_tctx;
for (i = 0; i < FLOW_PROTO_DEFAULT; i++) {
for (j = 0; j < ALPROTO_MAX; j++) {
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
uint8_t direction,
int (*Parser)(Flow *f, void *protocol_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *buf, uint32_t buf_len,
void *local_storage))
{
SCReturn;
}
-uint64_t AppLayerParserGetTransactionLogId(void *pstate)
+uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate)
{
SCEnter();
- SCReturnCT(((AppLayerParserState *)pstate)->log_id, "uint64_t");
+ SCReturnCT(pstate->log_id, "uint64_t");
}
-void AppLayerParserSetTransactionLogId(void *pstate)
+void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate)
{
SCEnter();
- ((AppLayerParserState *)pstate)->log_id++;
+ pstate->log_id++;
SCReturn;
}
-uint64_t AppLayerParserGetTransactionInspectId(void *pstate, uint8_t direction)
+uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction)
{
SCEnter();
- SCReturnCT(((AppLayerParserState *)pstate)->
- inspect_id[direction & STREAM_TOSERVER ? 0 : 1], "uint64_t");
+ SCReturnCT(pstate->inspect_id[direction & STREAM_TOSERVER ? 0 : 1], "uint64_t");
}
-void AppLayerParserSetTransactionInspectId(void *pstate,
+void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction)
{
else
break;
}
- ((AppLayerParserState *)pstate)->inspect_id[dir] = idx;
+ pstate->inspect_id[dir] = idx;
SCReturn;
}
-AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(void *pstate)
+AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate)
{
SCEnter();
- SCReturnPtr(((AppLayerParserState *)pstate)->decoder_events,
+ SCReturnPtr(pstate->decoder_events,
"AppLayerDecoderEvents *");
}
-void AppLayerParserSetDecoderEvents(void *pstate, AppLayerDecoderEvents *devents)
+void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents)
{
- (((AppLayerParserState *)pstate)->decoder_events) = devents;
+ pstate->decoder_events = devents;
}
AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto,
SCReturnPtr(ptr, "AppLayerDecoderEvents *");
}
-uint16_t AppLayerParserGetStateVersion(void *pstate)
+uint16_t AppLayerParserGetStateVersion(AppLayerParserState *pstate)
{
SCEnter();
- SCReturnCT((pstate == NULL) ? 0 : ((AppLayerParserState *)pstate)->version,
- "uint16_t");
+ SCReturnCT((pstate == NULL) ? 0 : pstate->version, "uint16_t");
}
FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto,
first_data_dir, "uint8_t");
}
-uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, void *pstate, uint8_t direction)
+uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto,
+ AppLayerParserState *pstate, uint8_t direction)
{
SCEnter();
- AppLayerParserState *state = (AppLayerParserState *)pstate;
uint64_t active_id;
- uint64_t log_id = state->log_id;
- uint64_t inspect_id = state->inspect_id[direction & STREAM_TOSERVER ? 0 : 1];
+ uint64_t log_id = pstate->log_id;
+ uint64_t inspect_id = pstate->inspect_id[direction & STREAM_TOSERVER ? 0 : 1];
if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].logger == TRUE) {
active_id = (log_id < inspect_id) ? log_id : inspect_id;
} else {
/***** General *****/
-int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto,
+int AppLayerParserParse(AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto,
uint8_t flags, uint8_t *input, uint32_t input_len)
{
SCEnter();
AppLayerParserProtoCtx *p = &alp_ctx.ctxs[FlowGetProtoMapping(f->proto)][alproto];
TcpSession *ssn = NULL;
void *alstate = NULL;
- AppLayerParserThreadCtx *alp_tctx = (AppLayerParserThreadCtx *)tctx;
/* we don't have the parser registered for this protocol */
if (p->StateAlloc == NULL)
SCReturnInt(-1);
}
-void AppLayerParserSetEOF(void *pstate)
+void AppLayerParserSetEOF(AppLayerParserState *pstate)
{
SCEnter();
AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_EOF);
/* increase version so we will inspect it one more time
* with the EOF flags now set */
- ((AppLayerParserState *)pstate)->version++;
+ pstate->version++;
end:
SCReturn;
}
int AppLayerParserHasDecoderEvents(uint8_t ipproto, AppProto alproto,
- void *alstate, void *pstate,
+ void *alstate, AppLayerParserState *pstate,
uint8_t flags)
{
SCEnter();
/***** Cleanup *****/
-void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate)
+void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate,
+ AppLayerParserState *pstate)
{
SCEnter();
}
-void AppLayerParserStateSetFlag(void *pstate, uint8_t flag)
+void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
{
SCEnter();
- ((AppLayerParserState *)pstate)->flags |= flag;
+ pstate->flags |= flag;
SCReturn;
}
-int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag)
+int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag)
{
SCEnter();
- SCReturnInt(((AppLayerParserState *)pstate)->flags & flag);
+ SCReturnInt(pstate->flags & flag);
}
}
#ifdef DEBUG
-void AppLayerParserStatePrintDetails(void *pstate)
+void AppLayerParserStatePrintDetails(AppLayerParserState *pstate)
{
SCEnter();
if (pstate == NULL)
SCReturn;
- AppLayerParserState *p = (AppLayerParserState *)pstate;
+ AppLayerParserState *p = pstate;
SCLogDebug("AppLayerParser parser state information for parser state p(%p). "
"p->inspect_id[0](%"PRIu64"), "
"p->inspect_id[1](%"PRIu64"), "
* \brief Test parser function to test the memory deallocation of app layer
* parser of occurence of an error.
*/
-static int TestProtocolParser(Flow *f, void *test_state, void *pstate,
+static int TestProtocolParser(Flow *f, void *test_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
int AppLayerParserDeSetup(void);
+typedef struct AppLayerParserThreadCtx_ AppLayerParserThreadCtx;
+
/**
* \brief Gets a new app layer protocol's parser thread context.
*
* \retval Non-NULL pointer on success.
* NULL pointer on failure.
*/
-void *AppLayerParserThreadCtxAlloc(void);
+AppLayerParserThreadCtx *AppLayerParserThreadCtxAlloc(void);
/**
* \brief Destroys the app layer parser thread context obtained
*
* \param tctx Pointer to the thread context to be destroyed.
*/
-void AppLayerParserThreadCtxFree(void *tctx);
+void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx);
/**
* \brief Given a protocol name, checks if the parser is enabled in
int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
uint8_t direction,
int (*Parser)(Flow *f, void *protocol_state,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *buf, uint32_t buf_len,
void *local_storage));
void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto,
void *local_data);
-uint64_t AppLayerParserGetTransactionLogId(void *pstate);
-void AppLayerParserSetTransactionLogId(void *pstate);
-uint64_t AppLayerParserGetTransactionInspectId(void *pstate, uint8_t direction);
-void AppLayerParserSetTransactionInspectId(void *pstate,
+uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate);
+void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate);
+uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
+void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction);
-AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(void *pstate);
-void AppLayerParserSetDecoderEvents(void *pstate, AppLayerDecoderEvents *devents);
+AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate);
+void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents);
AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *alstate,
uint64_t tx_id);
-uint16_t AppLayerParserGetStateVersion(void *pstate);
+uint16_t AppLayerParserGetStateVersion(AppLayerParserState *pstate);
FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto,
void *alstate, uint8_t direction);
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name,
int *event_id, AppLayerEventType *event_type);
-uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, void *pstate, uint8_t direction);
+uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, AppLayerParserState *pstate, uint8_t direction);
uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto);
/***** General *****/
-int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto,
+int AppLayerParserParse(AppLayerParserThreadCtx *tctx, Flow *f, AppProto alproto,
uint8_t flags, uint8_t *input, uint32_t input_len);
-void AppLayerParserSetEOF(void *pstate);
-int AppLayerParserHasDecoderEvents(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate,
+void AppLayerParserSetEOF(AppLayerParserState *pstate);
+int AppLayerParserHasDecoderEvents(uint8_t ipproto, AppProto alproto, void *alstate, AppLayerParserState *pstate,
uint8_t flags);
int AppLayerParserProtocolIsTxEventAware(uint8_t ipproto, AppProto alproto);
int AppLayerParserProtocolSupportsTxs(uint8_t ipproto, AppProto alproto);
/***** Cleanup *****/
-void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate);
+void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate, AppLayerParserState *pstate);
void AppLayerParserRegisterProtocolParsers(void);
-void AppLayerParserStateSetFlag(void *pstate, uint8_t flag);
-int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag);
+void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag);
+int AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint8_t flag);
void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction);
-void *AppLayerParserStateAlloc(void);
-void AppLayerParserStateFree(void *pstate);
+AppLayerParserState *AppLayerParserStateAlloc(void);
+void AppLayerParserStateFree(AppLayerParserState *pstate);
#ifdef DEBUG
-void AppLayerParserStatePrintDetails(void *pstate);
+void AppLayerParserStatePrintDetails(AppLayerParserState *pstate);
#endif
/***** Unittests *****/
*/
/* For WriteAndX we need to get writeandxdataoffset */
static uint32_t SMBParseWriteAndX(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
* \brief SMB Read AndX Response Parsing
*/
static uint32_t SMBParseReadAndX(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
}
static uint32_t SMBParseTransact(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
/**
* Handle variable length padding for WriteAndX and ReadAndX
*/
-static uint32_t PaddingParser(void *smb_state, void *pstate,
+static uint32_t PaddingParser(void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len)
{
SCEnter();
* \retval -1 f DCERPCParser does not validate
* \retval Number of bytes processed
*/
-static int32_t DataParser(void *smb_state, void *pstate,
+static int32_t DataParser(void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len)
{
SCEnter();
* Determine if this is an SMB AndX Command
*/
static uint32_t SMBGetWordCount(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
*/
static uint32_t SMBGetByteCount(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
* until sstate->wordcount.wordcount bytes are parsed.
*/
static uint32_t SMBParseWordCount(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
* until sstate->bytecount.bytecount bytes are parsed.
*/
static uint32_t SMBParseByteCount(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
* \retval 0 no input or already done
*/
static uint32_t NBSSParseHeader(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
* \retval -1 error
*/
static int SMBParseHeader(Flow *f, void *smb_state,
- void *pstate, uint8_t *input, uint32_t input_len)
+ AppLayerParserState *pstate, uint8_t *input, uint32_t input_len)
{
SCEnter();
SCReturnInt((p - input));
}
-static int SMBParse(Flow *f, void *smb_state, void *pstate,
+static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data, uint8_t dir)
{
SCReturnInt(1);
}
-static int SMBParseRequest(Flow *f, void *smb_state, void *pstate,
+static int SMBParseRequest(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
return SMBParse(f, smb_state, pstate, input, input_len, local_data, 0);
}
-static int SMBParseResponse(Flow *f, void *smb_state, void *pstate,
+static int SMBParseResponse(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
SMB_FIELD_MAX,
};
-static uint32_t NBSSParseHeader(void *smb2_state, void *pstate,
+static uint32_t NBSSParseHeader(void *smb2_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len)
{
SCEnter();
SCReturnUInt((uint32_t)(p - input));
}
-static uint32_t SMB2ParseHeader(void *smb2_state, void *pstate,
+static uint32_t SMB2ParseHeader(void *smb2_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len)
{
SCEnter();
SCReturnUInt((uint32_t)(p - input));
}
-static int SMB2Parse(Flow *f, void *smb2_state, void *pstate,
+static int SMB2Parse(Flow *f, void *smb2_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
}
static int SMTPProcessCommandBDAT(SMTPState *state, Flow *f,
- void *pstate)
+ AppLayerParserState *pstate)
{
SCEnter();
}
static int SMTPProcessCommandDATA(SMTPState *state, Flow *f,
- void *pstate)
+ AppLayerParserState *pstate)
{
SCEnter();
}
static int SMTPProcessCommandSTARTTLS(SMTPState *state, Flow *f,
- void *pstate)
+ AppLayerParserState *pstate)
{
return 0;
}
static int SMTPProcessReply(SMTPState *state, Flow *f,
- void *pstate)
+ AppLayerParserState *pstate)
{
SCEnter();
}
static int SMTPProcessRequest(SMTPState *state, Flow *f,
- void *pstate)
+ AppLayerParserState *pstate)
{
SCEnter();
}
static int SMTPParse(int direction, Flow *f, SMTPState *state,
- void *pstate, uint8_t *input,
+ AppLayerParserState *pstate, uint8_t *input,
uint32_t input_len,
PatternMatcherQueue *local_data)
{
}
static int SMTPParseClientRecord(Flow *f, void *alstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
}
static int SMTPParseServerRecord(Flow *f, void *alstate,
- void *pstate,
+ AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
}
static int SSLv2Decode(uint8_t direction, SSLState *ssl_state,
- void *pstate, uint8_t *input,
+ AppLayerParserState *pstate, uint8_t *input,
uint32_t input_len)
{
int retval = 0;
}
static int SSLv3Decode(uint8_t direction, SSLState *ssl_state,
- void *pstate, uint8_t *input,
+ AppLayerParserState *pstate, uint8_t *input,
uint32_t input_len)
{
int retval = 0;
*
* \retval >=0 On success.
*/
-static int SSLDecode(Flow *f, uint8_t direction, void *alstate, void *pstate,
+static int SSLDecode(Flow *f, uint8_t direction, void *alstate, AppLayerParserState *pstate,
uint8_t *input, uint32_t ilen)
{
SSLState *ssl_state = (SSLState *)alstate;
return 1;
}
-int SSLParseClientRecord(Flow *f, void *alstate, void *pstate,
+int SSLParseClientRecord(Flow *f, void *alstate, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
return SSLDecode(f, 0 /* toserver */, alstate, pstate, input, input_len);
}
-int SSLParseServerRecord(Flow *f, void *alstate, void *pstate,
+int SSLParseServerRecord(Flow *f, void *alstate, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
void *local_data)
{
*/
typedef struct AppLayerThreadCtx_ {
/* App layer protocol detection thread context, from AppLayerProtoDetectGetCtxThread(). */
- void *alpd_tctx;
+ AppLayerProtoDetectThreadCtx *alpd_tctx;
/* App layer parser thread context, from AppLayerParserThreadCtxAlloc(). */
- void *alp_tctx;
+ AppLayerParserThreadCtx *alp_tctx;
#ifdef PROFILING
uint64_t ticks_start;
SCReturnInt(0);
}
-int AppLayerHandleUdp(void *app_tctx, Packet *p, Flow *f)
+int AppLayerHandleUdp(AppLayerThreadCtx *tctx, Packet *p, Flow *f)
{
SCEnter();
- AppLayerThreadCtx *tctx = (AppLayerThreadCtx *)app_tctx;
-
int r = 0;
FLOWLOCK_WRLOCK(f);
SCReturnInt(0);
}
-void *AppLayerGetCtxThread(void)
+AppLayerThreadCtx *AppLayerGetCtxThread(void)
{
SCEnter();
SCReturnPtr(app_tctx, "void *");
}
-void AppLayerDestroyCtxThread(void *tctx)
+void AppLayerDestroyCtxThread(AppLayerThreadCtx *app_tctx)
{
SCEnter();
- AppLayerThreadCtx *app_tctx = (AppLayerThreadCtx *)tctx;
if (app_tctx == NULL)
SCReturn;
/* profiling */
-void AppLayerProfilingReset(void *tctx) {
+void AppLayerProfilingReset(AppLayerThreadCtx *app_tctx) {
#ifdef PROFILING
- AppLayerThreadCtx *app_tctx = tctx;
PACKET_PROFILING_APP_RESET(app_tctx);
#endif
}
-void AppLayerProfilingStore(void *tctx, Packet *p) {
+void AppLayerProfilingStore(AppLayerThreadCtx *app_tctx, Packet *p) {
#ifdef PROFILING
- AppLayerThreadCtx *app_tctx = tctx;
PACKET_PROFILING_APP_STORE(app_tctx, p);
#endif
}
/**
* \brief Handles an udp chunk.
*/
-int AppLayerHandleUdp(void *app_tctx, Packet *p, Flow *f);
+int AppLayerHandleUdp(AppLayerThreadCtx *app_tctx, Packet *p, Flow *f);
/***** Utility *****/
* \retval Pointer to the newly create thread context, on success;
* NULL, on failure.
*/
-void *AppLayerGetCtxThread(void);
+AppLayerThreadCtx *AppLayerGetCtxThread(void);
/**
* \brief Destroys the context created by AppLayeGetCtxThread().
*
* \param tctx Pointer to the thread context to destroy.
*/
-void AppLayerDestroyCtxThread(void *tctx);
+void AppLayerDestroyCtxThread(AppLayerThreadCtx *tctx);
-void AppLayerProfilingReset(void *tctx);
-void AppLayerProfilingStore(void *tctx, Packet *p);
+void AppLayerProfilingReset(AppLayerThreadCtx *tctx);
+void AppLayerProfilingStore(AppLayerThreadCtx *tctx, Packet *p);
/***** Unittests *****/
#include "app-layer-protos.h"
+typedef struct AppLayerThreadCtx_ AppLayerThreadCtx;
+
/* forward declaration */
struct DetectionEngineThreadCtx_;
typedef struct DecodeThreadVars_
{
/** Specific context for udp protocol detection (here atm) */
- void *app_tctx;
+ AppLayerThreadCtx *app_tctx;
int vlan_disabled;
#include "detect-tag.h"
#include "util-optimize.h"
+/* Part of the flow structure, so we declare it here.
+ * The actual declaration is in app-layer-parser.c */
+typedef struct AppLayerParserState_ AppLayerParserState;
+
#define FLOW_QUIET TRUE
#define FLOW_VERBOSE FALSE
/** application level storage ptrs.
*
*/
- void *alparser; /**< parser internal state */
+ AppLayerParserState *alparser; /**< parser internal state */
void *alstate; /**< application layer state */
/** detection engine state */