We're now a non-profit! Support open source packet analysis by making a donation.

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

From: sagar sg <[email protected]>
Date: Wed, 13 Jul 2011 11:10:54 +0530
Hi Ankit,
Do u have a sample of a Makefile for plugin to get .so file. i have all other files , i am not getting much idea abt writing makefile for my dissector. i found a makefile in net which is as below which contains some TSN compiler is that necessary to use that or any alternate is there ??

# Modify to point to your Wireshark and glib include directories
INCS = -I$(HOME)/wireshark-1.2.6 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include

# Modify to point to your TSN.1 Compiler installation directory
TSNC_DIR = $(HOME)/tsnc-v5.4.5

TSN_SRCS = foo.tsn
SRCS = packet-foo.c $(foreach src, $(TSN_SRCS), $(src:.tsn=.c))

CC = gcc
TSNC = $(TSNC_DIR)/tsnc

OBJS = $(foreach src, $(SRCS), $(src:.c=.o))

PLUGIN_NAME = packet-foo
PLUGIN_DIR = $(HOME)/.wireshark/plugins

CFLAGS = -DHAVE_CONFIG_H $(INCS) -DINET6 -D_U_=__attribute__\(\(unused\)\) -Wall -Wpointer-arith -g -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -fPIC -DPIC

mkdir -p $(PLUGIN_DIR)
$(CC) -shared $(OBJS) -o [email protected]

%.o : %.c
$(CC) -c $(CFLAGS) $< -o [email protected]

%.c : %.tsn
$(TSNC) -wireshark $<

rm -f $(PLUGIN) $(OBJS) foo.h foo.c

packet-foo.c : foo.c

Thanks and Regards


On Mon, Jul 11, 2011 at 4:16 PM, Ankith Agarwal <[email protected]> wrote:

On Mon, Jul 11, 2011, sagar sg <[email protected]> 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

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

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
-->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
--> 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 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 - 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
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 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


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

Sent via: Wireshark-dev mailing list <[email protected]>
Archives: http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe