Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Migrating dissector to WS 1.12

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Wed, 20 May 2015 20:23:04 +0200


2015-05-20 20:15 GMT+02:00 Helge Kruse <Helge.Kruse@xxxxxxx>:

Hi Pascal,

 

at first I’ve spotted two additional functions that are missing or have changed the semantic.

 

In old dissector I have a construct

       if (check_col(m_pinfo->cinfo, COL_PROTOCOL))

       {      // column is displayed

             col_set_str(m_pinfo->cinfo, COL_PROTOCOL, "my protocol");

       }

 

The check_col function is not available anymore. How to fill the protocol column.


You can remove the check_col function call completely: the col_XXX functions handle automatically whether the column is present of not.

 

And the second question is about TCP stream dissection. The function tcp_dissect_pdus has changed parameters and the signature of new_dissector_t isn’t clear. Wasn’t it the job of the get_pdu_len function to get the correct number of byte of a pdu?


I guess you are referring to the return value of new_dissector_t.  Keep in mind that dissectors are also used outside of tcp_dissect_pdus() call. Moreover this new signature adds an extra parameter allowing you to give eventually extra info to the sub dissector.
Changing dissector from dissector_t to new_dissector_t is quite straightforward. At the end of the dissection, you can simply do a "return tvb_captured_length(tvb);" and change the registration routine from register_dissector() to new_register_dissector().

 

Best regards

Helge

 

From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Pascal Quantin
Sent: Wednesday, May 20, 2015 7:04 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Migrating dissector to WS 1.12

 

Hi Helge,

 

2015-05-20 18:46 GMT+02:00 Helge Kruse <Helge.Kruse@xxxxxxx>:

Hi,

I am migrating from WS 1.6 to WS 1.12 skipping all version between.
I have some code that uses functions that are not available in the
current version. How can I find how this functions are replaced by newer
functions?

Example: tvb_get_ephemeral_string()

 

This one is replaced by tvb_get_string_enc(wmem_packet_scope(),tvb,offset,length, ENC_ASCII | ENC_NA);

Conversions from older to newer APIs are not veery well documented unfortunately. You can easily find them by doing searches in git hitory, or if the list is not too long you can ask on this mailing list.

Regards,

Pascal.


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