On Fri, Oct 13, 2000 at 12:24:14PM -0700, Mark Atwood wrote:
> When Ethereal starts, I would like a hook to do abit of setup and
> preperation. Specifically, I would like to be able to go out into the
> filesystem and grab some data, and then keep it in a chunk of "private
> memory" for my dissector. When my dissector is called, I would like to
> be able to get a handle or pointer into that private memory.
>
> Implemented?
Your dissector should, if it's for the "mumble" protocol, define a
routine named "proto_register_mumble", and declare it as
void
proto_register_mumble(void)
{
...
}
or
void proto_register_mumble(void)
{
...
}
(there's a script, used when Ethereal is built, that scans the source
for all dissectors, looking for those routines; it looks either for
"proto_register_[a-z_0-9A-Z]*" at the beginning of the line, or with
"void " preceding it, so
void proto_register_mumble(void)
for example won't work).
That routine registers the protocol, and any named packet fields, with
Ethereal's core, and can register other things such as subtrees,
subdissector tables, and preference variables.
It can also be used to do any one-time initialization.
Pointers to the private memory would be declared as static variables in
your dissector's source file, and would be available to other functions
in that source file.