suricata
|
Go to the source code of this file.
Data Structures | |
struct | Storage |
Typedefs | |
typedef enum StorageEnum_ | StorageEnum |
typedef struct Storage | Storage |
Enumerations | |
enum | StorageEnum_ { STORAGE_HOST, STORAGE_FLOW, STORAGE_IPPAIR, STORAGE_DEVICE, STORAGE_MAX } |
Functions | |
void | StorageInit (void) |
void | StorageCleanup (void) |
int | StorageRegister (const StorageEnum type, const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *)) |
Register new storage. More... | |
int | StorageFinalize (void) |
unsigned int | StorageGetCnt (const StorageEnum type) |
unsigned int | StorageGetSize (const StorageEnum type) |
get the size of the void array used to store the pointers More... | |
void * | StorageGetById (const Storage *storage, const StorageEnum type, const int id) |
get storage for id More... | |
int | StorageSetById (Storage *storage, const StorageEnum type, const int id, void *ptr) |
set storage for id More... | |
void * | StorageAllocByIdPrealloc (Storage *storage, StorageEnum type, int id) |
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block) More... | |
void | StorageFreeById (Storage *storage, const StorageEnum type, const int id) |
void | StorageFreeAll (Storage *storage, const StorageEnum type) |
Storage API
Definition in file util-storage.h.
typedef enum StorageEnum_ StorageEnum |
enum StorageEnum_ |
Enumerator | |
---|---|
STORAGE_HOST | |
STORAGE_FLOW | |
STORAGE_IPPAIR | |
STORAGE_DEVICE | |
STORAGE_MAX |
Definition at line 29 of file util-storage.h.
void* StorageAllocByIdPrealloc | ( | Storage * | storage, |
StorageEnum | type, | ||
int | id | ||
) |
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block)
Definition at line 236 of file util-storage.c.
References BUG_ON.
Referenced by FlowAllocStorageById(), HostAllocStorageById(), and IPPairAllocStorageById().
void StorageCleanup | ( | void | ) |
Definition at line 76 of file util-storage.c.
int StorageFinalize | ( | void | ) |
Definition at line 138 of file util-storage.c.
Referenced by RunUnittests().
void StorageFreeAll | ( | Storage * | storage, |
const StorageEnum | type | ||
) |
Definition at line 276 of file util-storage.c.
References BUG_ON.
Referenced by FlowFreeStorage(), HostFreeStorage(), IPPairFreeStorage(), and LiveDevFreeStorage().
void StorageFreeById | ( | Storage * | storage, |
const StorageEnum | type, | ||
const int | id | ||
) |
Definition at line 254 of file util-storage.c.
References BUG_ON.
Referenced by FlowFreeStorageById().
void* StorageGetById | ( | const Storage * | storage, |
const StorageEnum | type, | ||
const int | id | ||
) |
get storage for id
Definition at line 213 of file util-storage.c.
References BUG_ON.
Referenced by FlowGetStorageById(), HostGetStorageById(), IPPairGetStorageById(), and LiveDevGetStorageById().
unsigned int StorageGetCnt | ( | const StorageEnum | type | ) |
Definition at line 197 of file util-storage.c.
unsigned int StorageGetSize | ( | StorageEnum | type | ) |
get the size of the void array used to store the pointers
size | size in bytes, can return 0 if not storage is needed |
Definition at line 208 of file util-storage.c.
Referenced by FlowStorageSize(), HostStorageSize(), IPPairStorageSize(), and LiveDevStorageSize().
void StorageInit | ( | void | ) |
Definition at line 68 of file util-storage.c.
Referenced by PostConfLoadedSetup(), and RunUnittests().
int StorageRegister | ( | const StorageEnum | type, |
const char * | name, | ||
const unsigned int | size, | ||
void *(*)(unsigned int) | Alloc, | ||
void(*)(void *) | Free | ||
) |
Register new storage.
type | type from StorageEnum |
name | name |
size | size of the per instance storage |
Alloc | alloc function for per instance storage |
Free | free function for per instance storage |
Definition at line 100 of file util-storage.c.
Referenced by FlowStorageRegister(), HostStorageRegister(), IPPairStorageRegister(), and LiveDevStorageRegister().
int StorageSetById | ( | Storage * | storage, |
const StorageEnum | type, | ||
const int | id, | ||
void * | ptr | ||
) |
set storage for id
Definition at line 224 of file util-storage.c.
References BUG_ON.
Referenced by FlowSetStorageById(), HostSetStorageById(), IPPairSetStorageById(), and LiveDevSetStorageById().