|
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_THREAD, STORAGE_MAX } |
Functions | |
| void | SCStorageInit (void) |
| void | SCStorageCleanup (void) |
| int | SCStorageRegister (const StorageEnum type, const char *name, void(*Free)(void *)) |
| Register new storage. More... | |
| int | SCStorageFinalize (void) |
| unsigned int | SCStorageGetCnt (const StorageEnum type) |
| unsigned int | SCStorageGetSize (const StorageEnum type) |
| get the size of the void array used to store the pointers More... | |
| void * | SCStorageGetById (const Storage *storage, const StorageEnum type, const int id) |
| get storage for id More... | |
| int | SCStorageSetById (Storage *storage, const StorageEnum type, const int id, void *ptr) |
| set storage for id More... | |
| void * | SCStorageAllocByIdPrealloc (Storage *storage, StorageEnum type, int id) |
| AllocById func for prealloc'd base storage (storage ptrs are part of another memory block) More... | |
| void | SCStorageFreeById (Storage *storage, const StorageEnum type, const int id) |
| void | SCStorageFreeAll (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_THREAD | |
| STORAGE_MAX | |
Definition at line 29 of file util-storage.h.
| void* SCStorageAllocByIdPrealloc | ( | Storage * | storage, |
| StorageEnum | type, | ||
| int | id | ||
| ) |
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block)
| void SCStorageCleanup | ( | void | ) |
Definition at line 76 of file util-storage.c.
| int SCStorageFinalize | ( | void | ) |
Definition at line 135 of file util-storage.c.
Referenced by RunUnittests().

| void SCStorageFreeAll | ( | Storage * | storage, |
| const StorageEnum | type | ||
| ) |
Definition at line 252 of file util-storage.c.
References BUG_ON.
Referenced by SCFlowFreeStorage(), SCHostFreeStorage(), SCIPPairFreeStorage(), SCLiveDevFreeStorage(), and SCThreadFreeStorage().

| void SCStorageFreeById | ( | Storage * | storage, |
| const StorageEnum | type, | ||
| const int | id | ||
| ) |
Definition at line 230 of file util-storage.c.
References BUG_ON.
Referenced by SCFlowFreeStorageById(), and SCThreadFreeStorageById().

| void* SCStorageGetById | ( | const Storage * | storage, |
| const StorageEnum | type, | ||
| const int | id | ||
| ) |
get storage for id
Definition at line 207 of file util-storage.c.
References BUG_ON.
Referenced by SCFlowGetStorageById(), SCHostGetStorageById(), SCIPPairGetStorageById(), SCLiveDevGetStorageById(), and SCThreadGetStorageById().

| unsigned int SCStorageGetCnt | ( | const StorageEnum | type | ) |
Definition at line 191 of file util-storage.c.
| unsigned int SCStorageGetSize | ( | 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 202 of file util-storage.c.
Referenced by SCFlowStorageSize(), SCHostStorageSize(), SCIPPairStorageSize(), SCLiveDevStorageSize(), and SCThreadStorageSize().

| void SCStorageInit | ( | void | ) |
Definition at line 68 of file util-storage.c.
Referenced by PostConfLoadedSetup(), and RunUnittests().

| int SCStorageRegister | ( | const StorageEnum | type, |
| const char * | name, | ||
| void(*)(void *) | Free | ||
| ) |
Register new storage.
| type | type from StorageEnum |
| name | name |
| Free | free function for per instance storage |
Definition at line 100 of file util-storage.c.
Referenced by SCFlowStorageRegister(), SCHostStorageRegister(), SCIPPairStorageRegister(), SCLiveDevStorageRegister(), and SCThreadStorageRegister().

| int SCStorageSetById | ( | Storage * | storage, |
| const StorageEnum | type, | ||
| const int | id, | ||
| void * | ptr | ||
| ) |
set storage for id
Definition at line 218 of file util-storage.c.
References BUG_ON.
Referenced by SCFlowSetStorageById(), SCHostSetStorageById(), SCIPPairSetStorageById(), SCLiveDevSetStorageById(), and SCThreadSetStorageById().
