61 int IPPairStorageRegister(
const char *name,
const unsigned int size,
void *(*Alloc)(
unsigned int),
void (*Free)(
void *)) {
67 static void *StorageTestAlloc(
unsigned int size)
72 static void StorageTestFree(
void *x)
78 static int IPPairStorageTest01(
void)
98 memset(&a, 0x00,
sizeof(a));
99 memset(&b, 0x00,
sizeof(b));
100 a.addr_data32[0] = 0x01020304;
101 b.addr_data32[0] = 0x04030201;
106 printf(
"failed to get ippair: ");
137 if (ptr1a != ptr1b) {
141 if (ptr2a != ptr2b) {
145 if (ptr3a != ptr3b) {
160 static int IPPairStorageTest02(
void)
174 memset(&a, 0x00,
sizeof(a));
175 memset(&b, 0x00,
sizeof(b));
176 a.addr_data32[0] = 0x01020304;
177 b.addr_data32[0] = 0x04030201;
182 printf(
"failed to get ippair: ");
198 if (ptr1a != ptr1b) {
213 static int IPPairStorageTest03(
void)
233 memset(&a, 0x00,
sizeof(a));
234 memset(&b, 0x00,
sizeof(b));
235 a.addr_data32[0] = 0x01020304;
236 b.addr_data32[0] = 0x04030201;
241 printf(
"failed to get ippair: ");
268 if (ptr1a != ptr1b) {
272 if (ptr2a != ptr2b) {
276 if (ptr3a != ptr3b) {
int IPPairStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
int StorageFinalize(void)
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
set storage for id
IPPair * IPPairGetIPPairFromHash(Address *a, Address *b)
int StorageRegister(const StorageEnum type, const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
Register new storage.
void RegisterIPPairStorageTests(void)
void IPPairInitConfig(char quiet)
initialize the configuration
void * StorageAllocByIdPrealloc(Storage *storage, StorageEnum type, int id)
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block) ...
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void IPPairFreeStorageById(IPPair *h, int id)
void * IPPairGetStorageById(IPPair *h, int id)
void StorageFreeAll(Storage *storage, StorageEnum type)
int IPPairSetStorageById(IPPair *h, int id, void *ptr)
unsigned int StorageGetSize(StorageEnum type)
get the size of the void array used to store the pointers
void StorageCleanup(void)
void * StorageGetById(const Storage *storage, const StorageEnum type, const int id)
get storage for id
void * IPPairAllocStorageById(IPPair *h, int id)
void IPPairFreeStorage(IPPair *h)
void StorageFreeById(Storage *storage, StorageEnum type, int id)
void IPPairRelease(IPPair *h)
unsigned int IPPairStorageSize(void)
void IPPairShutdown(void)
shutdown the flow engine