frames: use dynamic number of app-layer protos

Ticket: 5053
pull/12358/head
Philippe Antoine 1 year ago committed by Victor Julien
parent 9e9333b7d0
commit 911cd628fc

@ -33,15 +33,25 @@
struct FrameConfig {
SC_ATOMIC_DECLARE(uint64_t, types);
};
static struct FrameConfig frame_config[ALPROTO_MAX];
/* This array should be allocated to contain ALPROTO_MAX protocols. */
static struct FrameConfig *frame_config;
void FrameConfigInit(void)
{
frame_config = SCCalloc(ALPROTO_MAX, sizeof(struct FrameConfig));
if (unlikely(frame_config == NULL)) {
FatalError("Unable to alloc frame_config.");
}
for (AppProto p = 0; p < ALPROTO_MAX; p++) {
SC_ATOMIC_INIT(frame_config[p].types);
}
}
void FrameConfigDeInit(void)
{
SCFree(frame_config);
}
void FrameConfigEnableAll(void)
{
const uint64_t bits = UINT64_MAX;

@ -106,6 +106,7 @@ FramesContainer *AppLayerFramesGetContainer(Flow *f);
FramesContainer *AppLayerFramesSetupContainer(Flow *f);
void FrameConfigInit(void);
void FrameConfigDeInit(void);
void FrameConfigEnableAll(void);
void FrameConfigEnable(const AppProto p, const uint8_t type);

@ -1041,6 +1041,7 @@ int AppLayerSetup(void)
AppLayerProtoDetectPrepareState();
AppLayerSetupCounters();
FrameConfigInit();
SCReturnInt(0);
}
@ -1053,6 +1054,7 @@ int AppLayerDeSetup(void)
AppLayerParserDeSetup();
AppLayerDeSetupCounters();
FrameConfigDeInit();
SCReturnInt(0);
}

@ -361,7 +361,6 @@ void GlobalsInitPreConfig(void)
SupportFastPatternForSigMatchTypes();
SCThresholdConfGlobalInit();
SCProtoNameInit();
FrameConfigInit();
}
void GlobalsDestroy(void)

Loading…
Cancel
Save