Wireshark-dev: [Wireshark-dev] Adding data parameter to dissector handler
From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Tue, 4 Sep 2012 01:35:48 +0200
Hi,

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);

call_dissector takes extra parameter data, prototype:
  call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);

 (assuming we can break this API, if not s/_only/only_data/)

Rationale:
  Right now pinfo structure and pinfo->private_data can be used to pass data from one dissector to another.

  Extending packet_info is considered as bad idea[1], and using pinfo->private_data is PITA (you need to restore it after changing).
  New API with passing data looks much cleaner and should be easies to use.


OK for change? Comments?

[1] http://www.wireshark.org/lists/wireshark-dev/201205/msg00031.html