Go to the documentation of this file.
59 int HostStorageRegister(
const char *name,
const unsigned int size,
void *(*Alloc)(
unsigned int),
void (*Free)(
void *)) {
114 static void *StorageTestAlloc(
unsigned int size)
119 static void StorageTestFree(
void *x)
125 static int HostStorageTest01(
void)
145 memset(&a, 0x00,
sizeof(a));
146 a.addr_data32[0] = 0x01020304;
150 printf(
"failed to get host: ");
181 if (ptr1a != ptr1b) {
185 if (ptr2a != ptr2b) {
189 if (ptr3a != ptr3b) {
204 static int HostStorageTest02(
void)
218 memset(&a, 0x00,
sizeof(a));
219 a.addr_data32[0] = 0x01020304;
223 printf(
"failed to get host: ");
239 if (ptr1a != ptr1b) {
254 static int HostStorageTest03(
void)
274 memset(&a, 0x00,
sizeof(a));
275 a.addr_data32[0] = 0x01020304;
279 printf(
"failed to get host: ");
306 if (ptr1a != ptr1b) {
310 if (ptr2a != ptr2b) {
314 if (ptr3a != ptr3b) {
void StorageFreeAll(Storage *storage, StorageEnum type)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
int HostSetStorageById(Host *h, int id, void *ptr)
Store a pointer in a given Host storage.
void HostInitConfig(char quiet)
initialize the configuration
void HostRelease(Host *h)
Host * HostGetHostFromHash(Address *a)
void StorageCleanup(void)
void * HostAllocStorageById(Host *h, int id)
void HostFreeStorageById(Host *h, int id)
void * HostGetStorageById(Host *h, int id)
Get a value from a given Host storage.
void RegisterHostStorageTests(void)
void HostFreeStorage(Host *h)
unsigned int HostStorageSize(void)
int StorageFinalize(void)
int HostStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
Register a Host storage.
void HostShutdown(void)
shutdown the flow engine
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
set storage for id
void * StorageAllocByIdPrealloc(Storage *storage, StorageEnum type, int id)
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block)
void StorageFreeById(Storage *storage, StorageEnum type, int id)
void * StorageGetById(const Storage *storage, const StorageEnum type, const int id)
get storage for id
unsigned int StorageGetSize(StorageEnum type)
get the size of the void array used to store the pointers
int StorageRegister(const StorageEnum type, const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
Register new storage.