Commit f3ff8ee9 authored by garciay's avatar garciay
Browse files

Build dissector for Wireshark 2.0.x

Create MAPEM & SPATEM dissectors
parent 99c0cd52
Loading
Loading
Loading
Loading
+22 −29
Original line number Diff line number Diff line
# Makefile.am
# Automake file for Wireshark BTP Plugin
#
# $Id: $
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
@@ -19,10 +17,12 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

INCLUDES = -I$(top_srcdir) -I$(includedir)
include $(top_srcdir)/Makefile.am.inc

AM_CPPFLAGS = -I$(top_srcdir)

include Makefile.common

@@ -36,9 +36,9 @@ plugin_LTLIBRARIES = btp.la
btp_la_SOURCES = \
	plugin.c \
	moduleinfo.h \
	$(DISSECTOR_SRC) \
	$(DISSECTOR_SUPPORT_SRC) \
	$(DISSECTOR_INCLUDES)
	$(SRC_FILES)	\
	$(HEADER_FILES)

btp_la_LDFLAGS = -module -avoid-version
btp_la_LIBADD = @PLUGIN_LIBS@

@@ -62,35 +62,23 @@ LIBS =
# preceded only by "void " starting in column zero, and must not be
# inside #if.
#
# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
# REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
#
# For some unknown reason, having a big "for" loop in the Makefile
# to scan all the files doesn't work with some "make"s; they seem to
# pass only the first few names in the list to the shell, for some
# reason.
#
# Therefore, we have a script to generate the plugin.c file.
# The shell script runs slowly, as multiple greps and seds are run
# for each input file; this is especially slow on Windows.  Therefore,
# if Python is present (as indicated by PYTHON being defined), we run
# a faster Python script to do that work instead.
#
# Therefore, we use a script to generate the register.c file.
# The first argument is the directory in which the source files live.
# The second argument is "plugin", to indicate that we should build
# a plugin.c file for a plugin.
# All subsequent arguments are the files to scan.
#
plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \
    $(top_srcdir)/tools/make-dissector-reg.py
	@if test -n "$(PYTHON)"; then \
		echo Making plugin.c with python ; \
		$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
		    plugin $(DISSECTOR_SRC) ; \
	else \
		echo Making plugin.c with shell script ; \
		$(top_srcdir)/tools/make-dissector-reg $(srcdir) \
		    $(plugin_src) plugin $(DISSECTOR_SRC) ; \
	fi
plugin.c: $(REGISTER_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg.py
	@echo Making plugin.c
	@$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
		plugin $(REGISTER_SRC_FILES)

#
# Currently plugin.c can be included in the distribution because
@@ -114,8 +102,14 @@ CLEANFILES = \
	btp \
	*~

DISTCLEANFILES = \
	$(NODIST_SRC_FILES) \
	$(NODIST_HEADER_FILES)

MAINTAINERCLEANFILES = \
	Makefile.in	\
	$(GENERATED_SRC_FILES) \
	$(GENERATED_HEADER_FILES) \
	plugin.c

EXTRA_DIST = \
@@ -126,7 +120,6 @@ EXTRA_DIST = \
	CMakeLists.txt

checkapi:
	$(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput \
	$(DISSECTOR_SRC) \
	$(DISSECTOR_INCLUDES) \
	$(DISSECTOR_SUPPORT_SRC)
	$(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
	-sourcedir=$(srcdir) \
	$(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)
+12 −12
Original line number Diff line number Diff line
@@ -3,8 +3,6 @@
#     a) common to both files and
#     b) portable between both files
#
# $Id: $
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
@@ -21,21 +19,23 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# the name of the plugin
PLUGIN_NAME = btp

# the dissector sources (without any helpers)
DISSECTOR_SRC = \
# Non-generated sources to be scanned for registration routines
NONGENERATED_REGISTER_C_FILES = \
	packet-btp.c

# corresponding headers
DISSECTOR_INCLUDES =	\
	crc.h		
# Non-generated sources
NONGENERATED_C_FILES = \
	$(NONGENERATED_REGISTER_C_FILES)

# Headers.
CLEAN_HEADER_FILES = 

# Dissector helpers.  They're included in the source files in this
# directory, but they're not dissectors themselves, i.e. they're not
# used to generate "register.c").
DISSECTOR_SUPPORT_SRC =	
HEADER_FILES = \
	$(CLEAN_HEADER_FILES)

include ../Makefile.common.inc
+13 −30
Original line number Diff line number Diff line
# Makefile.nmake
# nmake file for Wireshark plugin
#
# $Id: $
#

include ..\..\config.nmake
include ..\..\Makefile.nmake.inc

include moduleinfo.nmake

include Makefile.common

CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) /DHAVE_CONFIG_H \
	/I../.. $(GLIB_CFLAGS) \
	/I$(PCAP_DIR)\include

@@ -20,13 +20,9 @@ LDFLAGS = $(PLUGIN_LDFLAGS)

!IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib
CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS)

DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
CFLAGS=$(CFLAGS)

DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)

OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
OBJECTS = $(C_FILES:.c=.obj) $(CPP_FILES:.cpp=.obj) plugin.obj

RESOURCE=$(PLUGIN_NAME).res

@@ -61,38 +57,27 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU
# preceded only by "void " starting in column zero, and must not be
# inside #if.
#
# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
# REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
#
# For some unknown reason, having a big "for" loop in the Makefile
# to scan all the files doesn't work with some "make"s; they seem to
# pass only the first few names in the list to the shell, for some
# reason.
#
# Therefore, we have a script to generate the plugin.c file.
# The shell script runs slowly, as multiple greps and seds are run
# for each input file; this is especially slow on Windows.  Therefore,
# if Python is present (as indicated by PYTHON being defined), we run
# a faster Python script to do that work instead.
#
# Therefore, we use a script to generate the register.c file.
# The first argument is the directory in which the source files live.
# The second argument is "plugin", to indicate that we should build
# a plugin.c file for a plugin.
# All subsequent arguments are the files to scan.
#
!IFDEF PYTHON
plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
	@echo Making plugin.c (using python)
	@$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
!ELSE
plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
	@echo Making plugin.c (using sh)
	@$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
!ENDIF
plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h Makefile.common ../../tools/make-dissector-reg.py
	@echo Making plugin.c
	@$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(REGISTER_SRC_FILES)

!ENDIF

clean:
	rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
	rm -f $(OBJECTS) $(RESOURCE) plugin.c *.nativecodeanalysis.xml *.pdb *.sbr \
	    $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
	    $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc

@@ -101,7 +86,5 @@ distclean: clean
maintainer-clean: distclean

checkapi:
	$(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput \
	$(DISSECTOR_SRC) \
	$(DISSECTOR_INCLUDES) \
	$(DISSECTOR_SUPPORT_SRC)
	$(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput -build \
		$(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ dissect_btp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
  dissector_table_t btp_port_dissector_table;

  /* Check that there's enough data */
  if(tvb_length(tvb) < MIN_PDU_SIZE)
  if(tvb_captured_length(tvb) < MIN_PDU_SIZE)
    return 0;

  col_set_str(pinfo->cinfo, COL_PROTOCOL, "BTP");
+40 −15
Original line number Diff line number Diff line
# CMakeLists.txt
#
# $Id$
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
@@ -18,10 +16,15 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

set(DISSECTOR_SRC
include(WiresharkPlugin)

# This info is from moduleinfo.nmake
set_module_info(cam 0 0 6 0)

set(DISSECTOR
	packet-cam.c
)

@@ -46,22 +49,44 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})

register_dissector_files(plugin.c
	plugin
	${DISSECTOR_SRC}
	${DISSECTOR}
)

# todo
# Do I need any of this or is this handled by type MODULE?
# asn1_la_LDFLAGS = -module -avoid-version
add_plugin_library(cam)

add_library(cam ${LINK_MODE_MODULE}
	${PLUGIN_FILES}
set( EXPORT_FILES
	${PROTOCOL_NAME}-exp.cnf
)

target_link_libraries(cam epan)
set( EXT_ASN_FILE_LIST
)

install(TARGETS cam
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}
	RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION}
set( ASN_FILE_LIST
	ITS-Conatiner.asn
	CAM.asn
)

set( EXTRA_DIST
	${ASN_FILE_LIST}
	packet-${PROTOCOL_NAME}-template.c
	packet-${PROTOCOL_NAME}-template.h
	${PROTOCOL_NAME}.cnf
)

set( SRC_FILES
	${EXTRA_DIST}
	${EXT_ASN_FILE_LIST}
)

set( A2W_FLAGS  )

set( EXTRA_CNF
)

ASN2WRS()

install(TARGETS cam
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION} NAMELINK_SKIP
	RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CPACK_PACKAGE_NAME}/plugins/${CPACK_PACKAGE_VERSION}
)
Loading