suricata
Host storage API

The Host storage API is a per-host storage. It is a mean to extend the Host structure with arbitrary data. More...

Functions

SCHostStorageId SCHostStorageRegister (const char *name, void(*Free)(void *))
 Register a Host storage. More...
 
int SCHostSetStorageById (Host *h, SCHostStorageId id, void *ptr)
 Store a pointer in a given Host storage. More...
 
void * SCHostGetStorageById (Host *h, SCHostStorageId id)
 Get a value from a given Host storage. More...
 

Detailed Description

The Host storage API is a per-host storage. It is a mean to extend the Host structure with arbitrary data.

You have first to register the storage via SCHostStorageRegister() during the init of your module. Then you can attach data via SCHostSetStorageById() and access them via SCHostGetStorageById().

Function Documentation

◆ SCHostGetStorageById()

void* SCHostGetStorageById ( Host h,
SCHostStorageId  id 
)

Get a value from a given Host storage.

Parameters
ha pointer to the Host
idthe id of the storage (return of SCHostStorageRegister() call)

Definition at line 85 of file host-storage.c.

References SCStorageGetById(), Host_::storage, and STORAGE_HOST.

Referenced by HostBitList(), HostBitsTimedoutCheck(), HostHasHostBits(), TagHashAddTag(), TagHostHasTag(), and TagTimeoutCheck().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SCHostSetStorageById()

int SCHostSetStorageById ( Host h,
SCHostStorageId  id,
void *  ptr 
)

Store a pointer in a given Host storage.

Parameters
ha pointer to the Host
idthe id of the storage (return of SCHostStorageRegister() call)
ptrpointer to the data to store

Definition at line 72 of file host-storage.c.

References SCStorageSetById(), Host_::storage, and STORAGE_HOST.

Here is the call graph for this function:

◆ SCHostStorageRegister()

SCHostStorageId SCHostStorageRegister ( const char *  name,
void(*)(void *)  Free 
)

Register a Host storage.

Parameters
namethe name of the storage
Freefree function for the new storage
Return values
TheID of the newly register storage that will be used to access data

It has to be called once during the init of the sub system

Definition at line 57 of file host-storage.c.

References HostStorageId_::id, name, SCStorageRegister(), and STORAGE_HOST.

Here is the call graph for this function: