storage: prefix core API with SC

pull/15161/head
Jason Ish 2 months ago committed by Victor Julien
parent 3722477319
commit 336b50ae9e

@ -73,7 +73,7 @@ static inline struct NdpiThreadContext *NdpiGetThreadContext(ThreadVars *tv)
* Safe helper to get nDPI flow context. Returns NULL if the flow
* or its storage is not available. Guards against the case where
* f->storage is NULL (uninitialized flow) which would crash inside
* StorageGetById.
* SCStorageGetById.
*/
static inline struct NdpiFlowContext *NdpiGetFlowContext(const Flow *f)
{

@ -660,10 +660,10 @@ static int DetectTagTestPacket01 (void)
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}
};
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
SCLogDebug("running tests");
@ -695,7 +695,7 @@ static int DetectTagTestPacket01 (void)
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
PASS;
}
@ -716,10 +716,10 @@ static int DetectTagTestPacket02 (void)
memset(&th_v, 0, sizeof(th_v));
StatsThreadInit(&th_v.stats);
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
@ -799,7 +799,7 @@ static int DetectTagTestPacket02 (void)
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}
@ -821,10 +821,10 @@ static int DetectTagTestPacket03 (void)
memset(&th_v, 0, sizeof(th_v));
StatsThreadInit(&th_v.stats);
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
@ -901,7 +901,7 @@ static int DetectTagTestPacket03 (void)
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}
@ -919,10 +919,10 @@ static int DetectTagTestPacket04 (void)
TcpSession ssn;
memset(&ssn, 0, sizeof(ssn));
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
FlowInitConfig(1);
@ -1022,7 +1022,7 @@ static int DetectTagTestPacket04 (void)
FlowShutdown();
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}
@ -1040,10 +1040,10 @@ static int DetectTagTestPacket05 (void)
TcpSession ssn;
memset(&ssn, 0, sizeof(ssn));
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
FlowInitConfig(1);
@ -1148,7 +1148,7 @@ static int DetectTagTestPacket05 (void)
FlowShutdown();
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}
@ -1166,10 +1166,10 @@ static int DetectTagTestPacket06 (void)
TcpSession ssn;
memset(&ssn, 0, sizeof(ssn));
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
FlowInitConfig(1);
@ -1270,7 +1270,7 @@ static int DetectTagTestPacket06 (void)
FlowShutdown();
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}
@ -1288,10 +1288,10 @@ static int DetectTagTestPacket07 (void)
TcpSession ssn;
memset(&ssn, 0, sizeof(ssn));
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
TagInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(1);
FlowInitConfig(1);
@ -1391,7 +1391,7 @@ static int DetectTagTestPacket07 (void)
FlowShutdown();
HostShutdown();
TagDestroyCtx();
StorageCleanup();
SCStorageCleanup();
StatsThreadCleanup(&th_v.stats);
PASS;
}

@ -461,17 +461,17 @@ void DetectHostbitFree (DetectEngineCtx *de_ctx, void *ptr)
static void HostBitsTestSetup(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
}
static void HostBitsTestShutdown(void)
{
HostShutdown();
StorageCleanup();
SCStorageCleanup();
}
static int HostBitsTestParse01(void)

@ -447,11 +447,11 @@ static void DetectXbitFree (DetectEngineCtx *de_ctx, void *ptr)
static void XBitsTestSetup(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
IPPairInitConfig(true);
}
@ -460,7 +460,7 @@ static void XBitsTestShutdown(void)
{
HostShutdown();
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
}

@ -31,7 +31,7 @@
unsigned int SCLiveDevStorageSize(void)
{
return StorageGetSize(STORAGE_DEVICE);
return SCStorageGetSize(STORAGE_DEVICE);
}
/** \defgroup devicestorage Device storage API
@ -58,7 +58,7 @@ unsigned int SCLiveDevStorageSize(void)
SCLiveDevStorageId SCLiveDevStorageRegister(const char *name, void (*Free)(void *))
{
int id = StorageRegister(STORAGE_DEVICE, name, Free);
int id = SCStorageRegister(STORAGE_DEVICE, name, Free);
SCLiveDevStorageId ldsi = { .id = id };
return ldsi;
}
@ -73,7 +73,7 @@ SCLiveDevStorageId SCLiveDevStorageRegister(const char *name, void (*Free)(void
int SCLiveDevSetStorageById(LiveDevice *d, SCLiveDevStorageId id, void *ptr)
{
return StorageSetById(d->storage, STORAGE_DEVICE, id.id, ptr);
return SCStorageSetById(d->storage, STORAGE_DEVICE, id.id, ptr);
}
/**
@ -86,7 +86,7 @@ int SCLiveDevSetStorageById(LiveDevice *d, SCLiveDevStorageId id, void *ptr)
void *SCLiveDevGetStorageById(LiveDevice *d, SCLiveDevStorageId id)
{
return StorageGetById(d->storage, STORAGE_DEVICE, id.id);
return SCStorageGetById(d->storage, STORAGE_DEVICE, id.id);
}
/**
@ -98,7 +98,7 @@ void *SCLiveDevGetStorageById(LiveDevice *d, SCLiveDevStorageId id)
void SCLiveDevFreeStorage(LiveDevice *d)
{
if (SCLiveDevStorageSize() > 0)
StorageFreeAll(d->storage, STORAGE_DEVICE);
SCStorageFreeAll(d->storage, STORAGE_DEVICE);
}

@ -34,33 +34,33 @@
unsigned int SCFlowStorageSize(void)
{
return StorageGetSize(STORAGE_FLOW);
return SCStorageGetSize(STORAGE_FLOW);
}
void *SCFlowGetStorageById(const Flow *f, SCFlowStorageId id)
{
return StorageGetById(f->storage, STORAGE_FLOW, id.id);
return SCStorageGetById(f->storage, STORAGE_FLOW, id.id);
}
int SCFlowSetStorageById(Flow *f, SCFlowStorageId id, void *ptr)
{
return StorageSetById(f->storage, STORAGE_FLOW, id.id, ptr);
return SCStorageSetById(f->storage, STORAGE_FLOW, id.id, ptr);
}
void SCFlowFreeStorageById(Flow *f, SCFlowStorageId id)
{
StorageFreeById(f->storage, STORAGE_FLOW, id.id);
SCStorageFreeById(f->storage, STORAGE_FLOW, id.id);
}
void SCFlowFreeStorage(Flow *f)
{
if (SCFlowStorageSize() > 0)
StorageFreeAll(f->storage, STORAGE_FLOW);
SCStorageFreeAll(f->storage, STORAGE_FLOW);
}
SCFlowStorageId SCFlowStorageRegister(const char *name, void (*Free)(void *))
{
int id = StorageRegister(STORAGE_FLOW, name, Free);
int id = SCStorageRegister(STORAGE_FLOW, name, Free);
SCFlowStorageId fsi = { .id = id };
return fsi;
}
@ -75,8 +75,8 @@ static void StorageTestFree(void *x)
static int FlowStorageTest01(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCFlowStorageId id1 = SCFlowStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -85,7 +85,7 @@ static int FlowStorageTest01(void)
SCFlowStorageId id3 = SCFlowStorageRegister("store", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
FlowInitConfig(FLOW_QUIET);
@ -119,19 +119,19 @@ static int FlowStorageTest01(void)
FlowClearMemory(f, 0);
FlowFree(f);
FlowShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int FlowStorageTest02(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCFlowStorageId id1 = SCFlowStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
FlowInitConfig(FLOW_QUIET);
Flow *f = FlowAlloc();
@ -150,14 +150,14 @@ static int FlowStorageTest02(void)
FlowClearMemory(f, 0);
FlowFree(f);
FlowShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int FlowStorageTest03(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCFlowStorageId id1 = SCFlowStorageRegister("test1", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -166,7 +166,7 @@ static int FlowStorageTest03(void)
SCFlowStorageId id3 = SCFlowStorageRegister("test3", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
FlowInitConfig(FLOW_QUIET);
Flow *f = FlowAlloc();
@ -197,7 +197,7 @@ static int FlowStorageTest03(void)
FlowClearMemory(f, 0);
FlowFree(f);
FlowShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
#endif

@ -206,10 +206,10 @@ static int HostBitTest01 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -225,7 +225,7 @@ static int HostBitTest01 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -233,10 +233,10 @@ static int HostBitTest02 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -250,7 +250,7 @@ static int HostBitTest02 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -258,10 +258,10 @@ static int HostBitTest03 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -289,7 +289,7 @@ static int HostBitTest03 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -297,10 +297,10 @@ static int HostBitTest04 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -319,7 +319,7 @@ static int HostBitTest04 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -327,10 +327,10 @@ static int HostBitTest05 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -349,7 +349,7 @@ static int HostBitTest05 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -357,10 +357,10 @@ static int HostBitTest06 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -379,7 +379,7 @@ static int HostBitTest06 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -387,10 +387,10 @@ static int HostBitTest07 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -409,7 +409,7 @@ static int HostBitTest07 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -417,10 +417,10 @@ static int HostBitTest08 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -448,7 +448,7 @@ static int HostBitTest08 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -456,10 +456,10 @@ static int HostBitTest09 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -487,7 +487,7 @@ static int HostBitTest09 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -495,10 +495,10 @@ static int HostBitTest10 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -526,7 +526,7 @@ static int HostBitTest10 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}
@ -534,10 +534,10 @@ static int HostBitTest11 (void)
{
int ret = 0;
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
HostInitConfig(true);
Host *h = HostAlloc();
@ -565,7 +565,7 @@ static int HostBitTest11 (void)
HostFree(h);
end:
HostShutdown();
StorageCleanup();
SCStorageCleanup();
return ret;
}

@ -29,7 +29,7 @@
unsigned int SCHostStorageSize(void)
{
return StorageGetSize(STORAGE_HOST);
return SCStorageGetSize(STORAGE_HOST);
}
/** \defgroup hoststorage Host storage API
@ -56,7 +56,7 @@ unsigned int SCHostStorageSize(void)
SCHostStorageId SCHostStorageRegister(const char *name, void (*Free)(void *))
{
int id = StorageRegister(STORAGE_HOST, name, Free);
int id = SCStorageRegister(STORAGE_HOST, name, Free);
SCHostStorageId hsi = { .id = id };
return hsi;
}
@ -71,7 +71,7 @@ SCHostStorageId SCHostStorageRegister(const char *name, void (*Free)(void *))
int SCHostSetStorageById(Host *h, SCHostStorageId id, void *ptr)
{
return StorageSetById(h->storage, STORAGE_HOST, id.id, ptr);
return SCStorageSetById(h->storage, STORAGE_HOST, id.id, ptr);
}
/**
@ -84,7 +84,7 @@ int SCHostSetStorageById(Host *h, SCHostStorageId id, void *ptr)
void *SCHostGetStorageById(Host *h, SCHostStorageId id)
{
return StorageGetById(h->storage, STORAGE_HOST, id.id);
return SCStorageGetById(h->storage, STORAGE_HOST, id.id);
}
/**
@ -96,7 +96,7 @@ void *SCHostGetStorageById(Host *h, SCHostStorageId id)
void SCHostFreeStorage(Host *h)
{
if (SCHostStorageSize() > 0)
StorageFreeAll(h->storage, STORAGE_HOST);
SCStorageFreeAll(h->storage, STORAGE_HOST);
}
@ -110,8 +110,8 @@ static void StorageTestFree(void *x)
static int HostStorageTest01(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCHostStorageId id1 = SCHostStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -120,7 +120,7 @@ static int HostStorageTest01(void)
SCHostStorageId id3 = SCHostStorageRegister("store", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
HostInitConfig(1);
@ -158,19 +158,19 @@ static int HostStorageTest01(void)
HostRelease(h);
HostShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int HostStorageTest02(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCHostStorageId id1 = SCHostStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
HostInitConfig(1);
@ -194,14 +194,14 @@ static int HostStorageTest02(void)
HostRelease(h);
HostShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int HostStorageTest03(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCHostStorageId id1 = SCHostStorageRegister("test1", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -210,7 +210,7 @@ static int HostStorageTest03(void)
SCHostStorageId id3 = SCHostStorageRegister("test3", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
HostInitConfig(1);
@ -246,7 +246,7 @@ static int HostStorageTest03(void)
HostRelease(h);
HostShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
#endif

@ -188,10 +188,10 @@ int IPPairBitIsnotset(IPPair *h, uint32_t idx, SCTime_t ts)
#ifdef UNITTESTS
static int IPPairBitTest01 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -203,16 +203,16 @@ static int IPPairBitTest01 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest02 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -222,16 +222,16 @@ static int IPPairBitTest02 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest03 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -248,16 +248,16 @@ static int IPPairBitTest03 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest04 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -272,16 +272,16 @@ static int IPPairBitTest04 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest05 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -296,16 +296,16 @@ static int IPPairBitTest05 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest06 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -320,16 +320,16 @@ static int IPPairBitTest06 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest07 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -344,16 +344,16 @@ static int IPPairBitTest07 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest08 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -373,16 +373,16 @@ static int IPPairBitTest08 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest09 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -402,16 +402,16 @@ static int IPPairBitTest09 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest10 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -431,16 +431,16 @@ static int IPPairBitTest10 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairBitTest11 (void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
IPPairBitInitCtx();
StorageFinalize();
SCStorageFinalize();
IPPairInitConfig(true);
IPPair *h = IPPairAlloc();
FAIL_IF_NULL(h);
@ -460,7 +460,7 @@ static int IPPairBitTest11 (void)
IPPairFree(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}

@ -29,28 +29,28 @@
unsigned int SCIPPairStorageSize(void)
{
return StorageGetSize(STORAGE_IPPAIR);
return SCStorageGetSize(STORAGE_IPPAIR);
}
void *SCIPPairGetStorageById(IPPair *h, SCIPPairStorageId id)
{
return StorageGetById(h->storage, STORAGE_IPPAIR, id.id);
return SCStorageGetById(h->storage, STORAGE_IPPAIR, id.id);
}
int SCIPPairSetStorageById(IPPair *h, SCIPPairStorageId id, void *ptr)
{
return StorageSetById(h->storage, STORAGE_IPPAIR, id.id, ptr);
return SCStorageSetById(h->storage, STORAGE_IPPAIR, id.id, ptr);
}
void SCIPPairFreeStorage(IPPair *h)
{
if (SCIPPairStorageSize() > 0)
StorageFreeAll(h->storage, STORAGE_IPPAIR);
SCStorageFreeAll(h->storage, STORAGE_IPPAIR);
}
SCIPPairStorageId SCIPPairStorageRegister(const char *name, void (*Free)(void *))
{
int id = StorageRegister(STORAGE_IPPAIR, name, Free);
int id = SCStorageRegister(STORAGE_IPPAIR, name, Free);
SCIPPairStorageId ippsi = { .id = id };
return ippsi;
}
@ -65,8 +65,8 @@ static void StorageTestFree(void *x)
static int IPPairStorageTest01(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCIPPairStorageId id1 = SCIPPairStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -75,7 +75,7 @@ static int IPPairStorageTest01(void)
SCIPPairStorageId id3 = SCIPPairStorageRegister("store", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
IPPairInitConfig(1);
@ -115,19 +115,19 @@ static int IPPairStorageTest01(void)
IPPairRelease(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairStorageTest02(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCIPPairStorageId id1 = SCIPPairStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
IPPairInitConfig(1);
@ -154,14 +154,14 @@ static int IPPairStorageTest02(void)
IPPairRelease(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
static int IPPairStorageTest03(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCIPPairStorageId id1 = SCIPPairStorageRegister("test1", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -170,7 +170,7 @@ static int IPPairStorageTest03(void)
SCIPPairStorageId id3 = SCIPPairStorageRegister("test3", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
IPPairInitConfig(1);
@ -210,7 +210,7 @@ static int IPPairStorageTest03(void)
IPPairRelease(h);
IPPairShutdown();
StorageCleanup();
SCStorageCleanup();
PASS;
}
#endif

@ -248,7 +248,7 @@ void RunUnittests(int list_unittests, const char *regex_arg)
MpmTableSetup();
SpmTableSetup();
StorageInit();
SCStorageInit();
AppLayerSetup();
/* hardcoded initialization code */
@ -269,7 +269,7 @@ void RunUnittests(int list_unittests, const char *regex_arg)
HostBitInitCtx();
StorageFinalize();
SCStorageFinalize();
AppLayerHtpEnableRequestBodyCallback();
AppLayerHtpNeedFileInspection();

@ -2813,7 +2813,7 @@ int PostConfLoadedSetup(SCInstance *suri)
SCConfSet("runmode", suri->runmode_custom_mode);
}
StorageInit();
SCStorageInit();
#ifdef HAVE_PACKET_EBPF
if (suri->run_mode == RUNMODE_AFP_DEV) {
EBPFRegisterExtension();
@ -2915,7 +2915,7 @@ int PostConfLoadedSetup(SCInstance *suri)
RegisterAllModules();
AppLayerHtpNeedFileInspection();
StorageFinalize();
SCStorageFinalize();
TmModuleRunInit();

@ -24,33 +24,33 @@ const StorageEnum storage_type = STORAGE_THREAD;
unsigned int SCThreadStorageSize(void)
{
return StorageGetSize(storage_type);
return SCStorageGetSize(storage_type);
}
void *SCThreadGetStorageById(const ThreadVars *tv, SCThreadStorageId id)
{
return StorageGetById(tv->storage, storage_type, id.id);
return SCStorageGetById(tv->storage, storage_type, id.id);
}
int SCThreadSetStorageById(ThreadVars *tv, SCThreadStorageId id, void *ptr)
{
return StorageSetById(tv->storage, storage_type, id.id, ptr);
return SCStorageSetById(tv->storage, storage_type, id.id, ptr);
}
void SCThreadFreeStorageById(ThreadVars *tv, SCThreadStorageId id)
{
StorageFreeById(tv->storage, storage_type, id.id);
SCStorageFreeById(tv->storage, storage_type, id.id);
}
void SCThreadFreeStorage(ThreadVars *tv)
{
if (SCThreadStorageSize() > 0)
StorageFreeAll(tv->storage, storage_type);
SCStorageFreeAll(tv->storage, storage_type);
}
SCThreadStorageId SCThreadStorageRegister(const char *name, void (*Free)(void *))
{
int id = StorageRegister(storage_type, name, Free);
int id = SCStorageRegister(storage_type, name, Free);
SCThreadStorageId tsi = { .id = id };
return tsi;
}
@ -64,8 +64,8 @@ static void StorageTestFree(void *x)
static int ThreadStorageTest01(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCThreadStorageId id1 = SCThreadStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -76,7 +76,7 @@ static int ThreadStorageTest01(void)
SCThreadStorageId id3 = SCThreadStorageRegister("store", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
ThreadVars *tv = SCCalloc(1, sizeof(ThreadVars) + SCThreadStorageSize());
FAIL_IF_NULL(tv);
@ -112,20 +112,20 @@ static int ThreadStorageTest01(void)
FAIL_IF(ptr3a != ptr3b);
SCThreadFreeStorage(tv);
StorageCleanup();
SCStorageCleanup();
SCFree(tv);
PASS;
}
static int ThreadStorageTest02(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCThreadStorageId id1 = SCThreadStorageRegister("test", StorageTestFree);
FAIL_IF(id1.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
ThreadVars *tv = SCCalloc(1, sizeof(ThreadVars) + SCThreadStorageSize());
FAIL_IF_NULL(tv);
@ -142,15 +142,15 @@ static int ThreadStorageTest02(void)
FAIL_IF(ptr1a != ptr1b);
SCThreadFreeStorage(tv);
StorageCleanup();
SCStorageCleanup();
SCFree(tv);
PASS;
}
static int ThreadStorageTest03(void)
{
StorageCleanup();
StorageInit();
SCStorageCleanup();
SCStorageInit();
SCThreadStorageId id1 = SCThreadStorageRegister("test1", StorageTestFree);
FAIL_IF(id1.id < 0);
@ -161,7 +161,7 @@ static int ThreadStorageTest03(void)
SCThreadStorageId id3 = SCThreadStorageRegister("test3", StorageTestFree);
FAIL_IF(id3.id < 0);
FAIL_IF(StorageFinalize() < 0);
FAIL_IF(SCStorageFinalize() < 0);
ThreadVars *tv = SCCalloc(1, sizeof(ThreadVars) + SCThreadStorageSize());
FAIL_IF_NULL(tv);
@ -193,7 +193,7 @@ static int ThreadStorageTest03(void)
FAIL_IF(ptr3a != ptr3b);
SCThreadFreeStorage(tv);
StorageCleanup();
SCStorageCleanup();
SCFree(tv);
PASS;
}

@ -65,7 +65,7 @@ static const char *StoragePrintType(StorageEnum type)
return "invalid";
}
void StorageInit(void)
void SCStorageInit(void)
{
memset(&storage_max_id, 0x00, sizeof(storage_max_id));
storage_list = NULL;
@ -73,7 +73,7 @@ void StorageInit(void)
storage_registration_closed = 0;
}
void StorageCleanup(void)
void SCStorageCleanup(void)
{
if (storage_map) {
int i;
@ -97,7 +97,7 @@ void StorageCleanup(void)
storage_list = NULL;
}
int StorageRegister(const StorageEnum type, const char *name, void (*Free)(void *))
int SCStorageRegister(const StorageEnum type, const char *name, void (*Free)(void *))
{
if (storage_registration_closed)
return -1;
@ -132,7 +132,7 @@ int StorageRegister(const StorageEnum type, const char *name, void (*Free)(void
return entry->id;
}
int StorageFinalize(void)
int SCStorageFinalize(void)
{
int count = 0;
int i;
@ -188,7 +188,7 @@ int StorageFinalize(void)
return 0;
}
unsigned int StorageGetCnt(StorageEnum type)
unsigned int SCStorageGetCnt(StorageEnum type)
{
return storage_max_id[type];
}
@ -199,12 +199,12 @@ unsigned int StorageGetCnt(StorageEnum type)
*
* \todo we could return -1 when registration isn't closed yet, however
* this will break lots of tests currently, so not doing it now */
unsigned int StorageGetSize(StorageEnum type)
unsigned int SCStorageGetSize(StorageEnum type)
{
return storage_max_id[type] * sizeof(void *);
}
void *StorageGetById(const Storage *storage, const StorageEnum type, const int id)
void *SCStorageGetById(const Storage *storage, const StorageEnum type, const int id)
{
#ifdef DEBUG
BUG_ON(!storage_registration_closed);
@ -215,7 +215,7 @@ void *StorageGetById(const Storage *storage, const StorageEnum type, const int i
return storage[id].ptr;
}
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
int SCStorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
{
#ifdef DEBUG
BUG_ON(!storage_registration_closed);
@ -227,7 +227,7 @@ int StorageSetById(Storage *storage, const StorageEnum type, const int id, void
return 0;
}
void StorageFreeById(Storage *storage, StorageEnum type, int id)
void SCStorageFreeById(Storage *storage, StorageEnum type, int id)
{
#ifdef DEBUG
BUG_ON(!storage_registration_closed);
@ -249,7 +249,7 @@ void StorageFreeById(Storage *storage, StorageEnum type, int id)
}
}
void StorageFreeAll(Storage *storage, StorageEnum type)
void SCStorageFreeAll(Storage *storage, StorageEnum type)
{
if (storage == NULL)
return;

@ -41,8 +41,8 @@ typedef struct Storage {
void *ptr;
} Storage;
void StorageInit(void);
void StorageCleanup(void);
void SCStorageInit(void);
void SCStorageCleanup(void);
/** \brief Register new storage
*
@ -50,21 +50,21 @@ void StorageCleanup(void);
* \param name name
* \param Free free function for per instance storage
*/
int StorageRegister(const StorageEnum type, const char *name, void (*Free)(void *));
int StorageFinalize(void);
int SCStorageRegister(const StorageEnum type, const char *name, void (*Free)(void *));
int SCStorageFinalize(void);
unsigned int StorageGetCnt(const StorageEnum type);
unsigned int StorageGetSize(const StorageEnum type);
unsigned int SCStorageGetCnt(const StorageEnum type);
unsigned int SCStorageGetSize(const StorageEnum type);
/** \brief get storage for id */
void *StorageGetById(const Storage *storage, const StorageEnum type, const int id);
void *SCStorageGetById(const Storage *storage, const StorageEnum type, const int id);
/** \brief set storage for id */
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr);
int SCStorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr);
/** \brief AllocById func for prealloc'd base storage (storage ptrs are part
* of another memory block) */
void *StorageAllocByIdPrealloc(Storage *storage, StorageEnum type, int id);
void StorageFreeById(Storage *storage, const StorageEnum type, const int id);
void StorageFreeAll(Storage *storage, const StorageEnum type);
void *SCStorageAllocByIdPrealloc(Storage *storage, StorageEnum type, int id);
void SCStorageFreeById(Storage *storage, const StorageEnum type, const int id);
void SCStorageFreeAll(Storage *storage, const StorageEnum type);
#endif

Loading…
Cancel
Save