aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-10-17 21:04:49 +0200
committerAnders Broman <a.broman58@gmail.com>2016-10-18 04:00:35 +0000
commit303948500fee5f24600643638e3ed5cc5fa14132 (patch)
treeba35789f15a357782841066f76c1cf358bcf5945
parent867f2829c1c4e1f67b14a5ace5cc9f29e971a6c9 (diff)
CQL: add LZ4/Snappy decompression support on Windows
Change-Id: I34374cf29357e2ed5062da1a5245b9adbabf732d Reviewed-on: https://code.wireshark.org/review/18249 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--CMakeLists.txt14
-rw-r--r--cmake/modules/FindLZ4.cmake26
-rw-r--r--cmake/modules/FindSNAPPY.cmake26
-rw-r--r--epan/dissectors/packet-cql.c4
-rw-r--r--packaging/nsis/CMakeLists.txt3
-rw-r--r--packaging/wix/CMakeLists.txt6
-rw-r--r--tools/win-setup.ps114
7 files changed, 76 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68af9a53bb..ef5f4e8c53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1569,6 +1569,13 @@ if(WIN32)
"${_dll_output_dir}"
)
endif(LUA_FOUND)
+ if (LZ4_FOUND)
+ add_custom_command(TARGET copy_cli_dlls PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${LZ4_DLL_DIR}/${LZ4_DLL}"
+ "${_dll_output_dir}"
+ )
+ endif(LZ4_FOUND)
if (NGHTTP2_FOUND)
add_custom_command(TARGET copy_cli_dlls PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
@@ -1619,6 +1626,13 @@ if(WIN32)
"${_dll_output_dir}/snmp/mibs/tubs"
)
endif(SMI_FOUND)
+ if (SNAPPY_FOUND)
+ add_custom_command(TARGET copy_cli_dlls PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${SNAPPY_DLL_DIR}/${SNAPPY_DLL}"
+ "${_dll_output_dir}"
+ )
+ endif(SNAPPY_FOUND)
if (WINSPARKLE_FOUND)
add_custom_command(TARGET copy_cli_dlls PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
diff --git a/cmake/modules/FindLZ4.cmake b/cmake/modules/FindLZ4.cmake
index 5445c573ca..cbcd2b4659 100644
--- a/cmake/modules/FindLZ4.cmake
+++ b/cmake/modules/FindLZ4.cmake
@@ -3,15 +3,20 @@
# Find LZ4 includes and library
#
# LZ4_INCLUDE_DIRS - where to find lz4.h, etc.
-# LZ4_LIBRARIES - List of libraries when using lz4.
-# LZ4_FOUND - True if lz4 found.
+# LZ4_LIBRARIES - List of libraries when using LZ4.
+# LZ4_FOUND - True if LZ4 found.
+# LZ4_DLL_DIR - (Windows) Path to the LZ4 DLL
+# LZ4_DLL - (Windows) Name of the LZ4 DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "lz4-.*" "LZ4_HINTS" )
find_package(PkgConfig)
pkg_search_module(LZ4 lz4 liblz4)
find_path(LZ4_INCLUDE_DIR
NAMES lz4.h
- HINTS "${LZ4_INCLUDEDIR}"
+ HINTS "${LZ4_INCLUDEDIR}" "${LZ4_HINTS}/include"
PATHS
/usr/local/include
/usr/include
@@ -19,7 +24,7 @@ find_path(LZ4_INCLUDE_DIR
find_library(LZ4_LIBRARY
NAMES lz4 liblz4
- HINTS "${LZ4_LIBDIR}"
+ HINTS "${LZ4_LIBDIR}" "${LZ4_HINTS}/lib"
PATHS
/usr/local/lib
/usr/lib
@@ -31,6 +36,19 @@ find_package_handle_standard_args( LZ4 DEFAULT_MSG LZ4_INCLUDE_DIR LZ4_LIBRARY )
if( LZ4_FOUND )
set( LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR} )
set( LZ4_LIBRARIES ${LZ4_LIBRARY} )
+ if (WIN32)
+ set ( LZ4_DLL_DIR "${LZ4_HINTS}/bin"
+ CACHE PATH "Path to LZ4 DLL"
+ )
+ file( GLOB _lz4_dll RELATIVE "${LZ4_DLL_DIR}"
+ "${LZ4_DLL_DIR}/liblz4-*.dll"
+ )
+ set ( LZ4_DLL ${_lz4_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "LZ4 DLL file name"
+ )
+ mark_as_advanced( LZ4_DLL_DIR LZ4_DLL )
+ endif()
else()
set( LZ4_INCLUDE_DIRS )
set( LZ4_LIBRARIES )
diff --git a/cmake/modules/FindSNAPPY.cmake b/cmake/modules/FindSNAPPY.cmake
index cc018bbcba..99e8b60fc4 100644
--- a/cmake/modules/FindSNAPPY.cmake
+++ b/cmake/modules/FindSNAPPY.cmake
@@ -3,22 +3,27 @@
# Find Snappy includes and library
#
# SNAPPY_INCLUDE_DIRS - where to find snappy.h, etc.
-# SNAPPY_LIBRARIES - List of libraries when using snappy.
-# SNAPPY_FOUND - True if snappy found.
+# SNAPPY_LIBRARIES - List of libraries when using Snappy.
+# SNAPPY_FOUND - True if Snappy found.
+# SNAPPY_DLL_DIR - (Windows) Path to the Snappy DLL
+# SNAPPY_DLL - (Windows) Name of the Snappy DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "snappy-.*" "SNAPPY_HINTS" )
find_package(PkgConfig)
pkg_search_module(SNAPPY libsnappy)
find_path(SNAPPY_INCLUDE_DIR
NAMES snappy.h
- HINTS "${SNAPPY_INCLUDEDIR}"
+ HINTS "${SNAPPY_INCLUDEDIR}" "${SNAPPY_HINTS}/include"
/usr/include
/usr/local/include
)
find_library(SNAPPY_LIBRARY
NAMES snappy
- HINTS "${SNAPPY_LIBDIR}"
+ HINTS "${SNAPPY_LIBDIR}" "${SNAPPY_HINTS}/lib"
PATHS
/usr/lib
/usr/local/lib
@@ -30,6 +35,19 @@ find_package_handle_standard_args( SNAPPY DEFAULT_MSG SNAPPY_INCLUDE_DIR SNAPPY_
if( SNAPPY_FOUND )
set( SNAPPY_INCLUDE_DIRS ${SNAPPY_INCLUDE_DIR} )
set( SNAPPY_LIBRARIES ${SNAPPY_LIBRARY} )
+ if (WIN32)
+ set ( SNAPPY_DLL_DIR "${SNAPPY_HINTS}/bin"
+ CACHE PATH "Path to Snappy DLL"
+ )
+ file( GLOB _snappy_dll RELATIVE "${SNAPPY_DLL_DIR}"
+ "${SNAPPY_DLL_DIR}/libsnappy-*.dll"
+ )
+ set ( SNAPPY_DLL ${_snappy_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "Snappy DLL file name"
+ )
+ mark_as_advanced( SNAPPY_DLL_DIR SNAPPY_DLL )
+ endif()
else()
set( SNAPPY_INCLUDE_DIRS )
set( SNAPPY_LIBRARIES )
diff --git a/epan/dissectors/packet-cql.c b/epan/dissectors/packet-cql.c
index c524c3b684..b758b952d6 100644
--- a/epan/dissectors/packet-cql.c
+++ b/epan/dissectors/packet-cql.c
@@ -734,10 +734,10 @@ dissect_cql_tcp_pdu(tvbuff_t* raw_tvb, packet_info* pinfo, proto_tree* tree, voi
}
/* if the decompression succeeded build the new tvb */
if (ret == SNAPPY_OK) {
- tvb = tvb_new_child_real_data(raw_tvb, decompressed_buffer, orig_size, orig_size);
+ tvb = tvb_new_child_real_data(raw_tvb, decompressed_buffer, (guint32)orig_size, (guint32)orig_size);
add_new_data_source(pinfo, tvb, "Decompressed Data");
compression_level = CQL_COMPRESSION_SNAPPY;
- message_length= orig_size;
+ message_length = (guint32)orig_size;
}
}
#endif
diff --git a/packaging/nsis/CMakeLists.txt b/packaging/nsis/CMakeLists.txt
index 341f01828d..1fcec3f496 100644
--- a/packaging/nsis/CMakeLists.txt
+++ b/packaging/nsis/CMakeLists.txt
@@ -131,7 +131,8 @@ set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh")
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
foreach(_dll ${GLIB2_DLLS} ${CARES_DLL} ${GCRYPT_DLLS} ${GEOIP_DLL}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLL} ${LUA_DLL}
- ${NGHTTP2_DLL} ${SMI_DLL} ${WINSPARKLE_DLL} ${ZLIB_DLL}
+ ${LZ4_DLL} ${NGHTTP2_DLL} ${SMI_DLL} ${SNAPPY_DLL}
+ ${WINSPARKLE_DLL} ${ZLIB_DLL}
)
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
diff --git a/packaging/wix/CMakeLists.txt b/packaging/wix/CMakeLists.txt
index d497f603d2..99b3ecdea1 100644
--- a/packaging/wix/CMakeLists.txt
+++ b/packaging/wix/CMakeLists.txt
@@ -123,7 +123,8 @@ file(APPEND "${_all_manifest_wix}" " <DirectoryRef Id=\"INSTALLFOLDER\">\n")
SET(unique_component "")
foreach(_dll ${GLIB2_DLLS} ${CARES_DLL} ${GCRYPT_DLLS} ${GEOIP_DLL}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLL} ${LUA_DLL}
- ${NGHTTP2_DLL} ${SMI_DLL} ${WINSPARKLE_DLL} ${ZLIB_DLL}
+ ${LZ4_DLL} ${NGHTTP2_DLL} ${SMI_DLL} ${SNAPPY_DLL}
+ ${WINSPARKLE_DLL} ${ZLIB_DLL}
)
#ensure uniqueness of files
IF(NOT "${unique_component}" MATCHES "(^|;)${_dll}(;|$)")
@@ -147,7 +148,8 @@ file(APPEND "${_all_manifest_wix}" " <ComponentGroup Id=\"CG.RequiredDependen
SET(unique_file "")
foreach(_dll ${GLIB2_DLLS} ${CARES_DLL} ${GCRYPT_DLLS} ${GEOIP_DLL}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLL} ${LUA_DLL}
- ${NGHTTP2_DLL} ${SMI_DLL} ${WINSPARKLE_DLL} ${ZLIB_DLL}
+ ${LZ4_DLL} ${NGHTTP2_DLL} ${SMI_DLL} ${SNAPPY_DLL}
+ ${WINSPARKLE_DLL} ${ZLIB_DLL}
)
#ensure uniqueness of files
IF(NOT "${unique_file}" MATCHES "(^|;)${_dll}(;|$)")
diff --git a/tools/win-setup.ps1 b/tools/win-setup.ps1
index 4894e6ec5b..d205a48cff 100644
--- a/tools/win-setup.ps1
+++ b/tools/win-setup.ps1
@@ -99,8 +99,8 @@ Param(
# trouble instead of trying to catch exceptions everywhere.
$ErrorActionPreference = "Stop"
-$Win64CurrentTag = "2016-09-29"
-$Win32CurrentTag = "2016-09-29"
+$Win64CurrentTag = "2016-10-17"
+$Win32CurrentTag = "2016-10-17"
# Archive file / subdir.
$Win64Archives = @{
@@ -113,9 +113,11 @@ $Win64Archives = @{
"libsmi-svn-40773-win64ws.zip" = "";
"libssh-0.7.2-win64ws.zip" = "";
"lua-5.2.4_Win64_dllw4_lib.zip" = "lua5.2.4";
+ "lz4-r131-win64ws.zip" = "";
"nasm-2.09.08-win32.zip" = "";
"nghttp2-1.14.0-win64ws.zip" = "";
"portaudio_v19_2.zip" = "";
+ "snappy-1.1.3-win64ws.zip" = "";
"upx303w.zip" = "";
"WinSparkle-0.3-44-g2c8d9d3-win64ws.zip" = "";
"WpdPack_4_1_2.zip" = "";
@@ -132,9 +134,11 @@ $Win32Archives = @{
"libsmi-svn-40773-win32ws.zip" = "";
"libssh-0.7.2-win32ws.zip" = "";
"lua-5.2.4_Win32_dllw4_lib.zip" = "lua5.2.4";
+ "lz4-r131-win32ws.zip" = "";
"nasm-2.09.08-win32.zip" = "";
"nghttp2-1.14.0-win32ws.zip" = "";
"portaudio_v19_2.zip" = "";
+ "snappy-1.1.3-win32ws.zip" = "";
"upx303w.zip" = "";
"WinSparkle-0.3-44-g2c8d9d3-win32ws.zip" = "";
"WpdPack_4_1_2.zip" = "";
@@ -173,15 +177,17 @@ $CleanupItems = @(
"kfw-3-2-2-final"
"kfw-3-2-2-i386-ws-vc6"
"kfw-3-2-2-x64-ws"
- "lua5.1.4"
- "lua5.2.?"
"libsmi-0.4.8"
"libsmi-svn-40773-win??ws"
"libssh-0.7.2-win??ws"
+ "lua5.1.4"
+ "lua5.2.?"
+ "lz4-r131-win??ws"
"nasm-2.09.08"
"nghttp2-*-win??ws"
"portaudio_v19"
"portaudio_v19_2"
+ "snappy-1.1.3-win??ws"
"upx301w"
"upx303w"
"user-guide"