Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Makefile for wireshark dissector

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 11 Jul 2011 16:33:30 +0200
Hi,

You can find all instructions in README.plugins:
http://anonsvn.wireshark.org/wireshark/trunk/doc/README.plugins

As for C++ code, the Wireshark is a C only project, you should read up on the
portability guidelines in README.developer:
http://anonsvn.wireshark.org/wireshark/trunk/doc/README.developer

So for using C++ you're somewhat on your own.

<quote>
1.1.1 Portability.

Wireshark runs on many platforms, and can be compiled with a number of
different compilers; here are some rules for writing code that will work
on multiple platforms.

Don't use C++-style comments (comments beginning with "//" and running
to the end of the line); Wireshark's dissectors are written in C, and
thus run through C rather than C++ compilers.
</quote>

Thanks,
Jaap

On Mon, 11 Jul 2011 17:08:53 +0530, sagar sg wrote:

Hi Ankit,
Thank you very much Ankit, I 'm trying to follow the 1st method. the
question i have is the code i have written is in C++, i guess the
wireshark is compiled with CC ,Does CC can compile the C++ code, i have
used C style of C++ without much OOPS concepts.

Thanks and Regards
Sagar

On Mon, Jul 11, 2011 at 4:16 PM, Ankith Agarwal wrote:

On Mon, Jul 11, 2011, sagar sg said:

> Hi,
> I have written a dissector plug in in windows and it works fine,
now i
> want to compile it in linux to get the .so file, please help me how
do i
> write a make file for the wireshark dissector. i got one example
file but > there i saw something like .TSN compiler which i dint
understand of how it

is written, please give some suggestions.
>
> Thanks and Regards
> Saagar

Hi,
For doing this firstly, you have to download the latest source of
wireshark.
You have two options that can be done for your code to be included in
wireshark--

i) Compile your code into the wireshark main dissectors...
--> for this just take your .c file and paste it in the
(root)/epan/dissectors directory, where all the other dissectors are
placed. Now, to make changes in the makefile to reflect in the
compilation, just add your .c filename in the Makefile.common file in
this
directory.
-->Makefile.common is the common part of the makefile in both Windows
and
Linux platform.
-->Just go and edit the label DISSECTOR_SRC of this file and add your
filename in this list.
-->If your code also contains a header file then add it in the
DISSECTOR_INCLUDES label.
--> compile the wireshark source from the root directory of
wireshark.

ii) compile a plugin for wireshrk(.so file)
-->Assumption here is that your plugin already contains the required
makefiles(ie, makefile.am [2] and makefile.common)
-->Now these are the places where you have to edit the wireshark code
for
telling it to compile and execute your plugin...
a)root_direc/configure.in [3] - somewhere near line 1861 - add path
to
makefile of your plugin
b)root_direc/Makefile.am - line 277 - add the path to .la file of
your
plugin.
c)root_direc/epan/Makefile.am - line 221 - add path to the .c file of
the dissector.
d)root_direc/plugin/Makefile.am - line 35 - add your module in the
list of plugins.
-->compile the wireshark as usual.
-->new files will be generated in your plugin folder.
-->Now just copy the mih.la [4] file and mih.so (inside .libs folder
in
plugins folder) from the plugin and paste it into the
/usr/local/lib/wireshark/plugins/ folder.
Now run the wireshark tool and your plugin should start working.

Let me know if there are further problems

Regards
Ankith

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.