Wireshark mailing list archives

Re: Calling a dissector: Type for data parameter


From: Hardening <rdp.effort () gmail com>
Date: Wed, 16 Jun 2021 18:16:39 +0200

Le 16/06/2021 à 16:36, David Perry a écrit :
Sorry to drag up an old topic, but I've been thinking about this:

Message: 5
Date: Sat, 29 May 2021 09:32:29 +0200
From: Anders Broman <a.broman58 () gmail com>
[...]

I wasn't around for that discussion so I don't know the reasons, but how does this sound as a refined approach?:

* Define a `dissector_data_t` that has a `guint32` identifier field, and a `void *` data field.

* Replace the `void *data` parameter to dissectors with a pointer to a `dissector_data_t`.

* Either:

    * Easy way: maintain a static list of identifiers that map to expected data types, or

    * Have dissector X request an identifier in its registration function for the type of data it expects, and have dissector Y (which will call X) request, in its handoff function, the identifier of the type of data it needs to pass to X.

* Dissectors check for the right identifier in their `dissector_data_t` parameter and don't try to use it if it's wrong.


Hi,

I have that example with the SSL dissector: in almost all cases when we call this dissector from another one, we know exactly what is the next dissector to call on decoded content anyway AFAICT a heuristic is the only way to have things work as expected, or did I missed something ?

Best regards.
--
David FORT
website: https://www.hardening-consulting.com/

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: