|
suricata
|
#include "suricata-common.h"#include "util-unittest.h"#include "util-storage.h"#include "util-debug.h"
Go to the source code of this file.
Data Structures | |
| struct | StorageMapping_ |
| struct | StorageList_ |
| list of StorageMapping used at registration time More... | |
Typedefs | |
| typedef struct StorageMapping_ | StorageMapping |
| typedef struct StorageList_ | StorageList |
| list of StorageMapping used at registration time More... | |
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 (StorageEnum type) |
| unsigned int | SCStorageGetSize (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 | SCStorageFreeById (Storage *storage, StorageEnum type, int id) |
| void | SCStorageFreeAll (Storage *storage, StorageEnum type) |
Storage API
Definition in file util-storage.c.
| typedef struct StorageList_ StorageList |
list of StorageMapping used at registration time
| typedef struct StorageMapping_ StorageMapping |
| 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, |
| 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, |
| StorageEnum | type, | ||
| 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 | ( | 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().
