Wireshark mailing list archives
Re: Makefile for wireshark dissector
From: sagar sg <sagu072 () gmail com>
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 PLUGIN = $(PLUGIN_DIR)/$(PLUGIN_NAME).so CFLAGS = -DHAVE_CONFIG_H $(INCS) -DINET6 -D_U_=__attribute__\(\(unused\)\) -Wall -Wpointer-arith -g -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -fPIC -DPIC $(PLUGIN) : $(OBJS) mkdir -p $(PLUGIN_DIR) $(CC) -shared $(OBJS) -o $@ %.o : %.c $(CC) -c $(CFLAGS) $< -o $@ %.c : %.tsn $(TSNC) -wireshark $< clean: rm -f $(PLUGIN) $(OBJS) foo.h foo.c packet-foo.c : foo.c Thanks and Regards Sagar On Mon, Jul 11, 2011 at 4:16 PM, Ankith Agarwal <ankitha () cdac in> wrote:
On Mon, Jul 11, 2011, sagar sg <sagu072 () gmail com> said:Hi, I have written a dissector plug in in windows and it works fine, nowiwant 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 howitis written, please give some suggestions. Thanks and Regards SaagarHi, 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 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 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 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. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Makefile for wireshark dissector sagar sg (Jul 11)
- Makefile for wireshark dissector sagar sg (Jul 11)
- Message not available
- Re: Makefile for wireshark dissector Ankith Agarwal (Jul 11)
- Re: Makefile for wireshark dissector sagar sg (Jul 11)
- Re: Makefile for wireshark dissector Jaap Keuter (Jul 11)
- Re: Makefile for wireshark dissector Guy Harris (Jul 11)
- Message not available
- Re: Makefile for wireshark dissector Ankith Agarwal (Jul 11)
- Re: Makefile for wireshark dissector sagar sg (Jul 11)
- Re: Makefile for wireshark dissector Ankith Agarwal (Jul 11)
- Re: Makefile for wireshark dissector sagar sg (Jul 12)
- Re: Makefile for wireshark dissector sagar sg (Jul 12)
- Re: Makefile for wireshark dissector sagar sg (Jul 13)
- Message not available
- Re: Makefile for wireshark dissector Ankith Agarwal (Jul 13)
- Re: Makefile for wireshark dissector sagar sg (Jul 13)
- Re: Makefile for wireshark dissector sagar sg (Jul 13)
- Re: Makefile for wireshark dissector sagar sg (Jul 18)
- Re: Makefile for wireshark dissector sagar Guledagudda (Jul 20)
- <Possible follow-ups>
- Re: Makefile for wireshark dissector Huaqing Wang (Jul 13)
- Re: Makefile for wireshark dissector Ed Beroset (Jul 18)