Wireshark-dev: Re: [Wireshark-dev] Best way to give configuration information to a protocol

From: Juan Jose Martin Carrascosa <juanjo@xxxxxxx>
Date: Tue, 19 Sep 2017 18:44:57 +0200
Hi all,

I have now an UAT dialog. In the ~~copy_cb of the records, I am allocating an object and passing it to a registry that I maintain in the dissector.

The registry is initialized like this:

  registry = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), hash_by_guid, compare_by_guid);

However, if there is already an object in the UAT config file, when I start Wireshark (I know that we are out of the file scope) I get the following error:

ERROR:wmem_core.c:52:wmem_alloc: assertion failed: (allocator->in_scope)
Aborted (core dumped)

Because I am doing:

    type_mapping_object = wmem_new(wmem_file_scope(), type_mapping);

My question is, how can I manage this situation? should I allocate the object in a different callback? or should I change the scope? I have tried wmem_epan_scope() and it doesn't work either.

My goal is to populate the registry with the information I have in the UAT configuration file.

Thanks,
Juanjo Martin

On Mon, Sep 18, 2017 at 9:33 PM, Michael Mann via Wireshark-dev <wireshark-dev@xxxxxxxxxxxxx> wrote:
I would agree that a dissector table for the GUIDs is probably the best way to go. I also just created a GUID dissector table in my recent work with Netmon.  grep "netmon.provider_id" for example of how to setup a GUID dissector table (it's much more straightforward than the DCE/RPC one)
 
 
-----Original Message-----
From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Sent: Mon, Sep 18, 2017 3:03 pm
Subject: Re: [Wireshark-dev] Best way to give configuration information to a protocol

Hi Juan Jose,

2017-09-18 17:12 GMT+02:00 Juan Jose Martin Carrascosa <juanjo@xxxxxxx>:
Hi all,

Which is the best way to pass configuration to a protocol? Do we have any builtin mechanisms? I tried to upload a patch using CSV at some point but it didn't succeed. So I wonder if there is any recommended way I can implement: table or list in the Preferences, XML file, CSV file...

My goal is to pass ("GUID", "plugin_name") pairs to the RTPS protocol so Wireshark knows dynamically what plugin it should call to deserialize data that is written by the DataWriter with id = "GUID". The GUID is part of the DATA packet and it is already dissected and known at that point.

A UAT dialog could be appropriate for your needs. Several dissectors are already using it and can be taken as an example (packet-ipsec.c, packet-http.c, ...).
Or if the GUID / plugin mapping never changes, you could create a dissector table and have your plugin register to this table (see register_dissector_table() / register_custom_dissector_table() and the corresponding dissector_add_XXX() functions).

Best regards,
Pascal.
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> 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

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
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



--

Juanjo Martin
Senior Application Engineer
Professional Services Group
Office: +34 958 27 88 62
Mobile: +34 656 30 20 56