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

Wireshark-dev: [Wireshark-dev] An error during compiling wireshark dissector - megaco

From: Petr Janata <janata@xxxxxx>
Date: Tue, 20 Jan 2009 02:03:09 +0100
Hi wireshark-dev,

I tried to put megaco dissector outside of epan/dissector , because I need to make some changes. But compiler finished with errors in packet-h245.h. Log file - "log_wireshark-0.99.7_012009.txt" with errors is in the attachment.

Petr Janata
#!/bin/bash
#

# *** SETTING ***

# -----------------------------------------------------------------------------
# *** Common part (For Linux & Windows target) ***
# -----------------------------------------------------------------------------

# WireShark version
export WS_VER="0.99.7"

# Directory wits source code of WireShark
# without any slash (it will be used as ./$WS_DIR)
export WS_DIR="wireshark-$WS_VER"

# Install directory prefix
#export WS_PREFIX="/usr/local"
export WS_PREFIX=`pwd`"/_install_"

# WireShark plug-in directory
export WS_PLUGIN_DIR="$WS_PREFIX/lib/wireshark/plugins/$WS_VER"

# configure extra parameters (EXCEPT --prefix= and --exec-prefix= !!!)
# *!* bartapc:
#export WS_CONFIG=" --with-lua=/usr "
# *!* tucnak:
export WS_CONFIG=" --disable-lua --disable-wireshark  --disable-ipv6 "


# glib-2.0 include dir
export WS_GLIB2_INC="/usr/include/glib-2.0"

# glib-2.0 - glibconfig.h dir
export WS_GLIB2_CFG="/usr/lib/glib-2.0/include"

# -----------------------------------------------------------------------------
# *** Windows part (For Windows target, you can keep it empty
#     if Windows is not your target :) ) ***
# -----------------------------------------------------------------------------
#                *** mingw32 is needed !!! ***
# *! is not installed at "tucnak"
# -----------------------------------------------------------------------------

export WIN_AR=i586-mingw32msvc-ar
export WIN_CC=i586-mingw32msvc-cc

# We need libwireshark.dll from Windows installation of WireShark
# WARNING! This must be THE SAME VERSION as our source code!
export WS_DLL_NAME='libwireshark.dll'
######## export WS_DLL_PATH='/media/ntfs/Program Files/Wireshark'
export WS_DLL_PATH='/home/xpetjan/workspace/windll'

# -----------------------------------------------------------------------------
# *** Procedures for nice running :) ***
# -----------------------------------------------------------------------------

local_clean() {
  echo -e "\t\tLocal Cleaning..."
  rm -f $WS_DLL_NAME libwireshark.a \
  wireshark.def megaco.dll megaco.a megaco.so *~ \
  ./megaco/*.o ./megaco/*~ \
   scmp.dll scmp.a scmp.so *~ \
  ./scmp/*.o ./scmp/*~
}

doit() {
  CMD="$*"
  echo -e "\n\t\t----------- try -----------[ $CMD ]---\n\n";
  $CMD;
  RET=$?;
  if test $RET -ne 0; then
    echo -e "\n\t\t<-=-=-=-=-=-=-=-=-=-=-=-=- E R R O R ($RET) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==";
    echo -e "\t\t$CMD"
    echo -e "\t\t<-=-=-=-=-=-=-=-=-=-=-=-=- E R R O R ($RET) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==\n";
    exit 1;
  else
    echo -e "\n\t\t-------------------------------------------------------------------------------";
    echo -e "\t\t$CMD"
    echo -e "\t\t---------------------------- O K ----------------------------------------------\n\n";
  fi
}

checkit() {
  RET=$1;
  if test $RET -ne 0; then
    echo -e "\n\t\t<-=-=-=-=-=-=-=-=-=-=-=-=- E R R O R ($RET) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==\n";
    exit 1;
  else
    echo -e "\n\t\t---------------------------- O K ----------------------------------------------\n\n";
  fi
}
#!/bin/bash
#

. ./Settings_megaco.sh

local_clean

doit make clean

doit make

doit rm -f $WS_PLUGIN_DIR/megaco.* 

IAMHERE=`pwd`

doit ln $IAMHERE/megaco.a -s $WS_PLUGIN_DIR/megaco.a
doit ln $IAMHERE/megaco.so -s $WS_PLUGIN_DIR/megaco.so

doit ls -l megaco.* 


#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/outdata.bin
#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/output.bin
#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/outputnew.bin

#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/SCMP_outdata_64Pots_lo_SIP_1.7.9_3295.bin -R "tcp.port==1313 and tcp.len > 0"
#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/SCMP_outdata_scalar_lo.bin -R "tcp.port==1313 and tcp.len > 0"
#$WS_PREFIX/bin/wireshark /home/igor/DVLP/sniff/out/SCMP_outdata_table_lo.bin -R "tcp.port==1313 and tcp.len > 0"

exit 0 ;
#!/bin/bash
#

. ./Settings_megaco.sh

doit local_clean

# Test... :)
doit $WIN_CC --version
doit $WIN_AR --version

cp -v "$WS_DLL_PATH/$WS_DLL_NAME" ./$WS_DLL_NAME
checkit $?

export AR=$WIN_AR
export CC=$WIN_CC



doit $CC -O2 -Wall  -Wpointer-arith  -mwindows -DHAVE_CONFIG_H \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \
-I./megaco -I./$WS_DIR -I./$WS_DIR/epan \
-c -o megaco/plugin.o megaco/plugin.c

doit $CC -O2 -Wall -Wpointer-arith -mwindows -DHAVE_CONFIG_H  \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I./megaco \
-I./$WS_DIR -I./$WS_DIR/epan \
-c -o megaco/packet-megaco.o megaco/packet-megaco.c

doit $CC -O2 -Wall -Wpointer-arith -shared -mwindows --dll \
 -Wl,--subsystem,windows  -L.  -lwireshark \
 ./megaco/plugin.o  ./megaco/packet-megaco.o   -o megaco.dll






doit $CC -O2 -Wall  -Wpointer-arith  -mwindows -DHAVE_CONFIG_H \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \
-I./scmp -I./$WS_DIR -I./$WS_DIR/epan \
-c -o scmp/plugin.o scmp/plugin.c

doit $CC -O2 -Wall -Wpointer-arith -mwindows -DHAVE_CONFIG_H  \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I./scmp \
-I./$WS_DIR -I./$WS_DIR/epan \
-c -o scmp/packet-scmp.o scmp/packet-scmp.c

doit $CC -O2 -Wall -Wpointer-arith -shared -mwindows --dll \
 -Wl,--subsystem,windows  -L.  -lwireshark \
 ./scmp/plugin.o  ./scmp/packet-scmp.o   -o scmp.dll



doit ls -l megaco.* scmp.*


exit 0;
CC	= gcc

CFLAGS	= -O2 -fPIC -Wall -DHAVE_CONFIG_H \
	-D_REENTRANT -DNETSNMP_USE_INLINE -Dlinux \
	-DINET6 -Wpointer-arith -pthread

INCLUDE = -I/usr/include -I/usr/local/include \
	-I$(WS_GLIB2_INC) -I$(WS_GLIB2_CFG) \
	-I./megaco -I./scmp -I./$(WS_DIR) -I./$(WS_DIR)/epan

AR	= ar

ARFLAGS	= rc

RM      = rm -f

SHLD = ${CC} ${CFLAGS} ${INCLUDE}

LDSHFLAGS = -shared -L/usr/local/lib -L./$(WS_DIR)/epan -lwireshark \
	--export-dynamic -lgmodule-2.0 -ldl -lglib-2.0 \
	-L$(WS_PREFIX)/lib

LDFLAGS = -Wl,-rpath $(WS_PLUGIN_DIR)

SUFFIXES = .o .c .h .a .so .sl

COMPILE.c=$(CC) $(CFLAGS) $(INCLUDE) -c
.c.o:
	($(COMPILE.c) -o $@ $<)

SRCS_T =	megaco/plugin.c \
	megaco/packet-megaco.c

SRCS_S =	scmp/plugin.c \
	scmp/packet-scmp.c

OBJS_T = $(SRCS_T:.c=.o)
OBJS_S = $(SRCS_S:.c=.o)


default:	megaco.a megaco.so scmp.a scmp.so

megaco.a:	$(OBJS_T)
	($(AR) $(ARFLAGS) megaco.a $(OBJS_T))
	@chmod 0755 megaco.a

megaco.so:	$(OBJS_T)
	$(SHLD) $(LDSHFLAGS) -o $@ $(OBJS_T) $(LDFLAGS) \
		-Wl,-soname=`basename $@`

scmp.a:	$(OBJS_S)
	($(AR) $(ARFLAGS) scmp.a $(OBJS_S))
	@chmod 0755 scmp.a

scmp.so:	$(OBJS_S)
	$(SHLD) $(LDSHFLAGS) -o $@ $(OBJS_S) $(LDFLAGS) \
		-Wl,-soname=`basename $@`

clean:
	@$(RM) $(OBJS_T) megaco.a megaco.so* *~ ./megaco/*~
	@$(RM) $(OBJS_S) scmp.a scmp.so* *~ ./scmp/*~

xpetjan@tucnak8:~/workspace$ ./Make_megaco_plugin_for_Linux.sh 
		Local Cleaning...

		----------- try -----------[ make clean ]---



		-------------------------------------------------------------------------------
		make clean
		---------------------------- O K ----------------------------------------------



		----------- try -----------[ make ]---


(gcc -O2 -fPIC -Wall -DHAVE_CONFIG_H -D_REENTRANT -DNETSNMP_USE_INLINE -Dlinux -DINET6 -Wpointer-arith -pthread -I/usr/include -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I./megaco -I./scmp -I./wireshark-0.99.7 -I./wireshark-0.99.7/epan -c -o megaco/plugin.o megaco/plugin.c)
(gcc -O2 -fPIC -Wall -DHAVE_CONFIG_H -D_REENTRANT -DNETSNMP_USE_INLINE -Dlinux -DINET6 -Wpointer-arith -pthread -I/usr/include -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I./megaco -I./scmp -I./wireshark-0.99.7 -I./wireshark-0.99.7/epan -c -o megaco/packet-megaco.o megaco/packet-megaco.c)
In file included from megaco/packet-megaco.c:63:
packet-h245-exp.h:6: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:7: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:8: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:9: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:10: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:11: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:12: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:13: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:14: error: expected ';', ',' or ')' before '_U_'
packet-h245-exp.h:15: error: expected ';', ',' or ')' before '_U_'
packet-h245-template.h:125: error: expected ';', ',' or ')' before '_U_'
megaco/packet-megaco.c:184: error: conflicting types for 'tvb_skip_wsp'
./wireshark-0.99.7/epan/tvbuff.h:576: error: previous declaration of 'tvb_skip_wsp' was here
megaco/packet-megaco.c:185: error: static declaration of 'tvb_skip_wsp_return' follows non-static declaration
./wireshark-0.99.7/epan/tvbuff.h:578: error: previous declaration of 'tvb_skip_wsp_return' was here
megaco/packet-megaco.c: In function 'dissect_megaco_text':
megaco/packet-megaco.c:371: warning: pointer targets in passing argument 1 of 'strncasecmp' differ in signedness
megaco/packet-megaco.c:1203: warning: pointer targets in passing argument 6 of 'my_proto_tree_add_string' differ in signedness
megaco/packet-megaco.c: At top level:
megaco/packet-megaco.c:1775: error: expected ';', ',' or ')' before '_U_'
megaco/packet-megaco.c: In function 'dissect_megaco_servicechangedescriptor':
megaco/packet-megaco.c:2346: warning: pointer targets in passing argument 1 of 'atoi' differ in signedness
megaco/packet-megaco.c: In function 'dissect_megaco_errordescriptor':
megaco/packet-megaco.c:2828: warning: pointer targets in passing argument 1 of 'atoi' differ in signedness
megaco/packet-megaco.c: In function 'dissect_megaco_LocalControldescriptor':
megaco/packet-megaco.c:3161: warning: implicit declaration of function 'dissect_megaco_h324_h223caprn'
megaco/packet-megaco.c:3204: warning: pointer targets in passing argument 1 of 'strtoul' differ in signedness
make: *** [megaco/packet-megaco.o] Error 1

		<-=-=-=-=-=-=-=-=-=-=-=-=- E R R O R (2) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==
		make
		<-=-=-=-=-=-=-=-=-=-=-=-=- E R R O R (2) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==