diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 00000000..d87f5e52 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,65 @@ +name: build-and-test +on: [ push, workflow_dispatch ] + +jobs: + job: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + - os: windows-latest + triplet: x64-windows + - os: ubuntu-latest + triplet: x64-linux + - os: macos-latest + triplet: x64-osx + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/setup-python@v2 + with: + python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + + - name: Prepare Docker. + uses: docker-practice/actions-setup-docker@master + + - name: Prepare Tools. + run: | + pip install conan + if [ "$RUNNER_OS" != "Windows" ]; then + docker pull crossbario/crossbar + fi + shell: bash + + - uses: msys2/setup-msys2@v2 + if: matrix.os == 'windows-latest' + + - name: Restore Dependency Cache. + uses: actions/cache@v2 + with: + path: | + /home/runner/.conan/data + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'conanfile.py' ) }}-${{ matrix.triplet }} + + # Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json. + - name: Build and Test. + run: | + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release + make + if [ "$RUNNER_OS" != "Windows" ]; then + ctest + fi + shell: bash \ No newline at end of file diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml deleted file mode 100644 index c19594bc..00000000 --- a/.github/workflows/ci-linux.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: Linux CI - -on: [push, pull_request] - -jobs: - ci: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - - env: - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - - strategy: - fail-fast: false - matrix: - include: - - name: ubuntu-20.04-gcc-10 - os: ubuntu-20.04 - compiler: gcc - version: "10" - - - name: ubuntu-20.04-gcc-10-conan - os: ubuntu-20.04 - compiler: gcc - version: "10" - conan: true - cmake-args: -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build - - - name: ubuntu-20.04-clang-10 - os: ubuntu-20.04 - compiler: clang - version: "10" - cmake-args: -DAUTOBAHN_USE_LIBCXX=NO - - - name: ubuntu-20.04-clang-10-conan - os: ubuntu-20.04 - compiler: clang - version: "10" - conan: true - cmake-args: -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build -DAUTOBAHN_USE_LIBCXX=NO - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Set env vars - run: | - echo "CC=${{ matrix.compiler }}-${{ matrix.version }}" >> $GITHUB_ENV - if [ "${{ matrix.compiler }}" == "clang" ]; then - echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV - else - echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV - fi - - - name: Install - run: | - python -m pip install cmake==3.22.2 conan==1.44.1 --upgrade - - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main' -y - sudo apt update - - if [ "${{ matrix.compiler }}" = "gcc" ]; then - sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib - else - sudo apt-get install -y clang-${{ matrix.version }} clang-tidy-${{ matrix.version }} g++-multilib - fi - - - name: Install dependencies (system) - run: sudo apt-get install -y libboost-all-dev libmsgpack-dev libwebsocketpp-dev - if: ${{ !matrix.conan }} - - - name: Install dependencies (conan) - run: | - conan profile new default --detect --force - conan profile update settings.compiler.libcxx=libstdc++11 default - mkdir -p build && cd build - conan install .. --build=missing - if: ${{ matrix.conan }} - - - name: Build - run: | - cmake -S . -B build ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug - cmake --build build --config Debug diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml deleted file mode 100644 index 16379e76..00000000 --- a/.github/workflows/ci-windows.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: Windows CI - -on: [push, pull_request] - -jobs: - ci: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - - env: - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - - strategy: - fail-fast: false - matrix: - include: - - name: windows-2019-cl-x86 - os: windows-2019 - generator: Visual Studio 16 2019 - type: Debug - platform: Win32 - conan_arch: x86 - - - name: windows-2019-cl-x64 - os: windows-2019 - generator: Visual Studio 16 2019 - type: Debug - platform: x64 - conan_arch: x86_64 - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install - run: | - python -m pip install cmake==3.22.2 conan==1.44.1 --upgrade - conan profile new default --detect --force - mkdir -p build && cd build - conan install .. --build=missing -s arch=${{ matrix.conan_arch }} -s build_type=${{ matrix.type }} - - - name: Build - shell: bash # CMake doesn't like paths with backslashes. - run: | - cmake -S . -B build -G "${{ matrix.generator }}" -A ${{ matrix.platform }} -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build - cmake --build build --config ${{ matrix.type }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fe07c999 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg diff --git a/CMakeLists.txt b/CMakeLists.txt index 63365a7d..22f43122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,40 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.21) project(autobahn-cpp) +if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") + message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") + file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake" + "${CMAKE_BINARY_DIR}/conan.cmake" + TLS_VERIFY ON) +endif () + +file(COPY ${CMAKE_SOURCE_DIR}/conanfile.py DESTINATION ${CMAKE_BINARY_DIR}) + +include(${CMAKE_BINARY_DIR}/conan.cmake) + +set(CMAKE_CXX_STANDARD 17) + option(AUTOBAHN_BUILD_EXAMPLES "Build examples" ON) -option(AUTOBAHN_BUILD_EXAMPLES_BOTAN "Build Botan cryptosign example" OFF) -option(AUTOBAHN_USE_LIBCXX "Use libc++ instead of libstdc++ when building with Clang" ON) +option(AUTOBAHN_TESTS "Test" ON) -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt) +conan_cmake_run(CONANFILE ${CMAKE_SOURCE_DIR}/conanfile.py + BASIC_SETUP CMAKE_TARGETS + BUILD missing) -if(AUTOBAHN_BUILD_EXAMPLES) +conan_cmake_autodetect(settings) + +conan_cmake_install(PATH_OR_REFERENCE . + BUILD missing + REMOTE conancenter + SETTINGS ${settings}) + +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt) +if (AUTOBAHN_BUILD_EXAMPLES) add_subdirectory(examples) -endif(AUTOBAHN_BUILD_EXAMPLES) +endif (AUTOBAHN_BUILD_EXAMPLES) + +if (AUTOBAHN_TESTS) + include(CTest) + add_subdirectory(test) +endif () diff --git a/autobahn/wamp_auth_utils.hpp b/autobahn/wamp_auth_utils.hpp index e3877983..4160619e 100644 --- a/autobahn/wamp_auth_utils.hpp +++ b/autobahn/wamp_auth_utils.hpp @@ -166,13 +166,7 @@ inline std::string compute_wcs( HMAC_Final(&hmac, hash, &len); HMAC_CTX_cleanup(&hmac); #else - HMAC_CTX *hmac = HMAC_CTX_new(); - if (!hmac) - return ""; - HMAC_Init_ex(hmac, key.data(), (int) key.length(), EVP_sha256(), NULL); - HMAC_Update(hmac, ( unsigned char* ) challenge.data(), challenge.length()); - HMAC_Final(hmac, hash, &len); - HMAC_CTX_free(hmac); + HMAC(EVP_sha256(), key.data(), static_cast(key.length()), reinterpret_cast(challenge.data()), challenge.length(), hash, &len); #endif std::string str_out; diff --git a/cmake/Includes/CMakeLists.txt b/cmake/Includes/CMakeLists.txt index 0e9ef287..86c0405d 100644 --- a/cmake/Includes/CMakeLists.txt +++ b/cmake/Includes/CMakeLists.txt @@ -1,157 +1,87 @@ -# AutobahnC++ cmake build script. -# -# This script uses the following environment variables (if defined): -# -# * BOOST_ROOT -# * MSGPACK_ROOT -# * WEBSOCKETPP_ROOT -# -# When those are defined, they take precedence over any host system -# installations for the respective library. When an explicit library -# root location hasn't been set, cmake will look in other places. - -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs -Wno-unknown-warning-option ${CMAKE_CXX_FLAGS}") - if(AUTOBAHN_USE_LIBCXX) - set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") - endif() - if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") - set(CMAKE_CXX_FLAGS "-fcolor-diagnostics ${CMAKE_CXX_FLAGS}") - endif() -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0") # i.e. if >= 4.9.0 - if (CMAKE_GENERATOR STREQUAL "Ninja") - set(CMAKE_CXX_FLAGS "-fdiagnostics-color=always ${CMAKE_CXX_FLAGS}") - else() - set(CMAKE_CXX_FLAGS "-fdiagnostics-color=auto ${CMAKE_CXX_FLAGS}") - endif() - endif() -endif() - -if(NOT MSVC) - # https://stackoverflow.com/a/31010221/884770 - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror -Wno-unused-variable ${CMAKE_CXX_FLAGS}") -endif() - -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") - -find_package(Threads REQUIRED) -find_package(OpenSSL REQUIRED) - -if(BUILD_SHARED_LIBS) - set(Boost_USE_STATIC_LIBS OFF ) -else() - # https://stackoverflow.com/a/3176086/884770 - set(Boost_USE_STATIC_LIBS ON ) -endif() - -find_package(Boost REQUIRED COMPONENTS program_options system thread random) - -find_package(msgpack REQUIRED) -find_package(websocketpp REQUIRED) - -MESSAGE( STATUS "AUTOBAHN_BUILD_EXAMPLES: " ${AUTOBAHN_BUILD_EXAMPLES} ) -MESSAGE( STATUS "AUTOBAHN_USE_LIBCXX: " ${AUTOBAHN_USE_LIBCXX} ) -MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} ) -MESSAGE( STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX} ) -MESSAGE( STATUS "Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS} ) -MESSAGE( STATUS "Boost_LIBRARIES: " ${Boost_LIBRARIES} ) -MESSAGE( STATUS "msgpack_INCLUDE_DIRS: " ${msgpack_INCLUDE_DIRS} ) -MESSAGE( STATUS "msgpack_LIBRARIES: " ${msgpack_LIBRARIES} ) -MESSAGE( STATUS "websocketpp_INCLUDE_DIRS: " ${websocketpp_INCLUDE_DIRS} ) -MESSAGE( STATUS "websocketpp_LIBRARIES: " ${websocketpp_LIBRARIES} ) - set(PUBLIC_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/autobahn.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/boost_config.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/exceptions.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_arguments.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_auth_utils.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_procedure.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_uds_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.ipp - ) + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/autobahn.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/boost_config.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/exceptions.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_arguments.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_auth_utils.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_procedure.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_uds_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.ipp + ) add_library(autobahn_cpp INTERFACE) target_include_directories(autobahn_cpp INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} - ${Boost_INCLUDE_DIRS} - ${OPENSSL_INCLUDE_DIR} - ${websocketpp_INCLUDE_DIRS} - ${msgpack_INCLUDE_DIRS}) + ${CMAKE_CURRENT_SOURCE_DIR} + CONAN_PKG::openssl + CONAN_PKG::boost + CONAN_PKG::msgpack-cxx + CONAN_PKG::websocketpp + CONAN_PKG::botan + ) target_link_libraries(autobahn_cpp INTERFACE - ${Boost_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${websocketpp_LIBRARIES} - ${msgpack_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) + CONAN_PKG::openssl + CONAN_PKG::boost + CONAN_PKG::msgpack-cxx + CONAN_PKG::websocketpp + CONAN_PKG::botan + ) -foreach(h ${PUBLIC_HEADERS}) +foreach (h ${PUBLIC_HEADERS}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "include/" include "${h}") get_filename_component(HEADER_INCLUDE_DIRECTORY ${include} DIRECTORY) install(FILES ${h} - DESTINATION ${HEADER_INCLUDE_DIRECTORY} - COMPONENT "headers") -endforeach() + DESTINATION ${HEADER_INCLUDE_DIRECTORY} + COMPONENT "headers") +endforeach () diff --git a/cmake/Modules/FindBotan2.cmake b/cmake/Modules/FindBotan2.cmake deleted file mode 100644 index f99ec1b3..00000000 --- a/cmake/Modules/FindBotan2.cmake +++ /dev/null @@ -1,41 +0,0 @@ -if(MSVC OR MINGW) - message(FATAL_ERROR "Using system Botan 2 library in Window not supported") -endif() - -if(TARGET Botan2::Botan2) - message(STATUS "Target Botan::Botan already exists. Skipping searching") - return() -endif() - -find_package(PkgConfig REQUIRED QUIET) -find_package(PackageHandleStandardArgs REQUIRED QUIET) - - -pkg_check_modules(Botan2 - botan-2 - ) - -find_library(Botan2_FullLibraryPath - ${Botan2_LIBRARIES} - PATHS ${Botan2_LIBRARY_DIRS} - NO_DEFAULT_PATH - ) - -find_package_handle_standard_args(Botan2 - REQUIRED_VARS Botan2_LIBRARIES Botan2_INCLUDE_DIRS - VERSION_VAR Botan2_VERSION - ) -message("Botan2_INCLUDE_DIRS ${Botan2_INCLUDE_DIRS}") - -if(Botan2_FOUND) - if(NOT TARGET Botan2::Botan2) - add_library(Botan2::Botan2 - UNKNOWN IMPORTED GLOBAL - ) - set_target_properties(Botan2::Botan2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${Botan2_INCLUDE_DIRS} - IMPORTED_LOCATION ${Botan2_FullLibraryPath} - LINK_FLAGS ${Botan2_LDFLAGS_OTHER} - ) - endif() -endif() diff --git a/cmake/Modules/FindMsgpack.cmake b/cmake/Modules/FindMsgpack.cmake deleted file mode 100644 index 0677e3d3..00000000 --- a/cmake/Modules/FindMsgpack.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Try to find msgpack -# Once done this will define -# msgpack_FOUND - System has msgpack -# msgpack_INCLUDE_DIRS - The msgpack include directories - -set(_env "$ENV{MSGPACK_ROOT}") -if(_env) - - set(msgpack_FOUND TRUE) - set(msgpack_INCLUDE_DIRS "$ENV{MSGPACK_ROOT}/include") - set(msgpack_LIBRARIES "$ENV{MSGPACK_ROOT}/libs") - -else() - - find_package(PkgConfig QUIET) - - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_MSGPACK QUIET msgpack) - endif (PKG_CONFIG_FOUND) - - find_path(msgpack_INCLUDE_DIR msgpack.hpp - HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}) - - set(msgpack_INCLUDE_DIRS ${msgpack_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set Msgpack_FOUND to TRUE - # if all listed variables are TRUE - find_package_handle_standard_args(msgpack DEFAULT_MSG - msgpack_INCLUDE_DIR - msgpack_INCLUDE_DIRS) - - mark_as_advanced(msgpack_INCLUDE_DIR) - -endif() diff --git a/cmake/Modules/FindWebsocketpp.cmake b/cmake/Modules/FindWebsocketpp.cmake deleted file mode 100644 index b1e230e5..00000000 --- a/cmake/Modules/FindWebsocketpp.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Try to find websocketpp -# Once done this will define -# websocketpp_FOUND - System has websocketpp -# websocketpp_INCLUDE_DIRS - The websocketpp include directories - -set(_env "$ENV{WEBSOCKETPP_ROOT}") -if(_env) - - set(websocketpp_FOUND TRUE) - set(websocketpp_INCLUDE_DIRS "$ENV{WEBSOCKETPP_ROOT}/include") - set(websocketpp_LIBRARIES "$ENV{WEBSOCKETPP_ROOT}/libs") - -else() - - find_package(PkgConfig QUIET) - - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_WEBSOCKETPP QUIET websocketpp) - endif (PKG_CONFIG_FOUND) - - find_path(websocketpp_INCLUDE_DIR websocketpp - HINTS ${PC_WEBSOCKETPP_INCLUDEDIR} ${PC_WEBSOCKETPP_INCLUDE_DIRS}) - - set(websocketpp_INCLUDE_DIRS ${websocketpp_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set websocketpp_FOUND to TRUE - # if all listed variables are TRUE - find_package_handle_standard_args(websocketpp DEFAULT_MSG - websocketpp_INCLUDE_DIR - websocketpp_INCLUDE_DIRS) - - mark_as_advanced(websocketpp_INCLUDE_DIR) - -endif() diff --git a/conanfile.py b/conanfile.py index ce0ba845..ba583617 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, CMake, tools + class autobahn_cppConan(ConanFile): name = "autobahn-cpp" version = "v20.8.1" @@ -7,8 +8,8 @@ class autobahn_cppConan(ConanFile): author = "Crossbar.io Technologies GmbH and contributors" description = "WAMP for C++ on Boost/ASIO" url = "https://github.com/crossbario/autobahn-cpp" - requires = "boost/1.73.0","msgpack/3.2.1","websocketpp/0.8.2" - generators = "cmake_find_package" + requires = "openssl/3.0.1", "botan/2.19.1", "boost/1.78.0", "msgpack-cxx/4.0.3", "websocketpp/0.8.2", "catch2/2.13.8" + generators = "cmake" scm = { "type": "git", "subfolder": ".", diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 54f44c68..27a84930 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,11 +1,5 @@ -if (!APPLE) - set(CMAKE_EXE_LINKER_FLAGS " -static") -endif() - add_library(examples_parameters parameters.cpp parameters.hpp) -target_include_directories(examples_parameters PUBLIC ${Boost_INCLUDE_DIRS}) -target_link_libraries(examples_parameters PRIVATE ${Boost_LIBRARIES}) -target_compile_definitions(examples_parameters PRIVATE ${Boost_DEFINITIONS}) +target_link_libraries(examples_parameters PRIVATE CONAN_PKG::boost) function(make_example name src) add_executable(${name} ${src} ${PUBLIC_HEADERS}) @@ -20,19 +14,16 @@ make_example(subscriber subscriber.cpp) make_example(wampcra wampcra.cpp) make_example(websocket_callee websocket_callee.cpp) make_example(cryptosign-openssl cryptosign-openssl.cpp) -if (AUTOBAHN_BUILD_EXAMPLES_BOTAN) - find_package(Botan2 REQUIRED) - make_example(cryptosign-botan cryptosign-botan.cpp) - target_include_directories(cryptosign-botan PRIVATE ${BOTAN_INCLUDE_DIRS}) - target_link_libraries(cryptosign-botan Botan2::Botan2) -endif() +make_example(cryptosign-botan cryptosign-botan.cpp) -if(UNIX) +if (UNIX) make_example(uds uds.cpp) -endif() +endif () # By default MSVC has a 2^16 limit on the number of sections in an object file, # and this needs more than that. if (MSVC) set_source_files_properties(websocket_callee.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() + set_source_files_properties(cryptosign-openssl.cpp PROPERTIES COMPILE_FLAGS /bigobj) + set_source_files_properties(cryptosign-botan.cpp PROPERTIES COMPILE_FLAGS /bigobj) +endif () diff --git a/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln b/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln deleted file mode 100644 index 4eaecce9..00000000 --- a/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln +++ /dev/null @@ -1,94 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wampcra", "wampcra.vcxproj", "{4357F288-DC34-40E3-9AAA-80C1E3EFD633}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "autobahn-cpp", "autobahn-cpp.vcxproj", "{94DB2E6B-5051-43EB-A4BD-D41F4D70D597}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "callee", "callee.vcxproj", "{5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "caller", "caller.vcxproj", "{BF87E140-28C2-41F8-BF65-7776DD215B87}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "publisher", "publisher.vcxproj", "{352DB303-2BBA-4C01-B22F-35A1196FDE4C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subscriber", "subscriber.vcxproj", "{62501761-0470-453F-99BC-36FC69B339FA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "provide_prefix", "provide_prefix.vcxproj", "{B18D21E0-843C-4AC5-8365-495BED662808}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "websocket", "websocket.vcxproj", "{DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x64.ActiveCfg = Debug|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x64.Build.0 = Debug|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x86.ActiveCfg = Debug|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x86.Build.0 = Debug|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x64.ActiveCfg = Release|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x64.Build.0 = Release|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x86.ActiveCfg = Release|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x86.Build.0 = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Debug|x64.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Debug|x86.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Release|x64.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Release|x86.ActiveCfg = Release|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x64.ActiveCfg = Debug|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x64.Build.0 = Debug|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x86.ActiveCfg = Debug|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x86.Build.0 = Debug|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x64.ActiveCfg = Release|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x64.Build.0 = Release|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x86.ActiveCfg = Release|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x86.Build.0 = Release|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x64.ActiveCfg = Debug|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x64.Build.0 = Debug|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x86.ActiveCfg = Debug|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x86.Build.0 = Debug|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x64.ActiveCfg = Release|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x64.Build.0 = Release|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x86.ActiveCfg = Release|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x86.Build.0 = Release|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x64.ActiveCfg = Debug|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x64.Build.0 = Debug|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x86.ActiveCfg = Debug|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x86.Build.0 = Debug|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x64.ActiveCfg = Release|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x64.Build.0 = Release|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x86.ActiveCfg = Release|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x86.Build.0 = Release|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x64.ActiveCfg = Debug|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x64.Build.0 = Debug|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x86.ActiveCfg = Debug|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x86.Build.0 = Debug|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x64.ActiveCfg = Release|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x64.Build.0 = Release|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x86.ActiveCfg = Release|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x86.Build.0 = Release|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x64.ActiveCfg = Debug|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x64.Build.0 = Debug|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x86.ActiveCfg = Debug|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x86.Build.0 = Debug|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x64.ActiveCfg = Release|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x64.Build.0 = Release|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x86.ActiveCfg = Release|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x86.Build.0 = Release|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x64.ActiveCfg = Debug|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x64.Build.0 = Debug|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x86.ActiveCfg = Debug|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x86.Build.0 = Debug|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x64.ActiveCfg = Release|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x64.Build.0 = Release|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x86.ActiveCfg = Release|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/examples/projects/VS2015/autobahn-cpp.vcxproj b/examples/projects/VS2015/autobahn-cpp.vcxproj deleted file mode 100644 index 21a0bc48..00000000 --- a/examples/projects/VS2015/autobahn-cpp.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597} - Win32Proj - autobahncpp - 8.1 - - - - true - v140 - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - StaticLibrary - true - v140 - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - - - - - - - Level3 - Disabled - _DEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/callee.vcxproj b/examples/projects/VS2015/callee.vcxproj deleted file mode 100644 index 443bfcd6..00000000 --- a/examples/projects/VS2015/callee.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE} - Win32Proj - autobahncppexamples - 8.1 - callee - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/caller.vcxproj b/examples/projects/VS2015/caller.vcxproj deleted file mode 100644 index 005dbbde..00000000 --- a/examples/projects/VS2015/caller.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {BF87E140-28C2-41F8-BF65-7776DD215B87} - Win32Proj - autobahncppexamples - 8.1 - caller - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/provide_prefix.vcxproj b/examples/projects/VS2015/provide_prefix.vcxproj deleted file mode 100644 index 702cc769..00000000 --- a/examples/projects/VS2015/provide_prefix.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {B18D21E0-843C-4AC5-8365-495BED662808} - Win32Proj - autobahncppexamples - 8.1 - provide_prefix - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/publisher.vcxproj b/examples/projects/VS2015/publisher.vcxproj deleted file mode 100644 index 2fe0c93b..00000000 --- a/examples/projects/VS2015/publisher.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {352DB303-2BBA-4C01-B22F-35A1196FDE4C} - Win32Proj - autobahncppexamples - 8.1 - publisher - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/subscriber.vcxproj b/examples/projects/VS2015/subscriber.vcxproj deleted file mode 100644 index b2a00d27..00000000 --- a/examples/projects/VS2015/subscriber.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {62501761-0470-453F-99BC-36FC69B339FA} - Win32Proj - autobahncppexamples - 8.1 - subscriber - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/wampcra.vcxproj b/examples/projects/VS2015/wampcra.vcxproj deleted file mode 100644 index 98c01ecf..00000000 --- a/examples/projects/VS2015/wampcra.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {4357F288-DC34-40E3-9AAA-80C1E3EFD633} - Win32Proj - autobahncppexamples - 8.1 - wampcra - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/websocket.vcxproj b/examples/projects/VS2015/websocket.vcxproj deleted file mode 100644 index 87cf2a2f..00000000 --- a/examples/projects/VS2015/websocket.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73} - Win32Proj - autobahncppexamples - 8.1 - websocket - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..4bcfd4b9 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,16 @@ +function(make_test name src) + # By default MSVC has a 2^16 limit on the number of sections in an object file, + # and this needs more than that. + if (MSVC) + set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS /bigobj) + endif () + + add_executable(${name} ${src} wamp_test.hpp test_main.cpp ${PUBLIC_HEADERS}) + target_link_libraries(${name} PRIVATE CONAN_PKG::catch2 autobahn_cpp) + string(REPLACE "test_" "" pure_name ${name}) + add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh "${CMAKE_CURRENT_SOURCE_DIR}/${pure_name}" "$") +endfunction() + +make_test(test_auth auth/auth.cpp) +make_test(test_pubsub pubsub/pubsub.cpp) +make_test(test_calls calls/calls.cpp) diff --git a/test/auth/auth.cpp b/test/auth/auth.cpp new file mode 100644 index 00000000..0ae44cfd --- /dev/null +++ b/test/auth/auth.cpp @@ -0,0 +1,118 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config { + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.cra") { + bool joined_realm_with_success = join_realm( + "client1_cra", wamp_test::Secret("client1_secret"), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client1_cra"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "client2_cra", wamp_test::Secret("client2_secret"), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client2_cra"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == join_realm("client3", wamp_test::Secret("unknown"))); +} + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.ticket") { + bool joined_realm_with_success = join_realm( + "client1", wamp_test::Ticket("client1_ticket"), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client1"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "client2", wamp_test::Ticket("client2_ticket"), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client2"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == join_realm("client3", wamp_test::Ticket("unknown"))); +} + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.cryptosign") { + bool joined_realm_with_success = join_realm( + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + wamp_test::Cryptosign(Botan::secure_vector(32, 0)), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE( + welcome_details["authid"].as() == + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c", + wamp_test::Cryptosign(Botan::secure_vector(32, 1)), + [&](Transport &transport, Session &session) { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE( + welcome_details["authid"].as() == + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == + join_realm("unknown", wamp_test::Cryptosign( + Botan::secure_vector(32, 3)))); +} diff --git a/test/auth/crossbar/.crossbar/config.json b/test/auth/crossbar/.crossbar/config.json new file mode 100644 index 00000000..08d7f078 --- /dev/null +++ b/test/auth/crossbar/.crossbar/config.json @@ -0,0 +1,204 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": true, + "register": true, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic2", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.shutdown", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.", + "match": "prefix", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic2", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.foobar.topic1", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "cryptosign": { + "type": "static", + "principals": { + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29": { + "role": "frontend", + "authorized_keys": [ + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29" + ] + }, + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c": { + "role": "backend", + "authorized_keys": [ + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c" + ] + } + } + }, + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "client1_ticket", + "role": "frontend" + }, + "client2": { + "ticket": "client2_ticket", + "role": "backend" + } + } + }, + "wampcra": { + "type": "static", + "users": { + "client1_cra": { + "secret": "client1_secret", + "role": "frontend" + }, + "client2_cra": { + "secret": "client2_secret", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + ] + } + ] +} diff --git a/test/calls/calls.cpp b/test/calls/calls.cpp new file mode 100644 index 00000000..5f6293af --- /dev/null +++ b/test/calls/calls.cpp @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config { + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.calls.simple") { + bool joined_realm_with_success = join_realm( + "client1", wamp_test::Ticket("ticket"), + [&](Transport &transport, Session &session) { + REQUIRE( + 3 == + call("com.example.add2", std::tuple(1, 2)).get()); + REQUIRE( + 5 == + call("com.example.add2", std::tuple(2, 3)).get()); + REQUIRE(!call("com.example.unknown", + std::tuple(3, 4, 5)) + .has_value()); + }); + REQUIRE(true == joined_realm_with_success); +} diff --git a/test/calls/crossbar/.crossbar/config.json b/test/calls/crossbar/.crossbar/config.json new file mode 100644 index 00000000..2da03fd6 --- /dev/null +++ b/test/calls/crossbar/.crossbar/config.json @@ -0,0 +1,100 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": false, + "register": true, + "publish": false, + "subscribe": false + } + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "ticket", + "role": "frontend" + }, + "client2": { + "ticket": "ticket", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + { + "type": "class", + "classname": "backend.BackendSession", + "realm": "realm1", + "role": "backend" + } + ] + } + ] +} diff --git a/test/calls/crossbar/backend.py b/test/calls/crossbar/backend.py new file mode 100644 index 00000000..54fb620e --- /dev/null +++ b/test/calls/crossbar/backend.py @@ -0,0 +1,26 @@ +import os +import signal + +from autobahn.twisted.wamp import ApplicationSession +from twisted.internet import reactor +from twisted.internet.defer import Deferred +from twisted.internet.defer import inlineCallbacks + + +class BackendSession(ApplicationSession): + + @inlineCallbacks + def onJoin(self, details): + print("Backend session joined: {}".format(details)) + + ## REGISTER a procedure for remote calling + ## + def add2(x, y): + print("add2() called with {} and {}".format(x, y)) + return x + y + + try: + reg = yield self.register(add2, 'com.example.add2') + print("procedure add2() registered") + except Exception as e: + print("could not register procedure: {}".format(e)) diff --git a/test/pubsub/crossbar/.crossbar/config.json b/test/pubsub/crossbar/.crossbar/config.json new file mode 100644 index 00000000..54cb1e22 --- /dev/null +++ b/test/pubsub/crossbar/.crossbar/config.json @@ -0,0 +1,195 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": true, + "register": true, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.publish", + "match": "exact", + "allow": { + "call": false, + "register": true, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.publish", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.", + "match": "prefix", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.foobar.topic1", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "ticket", + "role": "frontend" + }, + "client2": { + "ticket": "ticket", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + { + "type": "class", + "classname": "backend.BackendSession", + "realm": "realm1", + "role": "backend" + } + ] + } + ] +} diff --git a/test/pubsub/crossbar/backend.py b/test/pubsub/crossbar/backend.py new file mode 100644 index 00000000..cd717d69 --- /dev/null +++ b/test/pubsub/crossbar/backend.py @@ -0,0 +1,25 @@ +import os +import signal + +from autobahn.twisted.wamp import ApplicationSession +from twisted.internet import reactor +from twisted.internet.defer import Deferred +from twisted.internet.defer import inlineCallbacks + + +class BackendSession(ApplicationSession): + counter = 0 + + @inlineCallbacks + def onJoin(self, details): + print("Backend session joined: {}".format(details)) + + def pub(): + self.counter += 1 + self.publish('com.example.topic', "data='{}'".format(self.counter)) + return self.counter + + try: + yield self.register(pub, 'com.example.publish') + except Exception as e: + print("could not register procedure: {}".format(e)) diff --git a/test/pubsub/pubsub.cpp b/test/pubsub/pubsub.cpp new file mode 100644 index 00000000..8a86325e --- /dev/null +++ b/test/pubsub/pubsub.cpp @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config { + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "WAMP AUTH: TICKET") { + bool joined_realm_with_success = join_realm( + "client1", wamp_test::Ticket("ticket"), + [&](Transport &transport, Session &session) { + std::string received_data; + session.subscribe("com.example.topic", + [&received_data](const autobahn::wamp_event &event) { + received_data = event->argument(0); + }); + REQUIRE(1 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='1'" == received_data); + REQUIRE(2 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='2'" == received_data); + REQUIRE(3 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='3'" == received_data); + }); + REQUIRE(true == joined_realm_with_success); +} diff --git a/test/run_test.sh b/test/run_test.sh new file mode 100755 index 00000000..7827c0a9 --- /dev/null +++ b/test/run_test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +CROSSBAR_PATH=${1}/crossbar +TEST_BINARY=${2} +cd "${CROSSBAR_PATH}" || exit 1 +docker run -d -v $PWD:/node -u 0 --rm --name=crossbar -it -p 8080:8080 crossbario/crossbar +sleep 15 +${TEST_BINARY} +RET=$? +docker container stop crossbar +exit ${RET} diff --git a/test/test_main.cpp b/test/test_main.cpp new file mode 100644 index 00000000..4ed06df1 --- /dev/null +++ b/test/test_main.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include diff --git a/test/wamp_test.hpp b/test/wamp_test.hpp new file mode 100644 index 00000000..5f8ebe45 --- /dev/null +++ b/test/wamp_test.hpp @@ -0,0 +1,417 @@ +// +// Created by Alexander Arlt on 08.02.22. +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace wamp_test +{ + +struct websocket_transport_base +{ + websocketpp::client ws_client; + boost::asio::io_service io; + websocket_transport_base() { ws_client.init_asio(&io); } +}; + +struct websocket_transport: public websocket_transport_base, + public autobahn::wamp_websocketpp_websocket_transport +{ + typedef websocket_transport Transport; + + websocket_transport(std::string uri, bool debug) + : autobahn::wamp_websocketpp_websocket_transport(ws_client, uri, debug) + { + } +}; + +class Secret +{ +public: + Secret() = default; + explicit Secret(std::string _secret): m_secret(std::move(_secret)) {} + const std::string& secret() { return m_secret; } + +private: + std::string m_secret{}; +}; + +class Ticket +{ +public: + Ticket() = default; + explicit Ticket(std::string _ticket): m_ticket(std::move(_ticket)) {} + const std::string& ticket() { return m_ticket; } + +private: + std::string m_ticket{}; +}; + +class Cryptosign +{ +public: + explicit Cryptosign(const Botan::secure_vector& _privateKey): m_private_key(_privateKey) {} + + const std::vector& publicKey() { return m_private_key.get_public_key(); } + + std::vector sign(const std::vector& _data) + { + Botan::AutoSeeded_RNG rng; + Botan::PK_Signer signer(m_private_key, rng, "Pure"); + signer.update(_data); + return signer.signature(rng); + } + const Botan::Ed25519_PrivateKey& privateKey() const { return m_private_key; } + +private: + Botan::Ed25519_PrivateKey m_private_key; + Botan::secure_vector m_publickey{}; +}; + +class test_session: public autobahn::wamp_session +{ +public: + virtual const std::vector& authmethods() = 0; + virtual std::map authextras() { return {}; }; + +protected: + test_session(boost::asio::io_service& io_service, bool debug_enabled = false) + : autobahn::wamp_session(io_service, debug_enabled) + { + } +}; + +class cra_session: public test_session +{ +public: + const std::vector& authmethods() + { + static std::vector authmethods = {"wampcra"}; + return authmethods; + } + + typedef cra_session Session; + + cra_session(boost::asio::io_service& io, bool debug, Secret _secret) + : test_session(io, debug), m_secret(std::move(_secret)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) + { + std::string signature = compute_wcs(m_secret.secret(), challenge.challenge()); + challenge_future.set_value(autobahn::wamp_authenticate(signature)); + return challenge_future.get_future(); + } + +private: + Secret m_secret; +}; + +class cryptosign_session: public test_session +{ +public: + const std::vector& authmethods() override + { + static std::vector authmethods = {"cryptosign"}; + return authmethods; + } + + std::map authextras() override + { + return {{"pubkey", Botan::hex_encode(m_privateKey.publicKey(), false)}}; + }; + + typedef cra_session Session; + + cryptosign_session(boost::asio::io_service& io, bool debug, Cryptosign _privateKey) + : test_session(io, debug), m_privateKey(std::move(_privateKey)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) override + { + Botan::AutoSeeded_RNG rng; + Botan::PK_Signer signer(m_privateKey.privateKey(), rng, "Pure"); + signer.update(Botan::hex_decode(challenge.challenge())); + std::string signature = Botan::hex_encode(signer.signature(rng)); + challenge_future.set_value(autobahn::wamp_authenticate(signature + challenge.challenge())); + return challenge_future.get_future(); + } + +private: + Cryptosign m_privateKey; +}; + +class ticket_session: public test_session +{ +public: + const std::vector& authmethods() override + { + static std::vector authmethods = {"ticket"}; + return authmethods; + } + + typedef ticket_session Session; + + ticket_session(boost::asio::io_service& io, bool debug, Ticket _ticket) + : test_session(io, debug), m_ticket(std::move(_ticket)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) override + { + challenge_future.set_value(autobahn::wamp_authenticate(m_ticket.ticket())); + return challenge_future.get_future(); + } + +private: + Ticket m_ticket; +}; + +template +struct fixture: public TConfig +{ + typedef typename TTransport::Transport Transport; + typedef test_session Session; + + template + bool join_realm( + const std::string& _realm, + const std::string& _authid, + const TAuthenticateWith _authenticate_with, + std::function _on_success = [](Transport& transport, Session& session) {}) + { + std::shared_ptr transport = std::make_shared(TConfig::uri, TConfig::debug); + return join_realm(*transport, _realm, _authid, _authenticate_with, _on_success); + } + + template + bool join_realm( + const std::string& _authid, + const TAuthenticateWith _authenticate_with, + std::function _on_success = [](Transport& transport, Session& session) {}) + { + std::shared_ptr transport = std::make_shared(TConfig::uri, TConfig::debug); + return join_realm(*transport, TConfig::realm, _authid, _authenticate_with, _on_success); + } + + template + boost::optional call(const std::string& procedure, TArguments _arguments) + { + autobahn::wamp_call_options call_options; + call_options.set_timeout(std::chrono::seconds(10)); + return m_session->call(procedure, _arguments, call_options) + .then( + [&](boost::future _result) + { + boost::optional result; + try + { + result = _result.get().argument(0); + } + catch (const std::exception& e) + { + result.reset(); + } + return result; + }) + .get(); + } + +protected: + Transport* m_transport; + Session* m_session; + +private: + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Ticket& _ticket, + std::function _on_success) + { + std::shared_ptr session + = std::make_shared(_transport.io, TConfig::debug, _ticket); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Secret& _secret, + std::function _on_success) + { + std::shared_ptr session = std::make_shared(_transport.io, TConfig::debug, _secret); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Cryptosign& _privateKey, + std::function _on_success) + { + std::shared_ptr session + = std::make_shared(_transport.io, TConfig::debug, _privateKey); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join( + Transport& _transport, + Session& _session, + const std::string& _realm, + const std::string& _authid, + std::function _on_success) + { + m_transport = &_transport; + m_session = &_session; + + bool result = false; + // Make sure the continuation futures we use do not run out of scope prematurely. + // Since we are only using one thread here this can cause the io service to block + // as a future generated by a continuation will block waiting for its promise to be + // fulfilled when it goes out of scope. This would prevent the session from receiving + // responses from the router. + boost::future connect_future; + boost::future start_future; + boost::future join_future; + boost::future leave_future; + boost::future stop_future; + + connect_future = _transport.connect().then( + [&](boost::future connected) + { + try + { + connected.get(); + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + return; + } + if (TConfig::debug) + std::cerr << "transport connected" << std::endl; + + result = true; + + start_future = _session.start().then( + [&](boost::future started) + { + try + { + started.get(); + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + result = false; + return; + } + + if (TConfig::debug) + std::cerr << "session started" << std::endl; + + join_future = _session.join(_realm, _session.authmethods(), _authid, _session.authextras()) + .then( + [&](boost::future joined) + { + try + { + auto j = joined.get(); + if (TConfig::debug) + std::cerr << "joined realm: " << j << std::endl; + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + result = false; + return; + } + + _on_success(_transport, _session); + + leave_future = _session.leave().then( + [&](boost::future reason) + { + try + { + auto r = reason.get(); + if (TConfig::debug) + std::cerr << "left session (" << r << ")" + << std::endl; + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << "failed to leave session: " << e.what() + << std::endl; + _transport.io.stop(); + result = false; + return; + } + + stop_future = _session.stop().then( + [&](boost::future stopped) + { + if (TConfig::debug) + std::cerr << "stopped session" << std::endl; + _transport.io.stop(); + }); + }); + }); + }); + }); + + try + { + if (TConfig::debug) + std::cerr << "starting io service" << std::endl; + _transport.io.run(); + if (TConfig::debug) + std::cerr << "stopped io service" << std::endl; + + connect_future.get(); + } + catch (...) + { + result = false; + } + + m_transport = nullptr; + m_session = nullptr; + + return result; + } +}; + +} // namespace wamp_test