Wireshark-dev: Re: [Wireshark-dev] [msvc] 'etype_vals' : unknown size

From: DbdM Tbt <spin.x2k@xxxxxxxxx>
Date: Tue, 13 Aug 2013 12:10:31 +0800
Hello again,
I forgot to add that this 'hack' requires wireshark to be compiled in two steps (if ever compilation is done from scratch or after distclean).
The first step is to 'make all' without the modification to etype_vals and without the openflow plugin.
Then the second step is to plug in the openflow dissector and modify etype_vals and make again.
Clearly something is not right with this picture.
Hopefully this additional info clears some things.
Thanks.


On Tue, Aug 13, 2013 at 11:07 AM, DbdM Tbt <spin.x2k@xxxxxxxxx> wrote:
Hello and good day.
My name is David and this is my first post in the list.
I am currently studying how to develop a dissector and currently building on top of an existing one.
The base I am using is an openflow dissector found here:
http://www.openflow.org/wp/downloads/#dissector
Created by Mr. David Underhill.

Before proceeding, I would like to say that where possible, I try to strictly follow the developers guide:
www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html
I think the only difference in my case is that I am using MS Visual Studio 2010 instead of the Express edition.

My environment is now this:
[OS] WindowsXP Professional SP3 32bit
[Compiler] Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
   Copyright (C) Microsoft Corporation.  All rights reserved.
[Wireshark Base] ver: 1.10.1
   url: http://www.wireshark.org/download/src/wireshark-1.10.1.tar.bz2

Setup and compilation is ok with the wireshark sources as is.

But when I include the openflow dissector, I get this error (among others):
C:\wireshark-1.10.1\epan/etypes.h(541) : error C2133: 'etype_vals' : unknown size

I tried to work around this error by modifying epan/etypes.h like this:
+ #ifdef _WIN32
+ WS_DLL_PUBLIC const value_string *etype_vals;
+ #else
  WS_DLL_PUBLIC const value_string etype_vals[];
+ #endif

After modifying this and working around other compile errors (not part of the topic), I have successfully built the plugin and wireshark.

I am a beginner in developing for windows as my experience is mostly in linux environments (GNU).

So I would like to ask for the opinions on the developers in this list if what I did was safe.
Is there a more 'correct' modification?
Is there a way around this error without modifying any wireshark codes?

Thank you very much,
David