Go to the documentation of this file.
45 static int storage_registration_closed = 0;
69 memset(&storage_max_id, 0x00,
sizeof(storage_max_id));
72 storage_registration_closed = 0;
80 if (storage_map[i] != NULL) {
82 storage_map[i] = NULL;
101 if (storage_registration_closed)
111 "name \"%s\" already registered",
127 entry->
id = storage_max_id[
type]++;
128 entry->
next = storage_list;
129 storage_list = entry;
139 storage_registration_closed = 1;
142 if (storage_max_id[i] > 0)
149 if (
unlikely(storage_map == NULL)) {
154 if (storage_max_id[i] > 0) {
156 if (storage_map[i] == NULL)
163 if (storage_map[entry->
map.
type] != NULL) {
177 if (storage_map[i] == NULL)
181 for (j = 0; j < storage_max_id[i]; j++) {
183 SCLogDebug(
"type \"%s\" name \"%s\"", StoragePrintType(
m->type),
m->name);
192 return storage_max_id[
type];
203 return storage_max_id[
type] *
sizeof(
void *);
209 BUG_ON(!storage_registration_closed);
214 return storage[
id].
ptr;
220 BUG_ON(!storage_registration_closed);
225 storage[
id].
ptr = ptr;
232 BUG_ON(!storage_registration_closed);
235 if (storage_map == NULL)
243 if (store[
id].ptr != NULL) {
246 store[
id].
ptr = NULL;
256 BUG_ON(!storage_registration_closed);
259 if (storage_map == NULL)
265 for (i = 0; i < storage_max_id[
type]; i++) {
266 if (store[i].ptr != NULL) {
unsigned int SCStorageGetCnt(StorageEnum type)
struct StorageList_ * next
struct HtpBodyChunk_ * next
void SCStorageFreeById(Storage *storage, StorageEnum type, int id)
int SCStorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
set storage for id
enum StorageEnum_ StorageEnum
struct StorageList_ StorageList
list of StorageMapping used at registration time
void * SCStorageGetById(const Storage *storage, const StorageEnum type, const int id)
get storage for id
int SCStorageRegister(const StorageEnum type, const char *name, void(*Free)(void *))
Register new storage.
unsigned int SCStorageGetSize(StorageEnum type)
get the size of the void array used to store the pointers
void SCStorageFreeAll(Storage *storage, StorageEnum type)
#define SCLogError(...)
Macro used to log ERROR messages.
void SCStorageCleanup(void)
struct StorageMapping_ StorageMapping
int SCStorageFinalize(void)
list of StorageMapping used at registration time