Wireshark mailing list archives

Re: Adding data parameter to dissector handler


From: Jakub Zawadzki <darkjames-ws () darkjames pl>
Date: Tue, 11 Sep 2012 00:22:02 +0200

On Tue, Sep 04, 2012 at 11:19:09AM +0200, Jakub Zawadzki wrote:
On Mon, Sep 03, 2012 at 06:00:06PM -0700, Guy Harris wrote:

On Sep 3, 2012, at 4:35 PM, Jakub Zawadzki wrote:

I plan to replace:
 typedef void (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *);
 typedef int (*new_dissector_t)(tvbuff_t *, packet_info *, proto_tree *);

with:
 typedef int (*real_dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *data);

"Replace"?  That means changing *all* dissectors to have the new function signature (not that doing so is the wrong 
thing to do; it's just going to be a lot of work, even if it's work with a shell script or something such as that).

Did you mean "I plan to add to ... this", i.e. keep dissector_t and new_dissector_t around, and add 
real_dissector_t and have new routines with which "new new style" dissectors can register themselves, with older 
dissectors not being passed the additional argument when called through call_dissector(), etc.?

I want to have one API, so yes, replace. I know it's monkey job ;-)

Don't forget to change heur_dissector_t - or add real_heur_dissector_t - and the calls to invoke a heuristic 
dissector.

Ok, good point, what about another try[1] of merging heur_dissector_t into real_dissector_t,
heuristic dissectors which haven't accept tvb just return -1.

[1] http://www.wireshark.org/lists/wireshark-dev/201207/msg00197.html

FYI, I added data to new_dissector_t and heur_dissector_t, without real_ prefix.
(commit r44860). I hope to commit changes for call_dissector_only, ...  this week.

I'm still ready to merge all *_dissector_t into one API.

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;
  };
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: