introduce app layer local storage api support

remotes/origin/master-1.2.x
Anoop Saldanha 13 years ago committed by Victor Julien
parent 87599bc78d
commit 01a35bb604

@ -282,6 +282,10 @@ void AlpProtoFinalizeThread(AlpProtoDetectCtx *ctx, AlpProtoDetectThreadCtx *tct
PmqSetup(&tctx->toserver.pmq, sig_maxid, pat_maxid);
}
int i;
for (i = 0; i < ALPROTO_MAX; i++) {
tctx->alproto_local_storage[i] = AppLayerGetProtocolParserLocalStorage(i);
}
}
void AlpProtoDeFinalize2Thread(AlpProtoDetectThreadCtx *tctx) {

@ -596,6 +596,15 @@ void AppLayerRegisterTransactionIdFuncs(uint16_t proto,
al_proto_table[proto].StateTransactionFree = StateTransactionFree;
}
void *AppLayerGetProtocolParserLocalStorage(uint16_t proto)
{
if (al_proto_table[proto].LocalStorageAlloc != NULL) {
return al_proto_table[proto].LocalStorageAlloc();
}
return NULL;
}
/** \brief Indicate to the app layer parser that a logger is active
* for this protocol.
*/

@ -48,6 +48,7 @@ typedef struct AppLayerProto_ {
void (*StateFree)(void *);
void (*StateUpdateTransactionId)(void *, uint16_t *);
void (*StateTransactionFree)(void *, uint16_t);
void *(*LocalStorageAlloc)(void);
} AppLayerProto;
@ -235,6 +236,7 @@ void AppLayerRegisterStateFuncs(uint16_t proto, void *(*StateAlloc)(void),
void AppLayerRegisterTransactionIdFuncs(uint16_t proto,
void (*StateTransactionId)(void *, uint16_t *),
void (*StateTransactionFree)(void *, uint16_t id));
void *AppLayerGetProtocolParserLocalStorage(uint16_t);
void AppLayerRegisterLogger(uint16_t proto);
uint16_t AppLayerGetProtoByName(const char *);

@ -490,6 +490,8 @@ typedef struct AlpProtoDetectThreadCtx_ {
AlpProtoDetectDirectionThread toserver;
AlpProtoDetectDirectionThread toclient;
void *alproto_local_storage[ALPROTO_MAX];
#ifdef PROFILING
uint64_t ticks_start;
uint64_t ticks_end;

Loading…
Cancel
Save