Ethereal-dev: Re: [Ethereal-dev] Dynamic arrays in proto_register_field_array and proto_regist
Hi,
> I have to construct header fields and etts arrays at runtime.
> Unfortunately this can't be avoided.
My experience with mate tells me that you cannot do that. Not at
runtime. I lost days trying to figure out that It could not be done.
> As far as I know, the content of these arrays isn't copied, so I have to
> provide to proto_register_field_array and proto_register_subtree_array
> static or heap-allocated objects.
Yes.
> Is there a way to execute a function after ethereal startup, before
> proto_register_xxx, to allocate these objects, and another function just
> before ethereal shutdown, to free them?
AFAIK The latest place where you can do it is proto_reg_handoff_xxx().
I believe the filter compiler has to know at initialization what it
can be used to filter for.
In mate's earlier stages I used to register just few strings which
mate "filled" in the form "attrib=value",
Then tey were filtered as:
thing.leg.attrib == "name=value"
or
thing.leg.attrib contains "name="
and so...
You may take a look at analyze_config() in plugins/mate/mate_setup.c
to see how mate's deals with the dynamically built hf array,still
mates hfis are set at proto_reg_handoff_xxx() not later in runtime
(I'd like to do it afterwards as well but I've failed more than once
at that).
Luis