Wireshark-dev: Re: [Wireshark-dev] Adding data parameter to dissector handler
From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Wed, 12 Sep 2012 13:20:34 +0200
 

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Jakub Zawadzki
Sent: den 12 september 2012 12:48
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Adding data parameter to dissector handler

On Tue, Sep 11, 2012 at 12:22:02AM +0200, Jakub Zawadzki wrote:
>> Btw. I was thinking it'd be great to have some magic number on begin 
>> of dissector data, instead of 'void *data' we could use some 'struct 
>> dissector_data', defined like:
>>   struct dissector_data {
>>     uint32_t magic;
>>   };
>> 
>>   struct dissector_xml_data {
>>     struct dissector_data top;
>>     xml_frame_t *frame;
>>   };
>
>FYI, Michał is first user of call_dissector_with_data[1][2] His use of data argument is really simple, no 
>strcture passing, just TRUE value or FALSE/NULL.
>
>I'd prefer to only pass strctures (flexible, easy to maintain), with magic numbers on begin of structure + 
>document every use in some doc/ file.
>
>These rules might be too strict, and I don't want to enforce only my rules, so how do we want to use data 
>argument?
>
>
>[1] https://bugs.wireshark.org/bugzilla/attachment.cgi?id=9132
>[2] https://bugs.wireshark.org/bugzilla/attachment.cgi?id=9133

Yes only using structs with magic numbers makes sense and assert if the number is incorrect.
Documentation can be tricky how about defining the struct and magic number in packet_info.h.
Enforsing it may be difficult unless a check can be added to checkAPI.pl

Once we have decided on how to do it we should remove stuff from pinfo only needed by a few protocols which can use the new method.

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