Go to the documentation of this file.
46 static int storage_registration_closed = 0;
70 memset(&storage_max_id, 0x00,
sizeof(storage_max_id));
73 storage_registration_closed = 0;
81 if (storage_map[i] != NULL) {
83 storage_map[i] = NULL;
102 if (storage_registration_closed)
112 "name \"%s\" already registered",
128 entry->
id = storage_max_id[
type]++;
129 entry->
next = storage_list;
130 storage_list = entry;
140 storage_registration_closed = 1;
143 if (storage_max_id[i] > 0)
150 if (
unlikely(storage_map == NULL)) {
155 if (storage_max_id[i] > 0) {
157 if (storage_map[i] == NULL)
164 if (storage_map[entry->
map.
type] != NULL) {
178 if (storage_map[i] == NULL)
182 for (j = 0; j < storage_max_id[i]; j++) {
184 SCLogDebug(
"type \"%s\" name \"%s\"", StoragePrintType(
m->type),
m->name);
193 return storage_max_id[
type];
204 return storage_max_id[
type] *
sizeof(
void *);
210 BUG_ON(!storage_registration_closed);
215 return storage[
id].
ptr;
221 BUG_ON(!storage_registration_closed);
226 storage[
id].
ptr = ptr;
233 BUG_ON(!storage_registration_closed);
236 if (storage_map == NULL)
244 if (store[
id].ptr != NULL) {
247 store[
id].
ptr = NULL;
257 BUG_ON(!storage_registration_closed);
260 if (storage_map == NULL)
266 for (i = 0; i < storage_max_id[
type]; i++) {
267 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