suricata
Device storage API

Functions

int LiveDevStorageRegister (const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
 Register a LiveDevice storage. More...
 
int LiveDevSetStorageById (LiveDevice *d, int id, void *ptr)
 Store a pointer in a given LiveDevice storage. More...
 
void * LiveDevGetStorageById (LiveDevice *d, int id)
 Get a value from a given LiveDevice storage. More...
 

Detailed Description

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

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

Function Documentation

void* LiveDevGetStorageById ( LiveDevice d,
int  id 
)

Get a value from a given LiveDevice storage.

Parameters
da pointer to the LiveDevice
idthe id of the storage (return of LiveDevStorageRegister() call)

Definition at line 84 of file device-storage.c.

References STORAGE_DEVICE, and StorageGetById().

Referenced by LiveDevAddBypassFail(), LiveDevAddBypassStats(), LiveDevAddBypassSuccess(), LiveDevSetBypassStats(), and LiveDevSubBypassStats().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveDevSetStorageById ( LiveDevice d,
int  id,
void *  ptr 
)

Store a pointer in a given LiveDevice storage.

Parameters
da pointer to the LiveDevice
idthe id of the storage (return of HostStorageRegister() call)
ptrpointer to the data to store

Definition at line 71 of file device-storage.c.

References STORAGE_DEVICE, and StorageSetById().

Referenced by LiveDevUseBypass().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveDevStorageRegister ( const char *  name,
const unsigned int  size,
void *(*)(unsigned int)  Alloc,
void(*)(void *)  Free 
)

Register a LiveDevice storage.

Parameters
namethe name of the storage
sizeinteger coding the size of the stored value (sizeof(void *) is best choice here)
Allocallocation function for the storage (can be null)
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 59 of file device-storage.c.

References STORAGE_DEVICE, and StorageRegister().

Referenced by LiveDevRegisterExtension().

Here is the call graph for this function:

Here is the caller graph for this function: