Wireshark mailing list archives
Re: Using global variables to store dissection?information
From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Thu, 10 May 2012 17:12:50 -0400
Jakub Zawadzki wrote:
On Wed, May 09, 2012 at 02:57:45PM +0000, Christopher Maynard wrote:Jakub Zawadzki <darkjames-ws@...> writes:There's already packet_info structure which is always private for currentdissection. The easiest fix would be to move all global variables to packet_info structure. Anyone against it?From Guy's comments I got the feeling that the packet_info "katamari" was already too big and that there was a desire to reduce its size, not increase it.It can be one member: void *current_proto_data; Another solution would require adding extra parameter to dissect_ subroutines. It's much more work and I'm afraid it's not easy to do in generated dissectors (like ASN.1 ones). I can live when people use global variables ;) But it's much easier to hit bugs when you forgot to register cleanup function. Primarly I wanted to know if we can decide on some global policy:If it's ok to use global variables or not? What should be used instead of them we can disscuss later.
I think the policy is: it's not a good idea, it should be avoided (in case one day the dream of a thread-safe libwireshark comes true), but it (generally) can't be completely avoided until we give dissector writers a way to store global (eventually per-thread) data. If you build it (the API), they will come (use it). ;-)
___________________________________________________________________________ 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:
- Using global variables to store dissection information Jakub Zawadzki (May 08)
- Re: [Wireshark-dev] Using global variables to store dissection information Christopher Maynard (May 09)
- Re: Using global variables to store dissection?information Jakub Zawadzki (May 10)
- Re: Using global variables to store dissection?information Anders Broman (May 10)
- Re: Using global variables to store dissection?information Jeff Morriss (May 10)
- Re: Using global variables to store dissection?information Jakub Zawadzki (May 10)
- Re: Using global variables to store dissection information Jim Wright (May 09)
- Re: [Wireshark-dev] Using global variables to store dissection information Christopher Maynard (May 09)