aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-12-12 21:42:14 +0100
committerPascal Quantin <pascal.quantin@gmail.com>2016-12-13 08:50:27 +0000
commit693dcd276e556033b1176d16f4ea257ae3e68ea5 (patch)
tree9eea1e83a8e0086c5f5f4d1fc00c4e692c40335e
parent862905da1b84e1997e2b2a5d4ae8bbaaedb804de (diff)
Build TRANSUM plugin
Add plugin to autofoo and CMake build systems and fix errors found Add plugin to Windows installer (optional component activated by default) Change-Id: Id1b777bdee04e53076b3291f6fb68d5abad6985d Reviewed-on: https://code.wireshark.org/review/19228 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--configure.ac1
-rw-r--r--packaging/nsis/wireshark.nsi8
-rw-r--r--packaging/wix/Plugins.wxi14
-rw-r--r--plugins/Makefile.am1
-rw-r--r--plugins/transum/CMakeLists.txt91
-rw-r--r--plugins/transum/Makefile.am71
-rw-r--r--plugins/transum/decoders.c12
-rw-r--r--plugins/transum/extractors.c8
-rw-r--r--plugins/transum/packet-transum.c38
-rw-r--r--plugins/transum/plugin.rc.in34
11 files changed, 244 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48ff874ae8..1c28f947bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1225,6 +1225,7 @@ if(ENABLE_PLUGINS)
plugins/opcua
plugins/profinet
plugins/stats_tree
+ plugins/transum
plugins/unistim
plugins/wimax
plugins/wimaxasncp
diff --git a/configure.ac b/configure.ac
index ab328d1a80..6ce81b1fcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2986,6 +2986,7 @@ AC_CONFIG_FILES(
plugins/opcua/Makefile
plugins/profinet/Makefile
plugins/stats_tree/Makefile
+ plugins/transum/Makefile
plugins/unistim/Makefile
plugins/wimax/Makefile
plugins/wimaxasncp/Makefile
diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi
index 527e765b55..184c1d9c16 100644
--- a/packaging/nsis/wireshark.nsi
+++ b/packaging/nsis/wireshark.nsi
@@ -1026,6 +1026,13 @@ SetOutPath '$INSTDIR\plugins\${VERSION}'
File "${STAGING_DIR}\plugins\mate.dll"
SectionEnd
+
+Section "TRANSUM - network and application performance analysis" SecTransum
+;-------------------------------------------
+SetOutPath '$INSTDIR\plugins\${VERSION}'
+File "${STAGING_DIR}\plugins\transum.dll"
+SectionEnd
+
Section "Configuration Profiles" SecProfiles
;-------------------------------------------
; This should be a function or macro
@@ -1166,6 +1173,7 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Additional protocol dissectors."
!insertmacro MUI_DESCRIPTION_TEXT ${SecStatsTree} "Extended statistics."
!insertmacro MUI_DESCRIPTION_TEXT ${SecMate} "Plugin - Meta Analysis and Tracing Engine (Experimental)."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecTransum} "TRANSUM plugin - network and application performance analysis."
!insertmacro MUI_DESCRIPTION_TEXT ${SecProfiles} "Configuration profiles"
diff --git a/packaging/wix/Plugins.wxi b/packaging/wix/Plugins.wxi
index 7964e27465..2bf2718fbc 100644
--- a/packaging/wix/Plugins.wxi
+++ b/packaging/wix/Plugins.wxi
@@ -85,4 +85,18 @@
</ComponentGroup>
</Fragment>
+ <!-- TRANSUM -->
+ <Fragment>
+ <DirectoryRef Id="dirPluginsVersion">
+ <Component Id="cmpTransum_dll" Guid="*">
+ <File Id="filTransum_dll" KeyPath="yes" Source="$(var.Plugins.Dir)\transum.dll" />
+ </Component>
+ </DirectoryRef>
+ </Fragment>
+ <Fragment>
+ <ComponentGroup Id="CG.Plugins.Transum">
+ <ComponentRef Id="cmpTransum_dll" />
+ </ComponentGroup>
+ </Fragment>
+
</Include>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 6b11b4ea71..2f8f7a0ab6 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -32,6 +32,7 @@ SUBDIRS = $(_CUSTOM_SUBDIRS_) \
opcua \
profinet \
stats_tree \
+ transum \
unistim \
wimax \
wimaxasncp \
diff --git a/plugins/transum/CMakeLists.txt b/plugins/transum/CMakeLists.txt
new file mode 100644
index 0000000000..aa9640790c
--- /dev/null
+++ b/plugins/transum/CMakeLists.txt
@@ -0,0 +1,91 @@
+# CMakeLists.txt
+#
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+include(WiresharkPlugin)
+
+# Plugin name and version info (major minor micro extra)
+set_module_info(transum 2 0 2 0)
+
+set(DISSECTOR_SRC
+ packet-transum.c
+)
+
+set(DISSECTOR_SUPPORT_SRC
+ decoders.c
+ extractors.c
+)
+
+set(PLUGIN_FILES
+ plugin.c
+ ${DISSECTOR_SRC}
+ ${DISSECTOR_SUPPORT_SRC}
+)
+
+set(CLEAN_FILES
+ ${PLUGIN_FILES}
+)
+
+set_source_files_properties(
+ ${CLEAN_FILES}
+ PROPERTIES
+ COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+register_dissector_files(plugin.c
+ plugin
+ ${DISSECTOR_SRC}
+ ${DISSECTOR_SUPPORT_SRC}
+)
+
+add_plugin_library(transum)
+
+install(TARGETS transum
+ 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}
+)
+
+file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h")
+CHECKAPI(
+ NAME
+ transum
+ SWITCHES
+ -g abort -g termoutput -build
+ SOURCES
+ ${DISSECTOR_SRC}
+ ${DISSECTOR_SUPPORT_SRC}
+ ${DISSECTOR_HEADERS}
+)
+
+#
+# Editor modelines - http://www.wireshark.org/tools/modelines.html
+#
+# Local variables:
+# c-basic-offset: 8
+# tab-width: 8
+# indent-tabs-mode: t
+# End:
+#
+# vi: set shiftwidth=8 tabstop=8 noexpandtab:
+# :indentSize=8:tabSize=8:noTabs=false:
+#
diff --git a/plugins/transum/Makefile.am b/plugins/transum/Makefile.am
new file mode 100644
index 0000000000..9cc6afb30b
--- /dev/null
+++ b/plugins/transum/Makefile.am
@@ -0,0 +1,71 @@
+# Makefile.am
+#
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+include $(top_srcdir)/Makefile.am.inc
+include ../Makefile.am.inc
+
+# the name of the plugin
+PLUGIN_NAME = transum
+
+# Non-generated sources to be scanned for registration routines
+NONGENERATED_REGISTER_C_FILES = \
+ packet-transum.c
+
+# Non-generated sources
+NONGENERATED_C_FILES = \
+ $(NONGENERATED_REGISTER_C_FILES) \
+ decoders.c \
+ extractors.c
+
+# Headers.
+CLEAN_HEADER_FILES = \
+ decoders.h \
+ extractors.h \
+ packet-transum.h \
+ preferences.h
+
+HEADER_FILES = \
+ $(CLEAN_HEADER_FILES)
+
+plugin_LTLIBRARIES = transum.la
+
+transum_la_SOURCES = \
+ plugin.c \
+ moduleinfo.h \
+ $(SRC_FILES) \
+ $(HEADER_FILES)
+
+transum_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_CPPFLAGS)
+
+transum_la_CFLAGS = $(AM_CFLAGS) $(PLUGIN_CFLAGS)
+
+transum_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+
+CLEANFILES = \
+ transum \
+ *~
+
+MAINTAINERCLEANFILES = \
+ Makefile.in \
+ plugin.c
+
+EXTRA_DIST = \
+ plugin.rc.in \
+ CMakeLists.txt
diff --git a/plugins/transum/decoders.c b/plugins/transum/decoders.c
index 347f5af02c..cd8e918db5 100644
--- a/plugins/transum/decoders.c
+++ b/plugins/transum/decoders.c
@@ -41,7 +41,7 @@ extern HF_OF_INTEREST hf_of_interest;
/* Returns the number of sub-packets of interest */
-int decode_syn(packet_info *pinfo, proto_tree *tree)
+int decode_syn(packet_info *pinfo _U_, proto_tree *tree _U_)
{
if (sub_packet[0].tcp_flags_ack)
sub_packet[0].rrpd.c2s = FALSE;
@@ -69,11 +69,11 @@ int decode_syn(packet_info *pinfo, proto_tree *tree)
Returns the number of sub-packets of interest, which in this case is always 1.
*/
-int decode_dcerpc(packet_info *pinfo, proto_tree *tree)
+int decode_dcerpc(packet_info *pinfo _U_, proto_tree *tree)
{
guint32 field_uint[MAX_RETURNED_ELEMENTS]; /* An extracted field array for unsigned integers */
size_t field_value_count; /* How many entries are there in the extracted field array */
- guint32 dcerpc_cn_ctx_id;
+ guint32 dcerpc_cn_ctx_id = 0;
if (!extract_uint(tree, hf_of_interest.dcerpc_ver, field_uint, &field_value_count))
{
@@ -145,7 +145,7 @@ int decode_dcerpc(packet_info *pinfo, proto_tree *tree)
}
/* Returns the number of sub-packets of interest */
-int decode_smb(packet_info *pinfo, proto_tree *tree)
+int decode_smb(packet_info *pinfo _U_, proto_tree *tree)
{
guint32 field_uint[MAX_RETURNED_ELEMENTS]; /* An extracted field array for unsigned integers */
size_t field_value_count; /* How many entries are there in the extracted field array */
@@ -184,7 +184,7 @@ int decode_smb(packet_info *pinfo, proto_tree *tree)
{
extract_ui64(tree, hf_of_interest.smb2_ses_id, ses_id, &ses_id_count);
- for (int i = 0; i < msg_id_count; i++)
+ for (size_t i = 0; i < msg_id_count; i++)
{
sub_packet[i].rrpd.c2s = sub_packet[0].rrpd.c2s;
sub_packet[i].rrpd.ip_proto = sub_packet[0].rrpd.ip_proto;
@@ -254,7 +254,7 @@ int decode_gtcp(packet_info *pinfo, proto_tree *tree)
}
/* Returns the number of sub-packets of interest */
-int decode_dns(packet_info *pinfo, proto_tree *tree)
+int decode_dns(packet_info *pinfo _U_, proto_tree *tree)
{
guint32 field_uint[MAX_RETURNED_ELEMENTS]; /* An extracted field array for unsigned integers */
size_t field_value_count; /* How many entries are there in the extracted field array */
diff --git a/plugins/transum/extractors.c b/plugins/transum/extractors.c
index f2c72371cc..f65cef49a6 100644
--- a/plugins/transum/extractors.c
+++ b/plugins/transum/extractors.c
@@ -44,7 +44,7 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t *
*element_count = g_ptr_array_len(finfo_array);
- for (int i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
+ for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
{
result_array[i] = fvalue_get_uinteger(&((field_info*)finfo_array->pdata[i])->value);
}
@@ -64,7 +64,7 @@ int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t *
*element_count = g_ptr_array_len(finfo_array);
- for (int i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
+ for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
{
result_array[i] = fvalue_get_uinteger64(&((field_info*)finfo_array->pdata[i])->value);
}
@@ -84,7 +84,7 @@ int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t *
*element_count = g_ptr_array_len(finfo_array);
- for (int i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
+ for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
{
result_array[i] = fvalue_get_sinteger64(&((field_info*)finfo_array->pdata[i])->value);
}
@@ -104,7 +104,7 @@ int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t
*element_count = g_ptr_array_len(finfo_array);
- for (int i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
+ for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++)
{
fvalue_t *fv = &(((field_info*)finfo_array->pdata[i])->value);
diff --git a/plugins/transum/packet-transum.c b/plugins/transum/packet-transum.c
index 6b112702b4..80221b3613 100644
--- a/plugins/transum/packet-transum.c
+++ b/plugins/transum/packet-transum.c
@@ -27,12 +27,11 @@
#include "config.h"
-#include <wiretap/wtap.h>
#include <epan/proto.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/dissectors/packet-tcp.h>
-#include <tap.h>
+#include <epan/tap.h>
#include <wsutil/report_err.h>
#include "packet-transum.h"
#include "preferences.h"
@@ -143,17 +142,17 @@ static const enum_val_t capture_position_vals[] = {
{ NULL, NULL, 0}
};
-static const enum_val_t time_multiplier_vals[] = {
+/*static const enum_val_t time_multiplier_vals[] = {
{ "RTE_TIME_SEC", "seconds", RTE_TIME_SEC },
{ "RTE_TIME_MSEC", "milliseconds", RTE_TIME_MSEC },
{ "RTE_TIME_USEC", "microseconds", RTE_TIME_USEC },
{ NULL, NULL, 0}
-};
+};*/
static int fake_tap = 0xa7a7a7a7;
-void init_detected_tcp_svc()
+void init_detected_tcp_svc(void)
{
for (int i = 0; i < 64 * 1024; i++)
detected_tcp_svc[i] = FALSE;
@@ -165,7 +164,7 @@ void add_detected_tcp_svc(guint16 port)
}
-void init_dcerpc_data()
+void init_dcerpc_data(void)
{
for (int i = 0; i < 256; i++)
dcerpc_req_pkt_type[i] = FALSE;
@@ -190,7 +189,7 @@ void clear_rrpd(RRPD *rrpd)
memset(rrpd, 0x00, sizeof(RRPD));
}
-void init_rrpd_data()
+void init_rrpd_data(void)
{
for (int i = 0; i < MAX_PACKETS; i++)
output_rrpd[i] = NULL;
@@ -255,11 +254,6 @@ int append_to_rrpd_list(RRPD *in_rrpd)
/*
This function finds the latest entry in the rrpd_list that matches the
-ip_proto and stream_no values. If is_struct os true it will only match
-if the session_id, msg_id and suffix are all zero or all ones.
-
-/*
-This function finds the latest entry in the rrpd_list that matches the
ip_proto, stream_no, session_id, msg_id and suffix values.
An input state value of 0 means that we don't care about state.
@@ -676,7 +670,7 @@ void update_rrpd_rte_data(RRPD *in_rrpd)
}
/* This function initialises all of the sub_packets in the sub_packet array. */
-void init_sub_packet()
+void init_sub_packet(void)
{
for (int i = 0; i < MAX_SUBPKTS_PER_PACKET; i++)
{
@@ -757,15 +751,10 @@ void init_globals(void)
if (!preferences.tsumenabled) return;
/* Create and initialise some dynamic memory areas */
- detected_tcp_svc = (gboolean *)wmem_alloc(wmem_file_scope(), (64 * 1024 * sizeof(gboolean)));
- sub_packet = (PKT_INFO *)wmem_alloc(wmem_file_scope(), (MAX_SUBPKTS_PER_PACKET * sizeof(PKT_INFO)));
- rrpd_list = (RRPD *)wmem_alloc(wmem_file_scope(), (MAX_RRPDS * sizeof(RRPD)));
- temp_rsp_rrpd_list = (RRPD *)wmem_alloc(wmem_file_scope(), (SIZE_OF_TEMP_RSP_RRPD_LIST * sizeof(RRPD)));
-
- memset(detected_tcp_svc, 0x00, (64 * 1024 * sizeof(gboolean)));
- memset(sub_packet, 0x00, (MAX_SUBPKTS_PER_PACKET * sizeof(PKT_INFO)));
- memset(rrpd_list, 0x00, (MAX_RRPDS * sizeof(RRPD)));
- memset(temp_rsp_rrpd_list, 0x00, (SIZE_OF_TEMP_RSP_RRPD_LIST * sizeof(RRPD)));
+ detected_tcp_svc = (gboolean *)wmem_alloc0(wmem_file_scope(), (64 * 1024 * sizeof(gboolean)));
+ sub_packet = (PKT_INFO *)wmem_alloc0(wmem_file_scope(), (MAX_SUBPKTS_PER_PACKET * sizeof(PKT_INFO)));
+ rrpd_list = (RRPD *)wmem_alloc0(wmem_file_scope(), (MAX_RRPDS * sizeof(RRPD)));
+ temp_rsp_rrpd_list = (RRPD *)wmem_alloc0(wmem_file_scope(), (SIZE_OF_TEMP_RSP_RRPD_LIST * sizeof(RRPD)));
next_free_rrpd = 0;
@@ -866,8 +855,7 @@ void write_rte(RRPD *in_rrpd, tvbuff_t *tvb, proto_tree *tree, char *summary)
proto_tree *rte_tree;
proto_item *pi;
- char *temp_string;
- temp_string = wmem_alloc(wmem_packet_scope(), SIZEOF_TEMP_STRING);
+ char *temp_string = (char *)wmem_alloc(wmem_packet_scope(), SIZEOF_TEMP_STRING);
if (in_rrpd->req_first_frame)
{
@@ -1106,7 +1094,7 @@ void set_proto_values(packet_info *pinfo, proto_tree *tree)
* Wireshark scans all the packets once and then once again as they are displayed
* The pinfo.visited boolean is set to FALSE; on the first scan
*/
-static int dissect_transum(tvbuff_t *buffer, packet_info *pinfo, proto_tree *tree _U_)
+static int dissect_transum(tvbuff_t *buffer, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
if (!preferences.tsumenabled) return 0;
diff --git a/plugins/transum/plugin.rc.in b/plugins/transum/plugin.rc.in
new file mode 100644
index 0000000000..cac1f406ac
--- /dev/null
+++ b/plugins/transum/plugin.rc.in
@@ -0,0 +1,34 @@
+#include "winver.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @RC_MODULE_VERSION@
+ PRODUCTVERSION @RC_VERSION@
+ FILEFLAGSMASK 0x0L
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0
+#endif
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0"
+ VALUE "FileDescription", "@PACKAGE@ dissector\0"
+ VALUE "FileVersion", "@MODULE_VERSION@\0"
+ VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0"
+ VALUE "LegalCopyright", "Copyright © 1998 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and others\0"
+ VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0"
+ VALUE "ProductName", "Wireshark\0"
+ VALUE "ProductVersion", "@VERSION@\0"
+ VALUE "Comments", "Built with @MSVC_VARIANT@\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END