Merge branch 'master' into security

Signed-off-by: Kurtulus Oksuztepe <kurtulus.oksuztepe@adlinktech.com>

Conflicts:
	.travis.yml
This commit is contained in:
Kurtulus Oksuztepe 2019-10-29 17:40:33 +01:00
commit aa3b95ee7f
39 changed files with 273 additions and 257 deletions

View file

@ -81,7 +81,7 @@ osx_xcode10_3: &osx_xcode10_3
- eval "export COV_COMPTYPE=clang COV_PLATFORM=macOSX" - eval "export COV_COMPTYPE=clang COV_PLATFORM=macOSX"
- eval "export PATH=\"${PATH}:$(python3 -m site --user-base)/bin\"" - eval "export PATH=\"${PATH}:$(python3 -m site --user-base)/bin\""
install: install:
- pip3 install conan --upgrade --user - python3 -m pip install conan --upgrade --user
osx_xcode9: &osx_xcode9 osx_xcode9: &osx_xcode9
<<: *osx_xcode10_3 <<: *osx_xcode10_3

View file

@ -10,6 +10,7 @@
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# #
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.7)
project(CycloneDDS VERSION 0.1.0)
# Set a default build type if none was specified # Set a default build type if none was specified
set(default_build_type "RelWithDebInfo") set(default_build_type "RelWithDebInfo")
@ -42,13 +43,12 @@ ENDFUNCTION(PREPEND)
# Set module path before defining project so platform files will work. # Set module path before defining project so platform files will work.
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
set(CMAKE_PROJECT_NAME_FULL "Eclipse Cyclone DDS") set(PROJECT_NAME_FULL "Eclipse Cyclone DDS")
project(CycloneDDS VERSION 0.1.0)
# Set some convenience variants of the project-name # Set some convenience variants of the project-name
string(REPLACE " " "-" CMAKE_PROJECT_NAME_DASHED "${CMAKE_PROJECT_NAME_FULL}") string(REPLACE " " "-" PROJECT_NAME_DASHED "${PROJECT_NAME_FULL}")
string(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_CAPS) string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_CAPS)
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_SMALL) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_SMALL)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks") if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
@ -170,17 +170,17 @@ endif()
# the address sanitizer for ordinary debug builds; gcc is giving some grief on # the address sanitizer for ordinary debug builds; gcc is giving some grief on
# Travis, so don't enable it for gcc by default # Travis, so don't enable it for gcc by default
if(NOT USE_SANITIZER) if(NOT USE_SANITIZER)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND
NOT (${CMAKE_GENERATOR} STREQUAL "Xcode") AND NOT ("${CMAKE_GENERATOR}" STREQUAL "Xcode") AND
(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"
OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang")) OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang"))
message(STATUS "Enabling address sanitizer; set USE_SANITIZER=none to prevent this") message(STATUS "Enabling address sanitizer; set USE_SANITIZER=none to prevent this")
set(USE_SANITIZER address) set(USE_SANITIZER address)
else() else()
set(USE_SANITIZER none) set(USE_SANITIZER none)
endif() endif()
endif() endif()
if(NOT (${USE_SANITIZER} STREQUAL "none")) if(NOT ("${USE_SANITIZER}" STREQUAL "none"))
message(STATUS "Sanitizer set to ${USE_SANITIZER}") message(STATUS "Sanitizer set to ${USE_SANITIZER}")
add_compile_options(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}) add_compile_options(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})
link_libraries(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}) link_libraries(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})

View file

@ -9,31 +9,37 @@
# #
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# #
set(CUNIT_HEADER "CUnit/CUnit.h") find_package(CUnit CONFIG QUIET)
if(CUnit_FOUND)
if(CONAN_INCLUDE_DIRS) message(STATUS "Found CUnit via Config file: ${CUnit_DIR}")
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER} HINTS ${CONAN_INCLUDE_DIRS}) set(CUNIT_FOUND ${CUnit_FOUND})
else() else()
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER}) set(CUNIT_HEADER "CUnit/CUnit.h")
endif()
mark_as_advanced(CUNIT_INCLUDE_DIR) if(CONAN_INCLUDE_DIRS)
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER} HINTS ${CONAN_INCLUDE_DIRS})
else()
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER})
endif()
if(CUNIT_INCLUDE_DIR AND EXISTS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}") mark_as_advanced(CUNIT_INCLUDE_DIR)
set(PATTERN "^#define CU_VERSION \"([0-9]+)\\.([0-9]+)\\-([0-9]+)\"$")
file(STRINGS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}" CUNIT_H REGEX "${PATTERN}")
string(REGEX REPLACE "${PATTERN}" "\\1" CUNIT_VERSION_MAJOR "${CUNIT_H}") if(CUNIT_INCLUDE_DIR AND EXISTS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}")
string(REGEX REPLACE "${PATTERN}" "\\2" CUNIT_VERSION_MINOR "${CUNIT_H}") set(PATTERN "^#define CU_VERSION \"([0-9]+)\\.([0-9]+)\\-([0-9]+)\"$")
string(REGEX REPLACE "${PATTERN}" "\\3" CUNIT_VERSION_PATCH "${CUNIT_H}") file(STRINGS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}" CUNIT_H REGEX "${PATTERN}")
set(CUNIT_VERSION "${CUNIT_VERSION_MAJOR}.${CUNIT_VERSION_MINOR}-${CUNIT_VERSION_PATCH}") string(REGEX REPLACE "${PATTERN}" "\\1" CUNIT_VERSION_MAJOR "${CUNIT_H}")
endif() string(REGEX REPLACE "${PATTERN}" "\\2" CUNIT_VERSION_MINOR "${CUNIT_H}")
string(REGEX REPLACE "${PATTERN}" "\\3" CUNIT_VERSION_PATCH "${CUNIT_H}")
if(CONAN_LIB_DIRS) set(CUNIT_VERSION "${CUNIT_VERSION_MAJOR}.${CUNIT_VERSION_MINOR}-${CUNIT_VERSION_PATCH}")
find_library(CUNIT_LIBRARY cunit HINTS ${CONAN_LIB_DIRS}) endif()
else()
find_library(CUNIT_LIBRARY cunit) if(CONAN_LIB_DIRS)
find_library(CUNIT_LIBRARY cunit HINTS ${CONAN_LIB_DIRS})
else()
find_library(CUNIT_LIBRARY cunit)
endif()
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View file

@ -18,39 +18,39 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs) include(GNUInstallDirs)
set(PACKAGING_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules/Packaging") set(PACKAGING_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/Modules/Packaging")
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
# Generates <Package>Config.cmake. # Generates <Package>Config.cmake.
if(BUILD_IDLC) if(BUILD_IDLC)
configure_package_config_file( configure_package_config_file(
"${PACKAGING_MODULE_DIR}/PackageConfig.cmake.in" "${PACKAGING_MODULE_DIR}/PackageConfig.cmake.in"
"${CMAKE_PROJECT_NAME}Config.cmake" "${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}") INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
else() else()
configure_package_config_file( configure_package_config_file(
"${PACKAGING_MODULE_DIR}/PackageConfigNoIdlc.cmake.in" "${PACKAGING_MODULE_DIR}/PackageConfigNoIdlc.cmake.in"
"${CMAKE_PROJECT_NAME}Config.cmake" "${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}") INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
endif() endif()
# Generates <Package>Version.cmake. # Generates <Package>Version.cmake.
write_basic_package_version_file( write_basic_package_version_file(
"${CMAKE_PROJECT_NAME}Version.cmake" "${PROJECT_NAME}Version.cmake"
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
install( install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake" FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Version.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Version.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev) DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
if((NOT DEFINED BUILD_SHARED_LIBS) OR BUILD_SHARED_LIBS) if((NOT DEFINED BUILD_SHARED_LIBS) OR BUILD_SHARED_LIBS)
# Generates <Package>Targets.cmake file included by <Package>Config.cmake. # Generates <Package>Targets.cmake file included by <Package>Config.cmake.
# The files are placed in CMakeFiles/Export in the build tree. # The files are placed in CMakeFiles/Export in the build tree.
install( install(
EXPORT "${CMAKE_PROJECT_NAME}" EXPORT "${PROJECT_NAME}"
FILE "${CMAKE_PROJECT_NAME}Targets.cmake" FILE "${PROJECT_NAME}Targets.cmake"
NAMESPACE "${CMAKE_PROJECT_NAME}::" NAMESPACE "${PROJECT_NAME}::"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev) DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
endif() endif()
@ -61,7 +61,7 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}) set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "Eclipse Cyclone DDS project") set(CPACK_PACKAGE_VENDOR "Eclipse Cyclone DDS project")
set(CPACK_PACKAGE_CONTACT "https://github.com/eclipse-cyclonedds/cyclonedds") set(CPACK_PACKAGE_CONTACT "https://github.com/eclipse-cyclonedds/cyclonedds")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Implementation of the OMG DDS standard") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Implementation of the OMG DDS standard")
@ -84,10 +84,10 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/license.txt")
# does help to clearify which settings are required for a platform. # does help to clearify which settings are required for a platform.
set(CPACK_COMPONENTS_ALL dev lib) set(CPACK_COMPONENTS_ALL dev lib)
set(CPACK_COMPONENT_LIB_DISPLAY_NAME "${CMAKE_PROJECT_NAME_FULL} library") set(CPACK_COMPONENT_LIB_DISPLAY_NAME "${PROJECT_NAME_FULL} library")
set(CPACK_COMPONENT_LIB_DESCRIPTION "Library used to run programs with ${CMAKE_PROJECT_NAME_FULL}") set(CPACK_COMPONENT_LIB_DESCRIPTION "Library used to run programs with ${PROJECT_NAME_FULL}")
set(CPACK_COMPONENT_DEV_DISPLAY_NAME "${CMAKE_PROJECT_NAME_FULL} development") set(CPACK_COMPONENT_DEV_DISPLAY_NAME "${PROJECT_NAME_FULL} development")
set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for use with ${CMAKE_PROJECT_NAME_FULL}") set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for use with ${PROJECT_NAME_FULL}")
if(WIN32 AND NOT UNIX) if(WIN32 AND NOT UNIX)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -99,8 +99,8 @@ if(WIN32 AND NOT UNIX)
set(CPACK_GENERATOR "WIX;ZIP;${CPACK_GENERATOR}" CACHE STRING "List of package generators") set(CPACK_GENERATOR "WIX;ZIP;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME_FULL}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_FULL}")
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -123,7 +123,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_RPM_COMPONENT_INSTALL ON) set(CPACK_RPM_COMPONENT_INSTALL ON)
# FIXME: The package file name must be updated to include the distribution. # FIXME: The package file name must be updated to include the distribution.
# See Fedora and Red Hat packaging guidelines for details. # See Fedora and Red Hat packaging guidelines for details.
set(CPACK_RPM_LIB_PACKAGE_NAME "${CMAKE_PROJECT_NAME_DASHED}") set(CPACK_RPM_LIB_PACKAGE_NAME "${PROJECT_NAME_DASHED}")
set(CPACK_RPM_LIB_FILE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm") set(CPACK_RPM_LIB_FILE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm")
set(CPACK_RPM_DEV_PACKAGE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-devel") set(CPACK_RPM_DEV_PACKAGE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-devel")
set(CPACK_RPM_DEV_FILE_NAME "${CPACK_RPM_DEV_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm") set(CPACK_RPM_DEV_FILE_NAME "${CPACK_RPM_DEV_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm")
@ -138,7 +138,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "DEB;TGZ;${CPACK_GENERATOR}" CACHE STRING "List of package generators") set(CPACK_GENERATOR "DEB;TGZ;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
string(TOLOWER "${CMAKE_PROJECT_NAME_DASHED}" CPACK_DEBIAN_LIB_PACKAGE_NAME) string(TOLOWER "${PROJECT_NAME_DASHED}" CPACK_DEBIAN_LIB_PACKAGE_NAME)
set(CPACK_DEBIAN_LIB_FILE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${__arch}.deb") set(CPACK_DEBIAN_LIB_FILE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${__arch}.deb")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_NAME} (= ${CPACK_PACKAGE_VERSION}), libc6 (>= 2.23)") set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_NAME} (= ${CPACK_PACKAGE_VERSION}), libc6 (>= 2.23)")
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}-dev") set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}-dev")

View file

@ -11,5 +11,5 @@
# #
@PACKAGE_INIT@ @PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/idlc/IdlcGenerate.cmake") include("${CMAKE_CURRENT_LIST_DIR}/idlc/IdlcGenerate.cmake")

View file

@ -11,4 +11,4 @@
# #
@PACKAGE_INIT@ @PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")

3
colcon.pkg Normal file
View file

@ -0,0 +1,3 @@
{
"cmake-args": [ "-DBUILD_IDLC=OFF" ]
}

View file

@ -9,7 +9,7 @@
# #
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# #
set(CMAKE_INSTALL_EXAMPLESDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/examples") set(CMAKE_INSTALL_EXAMPLESDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/examples")
add_subdirectory(helloworld) add_subdirectory(helloworld)
add_subdirectory(roundtrip) add_subdirectory(roundtrip)

View file

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc) if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try # Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides. # finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../") find_package(CycloneDDS REQUIRED PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif() endif()
# This is a convenience function, provided by the CycloneDDS package, # This is a convenience function, provided by the CycloneDDS package,

View file

@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc) if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try # Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides. # finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../") find_package(CycloneDDS REQUIRED PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif() endif()
# This is a convenience function, provided by the CycloneDDS package, # This is a convenience function, provided by the CycloneDDS package,

View file

@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc) if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try # Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides. # finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../") find_package(CycloneDDS REQUIRED PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../")
endif() endif()
# This is a convenience function, provided by the CycloneDDS package, # This is a convenience function, provided by the CycloneDDS package,

View file

@ -12,8 +12,6 @@
<url type="repository">https://github.com/eclipse-cyclonedds/cyclonedds</url> <url type="repository">https://github.com/eclipse-cyclonedds/cyclonedds</url>
<buildtool_depend>cmake</buildtool_depend> <buildtool_depend>cmake</buildtool_depend>
<buildtool_depend>java</buildtool_depend>
<buildtool_depend>maven</buildtool_depend>
<depend>openssl</depend> <depend>openssl</depend>
<test_depend>libcunit-dev</test_depend> <test_depend>libcunit-dev</test_depend>
<doc_depend>python3-sphinx</doc_depend> <doc_depend>python3-sphinx</doc_depend>

View file

@ -24,7 +24,7 @@ endif()
# default system locations, i.e. /usr/lib and /usr/include on *NIX platforms. # default system locations, i.e. /usr/lib and /usr/include on *NIX platforms.
# The install prefix must therefore be postfixed with the project name. # The install prefix must therefore be postfixed with the project name.
if(UNIX) if(UNIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}") set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}")
endif() endif()
set(ENTRYPOINT "real_main" set(ENTRYPOINT "real_main"
@ -119,7 +119,7 @@ install(
install( install(
TARGETS freertos-sim freertos-sim-loader TARGETS freertos-sim freertos-sim-loader
EXPORT "${CMAKE_PROJECT_NAME}" EXPORT "${PROJECT_NAME}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")

View file

@ -11,7 +11,7 @@
# #
# #
# CMake toolchain file generated by @CMAKE_PROJECT_NAME@ # CMake toolchain file generated by @PROJECT_NAME@
# #
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")

View file

@ -82,11 +82,11 @@ set_target_properties(ddsc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PRO
# Create a pseudo-target that other targets (i.e. examples, tests) can depend # Create a pseudo-target that other targets (i.e. examples, tests) can depend
# on and can also be provided as import-target by a package-file when building # on and can also be provided as import-target by a package-file when building
# those targets outside the regular Cyclone build-tree (i.e. the installed tree) # those targets outside the regular Cyclone build-tree (i.e. the installed tree)
add_library(${CMAKE_PROJECT_NAME}::ddsc ALIAS ddsc) add_library(${PROJECT_NAME}::ddsc ALIAS ddsc)
install( install(
TARGETS ddsc TARGETS ddsc
EXPORT "${CMAKE_PROJECT_NAME}" EXPORT "${PROJECT_NAME}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib

View file

@ -87,11 +87,6 @@ generate_export_header(
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/include/dds/export.h" EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/include/dds/export.h"
) )
target_include_directories(
ddsc PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
target_sources(ddsc target_sources(ddsc
PRIVATE PRIVATE
${srcs_ddsc} ${srcs_ddsc}
@ -103,29 +98,23 @@ target_sources(ddsc
target_include_directories(ddsc target_include_directories(ddsc
PUBLIC PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/src") "${CMAKE_CURRENT_LIST_DIR}/src"
INTERFACE
target_include_directories(ddsc INTERFACE $<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
install( install(
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/dds" DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/include/"
"${CMAKE_CURRENT_BINARY_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev) COMPONENT dev)
install(
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/ddsc"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/dds/export.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dds"
COMPONENT dev)
# TODO: improve test inclusion. # TODO: improve test inclusion.
if((BUILD_TESTING) AND ((NOT DEFINED MSVC_VERSION) OR (MSVC_VERSION GREATER "1800"))) if((BUILD_TESTING) AND (BUILD_IDLC) AND ((NOT DEFINED MSVC_VERSION) OR (MSVC_VERSION GREATER "1800")))
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tests") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tests")
endif() endif()

View file

@ -17,9 +17,9 @@
#define DDSC_VERSION_MINOR @CycloneDDS_VERSION_MINOR@ #define DDSC_VERSION_MINOR @CycloneDDS_VERSION_MINOR@
#define DDSC_VERSION_PATCH @CycloneDDS_VERSION_PATCH@ #define DDSC_VERSION_PATCH @CycloneDDS_VERSION_PATCH@
#define DDSC_VERSION_TWEAK @CycloneDDS_VERSION_TWEAK@ #define DDSC_VERSION_TWEAK @CycloneDDS_VERSION_TWEAK@
#define DDSC_PROJECT_NAME_NOSPACE_CAPS "@CMAKE_PROJECT_NAME_CAPS@" #define DDSC_PROJECT_NAME_NOSPACE_CAPS "@PROJECT_NAME_CAPS@"
#define DDSC_PROJECT_NAME_NOSPACE_SMALL "@CMAKE_PROJECT_NAME_SMALL@" #define DDSC_PROJECT_NAME_NOSPACE_SMALL "@PROJECT_NAME_SMALL@"
#define DDSC_PROJECT_NAME_NOSPACE "@CMAKE_PROJECT_NAME@" #define DDSC_PROJECT_NAME_NOSPACE "@PROJECT_NAME@"
#define DDSC_PROJECT_NAME "@CMAKE_PROJECT_NAME@" #define DDSC_PROJECT_NAME "@PROJECT_NAME@"
#endif /* DDSC_PROJECT_H */ #endif /* DDSC_PROJECT_H */

View file

@ -17,7 +17,6 @@
#include "dds/dds.h" #include "dds/dds.h"
#include "dds/ddsrt/heap.h" #include "dds/ddsrt/heap.h"
#include "dds/ddsrt/md5.h" #include "dds/ddsrt/md5.h"
#include "dds/ddsi/q_bswap.h"
#include "dds/ddsi/q_config.h" #include "dds/ddsi/q_config.h"
#include "dds/ddsi/q_freelist.h" #include "dds/ddsi/q_freelist.h"
#include "dds/ddsi/ddsi_sertopic.h" #include "dds/ddsi/ddsi_sertopic.h"

View file

@ -175,17 +175,17 @@ static void dds_os_put1be (dds_ostreamBE_t * __restrict s, uint8_t v)
static void dds_os_put2be (dds_ostreamBE_t * __restrict s, uint16_t v) static void dds_os_put2be (dds_ostreamBE_t * __restrict s, uint16_t v)
{ {
dds_os_put2 (&s->x, toBE2u (v)); dds_os_put2 (&s->x, ddsrt_toBE2u (v));
} }
static void dds_os_put4be (dds_ostreamBE_t * __restrict s, uint32_t v) static void dds_os_put4be (dds_ostreamBE_t * __restrict s, uint32_t v)
{ {
dds_os_put4 (&s->x, toBE4u (v)); dds_os_put4 (&s->x, ddsrt_toBE4u (v));
} }
static void dds_os_put8be (dds_ostreamBE_t * __restrict s, uint64_t v) static void dds_os_put8be (dds_ostreamBE_t * __restrict s, uint64_t v)
{ {
dds_os_put8 (&s->x, toBE8u (v)); dds_os_put8 (&s->x, ddsrt_toBE8u (v));
} }
static void dds_os_put_bytes (dds_ostream_t * __restrict s, const void * __restrict b, uint32_t l) static void dds_os_put_bytes (dds_ostream_t * __restrict s, const void * __restrict b, uint32_t l)
@ -782,7 +782,7 @@ static bool normalize_uint16 (char * __restrict data, uint32_t * __restrict off,
if ((*off = check_align_prim (*off, size, 1)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 1)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint16_t *) (data + *off)) = bswap2u (*((uint16_t *) (data + *off))); *((uint16_t *) (data + *off)) = ddsrt_bswap2u (*((uint16_t *) (data + *off)));
(*off) += 2; (*off) += 2;
return true; return true;
} }
@ -792,7 +792,7 @@ static bool normalize_uint32 (char * __restrict data, uint32_t * __restrict off,
if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint32_t *) (data + *off)) = bswap4u (*((uint32_t *) (data + *off))); *((uint32_t *) (data + *off)) = ddsrt_bswap4u (*((uint32_t *) (data + *off)));
(*off) += 4; (*off) += 4;
return true; return true;
} }
@ -802,7 +802,7 @@ static bool read_and_normalize_uint32 (uint32_t * __restrict val, char * __restr
if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint32_t *) (data + *off)) = bswap4u (*((uint32_t *) (data + *off))); *((uint32_t *) (data + *off)) = ddsrt_bswap4u (*((uint32_t *) (data + *off)));
*val = *((uint32_t *) (data + *off)); *val = *((uint32_t *) (data + *off));
(*off) += 4; (*off) += 4;
return true; return true;
@ -813,7 +813,7 @@ static bool normalize_uint64 (char * __restrict data, uint32_t * __restrict off,
if ((*off = check_align_prim (*off, size, 3)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 3)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint64_t *) (data + *off)) = bswap8u (*((uint64_t *) (data + *off))); *((uint64_t *) (data + *off)) = ddsrt_bswap8u (*((uint64_t *) (data + *off)));
(*off) += 8; (*off) += 8;
return true; return true;
} }
@ -847,7 +847,7 @@ static bool normalize_primarray (char * __restrict data, uint32_t * __restrict o
{ {
uint16_t *xs = (uint16_t *) (data + *off); uint16_t *xs = (uint16_t *) (data + *off);
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
xs[i] = bswap2u (xs[i]); xs[i] = ddsrt_bswap2u (xs[i]);
} }
*off += 2 * num; *off += 2 * num;
return true; return true;
@ -858,7 +858,7 @@ static bool normalize_primarray (char * __restrict data, uint32_t * __restrict o
{ {
uint32_t *xs = (uint32_t *) (data + *off); uint32_t *xs = (uint32_t *) (data + *off);
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
xs[i] = bswap4u (xs[i]); xs[i] = ddsrt_bswap4u (xs[i]);
} }
*off += 4 * num; *off += 4 * num;
return true; return true;
@ -869,7 +869,7 @@ static bool normalize_primarray (char * __restrict data, uint32_t * __restrict o
{ {
uint64_t *xs = (uint64_t *) (data + *off); uint64_t *xs = (uint64_t *) (data + *off);
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
xs[i] = bswap8u (xs[i]); xs[i] = ddsrt_bswap8u (xs[i]);
} }
*off += 8 * num; *off += 8 * num;
return true; return true;
@ -956,7 +956,7 @@ static bool normalize_uni_disc (uint32_t * __restrict val, char * __restrict dat
if ((*off = check_align_prim (*off, size, 1)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 1)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint16_t *) (data + *off)) = bswap2u (*((uint16_t *) (data + *off))); *((uint16_t *) (data + *off)) = ddsrt_bswap2u (*((uint16_t *) (data + *off)));
*val = *((uint16_t *) (data + *off)); *val = *((uint16_t *) (data + *off));
(*off) += 2; (*off) += 2;
return true; return true;
@ -964,7 +964,7 @@ static bool normalize_uni_disc (uint32_t * __restrict val, char * __restrict dat
if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX) if ((*off = check_align_prim (*off, size, 2)) == UINT32_MAX)
return false; return false;
if (bswap) if (bswap)
*((uint32_t *) (data + *off)) = bswap4u (*((uint32_t *) (data + *off))); *((uint32_t *) (data + *off)) = ddsrt_bswap4u (*((uint32_t *) (data + *off)));
*val = *((uint32_t *) (data + *off)); *val = *((uint32_t *) (data + *off));
(*off) += 4; (*off) += 4;
return true; return true;
@ -1180,19 +1180,19 @@ static void dds_stream_swap_insitu (void * __restrict vbuf, uint32_t size, uint3
case 2: { case 2: {
uint16_t *buf = vbuf; uint16_t *buf = vbuf;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
buf[i] = bswap2u (buf[i]); buf[i] = ddsrt_bswap2u (buf[i]);
break; break;
} }
case 4: { case 4: {
uint32_t *buf = vbuf; uint32_t *buf = vbuf;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
buf[i] = bswap4u (buf[i]); buf[i] = ddsrt_bswap4u (buf[i]);
break; break;
} }
case 8: { case 8: {
uint64_t *buf = vbuf; uint64_t *buf = vbuf;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
buf[i] = bswap8u (buf[i]); buf[i] = ddsrt_bswap8u (buf[i]);
break; break;
} }
} }
@ -1294,21 +1294,21 @@ static void dds_stream_swap_copy (void * __restrict vdst, const void * __restric
const uint16_t *src = vsrc; const uint16_t *src = vsrc;
uint16_t *dst = vdst; uint16_t *dst = vdst;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
dst[i] = bswap2u (src[i]); dst[i] = ddsrt_bswap2u (src[i]);
break; break;
} }
case 4: { case 4: {
const uint32_t *src = vsrc; const uint32_t *src = vsrc;
uint32_t *dst = vdst; uint32_t *dst = vdst;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
dst[i] = bswap4u (src[i]); dst[i] = ddsrt_bswap4u (src[i]);
break; break;
} }
case 8: { case 8: {
const uint64_t *src = vsrc; const uint64_t *src = vsrc;
uint64_t *dst = vdst; uint64_t *dst = vdst;
for (uint32_t i = 0; i < num; i++) for (uint32_t i = 0; i < num; i++)
dst[i] = bswap8u (src[i]); dst[i] = ddsrt_bswap8u (src[i]);
break; break;
} }
} }
@ -1943,7 +1943,7 @@ void dds_ostream_add_to_serdata_default (dds_ostream_t * __restrict s, struct dd
(*d) = (void *) s->m_buffer; (*d) = (void *) s->m_buffer;
(*d)->pos = (s->m_index - (uint32_t) offsetof (struct ddsi_serdata_default, data)); (*d)->pos = (s->m_index - (uint32_t) offsetof (struct ddsi_serdata_default, data));
(*d)->size = (s->m_size - (uint32_t) offsetof (struct ddsi_serdata_default, data)); (*d)->size = (s->m_size - (uint32_t) offsetof (struct ddsi_serdata_default, data));
(*d)->hdr.options = toBE2u ((uint16_t) pad); (*d)->hdr.options = ddsrt_toBE2u ((uint16_t) pad);
} }
void dds_ostreamBE_from_serdata_default (dds_ostreamBE_t * __restrict s, struct ddsi_serdata_default * __restrict d) void dds_ostreamBE_from_serdata_default (dds_ostreamBE_t * __restrict s, struct ddsi_serdata_default * __restrict d)
@ -1966,5 +1966,5 @@ void dds_ostreamBE_add_to_serdata_default (dds_ostreamBE_t * __restrict s, struc
(*d) = (void *) s->x.m_buffer; (*d) = (void *) s->x.m_buffer;
(*d)->pos = (s->x.m_index - (uint32_t) offsetof (struct ddsi_serdata_default, data)); (*d)->pos = (s->x.m_index - (uint32_t) offsetof (struct ddsi_serdata_default, data));
(*d)->size = (s->x.m_size - (uint32_t) offsetof (struct ddsi_serdata_default, data)); (*d)->size = (s->x.m_size - (uint32_t) offsetof (struct ddsi_serdata_default, data));
(*d)->hdr.options = toBE2u ((uint16_t) pad); (*d)->hdr.options = ddsrt_toBE2u ((uint16_t) pad);
} }

View file

@ -63,7 +63,7 @@ get_test_property(CUnit_ddsc_config_simple_udp ENVIRONMENT CUnit_ddsc_config_sim
set(CUnit_ddsc_config_simple_udp_file "${CMAKE_CURRENT_LIST_DIR}/config_simple_udp.xml") set(CUnit_ddsc_config_simple_udp_file "${CMAKE_CURRENT_LIST_DIR}/config_simple_udp.xml")
set(CUnit_ddsc_config_simple_udp_uri "file://${CUnit_ddsc_config_simple_udp_file}") set(CUnit_ddsc_config_simple_udp_uri "file://${CUnit_ddsc_config_simple_udp_file}")
set(CUnit_ddsc_config_simple_udp_max_participants "0") set(CUnit_ddsc_config_simple_udp_max_participants "0")
set(CUnit_ddsc_config_simple_udp_env "${CMAKE_PROJECT_NAME_CAPS}_URI=${CUnit_ddsc_config_simple_udp_uri};MAX_PARTICIPANTS=${CUnit_ddsc_config_simple_udp_max_participants};${CUnit_ddsc_config_simple_udp_env}") set(CUnit_ddsc_config_simple_udp_env "${PROJECT_NAME_CAPS}_URI=${CUnit_ddsc_config_simple_udp_uri};MAX_PARTICIPANTS=${CUnit_ddsc_config_simple_udp_max_participants};${CUnit_ddsc_config_simple_udp_env}")
set_tests_properties( set_tests_properties(
CUnit_ddsc_config_simple_udp CUnit_ddsc_config_simple_udp

View file

@ -30,7 +30,6 @@ PREPEND(srcs_ddsi "${CMAKE_CURRENT_LIST_DIR}/src"
q_addrset.c q_addrset.c
q_bitset_inlines.c q_bitset_inlines.c
q_bswap.c q_bswap.c
q_bswap_inlines.c
q_config.c q_config.c
q_ddsi_discovery.c q_ddsi_discovery.c
q_debmon.c q_debmon.c
@ -136,7 +135,7 @@ target_include_directories(ddsc
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include") PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include")
install( install(
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/dds" DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev) COMPONENT dev)

View file

@ -14,7 +14,7 @@
#include <stdint.h> #include <stdint.h>
#include "dds/ddsrt/endian.h" #include "dds/ddsrt/bswap.h"
#include "dds/ddsrt/misc.h" #include "dds/ddsrt/misc.h"
#include "dds/ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */ #include "dds/ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */
#include "dds/ddsi/q_protocol.h" /* for nn_sequence_number_t */ #include "dds/ddsi/q_protocol.h" /* for nn_sequence_number_t */
@ -23,71 +23,12 @@
extern "C" { extern "C" {
#endif #endif
inline uint16_t bswap2u (uint16_t x)
{
return (uint16_t) ((x >> 8) | (x << 8));
}
inline int16_t bswap2 (int16_t x)
{
return (int16_t) bswap2u ((uint16_t) x);
}
inline uint32_t bswap4u (uint32_t x)
{
return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
}
inline int32_t bswap4 (int32_t x)
{
return (int32_t) bswap4u ((uint32_t) x);
}
inline uint64_t bswap8u (uint64_t x)
{
const uint32_t newhi = bswap4u ((uint32_t) x);
const uint32_t newlo = bswap4u ((uint32_t) (x >> 32));
return ((uint64_t) newhi << 32) | (uint64_t) newlo;
}
inline int64_t bswap8 (int64_t x)
{
return (int64_t) bswap8u ((uint64_t) x);
}
inline void bswapSN (nn_sequence_number_t *sn) inline void bswapSN (nn_sequence_number_t *sn)
{ {
sn->high = bswap4 (sn->high); sn->high = ddsrt_bswap4 (sn->high);
sn->low = bswap4u (sn->low); sn->low = ddsrt_bswap4u (sn->low);
} }
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
#define toBE2(x) bswap2 (x)
#define toBE2u(x) bswap2u (x)
#define toBE4(x) bswap4 (x)
#define toBE4u(x) bswap4u (x)
#define toBE8(x) bswap8 (x)
#define toBE8u(x) bswap8u (x)
#define fromBE2(x) bswap2 (x)
#define fromBE2u(x) bswap2u (x)
#define fromBE4(x) bswap4 (x)
#define fromBE4u(x) bswap4u (x)
#define fromBE8(x) bswap8 (x)
#define fromBE8u(x) bswap8u (x)
#else
#define toBE2u(x) (x)
#define toBE4(x) (x)
#define toBE4u(x) (x)
#define toBE8(x) (x)
#define toBE8u(x) (x)
#define fromBE2(x) (x)
#define fromBE2u(x) (x)
#define fromBE4(x) (x)
#define fromBE4u(x) (x)
#define fromBE8(x) (x)
#define fromBE8u(x) (x)
#endif
ddsi_guid_prefix_t nn_hton_guid_prefix (ddsi_guid_prefix_t p); ddsi_guid_prefix_t nn_hton_guid_prefix (ddsi_guid_prefix_t p);
ddsi_guid_prefix_t nn_ntoh_guid_prefix (ddsi_guid_prefix_t p); ddsi_guid_prefix_t nn_ntoh_guid_prefix (ddsi_guid_prefix_t p);
ddsi_entityid_t nn_hton_entityid (ddsi_entityid_t e); ddsi_entityid_t nn_hton_entityid (ddsi_entityid_t e);

View file

@ -296,7 +296,7 @@ static struct ddsi_serdata_default *serdata_default_from_ser_common (const struc
const bool needs_bswap = (d->hdr.identifier != NATIVE_ENCODING); const bool needs_bswap = (d->hdr.identifier != NATIVE_ENCODING);
d->hdr.identifier = NATIVE_ENCODING; d->hdr.identifier = NATIVE_ENCODING;
const uint32_t pad = fromBE2u (d->hdr.options) & 2; const uint32_t pad = ddsrt_fromBE2u (d->hdr.options) & 2;
if (d->pos < pad) if (d->pos < pad)
{ {
ddsi_serdata_unref (&d->c); ddsi_serdata_unref (&d->c);
@ -474,7 +474,7 @@ static struct ddsi_serdata *serdata_default_from_sample_plist (const struct ddsi
ddsrt_md5_state_t md5st; ddsrt_md5_state_t md5st;
ddsrt_md5_byte_t digest[16]; ddsrt_md5_byte_t digest[16];
topic_name_sz = (uint32_t) strlen (topic_name) + 1; topic_name_sz = (uint32_t) strlen (topic_name) + 1;
topic_name_sz_BE = toBE4u (topic_name_sz); topic_name_sz_BE = ddsrt_toBE4u (topic_name_sz);
d->keyhash.m_set = 1; d->keyhash.m_set = 1;
d->keyhash.m_iskey = 0; d->keyhash.m_iskey = 0;
ddsrt_md5_init (&md5st); ddsrt_md5_init (&md5st);

View file

@ -11,11 +11,13 @@
*/ */
#include "dds/ddsi/q_bswap.h" #include "dds/ddsi/q_bswap.h"
extern inline void bswapSN (nn_sequence_number_t *sn);
ddsi_guid_prefix_t nn_hton_guid_prefix (ddsi_guid_prefix_t p) ddsi_guid_prefix_t nn_hton_guid_prefix (ddsi_guid_prefix_t p)
{ {
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
p.u[i] = toBE4u (p.u[i]); p.u[i] = ddsrt_toBE4u (p.u[i]);
return p; return p;
} }
@ -23,19 +25,19 @@ ddsi_guid_prefix_t nn_ntoh_guid_prefix (ddsi_guid_prefix_t p)
{ {
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
p.u[i] = fromBE4u (p.u[i]); p.u[i] = ddsrt_fromBE4u (p.u[i]);
return p; return p;
} }
ddsi_entityid_t nn_hton_entityid (ddsi_entityid_t e) ddsi_entityid_t nn_hton_entityid (ddsi_entityid_t e)
{ {
e.u = toBE4u (e.u); e.u = ddsrt_toBE4u (e.u);
return e; return e;
} }
ddsi_entityid_t nn_ntoh_entityid (ddsi_entityid_t e) ddsi_entityid_t nn_ntoh_entityid (ddsi_entityid_t e)
{ {
e.u = fromBE4u (e.u); e.u = ddsrt_fromBE4u (e.u);
return e; return e;
} }
@ -56,25 +58,26 @@ ddsi_guid_t nn_ntoh_guid (ddsi_guid_t g)
void bswap_sequence_number_set_hdr (nn_sequence_number_set_header_t *snset) void bswap_sequence_number_set_hdr (nn_sequence_number_set_header_t *snset)
{ {
bswapSN (&snset->bitmap_base); bswapSN (&snset->bitmap_base);
snset->numbits = bswap4u (snset->numbits); snset->numbits = ddsrt_bswap4u (snset->numbits);
} }
void bswap_sequence_number_set_bitmap (nn_sequence_number_set_header_t *snset, uint32_t *bits) void bswap_sequence_number_set_bitmap (nn_sequence_number_set_header_t *snset, uint32_t *bits)
{ {
const uint32_t n = (snset->numbits + 31) / 32; const uint32_t n = (snset->numbits + 31) / 32;
for (uint32_t i = 0; i < n; i++) for (uint32_t i = 0; i < n; i++)
bits[i] = bswap4u (bits[i]); bits[i] = ddsrt_bswap4u (bits[i]);
} }
void bswap_fragment_number_set_hdr (nn_fragment_number_set_header_t *fnset) void bswap_fragment_number_set_hdr (nn_fragment_number_set_header_t *fnset)
{ {
fnset->bitmap_base = bswap4u (fnset->bitmap_base); fnset->bitmap_base = ddsrt_bswap4u (fnset->bitmap_base);
fnset->numbits = bswap4u (fnset->numbits); fnset->numbits = ddsrt_bswap4u (fnset->numbits);
} }
void bswap_fragment_number_set_bitmap (nn_fragment_number_set_header_t *fnset, uint32_t *bits) void bswap_fragment_number_set_bitmap (nn_fragment_number_set_header_t *fnset, uint32_t *bits)
{ {
const uint32_t n = (fnset->numbits + 31) / 32; const uint32_t n = (fnset->numbits + 31) / 32;
for (uint32_t i = 0; i < n; i++) for (uint32_t i = 0; i < n; i++)
bits[i] = bswap4u (bits[i]); bits[i] = ddsrt_bswap4u (bits[i]);
} }

View file

@ -1038,7 +1038,7 @@ int rtps_init (struct q_globals *gv)
that won't repeat in the lifetime of the process. Seems like it ought to work that won't repeat in the lifetime of the process. Seems like it ought to work
to keep the risks of collisions low. */ to keep the risks of collisions low. */
{ {
uint64_t iid = toBE8u (ddsi_iid_gen ()); uint64_t iid = ddsrt_toBE8u (ddsi_iid_gen ());
ddsrt_md5_state_t st; ddsrt_md5_state_t st;
ddsrt_md5_byte_t digest[16]; ddsrt_md5_byte_t digest[16];
ddsrt_md5_init (&st); ddsrt_md5_init (&st);

View file

@ -320,7 +320,7 @@ void handle_PMD (const struct receiver_state *rst, nn_wctime_t timestamp, uint32
const ParticipantMessageData_t *pmd = (ParticipantMessageData_t *) (data + 1); const ParticipantMessageData_t *pmd = (ParticipantMessageData_t *) (data + 1);
ddsi_guid_prefix_t p = nn_ntoh_guid_prefix (pmd->participantGuidPrefix); ddsi_guid_prefix_t p = nn_ntoh_guid_prefix (pmd->participantGuidPrefix);
uint32_t kind = ntohl (pmd->kind); uint32_t kind = ntohl (pmd->kind);
uint32_t length = bswap ? bswap4u (pmd->length) : pmd->length; uint32_t length = bswap ? ddsrt_bswap4u (pmd->length) : pmd->length;
RSTTRACE (" pp %"PRIx32":%"PRIx32":%"PRIx32" kind %u data %u", p.u[0], p.u[1], p.u[2], kind, length); RSTTRACE (" pp %"PRIx32":%"PRIx32":%"PRIx32" kind %u data %u", p.u[0], p.u[1], p.u[2], kind, length);
if (len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value) < length) if (len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value) < length)
debug_print_rawdata (rst->gv, " SHORT2", pmd->value, len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value)); debug_print_rawdata (rst->gv, " SHORT2", pmd->value, len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value));

View file

@ -144,7 +144,7 @@ void write_pcap_received (struct q_globals *gv, nn_wctime_t tstamp, const struct
pcap_hdr.incl_len = pcap_hdr.orig_len = (uint32_t) sz_iud; pcap_hdr.incl_len = pcap_hdr.orig_len = (uint32_t) sz_iud;
fwrite (&pcap_hdr, sizeof (pcap_hdr), 1, gv->pcap_fp); fwrite (&pcap_hdr, sizeof (pcap_hdr), 1, gv->pcap_fp);
u.ipv4_hdr = ipv4_hdr_template; u.ipv4_hdr = ipv4_hdr_template;
u.ipv4_hdr.totallength = toBE2u ((unsigned short) sz_iud); u.ipv4_hdr.totallength = ddsrt_toBE2u ((unsigned short) sz_iud);
u.ipv4_hdr.ttl = 128; u.ipv4_hdr.ttl = 128;
u.ipv4_hdr.srcip = ((struct sockaddr_in*) src)->sin_addr.s_addr; u.ipv4_hdr.srcip = ((struct sockaddr_in*) src)->sin_addr.s_addr;
u.ipv4_hdr.dstip = ((struct sockaddr_in*) dst)->sin_addr.s_addr; u.ipv4_hdr.dstip = ((struct sockaddr_in*) dst)->sin_addr.s_addr;
@ -152,7 +152,7 @@ void write_pcap_received (struct q_globals *gv, nn_wctime_t tstamp, const struct
fwrite (&u.ipv4_hdr, sizeof (u.ipv4_hdr), 1, gv->pcap_fp); fwrite (&u.ipv4_hdr, sizeof (u.ipv4_hdr), 1, gv->pcap_fp);
udp_hdr.srcport = ((struct sockaddr_in*) src)->sin_port; udp_hdr.srcport = ((struct sockaddr_in*) src)->sin_port;
udp_hdr.dstport = ((struct sockaddr_in*) dst)->sin_port; udp_hdr.dstport = ((struct sockaddr_in*) dst)->sin_port;
udp_hdr.length = toBE2u ((unsigned short) sz_ud); udp_hdr.length = ddsrt_toBE2u ((unsigned short) sz_ud);
udp_hdr.checksum = 0; /* don't have to compute a checksum for UDPv4 */ udp_hdr.checksum = 0; /* don't have to compute a checksum for UDPv4 */
fwrite (&udp_hdr, sizeof (udp_hdr), 1, gv->pcap_fp); fwrite (&udp_hdr, sizeof (udp_hdr), 1, gv->pcap_fp);
fwrite (buf, sz, 1, gv->pcap_fp); fwrite (buf, sz, 1, gv->pcap_fp);
@ -177,7 +177,7 @@ void write_pcap_sent (struct q_globals *gv, nn_wctime_t tstamp, const struct soc
pcap_hdr.incl_len = pcap_hdr.orig_len = (uint32_t) sz_iud; pcap_hdr.incl_len = pcap_hdr.orig_len = (uint32_t) sz_iud;
fwrite (&pcap_hdr, sizeof (pcap_hdr), 1, gv->pcap_fp); fwrite (&pcap_hdr, sizeof (pcap_hdr), 1, gv->pcap_fp);
u.ipv4_hdr = ipv4_hdr_template; u.ipv4_hdr = ipv4_hdr_template;
u.ipv4_hdr.totallength = toBE2u ((unsigned short) sz_iud); u.ipv4_hdr.totallength = ddsrt_toBE2u ((unsigned short) sz_iud);
u.ipv4_hdr.ttl = 255; u.ipv4_hdr.ttl = 255;
u.ipv4_hdr.srcip = ((struct sockaddr_in*) src)->sin_addr.s_addr; u.ipv4_hdr.srcip = ((struct sockaddr_in*) src)->sin_addr.s_addr;
u.ipv4_hdr.dstip = ((struct sockaddr_in*) hdr->msg_name)->sin_addr.s_addr; u.ipv4_hdr.dstip = ((struct sockaddr_in*) hdr->msg_name)->sin_addr.s_addr;
@ -185,7 +185,7 @@ void write_pcap_sent (struct q_globals *gv, nn_wctime_t tstamp, const struct soc
fwrite (&u.ipv4_hdr, sizeof (u.ipv4_hdr), 1, gv->pcap_fp); fwrite (&u.ipv4_hdr, sizeof (u.ipv4_hdr), 1, gv->pcap_fp);
udp_hdr.srcport = ((struct sockaddr_in*) src)->sin_port; udp_hdr.srcport = ((struct sockaddr_in*) src)->sin_port;
udp_hdr.dstport = ((struct sockaddr_in*) hdr->msg_name)->sin_port; udp_hdr.dstport = ((struct sockaddr_in*) hdr->msg_name)->sin_port;
udp_hdr.length = toBE2u ((unsigned short) sz_ud); udp_hdr.length = ddsrt_toBE2u ((unsigned short) sz_ud);
udp_hdr.checksum = 0; /* don't have to compute a checksum for UDPv4 */ udp_hdr.checksum = 0; /* don't have to compute a checksum for UDPv4 */
fwrite (&udp_hdr, sizeof (udp_hdr), 1, gv->pcap_fp); fwrite (&udp_hdr, sizeof (udp_hdr), 1, gv->pcap_fp);
write_data (gv->pcap_fp, hdr, sz); write_data (gv->pcap_fp, hdr, sz);

View file

@ -216,7 +216,7 @@ static dds_return_t deser_uint32 (uint32_t *dst, const struct dd * __restrict dd
return DDS_RETCODE_BAD_PARAMETER; return DDS_RETCODE_BAD_PARAMETER;
tmp = *((uint32_t *) (dd->buf + off1)); tmp = *((uint32_t *) (dd->buf + off1));
if (dd->bswap) if (dd->bswap)
tmp = bswap4u (tmp); tmp = ddsrt_bswap4u (tmp);
*dst = tmp; *dst = tmp;
*off = off1 + 4; *off = off1 + 4;
return 0; return 0;
@ -230,7 +230,7 @@ static dds_return_t deser_int64 (int64_t *dst, const struct dd * __restrict dd,
return DDS_RETCODE_BAD_PARAMETER; return DDS_RETCODE_BAD_PARAMETER;
tmp = *((int64_t *) (dd->buf + off1)); tmp = *((int64_t *) (dd->buf + off1));
if (dd->bswap) if (dd->bswap)
tmp = bswap8 (tmp); tmp = ddsrt_bswap8 (tmp);
*dst = tmp; *dst = tmp;
*off = off1 + 8; *off = off1 + 8;
return 0; return 0;
@ -298,7 +298,7 @@ static dds_return_t deser_statusinfo (void * __restrict dst, size_t * __restrict
/* status info is always in BE format (it is an array of 4 octets according to the spec) -- /* status info is always in BE format (it is an array of 4 octets according to the spec) --
fortunately we have 4 byte alignment anyway -- and can have bits set we don't grok fortunately we have 4 byte alignment anyway -- and can have bits set we don't grok
(which we discard) */ (which we discard) */
*x = fromBE4u (*((uint32_t *) (dd->buf + srcoff1))) & NN_STATUSINFO_STANDARDIZED; *x = ddsrt_fromBE4u (*((uint32_t *) (dd->buf + srcoff1))) & NN_STATUSINFO_STANDARDIZED;
*dstoff += sizeof (*x); *dstoff += sizeof (*x);
*srcoff = srcoff1 + 4; *srcoff = srcoff1 + 4;
*flagset->present |= flag; *flagset->present |= flag;
@ -309,7 +309,7 @@ static dds_return_t ser_statusinfo (struct nn_xmsg *xmsg, nn_parameterid_t pid,
{ {
uint32_t const * const x = deser_generic_src (src, &srcoff, alignof (uint32_t)); uint32_t const * const x = deser_generic_src (src, &srcoff, alignof (uint32_t));
uint32_t * const p = nn_xmsg_addpar (xmsg, pid, sizeof (uint32_t)); uint32_t * const p = nn_xmsg_addpar (xmsg, pid, sizeof (uint32_t));
*p = toBE4u (*x); *p = ddsrt_toBE4u (*x);
return 0; return 0;
} }
@ -2032,8 +2032,8 @@ static dds_return_t do_locator (nn_locators_t *ls, uint64_t *present, uint64_t w
memcpy (&loc, dd->buf, sizeof (loc)); memcpy (&loc, dd->buf, sizeof (loc));
if (dd->bswap) if (dd->bswap)
{ {
loc.kind = bswap4 (loc.kind); loc.kind = ddsrt_bswap4 (loc.kind);
loc.port = bswap4u (loc.port); loc.port = ddsrt_bswap4u (loc.port);
} }
switch (loc.kind) switch (loc.kind)
{ {
@ -2187,7 +2187,7 @@ static dds_return_t do_port (nn_plist_t *dest, nn_ipaddress_params_tmp_t *dest_t
} }
memcpy (p, dd->buf, sizeof (*p)); memcpy (p, dd->buf, sizeof (*p));
if (dd->bswap) if (dd->bswap)
*p = bswap4u (*p); *p = ddsrt_bswap4u (*p);
if (*p <= 0 || *p > 65535) if (*p <= 0 || *p > 65535)
return DDS_RETCODE_BAD_PARAMETER; return DDS_RETCODE_BAD_PARAMETER;
dest_tmp->present |= fl_tmp; dest_tmp->present |= fl_tmp;
@ -2488,8 +2488,8 @@ dds_return_t nn_plist_init_frommsg (nn_plist_t *dest, char **nextafterplist, uin
/* swapping header partially based on wireshark dissector /* swapping header partially based on wireshark dissector
output, partially on intuition, and in a small part based on output, partially on intuition, and in a small part based on
the spec */ the spec */
pid = (nn_parameterid_t) (dd.bswap ? bswap2u (par->parameterid) : par->parameterid); pid = (nn_parameterid_t) (dd.bswap ? ddsrt_bswap2u (par->parameterid) : par->parameterid);
length = (uint16_t) (dd.bswap ? bswap2u (par->length) : par->length); length = (uint16_t) (dd.bswap ? ddsrt_bswap2u (par->length) : par->length);
if (pid == PID_SENTINEL) if (pid == PID_SENTINEL)
{ {
/* Sentinel terminates list, the length is ignored, DDSI 9.4.2.11. */ /* Sentinel terminates list, the length is ignored, DDSI 9.4.2.11. */
@ -2607,8 +2607,8 @@ unsigned char *nn_plist_quickscan (struct nn_rsample_info *dest, const struct nn
nn_parameter_t *par = (nn_parameter_t *) pl; nn_parameter_t *par = (nn_parameter_t *) pl;
nn_parameterid_t pid; nn_parameterid_t pid;
uint16_t length; uint16_t length;
pid = (nn_parameterid_t) (dest->bswap ? bswap2u (par->parameterid) : par->parameterid); pid = (nn_parameterid_t) (dest->bswap ? ddsrt_bswap2u (par->parameterid) : par->parameterid);
length = (uint16_t) (dest->bswap ? bswap2u (par->length) : par->length); length = (uint16_t) (dest->bswap ? ddsrt_bswap2u (par->length) : par->length);
pl += sizeof (*par); pl += sizeof (*par);
if (pid == PID_SENTINEL) if (pid == PID_SENTINEL)
return (unsigned char *) pl; return (unsigned char *) pl;
@ -2639,7 +2639,7 @@ unsigned char *nn_plist_quickscan (struct nn_rsample_info *dest, const struct nn
{ {
/* can only represent 2 LSBs of statusinfo in "dest", so if others are set, /* can only represent 2 LSBs of statusinfo in "dest", so if others are set,
mark it as a "complex_qos" and accept the hit of parsing the data completely. */ mark it as a "complex_qos" and accept the hit of parsing the data completely. */
uint32_t stinfo = fromBE4u (*((uint32_t *) pl)); uint32_t stinfo = ddsrt_fromBE4u (*((uint32_t *) pl));
dest->statusinfo = stinfo & 3u; dest->statusinfo = stinfo & 3u;
if ((stinfo & ~3u)) if ((stinfo & ~3u))
dest->complex_qos = 1; dest->complex_qos = 1;

View file

@ -145,7 +145,7 @@ static int valid_AckNack (const struct receiver_state *rst, AckNack_t *msg, size
if (byteswap) if (byteswap)
{ {
bswap_sequence_number_set_bitmap (&msg->readerSNState, msg->bits); bswap_sequence_number_set_bitmap (&msg->readerSNState, msg->bits);
*count = bswap4 (*count); *count = ddsrt_bswap4 (*count);
} }
return 1; return 1;
} }
@ -199,8 +199,8 @@ static int valid_InfoTS (InfoTS_t *msg, size_t size, int byteswap)
{ {
if (byteswap) if (byteswap)
{ {
msg->time.seconds = bswap4 (msg->time.seconds); msg->time.seconds = ddsrt_bswap4 (msg->time.seconds);
msg->time.fraction = bswap4u (msg->time.fraction); msg->time.fraction = ddsrt_bswap4u (msg->time.fraction);
} }
return valid_ddsi_timestamp (msg->time); return valid_ddsi_timestamp (msg->time);
} }
@ -214,7 +214,7 @@ static int valid_Heartbeat (Heartbeat_t *msg, size_t size, int byteswap)
{ {
bswapSN (&msg->firstSN); bswapSN (&msg->firstSN);
bswapSN (&msg->lastSN); bswapSN (&msg->lastSN);
msg->count = bswap4 (msg->count); msg->count = ddsrt_bswap4 (msg->count);
} }
msg->readerId = nn_ntoh_entityid (msg->readerId); msg->readerId = nn_ntoh_entityid (msg->readerId);
msg->writerId = nn_ntoh_entityid (msg->writerId); msg->writerId = nn_ntoh_entityid (msg->writerId);
@ -231,8 +231,8 @@ static int valid_HeartbeatFrag (HeartbeatFrag_t *msg, size_t size, int byteswap)
if (byteswap) if (byteswap)
{ {
bswapSN (&msg->writerSN); bswapSN (&msg->writerSN);
msg->lastFragmentNum = bswap4u (msg->lastFragmentNum); msg->lastFragmentNum = ddsrt_bswap4u (msg->lastFragmentNum);
msg->count = bswap4 (msg->count); msg->count = ddsrt_bswap4 (msg->count);
} }
msg->readerId = nn_ntoh_entityid (msg->readerId); msg->readerId = nn_ntoh_entityid (msg->readerId);
msg->writerId = nn_ntoh_entityid (msg->writerId); msg->writerId = nn_ntoh_entityid (msg->writerId);
@ -267,7 +267,7 @@ static int valid_NackFrag (NackFrag_t *msg, size_t size, int byteswap)
if (byteswap) if (byteswap)
{ {
bswap_fragment_number_set_bitmap (&msg->fragmentNumberState, msg->bits); bswap_fragment_number_set_bitmap (&msg->fragmentNumberState, msg->bits);
*count = bswap4 (*count); *count = ddsrt_bswap4 (*count);
} }
return 1; return 1;
} }
@ -292,8 +292,8 @@ static int valid_Data (const struct receiver_state *rst, struct nn_rmsg *rmsg, D
return 0; return 0;
if (byteswap) if (byteswap)
{ {
msg->x.extraFlags = bswap2u (msg->x.extraFlags); msg->x.extraFlags = ddsrt_bswap2u (msg->x.extraFlags);
msg->x.octetsToInlineQos = bswap2u (msg->x.octetsToInlineQos); msg->x.octetsToInlineQos = ddsrt_bswap2u (msg->x.octetsToInlineQos);
bswapSN (&msg->x.writerSN); bswapSN (&msg->x.writerSN);
} }
msg->x.readerId = nn_ntoh_entityid (msg->x.readerId); msg->x.readerId = nn_ntoh_entityid (msg->x.readerId);
@ -400,13 +400,13 @@ static int valid_DataFrag (const struct receiver_state *rst, struct nn_rmsg *rms
if (byteswap) if (byteswap)
{ {
msg->x.extraFlags = bswap2u (msg->x.extraFlags); msg->x.extraFlags = ddsrt_bswap2u (msg->x.extraFlags);
msg->x.octetsToInlineQos = bswap2u (msg->x.octetsToInlineQos); msg->x.octetsToInlineQos = ddsrt_bswap2u (msg->x.octetsToInlineQos);
bswapSN (&msg->x.writerSN); bswapSN (&msg->x.writerSN);
msg->fragmentStartingNum = bswap4u (msg->fragmentStartingNum); msg->fragmentStartingNum = ddsrt_bswap4u (msg->fragmentStartingNum);
msg->fragmentsInSubmessage = bswap2u (msg->fragmentsInSubmessage); msg->fragmentsInSubmessage = ddsrt_bswap2u (msg->fragmentsInSubmessage);
msg->fragmentSize = bswap2u (msg->fragmentSize); msg->fragmentSize = ddsrt_bswap2u (msg->fragmentSize);
msg->sampleSize = bswap4u (msg->sampleSize); msg->sampleSize = ddsrt_bswap4u (msg->sampleSize);
} }
msg->x.readerId = nn_ntoh_entityid (msg->x.readerId); msg->x.readerId = nn_ntoh_entityid (msg->x.readerId);
msg->x.writerId = nn_ntoh_entityid (msg->x.writerId); msg->x.writerId = nn_ntoh_entityid (msg->x.writerId);
@ -2662,7 +2662,7 @@ static int handle_submsg_sequence
} }
if (byteswap) if (byteswap)
{ {
sm->smhdr.octetsToNextHeader = bswap2u (sm->smhdr.octetsToNextHeader); sm->smhdr.octetsToNextHeader = ddsrt_bswap2u (sm->smhdr.octetsToNextHeader);
} }
octetsToNextHeader = sm->smhdr.octetsToNextHeader; octetsToNextHeader = sm->smhdr.octetsToNextHeader;
@ -2929,7 +2929,7 @@ static bool do_packet (struct thread_state1 * const ts1, struct q_globals *gv, d
} }
if (swap) if (swap)
{ {
ml->length = bswap4u (ml->length); ml->length = ddsrt_bswap4u (ml->length);
} }
if (ml->smhdr.submessageId != SMID_PT_MSG_LEN) if (ml->smhdr.submessageId != SMID_PT_MSG_LEN)

View file

@ -1109,7 +1109,7 @@ static void write_pmd_message (struct thread_state1 * const ts1, struct nn_xpack
} }
u.pmd.participantGuidPrefix = nn_hton_guid_prefix (pp->e.guid.prefix); u.pmd.participantGuidPrefix = nn_hton_guid_prefix (pp->e.guid.prefix);
u.pmd.kind = toBE4u (pmd_kind); u.pmd.kind = ddsrt_toBE4u (pmd_kind);
u.pmd.length = PMD_DATA_LENGTH; u.pmd.length = PMD_DATA_LENGTH;
memset (u.pmd.value, 0, u.pmd.length); memset (u.pmd.value, 0, u.pmd.length);

View file

@ -786,7 +786,7 @@ void nn_xmsg_addpar_keyhash (struct nn_xmsg *m, const struct ddsi_serdata *serda
static void nn_xmsg_addpar_BE4u (struct nn_xmsg *m, nn_parameterid_t pid, uint32_t x) static void nn_xmsg_addpar_BE4u (struct nn_xmsg *m, nn_parameterid_t pid, uint32_t x)
{ {
unsigned *p = nn_xmsg_addpar (m, pid, sizeof (x)); unsigned *p = nn_xmsg_addpar (m, pid, sizeof (x));
*p = toBE4u (x); *p = ddsrt_toBE4u (x);
} }
void nn_xmsg_addpar_statusinfo (struct nn_xmsg *m, unsigned statusinfo) void nn_xmsg_addpar_statusinfo (struct nn_xmsg *m, unsigned statusinfo)
@ -800,8 +800,8 @@ void nn_xmsg_addpar_statusinfo (struct nn_xmsg *m, unsigned statusinfo)
assert ((statusinfo & ~NN_STATUSINFO_STANDARDIZED) == NN_STATUSINFO_OSPL_AUTO); assert ((statusinfo & ~NN_STATUSINFO_STANDARDIZED) == NN_STATUSINFO_OSPL_AUTO);
if (statusinfo & NN_STATUSINFO_OSPL_AUTO) if (statusinfo & NN_STATUSINFO_OSPL_AUTO)
statusinfox |= NN_STATUSINFOX_OSPL_AUTO; statusinfox |= NN_STATUSINFOX_OSPL_AUTO;
p[0] = toBE4u (statusinfo & NN_STATUSINFO_STANDARDIZED); p[0] = ddsrt_toBE4u (statusinfo & NN_STATUSINFO_STANDARDIZED);
p[1] = toBE4u (statusinfox); p[1] = ddsrt_toBE4u (statusinfox);
} }
} }
@ -1374,7 +1374,7 @@ int nn_xpack_addmsg (struct nn_xpack *xp, struct nn_xmsg *m, const uint32_t flag
assert (m->refd_payload == NULL || (m->refd_payload_iov.iov_len % 4) == 0); assert (m->refd_payload == NULL || (m->refd_payload_iov.iov_len % 4) == 0);
if (xp->iov == NULL) if (xp->iov == NULL)
xp->iov = malloc (NN_XMSG_MAX_MESSAGE_IOVECS * sizeof (*xp->iov)); xp->iov = ddsrt_malloc (NN_XMSG_MAX_MESSAGE_IOVECS * sizeof (*xp->iov));
if (!nn_xpack_mayaddmsg (xp, m, flags)) if (!nn_xpack_mayaddmsg (xp, m, flags))
{ {

View file

@ -117,6 +117,7 @@ list(APPEND headers
"${include_path}/dds/ddsrt/static_assert.h") "${include_path}/dds/ddsrt/static_assert.h")
list(APPEND sources list(APPEND sources
"${source_path}/bswap.c"
"${source_path}/io.c" "${source_path}/io.c"
"${source_path}/log.c" "${source_path}/log.c"
"${source_path}/retcode.c" "${source_path}/retcode.c"
@ -262,20 +263,9 @@ if(BUILD_TESTING)
endif() endif()
install( install(
DIRECTORY "include/dds" DIRECTORY
"include/"
${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev COMPONENT dev
FILES_MATCHING PATTERN "*.h") FILES_MATCHING PATTERN "*.h")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/dds/version.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dds"
COMPONENT dev)
if(WIN32)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/getopt.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev)
endif()

View file

@ -0,0 +1,87 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef DDSRT_BSWAP_H
#define DDSRT_BSWAP_H
#include <stdint.h>
#include <stdlib.h>
#include "dds/ddsrt/endian.h"
#if defined (__cplusplus)
extern "C" {
#endif
inline uint16_t ddsrt_bswap2u (uint16_t x)
{
return (uint16_t) ((x >> 8) | (x << 8));
}
inline int16_t ddsrt_bswap2 (int16_t x)
{
return (int16_t) ddsrt_bswap2u ((uint16_t) x);
}
inline uint32_t ddsrt_bswap4u (uint32_t x)
{
return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
}
inline int32_t ddsrt_bswap4 (int32_t x)
{
return (int32_t) ddsrt_bswap4u ((uint32_t) x);
}
inline uint64_t ddsrt_bswap8u (uint64_t x)
{
const uint32_t newhi = ddsrt_bswap4u ((uint32_t) x);
const uint32_t newlo = ddsrt_bswap4u ((uint32_t) (x >> 32));
return ((uint64_t) newhi << 32) | (uint64_t) newlo;
}
inline int64_t ddsrt_bswap8 (int64_t x)
{
return (int64_t) ddsrt_bswap8u ((uint64_t) x);
}
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
#define ddsrt_toBE2(x) ddsrt_bswap2 (x)
#define ddsrt_toBE2u(x) ddsrt_bswap2u (x)
#define ddsrt_toBE4(x) ddsrt_bswap4 (x)
#define ddsrt_toBE4u(x) ddsrt_bswap4u (x)
#define ddsrt_toBE8(x) ddsrt_bswap8 (x)
#define ddsrt_toBE8u(x) ddsrt_bswap8u (x)
#define ddsrt_fromBE2(x) ddsrt_bswap2 (x)
#define ddsrt_fromBE2u(x) ddsrt_bswap2u (x)
#define ddsrt_fromBE4(x) ddsrt_bswap4 (x)
#define ddsrt_fromBE4u(x) ddsrt_bswap4u (x)
#define ddsrt_fromBE8(x) ddsrt_bswap8 (x)
#define ddsrt_fromBE8u(x) ddsrt_bswap8u (x)
#else
#define ddsrt_toBE2u(x) (x)
#define ddsrt_toBE4(x) (x)
#define ddsrt_toBE4u(x) (x)
#define ddsrt_toBE8(x) (x)
#define ddsrt_toBE8u(x) (x)
#define ddsrt_fromBE2(x) (x)
#define ddsrt_fromBE2u(x) (x)
#define ddsrt_fromBE4(x) (x)
#define ddsrt_fromBE4u(x) (x)
#define ddsrt_fromBE8(x) (x)
#define ddsrt_fromBE8u(x) (x)
#endif
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_BSWAP_H */

View file

@ -17,10 +17,10 @@
#define DDS_VERSION_MINOR @CycloneDDS_VERSION_MINOR@ #define DDS_VERSION_MINOR @CycloneDDS_VERSION_MINOR@
#define DDS_VERSION_PATCH @CycloneDDS_VERSION_PATCH@ #define DDS_VERSION_PATCH @CycloneDDS_VERSION_PATCH@
#define DDS_VERSION_TWEAK @CycloneDDS_VERSION_TWEAK@ #define DDS_VERSION_TWEAK @CycloneDDS_VERSION_TWEAK@
#define DDS_PROJECT_NAME_NOSPACE_CAPS "@CMAKE_PROJECT_NAME_CAPS@" #define DDS_PROJECT_NAME_NOSPACE_CAPS "@PROJECT_NAME_CAPS@"
#define DDS_PROJECT_NAME_NOSPACE_SMALL "@CMAKE_PROJECT_NAME_SMALL@" #define DDS_PROJECT_NAME_NOSPACE_SMALL "@PROJECT_NAME_SMALL@"
#define DDS_PROJECT_NAME_NOSPACE "@CMAKE_PROJECT_NAME@" #define DDS_PROJECT_NAME_NOSPACE "@PROJECT_NAME@"
#define DDS_PROJECT_NAME "@CMAKE_PROJECT_NAME@" #define DDS_PROJECT_NAME "@PROJECT_NAME@"
#define DDS_HOST_NAME "@CMAKE_HOST_SYSTEM_NAME@" #define DDS_HOST_NAME "@CMAKE_HOST_SYSTEM_NAME@"
#define DDS_TARGET_NAME "@CMAKE_SYSTEM_NAME@" #define DDS_TARGET_NAME "@CMAKE_SYSTEM_NAME@"

View file

@ -9,13 +9,11 @@
* *
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/ */
#include "dds/ddsi/q_bswap.h" #include "dds/ddsrt/bswap.h"
extern inline uint16_t bswap2u (uint16_t x);
extern inline uint32_t bswap4u (uint32_t x);
extern inline uint64_t bswap8u (uint64_t x);
extern inline int16_t bswap2 (int16_t x);
extern inline int32_t bswap4 (int32_t x);
extern inline int64_t bswap8 (int64_t x);
extern inline void bswapSN (nn_sequence_number_t *sn);
extern inline uint16_t ddsrt_bswap2u (uint16_t x);
extern inline uint32_t ddsrt_bswap4u (uint32_t x);
extern inline uint64_t ddsrt_bswap8u (uint64_t x);
extern inline int16_t ddsrt_bswap2 (int16_t x);
extern inline int32_t ddsrt_bswap4 (int32_t x);
extern inline int64_t ddsrt_bswap8 (int64_t x);

View file

@ -45,17 +45,17 @@ include(cmake/IdlcGenerate.cmake)
install( install(
FILES "cmake/IdlcGenerate.cmake" FILES "cmake/IdlcGenerate.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/idlc" DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
COMPONENT dev) COMPONENT dev)
install( install(
FILES "${IDLC_SCRIPT_IN}" FILES "${IDLC_SCRIPT_IN}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/idlc" DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
COMPONENT dev) COMPONENT dev)
install( install(
FILES "${IDLC_JAR}" FILES "${IDLC_JAR}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/idlc" DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idlc"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT dev) COMPONENT dev)

View file

@ -14,6 +14,6 @@ package org.eclipse.cyclonedds;
public class Project public class Project
{ {
public static String version = "@PROJECT_VERSION@"; public static String version = "@PROJECT_VERSION@";
public static String name = "@CMAKE_PROJECT_NAME@"; public static String name = "@PROJECT_NAME@";
public static String nameCaps = "@CMAKE_PROJECT_NAME_CAPS@"; public static String nameCaps = "@PROJECT_NAME_CAPS@";
} }

View file

@ -11,14 +11,17 @@
# #
include(${MPT_CMAKE}) include(${MPT_CMAKE})
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/core/ddsi/include")
idlc_generate(mpt_rwdata_lib "procs/rwdata.idl") idlc_generate(mpt_rwdata_lib "procs/rwdata.idl")
set(sources_qosmatch set(sources_qosmatch
"procs/rw.c" "procs/rw.c"
"qosmatch.c") "qosmatch.c")
add_mpt_executable(mpt_qosmatch ${sources_qosmatch}) add_mpt_executable(mpt_qosmatch ${sources_qosmatch})
target_include_directories(
mpt_qosmatch PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../core/ddsi/include>")
target_link_libraries(mpt_qosmatch PRIVATE mpt_rwdata_lib) target_link_libraries(mpt_qosmatch PRIVATE mpt_rwdata_lib)
set(sources_ppuserdata set(sources_ppuserdata

View file

@ -9,7 +9,7 @@
# #
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# #
set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/tools") set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/tools")
add_subdirectory(pubsub) add_subdirectory(pubsub)
add_subdirectory(ddsls) add_subdirectory(ddsls)
if(BUILD_IDLC) if(BUILD_IDLC)