Remove need_lock from app layer parsers.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 7e2408d273
commit 18fe3818dc

@ -38,7 +38,7 @@ enum {
};
#if 0
static int DCERPCParseBIND(void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock) {
static int DCERPCParseBIND(void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output) {
DCERPCState *sstate = (DCERPCState *)dcerpc_state;
uint8_t *p = input;
if (input_len) {
@ -73,7 +73,7 @@ static int DCERPCParseBIND(void *dcerpc_state, AppLayerParserState *pstate, uint
return (p - input);
}
static int DCERPCParseBINDACK(void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock) {
static int DCERPCParseBINDACK(void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output) {
DCERPCState *sstate = (DCERPCState *)dcerpc_state;
uint8_t *p = input;
return 0;
@ -82,7 +82,7 @@ static int DCERPCParseBINDACK(void *dcerpc_state, AppLayerParserState *pstate, u
static int DCERPCParseHeader(Flow *f, void *dcerpc_state, AppLayerParserState
*pstate, uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock) {
AppLayerParserResult *output) {
SCEnter();
DCERPCState *sstate = (DCERPCState *)dcerpc_state;
@ -175,7 +175,7 @@ static int DCERPCParseHeader(Flow *f, void *dcerpc_state, AppLayerParserState
SCReturnInt(0);
}
static int DCERPCParse(Flow *f, void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock) {
static int DCERPCParse(Flow *f, void *dcerpc_state, AppLayerParserState *pstate, uint8_t *input, uint32_t input_len, AppLayerParserResult *output) {
SCEnter();
// DCERPCState *sstate = (DCERPCState *)dcerpc_state;
uint16_t max_fields = 3;

@ -108,7 +108,7 @@ void HTPGetIPAddr(Flow *f, int family, char *remote_addr, char *local_addr)
static int HTPHandleRequestData(Flow *f, void *htp_state,
AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
HtpState *hstate = (HtpState *)htp_state;
@ -165,7 +165,7 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
static int HTPHandleResponseData(Flow *f, void *htp_state,
AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
HtpState *hstate = (HtpState *)htp_state;

@ -477,8 +477,8 @@ uint16_t AppLayerGetProtoByName(const char *name)
int AppLayerRegisterParser(char *name, uint16_t proto, uint16_t parser_id,
int (*AppLayerParser)(Flow *f, void *protocol_state,
AppLayerParserState *parser_state, uint8_t *input,
uint32_t input_len, AppLayerParserResult *output,
char need_lock), char *dependency)
uint32_t input_len, AppLayerParserResult *output),
char *dependency)
{
al_max_parsers++;
@ -513,8 +513,7 @@ int AppLayerRegisterParser(char *name, uint16_t proto, uint16_t parser_id,
int AppLayerRegisterProto(char *name, uint8_t proto, uint8_t flags,
int (*AppLayerParser)(Flow *f, void *protocol_state,
AppLayerParserState *parser_state, uint8_t *input,
uint32_t input_len, AppLayerParserResult *output,
char need_lock))
uint32_t input_len, AppLayerParserResult *output))
{
al_max_parsers++;
@ -610,8 +609,7 @@ static int AppLayerDoParse(Flow *f, void *app_layer_state, AppLayerParserState *
/* invoke the parser */
int r = al_parser_table[parser_idx].AppLayerParser(f, app_layer_state,
parser_state, input, input_len, &result,
need_lock);
parser_state, input, input_len, &result);
if (r < 0) {
if (r == -1) {
AppLayerParserResultCleanup(&result);
@ -981,7 +979,7 @@ typedef struct TestState_ {
*/
static int TestProtocolParser(Flow *f, void *test_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
return -1;
}

@ -77,7 +77,7 @@ typedef struct AppLayerParserTableElement_ {
uint8_t flags;
int (*AppLayerParser)(Flow *f, void *protocol_state, AppLayerParserState
*parser_state, uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock);
AppLayerParserResult *output);
uint16_t max_outputs; /* rationele is that if we know the max outputs of all
parsers, we can statically define our output array
to be a certain size */
@ -90,13 +90,12 @@ void RegisterAppLayerParsers(void);
int AppLayerRegisterProto(char *name, uint8_t proto, uint8_t flags,
int (*AppLayerParser)(Flow *f, void *protocol_state,
AppLayerParserState *parser_state, uint8_t *input,
uint32_t input_len, AppLayerParserResult *output,
char need_lock));
uint32_t input_len, AppLayerParserResult *output));
int AppLayerRegisterParser(char *name, uint16_t proto, uint16_t parser_id,
int (*AppLayerParser)(Flow *f, void *protocol_state,
AppLayerParserState *parser_state, uint8_t *input,
uint32_t input_len, AppLayerParserResult *output,
char need_lock), char *dependency);
uint32_t input_len, AppLayerParserResult *output),
char *dependency);
void AppLayerRegisterStateFuncs(uint16_t proto, void *(*StateAlloc)(void),
void (*StateFree)(void *));

@ -100,8 +100,8 @@ void hexdump(const void *buf, size_t len) {
* \brief SMB Write AndX Request Parsing
*/
/* For WriteAndX we need to get writeandxdataoffset */
static int SMBParseAndX(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock) {
static int SMBParseWriteAndX(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output) {
SMBState *sstate = (SMBState *) smb_state;
uint8_t *p = input;
switch (sstate->andx.andxbytesprocessed) {
@ -239,7 +239,7 @@ static int SMBParseAndX(Flow *f, void *smb_state, AppLayerParserState *pstate,
/**
* \brief SMB Read AndX Response Parsing
*/
static int SMBParseReadAndX(void *smb_state, AppLayerParserState *pstate,
static int SMBParseReadAndX(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output) {
SMBState *sstate = (SMBState *) smb_state;
uint8_t *p = input;
@ -380,7 +380,7 @@ static int DataParser(void *smb_state, AppLayerParserState *pstate,
* Determine if this is an SMB AndX Command
*/
static int SMBGetWordCount(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
if (input_len) {
@ -402,7 +402,7 @@ static int SMBGetWordCount(Flow *f, void *smb_state, AppLayerParserState *pstate
*/
static int SMBGetByteCount(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
@ -428,7 +428,7 @@ static int SMBGetByteCount(Flow *f, void *smb_state, AppLayerParserState *pstate
* until sstate->wordcount.wordcount bytes are parsed.
*/
static int SMBParseWordCount(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
@ -436,13 +436,13 @@ static int SMBParseWordCount(Flow *f, void *smb_state, AppLayerParserState *psta
uint32_t retval = 0;
uint32_t parsed = 0;
if ((sstate->smb.flags & SMB_FLAGS_SERVER_TO_REDIR) && sstate->smb.command == SMB_COM_READ_ANDX) {
retval = SMBParseReadAndX(sstate, pstate, input + parsed, input_len, output);
retval = SMBParseReadAndX(f, sstate, pstate, input + parsed, input_len, output);
parsed += retval;
input_len -= retval;
sstate->wordcount.wordcount -= retval;
return retval;
} else if (((sstate->smb.flags & SMB_FLAGS_SERVER_TO_REDIR) == 0) && sstate->smb.command == SMB_COM_WRITE_ANDX) {
retval = SMBParseWriteAndX(sstate, pstate, input + parsed, input_len, output);
retval = SMBParseWriteAndX(f, sstate, pstate, input + parsed, input_len, output);
parsed += retval;
input_len -= retval;
sstate->wordcount.wordcount -= retval;
@ -464,7 +464,7 @@ static int SMBParseWordCount(Flow *f, void *smb_state, AppLayerParserState *psta
*/
static int SMBParseByteCount(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
@ -500,7 +500,7 @@ static int SMBParseByteCount(Flow *f, void *smb_state, AppLayerParserState *psta
#define DEBUG 1
static int NBSSParseHeader(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
@ -543,7 +543,7 @@ static int NBSSParseHeader(Flow *f, void *smb_state, AppLayerParserState *pstate
}
static int SMBParseHeader(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
@ -701,7 +701,7 @@ static int SMBParseHeader(Flow *f, void *smb_state, AppLayerParserState *pstate,
}
static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
@ -714,7 +714,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
while (sstate->bytesprocessed < NBSS_HDR_LEN) {
retval = NBSSParseHeader(f, smb_state, pstate, input, input_len,
output, need_lock);
output);
parsed += retval;
input_len -= retval;
@ -728,7 +728,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
while (input_len && (sstate->bytesprocessed >= NBSS_HDR_LEN &&
sstate->bytesprocessed < NBSS_HDR_LEN + SMB_HDR_LEN)) {
retval = SMBParseHeader(f, smb_state, pstate, input +
parsed, input_len, output, need_lock);
parsed, input_len, output);
parsed += retval;
input_len -= retval;
printf("SMB Header (%u/%u) Command 0x%02x parsed %u input_len %u\n",
@ -740,7 +740,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
if (input_len && (sstate->bytesprocessed == NBSS_HDR_LEN + SMB_HDR_LEN)) {
retval = SMBGetWordCount(f, smb_state, pstate,
input + parsed, input_len,
output, need_lock);
output);
parsed += retval;
input_len -= retval;
printf("Wordcount (%u) parsed %u input_len %u\n",
@ -752,7 +752,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
+ sstate->wordcount.wordcount)) {
retval = SMBParseWordCount(f, smb_state, pstate,
input + parsed, input_len,
output, need_lock);
output);
parsed += retval;
input_len -= retval;
}
@ -762,7 +762,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
SMB_HDR_LEN + 3 + sstate->wordcount.wordcount)) {
retval = SMBGetByteCount(f, smb_state, pstate,
input + parsed, input_len,
output, need_lock);
output);
parsed += retval;
input_len -= retval;
}
@ -773,7 +773,7 @@ static int SMBParse(Flow *f, void *smb_state, AppLayerParserState *pstate,
+ sstate->wordcount.wordcount + sstate->bytecount.bytecount)) {
retval = SMBParseByteCount(f, smb_state, pstate,
input + parsed, input_len,
output, need_lock);
output);
parsed += retval;
input_len -= retval;
}

@ -43,7 +43,7 @@
*/
static int TLSParseClientContentType(Flow *f, void *tls_state, AppLayerParserState
*pstate, uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
@ -102,7 +102,7 @@ static int TLSParseClientContentType(Flow *f, void *tls_state, AppLayerParserSta
* \param output Pointer to the list of parsed elements
*/
static int TLSParseClientVersion(Flow *f, void *tls_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len, AppLayerParserResult *output, char need_lock)
uint8_t *input, uint32_t input_len, AppLayerParserResult *output)
{
SCEnter();
@ -144,7 +144,7 @@ static int TLSParseClientVersion(Flow *f, void *tls_state, AppLayerParserState *
*/
static int TLSParseClientRecord(Flow *f, void *tls_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
@ -269,7 +269,7 @@ static int TLSParseClientRecord(Flow *f, void *tls_state, AppLayerParserState *p
*/
static int TLSParseServerRecord(Flow *f, void *tls_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
@ -393,7 +393,7 @@ static int TLSParseServerRecord(Flow *f, void *tls_state, AppLayerParserState *p
*/
static int TLSParseServerVersion(Flow *f, void *tls_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
TlsState *state = (TlsState *)tls_state;
@ -424,7 +424,7 @@ static int TLSParseServerVersion(Flow *f, void *tls_state, AppLayerParserState *
*/
static int TLSParseServerContentType(Flow *f, void *tls_state, AppLayerParserState *pstate,
uint8_t *input, uint32_t input_len,
AppLayerParserResult *output, char need_lock)
AppLayerParserResult *output)
{
SCEnter();
TlsState *state = (TlsState *)tls_state;

Loading…
Cancel
Save