add wss transport and fix tipc tests when building using cmake on linux (#3857)

* Allow CMAKE to generate ws and wss transports
I guess there is little use of just ws transport, so by default
GnuTLS (and libsodium) are enabled

* cmake libzmq including wss transport (ubuntu 19.10 and ubuntu 19.10 + wsl 1.0)
test_security_fails (libsodium assert !?)

* updated relicense

* make external libs gnutls nss sodium optional

* #ifdef WSS classes and functions, build test*ws* only if correct libs are included, warning if libs not present

* make libsodium optional

* cmake fix tests TIPC transport

* clang-format pointed out a wrongly placed #ifdef

* GnuTLS before 3.6.7 is not safe

* msvc doesn't agree with strlen in array declaration, test_socks now at least compiles on windows

* windows: libsodium build fails, missing include dirs set by env var

* ws transport test only works when GnuTLS is found

* Fixed condition to use NSS / built in SHA1, so that test_ws_transport should now pass, also when GnuTLS is not found
This commit is contained in:
grmt 2020-04-14 00:03:19 +02:00 committed by GitHub
parent 7276b6809a
commit 718ad8ab96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 1286 additions and 1164 deletions

2
.gitignore vendored
View File

@ -26,6 +26,8 @@ build/
builds/android/prefix
## IntelliJ
.idea/
## Visual Code
.vscode/
## other results-like folders
bin/
lib/

File diff suppressed because it is too large Load Diff

13
RELICENSE/grmt.md Normal file
View File

@ -0,0 +1,13 @@
# Permission to Relicense under MPLv2
This is a statement by grmt.
that grants permission to relicense its copyrights in the libzmq C++
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2).
A portion of the commits made by the Github handle "grmt", with
commit author "grmt", are copyright of grmt.
This document hereby grants the libzmq project team to relicense libzmq,
including all past, present and future contributions of the author listed above.
grmt (garmt.noname@gmail.com)
2020/05/04

View File

@ -4,7 +4,7 @@
################################################################################
if (NOT MSVC)
include(FindPkgConfig)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_SODIUM "libsodium")
if (PC_SODIUM_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} libsodium")
@ -39,7 +39,7 @@ find_library(
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
find_package_handle_standard_args(sodium DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
################################################################################

View File

@ -59,14 +59,19 @@
#cmakedefine ZMQ_USE_BUILTIN_SHA1
#cmakedefine ZMQ_USE_NSS
#cmakedefine ZMQ_HAVE_WS
#cmakedefine ZMQ_HAVE_WSS
#cmakedefine ZMQ_HAVE_TIPC
#cmakedefine ZMQ_HAVE_OPENPGM
#cmakedefine ZMQ_MAKE_VALGRIND_HAPPY
#cmakedefine ZMQ_BUILD_DRAFT_API
#cmakedefine ZMQ_HAVE_CURVE
#cmakedefine ZMQ_USE_TWEETNACL
#cmakedefine ZMQ_USE_LIBSODIUM
#cmakedefine SODIUM_STATIC
#cmakedefine ZMQ_USE_GNUTLS
#cmakedefine ZMQ_USE_RADIX_TREE
#ifdef _AIX
#define ZMQ_HAVE_AIX

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- These values are populated into the package.gsl templates by package.bat. -->
<!-- The target attribute controls path and file name only, id controls package naming. -->
<package id="libzmq-vc120" target="libzmq" version = "4.2.3.0" pathversion="4_2_3_0" platformtoolset="v120">
<package id="libzmq-vc142" target="libzmq" version = "4.2.3.0" pathversion="4_2_3_0" platformtoolset="v142">
<!--<dependency id="libsodium_vc120" version="1.0.12.0" />-->
</package>

View File

@ -1,98 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>libzmq-vc120</id>
<version>4.2.3.0</version>
<title>libzmq-vc120</title>
<authors>libzmq contributors</authors>
<owners>Eric Voskuil</owners>
<licenseUrl>https://raw.github.com/zeromq/libzmq/master/COPYING.LESSER</licenseUrl>
<projectUrl>https://github.com/zeromq/libzmq</projectUrl>
<iconUrl>https://avatars1.githubusercontent.com/u/109777?s=32</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<description>The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products. 0MQ sockets provide an abstraction of asynchronous message queues, multiple messaging patterns, message filtering (subscriptions), seamless access to multiple transport protocols and more.</description>
<summary>The 0MQ lightweight messaging kernel, with tweetnacl integrated, packaged for specific Visual Studio compiler.</summary>
<releaseNotes>https://raw.github.com/zeromq/libzmq/master/NEWS</releaseNotes>
<copyright>GNU Lesser GPL v3</copyright>
<tags>native, libzmq, zmq, 0MQ, messaging, sockets, C++</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<!-- include -->
<file src="..\..\include\*.h" target="build\native\include" />
<file src="..\..\builds\msvc\platform.hpp" target="build\native\include" />
<!-- targets -->
<file src="package.targets" target="build\native\libzmq-vc120.targets" />
<file src="package.xml" target="build\native\package.xml" />
<!-- docs -->
<!-- Documents (.*) -->
<!--<file src="..\..\docs\*" target="build\native\docs" />-->
<!-- libraries -->
<!-- x86 Dynamic libraries (.dll) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.dll" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.dll" />
<!-- x86 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.pdb" />
<!-- x86 Import libraries (.imp.lib) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.imp.lib" />
<!-- x86 Export libraries (.exp) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.exp" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.exp" />
<!-- x86 Static libraries (.lib) -->
<file src="..\..\bin\Win32\Release\v120\static\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\Win32\Debug\v120\static\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-sgd-4_2_3_0.lib" />
<!-- x86 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-sgd-4_2_3_0.ltcg.lib" />
<!-- x64 Dynamic libraries (.dll) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.dll" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.dll" />
<!-- x64 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.pdb" />
<!-- x64 Import libraries (.imp.lib) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.imp.lib" />
<!-- x64 Export libraries (.exp) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.exp" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.exp" />
<!-- x64 Static libraries (.lib) -->
<file src="..\..\bin\x64\Release\v120\static\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\x64\Debug\v120\static\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-sgd-4_2_3_0.lib" />
<!-- x64 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-sgd-4_2_3_0.ltcg.lib" />
</files>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</package>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>libzmq-vc142</id>
<version>4.2.3.0</version>
<title>libzmq-vc142</title>
<authors>libzmq contributors</authors>
<owners>Eric Voskuil</owners>
<licenseUrl>https://raw.github.com/zeromq/libzmq/master/COPYING.LESSER</licenseUrl>
<projectUrl>https://github.com/zeromq/libzmq</projectUrl>
<iconUrl>https://avatars1.githubusercontent.com/u/109777?s=32</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<description>The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products. 0MQ sockets provide an abstraction of asynchronous message queues, multiple messaging patterns, message filtering (subscriptions), seamless access to multiple transport protocols and more.</description>
<summary>The 0MQ lightweight messaging kernel, with tweetnacl integrated, packaged for specific Visual Studio compiler.</summary>
<releaseNotes>https://raw.github.com/zeromq/libzmq/master/NEWS</releaseNotes>
<copyright>GNU Lesser GPL v3</copyright>
<tags>native, libzmq, zmq, 0MQ, messaging, sockets, C++</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<!-- include -->
<file src="..\..\include\*.h" target="build\native\include" />
<file src="..\..\builds\msvc\platform.hpp" target="build\native\include" />
<!-- targets -->
<file src="package.targets" target="build\native\libzmq-vc142.targets" />
<file src="package.xml" target="build\native\package.xml" />
<!-- docs -->
<!-- Documents (.*) -->
<!--<file src="..\..\docs\*" target="build\native\docs" />-->
<!-- libraries -->
<!-- x86 Dynamic libraries (.dll) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.dll" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.dll" />
<!-- x86 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.pdb" />
<!-- x86 Import libraries (.imp.lib) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.imp.lib" />
<!-- x86 Export libraries (.exp) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.exp" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.exp" />
<!-- x86 Static libraries (.lib) -->
<file src="..\..\bin\Win32\Release\v142\static\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\Win32\Debug\v142\static\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-sgd-4_2_3_0.lib" />
<!-- x86 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-sgd-4_2_3_0.ltcg.lib" />
<!-- x64 Dynamic libraries (.dll) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.dll" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.dll" />
<!-- x64 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.pdb" />
<!-- x64 Import libraries (.imp.lib) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.imp.lib" />
<!-- x64 Export libraries (.exp) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.exp" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.exp" />
<!-- x64 Static libraries (.lib) -->
<file src="..\..\bin\x64\Release\v142\static\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\x64\Debug\v142\static\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-sgd-4_2_3_0.lib" />
<!-- x64 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-sgd-4_2_3_0.ltcg.lib" />
</files>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</package>

View File

@ -1,129 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- user interface -->
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)package.xml" />
</ItemGroup>
<!-- general -->
<ItemDefinitionGroup>
<ClCompile>
<!-- ZMQ_USE_TWEETNACL defined in packaged builds and must be defined for package consumer. -->
<PreprocessorDefinitions>ZMQ_USE_TWEETNACL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Linkage-libzmq)' == 'static' Or '$(Linkage-libzmq)' == 'ltcg'">
<ClCompile>
<PreprocessorDefinitions>ZMQ_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<!-- static libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- static ltcg libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic import libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic libraries with debug symbols -->
<Target Name="libzmq_AfterBuild" AfterTargets="AfterBuild" />
<Target Name="libzmq_AfterBuild_Win32_v120_Dynamic_Release"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_Win32_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<Target Name="libzmq_AfterBuild_x64_v120_Dynamic_Release"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_x64_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- user interface -->
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)package.xml" />
</ItemGroup>
<!-- general -->
<ItemDefinitionGroup>
<ClCompile>
<!-- ZMQ_USE_TWEETNACL defined in packaged builds and must be defined for package consumer. -->
<PreprocessorDefinitions>ZMQ_USE_TWEETNACL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Linkage-libzmq)' == 'static' Or '$(Linkage-libzmq)' == 'ltcg'">
<ClCompile>
<PreprocessorDefinitions>ZMQ_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<!-- static libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- static ltcg libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic import libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic libraries with debug symbols -->
<Target Name="libzmq_AfterBuild" AfterTargets="AfterBuild" />
<Target Name="libzmq_AfterBuild_Win32_v142_Dynamic_Release"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_Win32_v142_Dynamic_Debug"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<Target Name="libzmq_AfterBuild_x64_v142_Dynamic_Release"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_x64_v142_Dynamic_Debug"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</Project>

View File

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="Linkage-libzmq-uiextension" PageTemplate="tool" DisplayName="NuGet Dependencies" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="libzmq" DisplayName="libzmq" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Linkage-libzmq" DisplayName="Linkage" Description="How NuGet libzmq will be linked into the output of this project" Category="libzmq">
<EnumValue Name="" DisplayName="Not linked" />
<EnumValue Name="dynamic" DisplayName="Dynamic (DLL)" />
<EnumValue Name="static" DisplayName="Static (LIB)" />
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="Linkage-libzmq-uiextension" PageTemplate="tool" DisplayName="NuGet Dependencies" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="libzmq" DisplayName="libzmq" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Linkage-libzmq" DisplayName="Linkage" Description="How NuGet libzmq will be linked into the output of this project" Category="libzmq">
<EnumValue Name="" DisplayName="Not linked" />
<EnumValue Name="dynamic" DisplayName="Dynamic (DLL)" />
<EnumValue Name="static" DisplayName="Static (LIB)" />
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
</ProjectSchemaDefinitions>

View File

@ -46,7 +46,9 @@ class ctx_t;
class tcp_address_t;
class udp_address_t;
class ws_address_t;
#ifdef ZMQ_HAVE_WSS
class wss_address_t;
#endif
#if defined ZMQ_HAVE_IPC
class ipc_address_t;
#endif
@ -107,6 +109,8 @@ struct address_t
udp_address_t *udp_addr;
#ifdef ZMQ_HAVE_WS
ws_address_t *ws_addr;
#endif
#ifdef ZMQ_HAVE_WSS
wss_address_t *wss_addr;
#endif
#if defined ZMQ_HAVE_IPC

View File

@ -112,7 +112,8 @@ f_compatible_get_tick_count64 init_compatible_get_tick_count64 ()
func = compatible_get_tick_count64;
#if !defined ZMQ_HAVE_WINDOWS_UWP
::FreeLibrary (module);
if (module != NULL)
::FreeLibrary (module);
#endif
return func;

View File

@ -54,8 +54,9 @@
#include "ipc_listener.hpp"
#include "tipc_listener.hpp"
#include "tcp_connecter.hpp"
#ifdef ZMQ_HAVE_WS
#include "ws_address.hpp"
#include "wss_address.hpp"
#endif
#include "io_thread.hpp"
#include "session_base.hpp"
#include "config.hpp"
@ -72,6 +73,9 @@
#include "mailbox.hpp"
#include "mailbox_safe.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_address.hpp"
#endif
#if defined ZMQ_HAVE_VMCI
#include "vmci_address.hpp"
#include "vmci_listener.hpp"

View File

@ -71,7 +71,7 @@ class stream_engine_base_t : public io_object_t, public i_engine
// i_poll_events interface implementation.
void in_event () ZMQ_FINAL;
void out_event () ZMQ_FINAL;
void out_event ();
void timer_event (int id_) ZMQ_FINAL;
protected:

View File

@ -39,12 +39,12 @@
#include "tcp.hpp"
#include "address.hpp"
#include "ws_address.hpp"
#include "wss_address.hpp"
#include "session_base.hpp"
#include "ws_engine.hpp"
#include "session_base.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_engine.hpp"
#include "wss_address.hpp"
#endif
#if !defined ZMQ_HAVE_WINDOWS
@ -120,8 +120,12 @@ void zmq::ws_connecter_t::out_event ()
}
if (_wss)
#ifdef ZMQ_HAVE_WSS
create_engine (fd,
get_socket_name<wss_address_t> (fd, socket_end_local));
#else
assert (false);
#endif
else
create_engine (fd,
get_socket_name<ws_address_t> (fd, socket_end_local));
@ -190,7 +194,7 @@ int zmq::ws_connecter_t::open ()
unblock_socket (_s);
// Connect to the remote peer.
#if defined ZMQ_HAVE_VXWORKS
#ifdef ZMQ_HAVE_VXWORKS
int rc = ::connect (_s, (sockaddr *) tcp_addr.addr (), tcp_addr.addrlen ());
#else
const int rc = ::connect (_s, tcp_addr.addr (), tcp_addr.addrlen ());

View File

@ -128,7 +128,7 @@ zmq::ws_engine_t::ws_engine_t (fd_t fd_,
{
memset (_websocket_key, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_accept, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_protocol, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_protocol, 0, 256);
_next_msg = &ws_engine_t::next_handshake_command;
_process_msg = &ws_engine_t::process_handshake_command;
@ -488,7 +488,7 @@ bool zmq::ws_engine_t::server_handshake ()
// Sec-WebSocket-Protocol can appear multiple times or be a comma separated list
// if _websocket_protocol is already set we skip the check
if (_websocket_protocol[0] == '\0') {
char *rest;
char *rest = 0;
char *p = strtok_r (_header_value, ",", &rest);
while (p != NULL) {
if (*p == ' ')

View File

@ -124,7 +124,7 @@ typedef enum
client_handshake_error = -1
} ws_client_handshake_state_t;
class ws_engine_t ZMQ_FINAL : public stream_engine_base_t
class ws_engine_t : public stream_engine_base_t
{
public:
ws_engine_t (fd_t fd_,

View File

@ -42,11 +42,11 @@
#include "socket_base.hpp"
#include "address.hpp"
#include "ws_engine.hpp"
#include "wss_address.hpp"
#include "session_base.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_engine.hpp"
#include "wss_address.hpp"
#endif
#ifndef ZMQ_HAVE_WINDOWS
@ -126,9 +126,11 @@ std::string zmq::ws_listener_t::get_socket_name (zmq::fd_t fd_,
{
std::string socket_name;
#ifdef ZMQ_HAVE_WSS
if (_wss)
socket_name = zmq::get_socket_name<wss_address_t> (fd_, socket_end_);
else
#endif
socket_name = zmq::get_socket_name<ws_address_t> (fd_, socket_end_);
return socket_name + _address.path ();
@ -313,6 +315,7 @@ void zmq::ws_listener_t::create_engine (fd_t fd_)
else
engine = new (std::nothrow)
ws_engine_t (fd_, options, endpoint_pair, _address, false);
alloc_assert (engine);
// Choose I/O thread to run connecter in. Given that we are already

View File

@ -34,7 +34,7 @@
#include "ws_address.hpp"
#include "stream_listener_base.hpp"
#if ZMQ_USE_GNUTLS
#ifdef ZMQ_USE_GNUTLS
#include <gnutls/gnutls.h>
#endif
@ -73,7 +73,7 @@ class ws_listener_t ZMQ_FINAL : public stream_listener_base_t
ws_address_t _address;
bool _wss;
#if ZMQ_HAVE_WSS
#ifdef ZMQ_HAVE_WSS
gnutls_certificate_credentials_t _tls_cred;
#endif

View File

@ -5,110 +5,102 @@ cmake_minimum_required(VERSION "2.8.1")
project(tests)
set(tests
test_ancillaries
test_system
test_pair_inproc
test_pair_tcp
test_reqrep_inproc
test_reqrep_tcp
test_hwm
test_hwm_pubsub
test_reqrep_device
test_sub_forward
test_invalid_rep
test_msg_flags
test_msg_ffn
test_connect_resolve
test_immediate
test_last_endpoint
test_term_endpoint
test_router_mandatory
test_probe_router
test_stream
test_stream_empty
test_stream_disconnect
test_disconnect_inproc
test_unbind_wildcard
test_ctx_options
test_ctx_destroy
test_security_no_zap_handler
test_security_null
test_security_plain
test_security_zap
test_iov
test_spec_req
test_spec_rep
test_spec_dealer
test_spec_router
test_spec_pushpull
test_req_correlate
test_req_relaxed
test_conflate
test_inproc_connect
test_issue_566
test_shutdown_stress
test_timeo
test_many_sockets
test_diffserv
test_connect_rid
test_xpub_nodrop
test_pub_invert_matching
test_setsockopt
test_sockopt_hwm
test_heartbeats
test_atomics
test_bind_src_address
test_capabilities
test_metadata
test_router_handover
test_srcfd
test_stream_timeout
test_xpub_manual
test_xpub_welcome_msg
test_xpub_verbose
test_base85
test_bind_after_connect_tcp
test_sodium
test_monitor
test_socket_null
test_reconnect_ivl
test_mock_pub_sub
)
test_ancillaries
test_system
test_pair_inproc
test_pair_tcp
test_reqrep_inproc
test_reqrep_tcp
test_hwm
test_hwm_pubsub
test_reqrep_device
test_sub_forward
test_invalid_rep
test_msg_flags
test_msg_ffn
test_connect_resolve
test_immediate
test_last_endpoint
test_term_endpoint
test_router_mandatory
test_probe_router
test_stream
test_stream_empty
test_stream_disconnect
test_disconnect_inproc
test_unbind_wildcard
test_ctx_options
test_ctx_destroy
test_security_no_zap_handler
test_security_null
test_security_plain
test_security_zap
test_iov
test_spec_req
test_spec_rep
test_spec_dealer
test_spec_router
test_spec_pushpull
test_req_correlate
test_req_relaxed
test_conflate
test_inproc_connect
test_issue_566
test_shutdown_stress
test_timeo
test_many_sockets
test_diffserv
test_connect_rid
test_xpub_nodrop
test_pub_invert_matching
test_setsockopt
test_sockopt_hwm
test_heartbeats
test_atomics
test_bind_src_address
test_capabilities
test_metadata
test_router_handover
test_srcfd
test_stream_timeout
test_xpub_manual
test_xpub_welcome_msg
test_xpub_verbose
test_base85
test_bind_after_connect_tcp
test_sodium
test_monitor
test_socket_null
test_reconnect_ivl
test_mock_pub_sub)
if(NOT WIN32)
list(APPEND tests
test_security_gssapi)
list(APPEND tests test_security_gssapi test_socks)
endif()
if(ZMQ_HAVE_CURVE)
list(APPEND tests
test_security_curve)
list(APPEND tests test_security_curve)
endif()
option(ENABLE_CAPSH "Run tests that require sudo and capsh (for cap_net_admin)" OFF)
if(ENABLE_CAPSH)
find_program(CAPSH_PROGRAM NAMES capsh)
if (CAPSH_PROGRAM)
list(APPEND tests
test_pair_tcp_cap_net_admin
)
if(CAPSH_PROGRAM)
list(APPEND tests test_pair_tcp_cap_net_admin)
else()
message(STATUS "capsh not found, skipping tests that require CAP_NET_ADMIN")
message(STATUS "capsh not found, skipping tests that require CAP_NET_ADMIN")
endif()
endif()
if(ZMQ_HAVE_IPC)
list(APPEND tests
test_ipc_wildcard
test_pair_ipc
test_reqrep_ipc
test_rebind_ipc
)
list(APPEND tests test_ipc_wildcard test_pair_ipc test_reqrep_ipc test_rebind_ipc)
endif()
if(NOT WIN32)
list(APPEND tests
list(
APPEND
tests
test_proxy
test_proxy_hwm
test_proxy_single_socket
@ -118,17 +110,16 @@ if(NOT WIN32)
test_stream_exceeds_buffer
test_router_mandatory_hwm
test_use_fd
test_zmq_poll_fd
)
test_zmq_poll_fd)
if(HAVE_FORK)
list(APPEND tests test_fork)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND tests
test_abstract_ipc
)
list(APPEND tests test_abstract_ipc)
if(ZMQ_HAVE_TIPC)
list(APPEND tests
list(
APPEND
tests
test_address_tipc
test_pair_tipc
test_reqrep_device_tipc
@ -137,21 +128,19 @@ if(NOT WIN32)
test_sub_forward_tipc
test_connect_delay_tipc
test_shutdown_stress_tipc
test_term_endpoint_tipc
)
test_term_endpoint_tipc)
endif()
endif()
endif()
if(WITH_VMCI)
list(APPEND tests
test_pair_vmci
test_reqrep_vmci
)
list(APPEND tests test_pair_vmci test_reqrep_vmci)
endif()
if(ENABLE_DRAFTS)
list(APPEND tests
list(
APPEND
tests
test_poller
test_thread_safe
test_client_server
@ -164,8 +153,14 @@ if(ENABLE_DRAFTS)
test_xpub_manual_last_value
test_peer
test_reconnect_options
test_msg_init
)
test_msg_init)
endif()
if(ZMQ_HAVE_WS)
list(APPEND tests test_ws_transport)
if(ZMQ_HAVE_WSS)
list(APPEND tests test_wss_transport)
endif()
endif()
# add location of platform.hpp for Windows builds
@ -176,12 +171,11 @@ if(WIN32)
link_libraries(ws2_32.lib)
endif()
add_library(unity STATIC
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
add_library(
unity STATIC
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c" "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
set_target_properties(unity PROPERTIES
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
set_target_properties(unity PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
target_compile_definitions(unity PUBLIC "UNITY_USE_COMMAND_LINE_ARGS" "UNITY_EXCLUDE_FLOAT")
target_include_directories(unity PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
@ -193,22 +187,21 @@ set(TESTUTIL_SOURCES
testutil_security.cpp
testutil_security.hpp
testutil_unity.cpp
testutil_unity.hpp
)
testutil_unity.hpp)
if(BUILD_STATIC)
add_library(testutil-static STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil-static libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
add_library(testutil-static STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil-static libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
endif()
if(BUILD_SHARED)
add_library(testutil STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
add_library(testutil STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
endif()
if(BUILD_STATIC AND NOT BUILD_SHARED)
# use testutil-static for both tests and unit tests
set(TESTUTIL_LIB testutil-static)
# use testutil-static for both tests and unit tests
set(TESTUTIL_LIB testutil-static)
else()
# use testutil for tests and testutil-static for unit tests
set(TESTUTIL_LIB testutil)
# use testutil for tests and testutil-static for unit tests
set(TESTUTIL_LIB testutil)
endif()
if(MSVC_VERSION LESS 1700)
@ -228,18 +221,14 @@ endif()
foreach(test ${tests})
# target_sources not supported before CMake 3.1
if(ZMQ_HAVE_CURVE AND ${test} MATCHES test_security_curve)
add_executable(${test} ${test}.cpp
"../src/tweetnacl.c"
"../src/err.cpp"
"../src/random.cpp"
"../src/clock.cpp")
add_executable(${test} ${test}.cpp "../src/tweetnacl.c" "../src/err.cpp" "../src/random.cpp" "../src/clock.cpp")
else()
add_executable(${test} ${test}.cpp)
endif()
target_link_libraries(${test} ${TESTUTIL_LIB})
if(WIN32)
# This is the output for Debug dynamic builds on Visual Studio 6.0
# You should provide the correct directory, don't know how to do it automatically
# This is the output for Debug dynamic builds on Visual Studio 6.0 You should provide the correct directory, don't
# know how to do it automatically
find_path(LIBZMQ_PATH "libzmq.lib" PATHS "../bin/Win32/Debug/v120/dynamic")
if(NOT ${LIBZMQ_PATH} STREQUAL "LIBZMQ_PATH-NOTFOUND")
set_target_properties(${test} PROPERTIES LINK_FLAGS "/LIBPATH:${LIBZMQ_PATH}")
@ -261,9 +250,12 @@ foreach(test ${tests})
endif()
if(WIN32)
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
add_test(
NAME ${test}
WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMMAND ${test})
else()
if (${test} MATCHES "_cap_net_admin")
if(${test} MATCHES "_cap_net_admin")
add_test(NAME ${test} COMMAND sh -c "sudo ${CAPSH_PROGRAM} --caps=cap_net_admin+eip -- -c $<TARGET_FILE:${test}>")
else()
add_test(NAME ${test} COMMAND ${test})
@ -273,7 +265,7 @@ foreach(test ${tests})
set_tests_properties(${test} PROPERTIES SKIP_RETURN_CODE 77)
endforeach()
#override timeout for these tests
# override timeout for these tests
if(ZMQ_HAVE_CURVE)
set_tests_properties(test_security_curve PROPERTIES TIMEOUT 60)
endif()
@ -287,8 +279,7 @@ if(WIN32 AND ENABLE_DRAFTS)
set_tests_properties(test_radio_dish PROPERTIES TIMEOUT 30)
endif()
#add additional required flags
#ZMQ_USE_TWEETNACL will already be defined when not using sodium
# add additional required flags ZMQ_USE_TWEETNACL will already be defined when not using sodium
if(ZMQ_HAVE_CURVE AND NOT ZMQ_USE_TWEETNACL)
target_compile_definitions(test_security_curve PRIVATE "-DZMQ_USE_TWEETNACL")
endif()
@ -296,7 +287,7 @@ endif()
set_tests_properties(test_security_zap PROPERTIES TIMEOUT 60)
set_tests_properties(test_reconnect_ivl PROPERTIES TIMEOUT 15)
#Check whether all tests in the current folder are present
# Check whether all tests in the current folder are present
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})

View File

@ -27,10 +27,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _WIN32
#include "../src/windows.hpp"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -104,7 +109,12 @@ void *setup_socks_server (char *socks_server_address,
TEST_ASSERT_NOT_EQUAL (-1, server_fd);
int flag = 1;
int res;
#ifdef _WIN32
res = setsockopt (server_fd, SOL_SOCKET, SO_REUSEADDR, (const char *) &flag,
sizeof (int));
#else
res = setsockopt (server_fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int));
#endif
TEST_ASSERT_SUCCESS_RAW_ERRNO (res);
struct sockaddr_in saddr = bind_bsd_socket (server_fd);
int nbytes = snprintf (socks_server_address, socks_server_address_len,

View File

@ -35,18 +35,27 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_roundtrip ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/roundtrip")];
char bind_address[MAX_SOCKET_STRING];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, bind_address, &addr_length));
// Windows can't connect to 0.0.0.0
sprintf (connect_address, "ws://127.0.0.1%s", strrchr (bind_address, ':'));
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, connect_address));
bounce (sb, sc);
TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (sc, connect_address));
TEST_ASSERT_SUCCESS_ERRNO (zmq_unbind (sb, bind_address));
test_context_socket_close (sc);
test_context_socket_close (sb);
}
@ -56,7 +65,7 @@ void test_roundtrip_without_path ()
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
@ -72,10 +81,10 @@ void test_roundtrip_without_path ()
void test_heartbeat ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/heartbeat")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/heartbeat"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/heartbeat"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
@ -105,10 +114,10 @@ void test_heartbeat ()
void test_short_message ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/short")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/short"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/short"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
@ -138,10 +147,10 @@ void test_short_message ()
void test_large_message ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/large")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/large"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/large"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
@ -172,7 +181,7 @@ void test_large_message ()
void test_curve ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/roundtrip")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
char client_public[41];
char client_secret[41];
@ -190,7 +199,7 @@ void test_curve ()
zmq_setsockopt (server, ZMQ_CURVE_SERVER, &as_server, sizeof (int)));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_setsockopt (server, ZMQ_CURVE_SECRETKEY, server_secret, 41));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (server, "ws://*:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (server, "ws://127.0.0.1:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_getsockopt (server, ZMQ_LAST_ENDPOINT,
connect_address, &addr_length));
@ -212,10 +221,10 @@ void test_curve ()
void test_mask_shared_msg ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/mask-shared")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_DEALER);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/mask-shared"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/mask-shared"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
@ -268,8 +277,8 @@ int main ()
setup_test_environment ();
UNITY_BEGIN ();
RUN_TEST (test_roundtrip);
RUN_TEST (test_roundtrip_without_path);
RUN_TEST (test_roundtrip);
RUN_TEST (test_short_message);
RUN_TEST (test_large_message);
RUN_TEST (test_heartbeat);

View File

@ -2,19 +2,15 @@
cmake_minimum_required(VERSION "2.8.1")
set(unittests
unittest_ypipe
unittest_poller
unittest_mtrie
unittest_ip_resolver
unittest_udp_address
unittest_radix_tree
unittest_curve_encoding
)
unittest_ypipe
unittest_poller
unittest_mtrie
unittest_ip_resolver
unittest_udp_address
unittest_radix_tree
unittest_curve_encoding)
#if(ENABLE_DRAFTS)
# list(APPEND tests
# )
#endif(ENABLE_DRAFTS)
# if(ENABLE_DRAFTS) list(APPEND tests ) endif(ENABLE_DRAFTS)
# add location of platform.hpp for Windows builds
if(WIN32)
@ -48,7 +44,10 @@ foreach(test ${unittests})
endif()
if(WIN32)
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
add_test(
NAME ${test}
WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMMAND ${test})
else()
add_test(NAME ${test} COMMAND ${test})
endif()
@ -61,8 +60,8 @@ foreach(test ${unittests})
set_target_properties(${test} PROPERTIES LINK_LIBRARIES "${LIBS}")
endforeach()
#Check whether all tests in the current folder are present
#TODO duplicated with tests/CMakeLists.txt, define as a function?
# Check whether all tests in the current folder are present TODO duplicated with tests/CMakeLists.txt, define as a
# function?
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})