[Oisf-devel] new storage api (wip)
Victor Julien
victor at inliniac.net
Fri Mar 15 10:23:14 UTC 2013
On 03/15/2013 10:55 AM, Victor Julien wrote:
> On 03/14/2013 03:36 PM, עמית קליינמן wrote:
>> Ok, thanks for the feedback.
>> Is there anything I can do in order to advance this storage feature? I
>> am willing to take tasks and to contribute. How can I get involved?
>>
>> On Wed, Mar 13, 2013 at 5:32 PM, Victor Julien <victor at inliniac.net
>> <mailto:victor at inliniac.net>> wrote:
>
> ...
>
>>
>> We're actually adding some storage api soon. Until then it's not trivial
>> to do what you want. Using alstate is definitely not the way it's
>> supposed to work and might break things elsewhere.
>
>
> Made my dev branch available here:
> https://github.com/inliniac/suricata/tree/dev-storage-api
>
> Implemented a low level generic api, with a host implementation only
> right now.
>
> Low level is: util-storage.[ch]
> Host implementation: host-storage.[ch]
>
> Tag and Threshold are switched over to use it, see these commits:
>
> https://github.com/inliniac/suricata/commit/af4f49566f17ff160d12f851c75cc8ed82141d1a
>
> https://github.com/inliniac/suricata/commit/187943d7070d48537b048140ea32d6a259a542bb
>
> Planning to do support for flow soon, so modules can register their own
> storage.
Basically you either register an alloc func (Init) that gets passed the
size arg when it's run. So in this case HostGetStorageById will get you
a ptr to this memory block.
Alternatively, you can set the size to sizeof(void *) and leave init
NULL. In this case you just have a place to store a ptr. You still need
to pass a Free func as the Host (and later Flow etc too) can be freed
async by timeout handlers.
HostGetStorageById will return the current storage ptr, which can be
NULL if there storage hasn't been alloc'd yet.
HostAllocById will run the Init func and return a ptr to this memory.
--
---------------------------------------------
Victor Julien
http://www.inliniac.net/
PGP: http://www.inliniac.net/victorjulien.asc
---------------------------------------------
More information about the Oisf-devel
mailing list