On Thu, Jan 25, 2001 at 02:32:33PM +0100, Dr. Uwe Girlich wrote:
> Please start with the (already converted) RPC dissector and make it able to
> call old and new sub-dissectors.
Note that this is a bit trickier than making "dissector_try_port()",
etc. handle that; you'd either
1) have to have both "old_vsff" and "vsff" types, with the
former having two "old_dissect_function_t" pointer members
(the current "vsff" and "dissect_function_t" types would be
changed to "old_vsff" and "old_dissect_function_t") and the
latter havng two "dissect_function_t" pointer members
("dissect_function_t" would be a tvbuffified version of the
current "dissect_function_t")
or
2) have to make the dissector pointer members of a "vsff" become
unions and supply a type flag somehow - unfortunately, as
C89's rules for initializing unions are merely what was
required in order to specify *an* initialization rule for
compile-time initialization, they're not sufficient to allow
*arbitrary* members of a union to be initialized at compile
time, that means you wouldn't be able to initialize the
"vsff" arrays at compile time
or
3) find some other way to handle the problem.
Unless somebody has a better way, I'd vote for 1), as it lets you
continue to initialize the "vsff" (or "old_vsff") tables at compile
time; you'd then have "old_rpc_init_proc_table()", taking an "old_vsff *"
as its last argument, and "rpc_init_proc_table()", taking a "vsff *" as
its last argument.
A "rpc_proc_info_value" could then contain an "old or new" flag, and
contain unions of "old_dissect_function_t *" and "dissect_function_t *"
for "dissect_call" and "dissect_reply", with "old_rpc_init_proc_table()"
and "rpc_init_proc_table()" initializing the newly-allocated
"rpc_proc_info_value"s appropriately.
"dissect_rpc" would then have to have both "old_dissect_function" and
"dissect_function" pointers, setting the appropriate one, and
"call_dissect_function()" might take both pointers as arguments, calling
whichever one is non-NULL and:
if it's "old_dissect_function", doing the "tvb_compat()"
mapping it does now;
if it's "dissect_function", just calling it without bothering
with "tvb_compat()".