This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Hi all,

Anybody knows, how to get Wireshark version during compilation ? I am writing a dissector plugin, and I would like to be able to build this plugin under different version of Wireshark. The interface functions prototypes can differ in different version of Wireshark, so I would like to check it during build, something like this:

#if CURRENT_WIRESHARK_VERSION >= VERSION(10,1,0)
...
#else
...
#endif

Is it possible to get a version somehow?

asked 01 Feb '16, 05:01

gralex's gravatar image

gralex
6112
accept rate: 0%


You should use the following preprocessor variables: VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO

For example in my own plugins I use this kind of code:

#if (VERSION_MAJOR > 2) || ((VERSION_MAJOR == 2) && (VERSION_MINOR >= 1))
    sqnmbim_handle = create_dissector_handle(dissect_foo, proto_foo);
#else
    sqnmbim_handle = new_create_dissector_handle(dissect_foo, proto_foo);
#endif
permanent link

answered 01 Feb '16, 08:49

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%

Oops, @Pascal Quantin is correct, I forgot about the definitions in config.h, instead I looked for them on the compiler command line.

(01 Feb '16, 10:14) grahamb ♦

Unfortunately for you there's no pre-processor definition of the build version. I guess one could be generated by the build systems, CMake and autotools. I suggest you file an enhancement request for this on the Wireshark Bugzilla.

Edit: Ignore, the answer from @Pascal Quantin is the correct answer.

permanent link

answered 01 Feb '16, 06:25

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

edited 01 Feb '16, 14:59

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×637
×173
×29

question asked: 01 Feb '16, 05:01

question was seen: 970 times

last updated: 01 Feb '16, 14:59

p​o​w​e​r​e​d by O​S​Q​A