Wireshark-dev: Re: [Wireshark-dev] Retrieving dissection result from another dissector
From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Tue, 3 Jul 2018 21:01:24 +0200


Le mar. 3 juil. 2018 à 20:57, Richard Sharpe <realrichardsharpe@xxxxxxxxx> a écrit :
On Tue, Jul 3, 2018 at 11:48 AM, Guy Harris <guy@xxxxxxxxxxxx> wrote:
> On Jul 3, 2018, at 9:24 AM, Peter Wu <peter@xxxxxxxxxxxxx> wrote:
>
>> Another possibility is to use p_add_proto_data/p_get_proto_data with packet scope
>
> 1) Presumably you mean pinfo->pool scope - the only scopes p_add_proto_data() allows are wmem_file_scope() and pinfo->pool.
>
> 2) The original purpose of per-packet data was to remember information about a packet that can only easily be determined during a sequential pass through the packets and that is required in order to dissect the packet correctly.  That information would thus have to have *file* scope.
>
> Having that mechanism serve two purposes in this fashion seems like a bit of a hack.
>
> Should we, instead, get rid of the scope arguments to those functions and, instead, have separate functions, one of which serves the original purpose, using file scope, and one of which serves this new purpose, using pinfo->pool scope?

That might make it more obvious what is going on when reading the
code, so I think that is a useful idea.

As the scope is an explicit argument, I find it quite clear what's going on already. Personally I do not think a new function is required (the add/get/remove being what they mean), and they are here since a long time so it would change existing habits.

BR,
Pascal.