Ethereal-dev: Re: [Ethereal-dev] Dynamic arrays in proto_register_field_array and proto_regist

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Thu, 06 Jan 2005 12:54:12 -0800
Stefano Pettini wrote:

As far as I know, the content of these arrays isn't copied,

Correct.

so I have to provide to proto_register_field_array and proto_register_subtree_array static or heap-allocated objects.

Is there a way to execute a function after ethereal startup, before proto_register_xxx, to allocate these objects?

There is no mechanism for calling a per-dissector function before its proto_register_xxx function is called.

Why does it have to be *before* proto_register_xxx? Why can't it be *in* proto_register_xxx, just before those arrays are registered?

and another function just before ethereal shutdown, to free them?

There's currently no mechanism in Ethereal for that; note that, in all the platforms on which we support Ethereal, when a process exits all its per-process address space is released. (Items in the address space aren't *individually* freed - the entire per-process address space is released.)