Wireshark-dev: Re: [Wireshark-dev] How to extend value_string arrays?
From: Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Jul 2009 12:09:27 -0600
On Tue, Jul 07, 2009 at 10:46:52AM -0700, Alex Lindberg wrote:

> I am creating an extended protocol plugin that requires extending a 
> value_string array that exists in epan/dissectors/packet-foo.c file 
> defined like:
> 
> static const value_string foo_name_vals[] = {
> ? {? 0, "Foo Name 1" },
> ? {? 1, "Foo Name 2" },
> ? {? 2, "Foo Name 3" },
> ? {? 0, NULL }
> };
> 
> This array is used as field names when decoding protocol foo.? What I 
> would like to do in my plugin is to extend the array foo_name_vals[] 
> by adding additional elements.

You could move foo_name_vals[] to a header file in epan/dissectors, 
extend it and then include it in both the dissector and your plugin.  
If the normal dissector doesn't come across those extra values you put 
in the value string, it will just ignore them.  However, there is the 
potential of issues with not having all of the plug-in's files within 
the plug-in directory.


Steve