Rearrange and fixup abstraction layer
- Replace os_result by dds_retcode_t and move DDS return code defines down. Eliminates the need to convert between different return code types. - Move dds_time_t down and remove os_time. Eliminates the need to convert between different time representations and reduces code duplication. - Remove use of Microsoft source-code annotation language (SAL). SAL annotations are Microsoft specific and not very well documented. This makes it very difficult for contributers to write. - Rearrange the abstraction layer to be feature-based. The previous layout falsely assumed that the operating system dictates which implementation is best suited. For general purpose operating systems this is mostly true, but embedded targets require a slightly different approach and may not even offer all features. The new layout makes it possible to mix-and-match feature implementations and allows for features to not be implemented at all. - Replace the os prefix by ddsrt to avoid name collisions. - Remove various portions of unused and unwanted code. - Export thread names on all supported platforms. - Return native thread identifier on POSIX compatible platforms. - Add timed wait for condition variables that takes an absolute time. - Remove system abstraction for errno. The os_getErrno and os_setErrno were incorrect. Functions that might fail now simply return a DDS return code instead. - Remove thread-specific memory abstraction. os_threadMemGet and accompanying functions were a mess and their use has been eliminated by other changes in this commit. - Replace attribute (re)defines by ddsrt_ prefixed equivalents to avoid name collisions and problems with faulty __nonnull__ attributes. Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
parent
318968f40f
commit
cd6742ee12
439 changed files with 22117 additions and 28782 deletions
201
docs/dev/modules.md
Normal file
201
docs/dev/modules.md
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
# Eclipse Cyclone DDS Module Layout
|
||||||
|
|
||||||
|
Cyclone DDS is made up of multiple modules, each of which provides a certain
|
||||||
|
set of functionality, either private, public or a combination therof. Since
|
||||||
|
Cyclone DDS is a middleware product, the api is of course the most visible
|
||||||
|
interface. Cyclone DDS uses the *dds* (not followed by an underscore) prefix
|
||||||
|
to avoid name collisions with other code.
|
||||||
|
|
||||||
|
The fact that Cyclone DDS is made up of multiple modules is largely historic,
|
||||||
|
but does offer a neat way to separate features logically.
|
||||||
|
|
||||||
|
|-------------|
|
||||||
|
| | DDS is not a target, it is the product, the sum of the
|
||||||
|
| DDS | targets that together form Cyclone DDS. i.e. the stable
|
||||||
|
| | api prefixed with dds\_ and the libddsc.so library.
|
||||||
|
|---|---------|
|
||||||
|
| | | ddsc implements most of dds\_ api. A modern,
|
||||||
|
| | ddsc | user-friendly implementation of the DDS specification.
|
||||||
|
| | |
|
||||||
|
| |---------|
|
||||||
|
| | | ddsi, as the name suggests, is an implementation of the
|
||||||
|
| | ddsi | RTPS-DDSI specification.
|
||||||
|
| | |
|
||||||
|
| |---------|
|
||||||
|
| | | util is a collection of snippets that do not require
|
||||||
|
| | util | per-target implementations and may be used by the ddsc
|
||||||
|
| | | and ddsi targets. util will be merged into ddsrt.
|
||||||
|
| |---------|
|
||||||
|
| | ddsrt offers target agnostic implementations of
|
||||||
|
| ddsrt | functionality required by the ddsc and ddsi targets, but
|
||||||
|
| | also exports a subset of the dds\_ api directly. e.g.
|
||||||
|
|-------------| dds_time_t and functions to read the current time from
|
||||||
|
the target are implemented here.
|
||||||
|
|
||||||
|
> The need for a separate utility module (util) has disappeared with the
|
||||||
|
> restructuring of the runtime module. The two will be merged in the not too
|
||||||
|
> distant future.
|
||||||
|
|
||||||
|
All modules are exported seperately, for convenience. e.g. the *ddsrt* module
|
||||||
|
offers target agnostic interfaces to create and manage threads and
|
||||||
|
synchronization primitives, retrieve resource usage, system time, etc.
|
||||||
|
However, all symbols not referenced by including *dds.h* or prefixed with
|
||||||
|
*dds_* are considered internal and there are no guarantees with regard to api
|
||||||
|
stability and backwards compatibility. That being said, they are not expected
|
||||||
|
to change frequently. Module specific headers are located in the respective
|
||||||
|
directory under `INSTALL_PREFIX/include/dds`.
|
||||||
|
|
||||||
|
|
||||||
|
## DDS Runtime (ddsrt)
|
||||||
|
The main purpose of the runtime module is to allow modules stacked on top of
|
||||||
|
it, e.g. ddsi and dds, to be target agnostic. Meaning that, it ensures that
|
||||||
|
features required by other modules can be used in the same way across supported
|
||||||
|
targets. The runtime module will NOT try to mimic or stub features that it can
|
||||||
|
simply cannot offer on a given target. For features that cannot be implemented
|
||||||
|
on all targets, a feature macro will be introduced that other modules can use
|
||||||
|
to test for availability. e.g. *DDSRT_HAVE_IPV6* can be used to determine if
|
||||||
|
the target supports IPv6 addresses.
|
||||||
|
|
||||||
|
|
||||||
|
### Feature discovery
|
||||||
|
Discovery of target features at compile time is lagely dynamic. Various target
|
||||||
|
specific predefined macros determine if a feature is supported and which
|
||||||
|
implementation is built. This is on purpose, to avoid a target specific
|
||||||
|
include directory and an abundance of configuration header files and works
|
||||||
|
well for most use cases. Of course, there are exceptions where the preprocessor
|
||||||
|
requires some hints to make the right the descision. e.g. when the lwIP TCP/IP
|
||||||
|
stack should be used as opposed to the native stack. The build system is
|
||||||
|
responsible for the availability of the proper macros at compile time.
|
||||||
|
|
||||||
|
Feature implementations are often tied directly to the operating system for
|
||||||
|
general purpose operating systems. This level of abstraction is not good
|
||||||
|
enough for embedded targets though. Whether a feature is available or not
|
||||||
|
depends on (a combination) of the following.
|
||||||
|
|
||||||
|
1. Operating system. e.g. Linux, Windows, FreeRTOS.
|
||||||
|
2. Compiler. e.g. GCC, Clang, MSVC, IAR.
|
||||||
|
3. Architecture. e.g. i386, amd64, ARM.
|
||||||
|
4. C library. e.g. glibc (GNU), dlib (IAR).
|
||||||
|
|
||||||
|
#### Atomic operations
|
||||||
|
Support for atomic operations is determined by the target architecture. Most
|
||||||
|
compilers (at least GCC, Clang, Microsoft Visual Studio and Solaris Studio)
|
||||||
|
offer atomic builtins, but if support is unavailable, fall back on the
|
||||||
|
target architecture specific implementation.
|
||||||
|
|
||||||
|
#### Network stack
|
||||||
|
General purpose operating systems like Microsoft Windows and Linux come with
|
||||||
|
a network stack, as does VxWorks. FreeRTOS, however, does not and requires a
|
||||||
|
seperate TCP/IP stack, which is often part of the Board Support Package (BSP).
|
||||||
|
But separate stacks can be used on Microsoft Windows and Linux too. e.g. the
|
||||||
|
network stack in Tizen RT is based on lwIP, but the platform uses the Linux
|
||||||
|
kernel. Wheter or not lwIP must be used cannot be determined automatically and
|
||||||
|
the build system must hint which implementation is to be used.
|
||||||
|
|
||||||
|
|
||||||
|
### Structure
|
||||||
|
The runtime module uses a very specific directory structure to allow for
|
||||||
|
feature-based implementations and sane fallback defaults.
|
||||||
|
|
||||||
|
#### Header files
|
||||||
|
The include directory must provide a header file per feature. e.g.
|
||||||
|
`dds/ddsrt/sync.h` is used for synchronisation primitives. If there are
|
||||||
|
only minor differences between targets, everything is contained within
|
||||||
|
that file. If not, as is the case with `dds/ddsrt/types.h`, a header file per
|
||||||
|
target is a better choice.
|
||||||
|
|
||||||
|
Private headers may also be required to share type definitions between target
|
||||||
|
implementations that do not need to be public. These are located in a feature
|
||||||
|
specific include directory with the sources.
|
||||||
|
|
||||||
|
ddsrt
|
||||||
|
|- include
|
||||||
|
| \- dds
|
||||||
|
| \- ddsrt
|
||||||
|
| |- atomics
|
||||||
|
| | |- arm.h
|
||||||
|
| | |- gcc.h
|
||||||
|
| | |- msvc.h
|
||||||
|
| | \- sun.h
|
||||||
|
| |- atomics.h
|
||||||
|
| |- time.h
|
||||||
|
| |- threads
|
||||||
|
| | |- posix.h
|
||||||
|
| | \- windows.h
|
||||||
|
| \- threads.h
|
||||||
|
|
|
||||||
|
\- src
|
||||||
|
\- threads
|
||||||
|
\- include
|
||||||
|
\- dds
|
||||||
|
\- ddsrt
|
||||||
|
\- threads_priv.h
|
||||||
|
|
||||||
|
> Which target specific header file is included is determined by the top-level
|
||||||
|
> header file, not the build system. However, which files are exported
|
||||||
|
> automatically is determined by the build system.
|
||||||
|
|
||||||
|
#### Source files
|
||||||
|
Source files are grouped per feature too, but here the build system determines
|
||||||
|
what is compiled and what is not. By default the build system looks for a
|
||||||
|
directory with the system name, e.g. windows or linux, but it is possible to
|
||||||
|
overwrite it from a feature test. This allows for a non-default target to be
|
||||||
|
used as would be the case with e.g. lwip for sockets. If a target-specific
|
||||||
|
implementation cannot be found, the build system will fall back to posix. All
|
||||||
|
files with a .c extension under the selected directory will be compiled. Code
|
||||||
|
that can be shared among targets can be put in a file named after the feature
|
||||||
|
with the .c extension. Of course if there is no target-specific code, or if
|
||||||
|
there are only minimal differences there is not need to create a feature
|
||||||
|
directory.
|
||||||
|
|
||||||
|
ddsrt
|
||||||
|
\- src
|
||||||
|
|- atomics.c
|
||||||
|
|- sockets
|
||||||
|
| |- posix
|
||||||
|
| | |- gethostname.c
|
||||||
|
| | \- sockets.c
|
||||||
|
| \- windows
|
||||||
|
| |- gethostname.c
|
||||||
|
| \- sockets.c
|
||||||
|
\- sockets.c
|
||||||
|
|
||||||
|
### Development guidelines
|
||||||
|
* Be pragmatic. Use ifdefs (only) where it makes sense. Do not ifdef if target
|
||||||
|
implementations are completely different. Add a seperate implementation. If
|
||||||
|
there are only minor differences, as is typically the case between unices,
|
||||||
|
use an ifdef.
|
||||||
|
* Header and source files are not prefixed. Instead they reside in a directory
|
||||||
|
named after the module that serves as a namespace. e.g. the threads feature
|
||||||
|
interface is defined in `dds/ddsrt/threads.h`.
|
||||||
|
* Macros that influence which implementation is used, must be prefixed by
|
||||||
|
*DDSRT_USE_* followed by the feature name. e.g. *DDSRT_USE_LWIP* to indicate
|
||||||
|
the lwIP TCP/IP stack must be used. Macros that are defined at compile time
|
||||||
|
to indicate whether or not a certain feature is available, must be prefixed
|
||||||
|
by *DDSR_HAVE_* followed by the feature name. e.g. *DDSRT_HAVE_IPV6* to
|
||||||
|
indicate the target supports IPv6 addresses.
|
||||||
|
|
||||||
|
### Constructors and destructors
|
||||||
|
The runtime module (on some targets) requires initialization. For that reason,
|
||||||
|
`void ddsrt_init(void)` and `void ddsrt_fini(void)` are exported. They are
|
||||||
|
called automatically when the library is loaded if the target supports it, but
|
||||||
|
even if the target does not, the application should not need to invoke the
|
||||||
|
functions as they are called by `dds_init` and `dds_fini` respectively.
|
||||||
|
|
||||||
|
Of course, if the runtime module is used by itself, and the target does not
|
||||||
|
support constructors and/or destructors, the application is required to call
|
||||||
|
the functions before any of the features from the runtime module are used.
|
||||||
|
|
||||||
|
> `ddsrt_init` and `ddsrt_fini` are idempotent. Meaning that, it is safe to
|
||||||
|
> call `ddsrt_init` more than once. However, initialization is reference
|
||||||
|
> counted and the number of calls to `ddsrt_init` must match the number of
|
||||||
|
> calls to `ddsrt_fini`.
|
||||||
|
|
||||||
|
#### Threads
|
||||||
|
Threads require initialization and finalization if not created by the runtime
|
||||||
|
module. `void ddsrt_thread_init(void)` and `void ddsrt_thread_fini(void)` are
|
||||||
|
provided for that purpose. Initialization is always automatic, finalization is
|
||||||
|
automatic if the target supports it. Finalization is primarily used to release
|
||||||
|
thread-specific memory and call routines registered by
|
||||||
|
`ddsrt_thread_cleanup_push`.
|
||||||
|
|
|
@ -147,9 +147,8 @@ if(NOT USE_SANITIZER)
|
||||||
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}")
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}")
|
add_compile_options(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}")
|
link_libraries(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})
|
||||||
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(FileIDs)
|
include(FileIDs)
|
||||||
|
@ -172,7 +171,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
|
|
||||||
add_subdirectory(idlc)
|
add_subdirectory(idlc)
|
||||||
add_subdirectory(os)
|
add_subdirectory(ddsrt)
|
||||||
add_subdirectory(etc)
|
add_subdirectory(etc)
|
||||||
add_subdirectory(util)
|
add_subdirectory(util)
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
|
|
|
@ -305,7 +305,7 @@ function(add_cunit_executable TARGET)
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
${TARGET} "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.c" ${sources})
|
${TARGET} "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.c" ${sources})
|
||||||
target_link_libraries(${TARGET} CUnit)
|
target_link_libraries(${TARGET} PRIVATE CUnit)
|
||||||
target_include_directories(${TARGET} PRIVATE "${CUNIT_DIR}/include")
|
target_include_directories(${TARGET} PRIVATE "${CUNIT_DIR}/include")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -51,17 +51,13 @@ include(ddsi/CMakeLists.txt)
|
||||||
include(ddsc/CMakeLists.txt)
|
include(ddsc/CMakeLists.txt)
|
||||||
|
|
||||||
target_link_libraries(ddsc PRIVATE util)
|
target_link_libraries(ddsc PRIVATE util)
|
||||||
target_link_libraries(ddsc PRIVATE OSAPI)
|
target_link_libraries(ddsc PRIVATE ddsrt)
|
||||||
|
target_include_directories(
|
||||||
|
ddsc PUBLIC $<BUILD_INTERFACE:$<TARGET_PROPERTY:ddsrt,INTERFACE_INCLUDE_DIRECTORIES>>)
|
||||||
|
|
||||||
# SOVERSION should increase on incompatible ABI change
|
# SOVERSION should increase on incompatible ABI change
|
||||||
set_target_properties(ddsc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
set_target_properties(ddsc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||||
|
|
||||||
get_target_property(os_api_src_dir OSAPI SOURCE_DIR)
|
|
||||||
# We need to expose some of the OS headers as well.
|
|
||||||
target_include_directories(ddsc
|
|
||||||
PUBLIC
|
|
||||||
"$<BUILD_INTERFACE:${os_api_src_dir}/include>")
|
|
||||||
|
|
||||||
set_target_file_ids(ddsc)
|
set_target_file_ids(ddsc)
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -19,7 +19,6 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds_init.c
|
dds_init.c
|
||||||
dds_publisher.c
|
dds_publisher.c
|
||||||
dds_rhc.c
|
dds_rhc.c
|
||||||
dds_time.c
|
|
||||||
dds_domain.c
|
dds_domain.c
|
||||||
dds_instance.c
|
dds_instance.c
|
||||||
dds_qos.c
|
dds_qos.c
|
||||||
|
@ -27,7 +26,6 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds_key.c
|
dds_key.c
|
||||||
dds_querycond.c
|
dds_querycond.c
|
||||||
dds_topic.c
|
dds_topic.c
|
||||||
dds_err.c
|
|
||||||
dds_listener.c
|
dds_listener.c
|
||||||
dds_read.c
|
dds_read.c
|
||||||
dds_stream.c
|
dds_stream.c
|
||||||
|
@ -41,16 +39,15 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds_serdata_builtintopic.c
|
dds_serdata_builtintopic.c
|
||||||
dds_sertopic_builtintopic.c
|
dds_sertopic_builtintopic.c
|
||||||
)
|
)
|
||||||
|
|
||||||
PREPEND(hdrs_public_ddsc "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/ddsc>$<INSTALL_INTERFACE:include/ddsc>"
|
PREPEND(hdrs_public_ddsc "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/dds>$<INSTALL_INTERFACE:include/dds>"
|
||||||
dds.h
|
dds.h
|
||||||
dds_public_error.h
|
ddsc/dds_public_error.h
|
||||||
dds_public_impl.h
|
ddsc/dds_public_impl.h
|
||||||
dds_public_listener.h
|
ddsc/dds_public_listener.h
|
||||||
dds_public_qos.h
|
ddsc/dds_public_qos.h
|
||||||
dds_public_status.h
|
ddsc/dds_public_status.h
|
||||||
dds_public_stream.h
|
ddsc/dds_public_stream.h
|
||||||
dds_public_time.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
|
@ -80,32 +77,24 @@ PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds__serdata_builtintopic.h
|
dds__serdata_builtintopic.h
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/cmake/ddsc_project.h.in"
|
|
||||||
"include/ddsc/ddsc_project.h")
|
|
||||||
|
|
||||||
generate_export_header(
|
generate_export_header(
|
||||||
ddsc
|
ddsc
|
||||||
BASE_NAME DDS
|
BASE_NAME DDS
|
||||||
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/include/ddsc/dds_export.h"
|
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/include/dds/export.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(ddsc
|
target_include_directories(
|
||||||
PUBLIC
|
ddsc PUBLIC
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
|
||||||
target_include_directories(ddsc
|
|
||||||
PUBLIC
|
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
|
|
||||||
|
|
||||||
target_sources(ddsc
|
target_sources(ddsc
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${srcs_ddsc}
|
${srcs_ddsc}
|
||||||
${hdrs_private_ddsc}
|
${hdrs_private_ddsc}
|
||||||
"include/ddsc/ddsc_project.h"
|
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${hdrs_public_ddsc}
|
${hdrs_public_ddsc}
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>$<INSTALL_INTERFACE:include>/ddsc/dds_export.h"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>$<INSTALL_INTERFACE:include>/dds/export.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(ddsc
|
target_include_directories(ddsc
|
||||||
|
@ -116,14 +105,19 @@ target_include_directories(ddsc
|
||||||
|
|
||||||
target_include_directories(ddsc INTERFACE $<INSTALL_INTERFACE:include>)
|
target_include_directories(ddsc INTERFACE $<INSTALL_INTERFACE:include>)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/dds"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
|
COMPONENT dev)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/ddsc"
|
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include/ddsc"
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
COMPONENT dev)
|
COMPONENT dev)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/ddsc/dds_export.h"
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/dds/export.h"
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ddsc"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dds"
|
||||||
COMPONENT dev)
|
COMPONENT dev)
|
||||||
|
|
||||||
# TODO: improve test inclusion.
|
# TODO: improve test inclusion.
|
||||||
|
|
3074
src/core/ddsc/include/dds/dds.h
Normal file
3074
src/core/ddsc/include/dds/dds.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -21,8 +21,9 @@
|
||||||
#ifndef DDS_ALLOC_H
|
#ifndef DDS_ALLOC_H
|
||||||
#define DDS_ALLOC_H
|
#define DDS_ALLOC_H
|
||||||
|
|
||||||
#include "os/os_public.h"
|
#include <stddef.h>
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
#include "dds/export.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
51
src/core/ddsc/include/dds/ddsc/dds_public_error.h
Normal file
51
src/core/ddsc/include/dds/ddsc/dds_public_error.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* @brief DDS C Error API
|
||||||
|
*
|
||||||
|
* This header file defines the public API of error values and convenience
|
||||||
|
* functions in the CycloneDDS C language binding.
|
||||||
|
*/
|
||||||
|
#ifndef DDS_ERROR_H
|
||||||
|
#define DDS_ERROR_H
|
||||||
|
|
||||||
|
#include "dds/export.h"
|
||||||
|
#include "dds/ddsrt/log.h"
|
||||||
|
#include "dds/ddsrt/retcode.h"
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Error masks for returned status values */
|
||||||
|
|
||||||
|
#define DDS_ERR_NR_MASK 0x000000ff
|
||||||
|
#define DDS_ERR_LINE_MASK 0x003fff00
|
||||||
|
#define DDS_ERR_FILE_ID_MASK 0x7fc00000
|
||||||
|
|
||||||
|
/* Error code handling functions */
|
||||||
|
|
||||||
|
/** Macro to extract error number */
|
||||||
|
#define dds_err_nr(e) ((-(e)) & DDS_ERR_NR_MASK)
|
||||||
|
|
||||||
|
/** Macro to extract line number */
|
||||||
|
#define dds_err_line(e) (((-(e)) & DDS_ERR_LINE_MASK) >> 8)
|
||||||
|
|
||||||
|
/** Macro to extract file identifier */
|
||||||
|
#define dds_err_file_id(e) (((-(e)) & DDS_ERR_FILE_ID_MASK) >> 22)
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -21,10 +21,9 @@
|
||||||
#ifndef DDS_IMPL_H
|
#ifndef DDS_IMPL_H
|
||||||
#define DDS_IMPL_H
|
#define DDS_IMPL_H
|
||||||
|
|
||||||
#include "ddsc/dds_public_alloc.h"
|
#include "dds/export.h"
|
||||||
#include "ddsc/dds_public_stream.h"
|
#include "dds/ddsc/dds_public_alloc.h"
|
||||||
#include "os/os_public.h"
|
#include "dds/ddsc/dds_public_stream.h"
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
|
@ -20,10 +20,9 @@
|
||||||
#ifndef _DDS_PUBLIC_LISTENER_H_
|
#ifndef _DDS_PUBLIC_LISTENER_H_
|
||||||
#define _DDS_PUBLIC_LISTENER_H_
|
#define _DDS_PUBLIC_LISTENER_H_
|
||||||
|
|
||||||
#include "ddsc/dds_export.h"
|
#include "dds/export.h"
|
||||||
#include "ddsc/dds_public_impl.h"
|
#include "dds/ddsc/dds_public_impl.h"
|
||||||
#include "ddsc/dds_public_status.h"
|
#include "dds/ddsc/dds_public_status.h"
|
||||||
#include "os/os_public.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -55,26 +54,24 @@ typedef struct dds_listener dds_listener_t;
|
||||||
*
|
*
|
||||||
* @return Returns a pointer to the allocated memory for dds_listener_t structure.
|
* @return Returns a pointer to the allocated memory for dds_listener_t structure.
|
||||||
*/
|
*/
|
||||||
_Ret_notnull_
|
DDS_EXPORT dds_listener_t* dds_create_listener (void* arg);
|
||||||
DDS_EXPORT dds_listener_t* dds_create_listener (_In_opt_ void* arg);
|
DDS_DEPRECATED_EXPORT dds_listener_t* dds_listener_create (void* arg);
|
||||||
_Ret_notnull_
|
|
||||||
DDS_DEPRECATED_EXPORT dds_listener_t* dds_listener_create (_In_opt_ void* arg);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete the memory allocated to listener structure
|
* @brief Delete the memory allocated to listener structure
|
||||||
*
|
*
|
||||||
* @param[in] listener pointer to the listener struct to delete
|
* @param[in] listener pointer to the listener struct to delete
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_delete_listener (_In_ _Post_invalid_ dds_listener_t * __restrict listener);
|
DDS_EXPORT void dds_delete_listener (dds_listener_t * __restrict listener);
|
||||||
DDS_DEPRECATED_EXPORT void dds_listener_delete (_In_ _Post_invalid_ dds_listener_t * __restrict listener);
|
DDS_DEPRECATED_EXPORT void dds_listener_delete (dds_listener_t * __restrict listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the listener structure contents to ::DDS_LUNSET
|
* @brief Reset the listener structure contents to ::DDS_LUNSET
|
||||||
*
|
*
|
||||||
* @param[in,out] listener pointer to the listener struct to reset
|
* @param[in,out] listener pointer to the listener struct to reset
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_reset_listener (_Out_ dds_listener_t * __restrict listener);
|
DDS_EXPORT void dds_reset_listener (dds_listener_t * __restrict listener);
|
||||||
DDS_DEPRECATED_EXPORT void dds_listener_reset (_Out_ dds_listener_t * __restrict listener);
|
DDS_DEPRECATED_EXPORT void dds_listener_reset (dds_listener_t * __restrict listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copy the listener callbacks from source to destination
|
* @brief Copy the listener callbacks from source to destination
|
||||||
|
@ -82,8 +79,8 @@ DDS_DEPRECATED_EXPORT void dds_listener_reset (_Out_ dds_listener_t * __restrict
|
||||||
* @param[in,out] dst The pointer to the destination listener structure, where the content is to copied
|
* @param[in,out] dst The pointer to the destination listener structure, where the content is to copied
|
||||||
* @param[in] src The pointer to the source listener structure to be copied
|
* @param[in] src The pointer to the source listener structure to be copied
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_copy_listener (_Out_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
DDS_EXPORT void dds_copy_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
|
||||||
DDS_DEPRECATED_EXPORT void dds_listener_copy (_Out_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
DDS_DEPRECATED_EXPORT void dds_listener_copy (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copy the listener callbacks from source to destination, unless already set
|
* @brief Copy the listener callbacks from source to destination, unless already set
|
||||||
|
@ -94,8 +91,8 @@ DDS_DEPRECATED_EXPORT void dds_listener_copy (_Out_ dds_listener_t * __restrict
|
||||||
* @param[in,out] dst The pointer to the destination listener structure, where the content is merged
|
* @param[in,out] dst The pointer to the destination listener structure, where the content is merged
|
||||||
* @param[in] src The pointer to the source listener structure to be copied
|
* @param[in] src The pointer to the source listener structure to be copied
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_merge_listener (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
DDS_EXPORT void dds_merge_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
|
||||||
DDS_DEPRECATED_EXPORT void dds_listener_merge (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
DDS_DEPRECATED_EXPORT void dds_listener_merge (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src);
|
||||||
|
|
||||||
/************************************************************************************************
|
/************************************************************************************************
|
||||||
* Setters
|
* Setters
|
||||||
|
@ -107,7 +104,7 @@ DDS_DEPRECATED_EXPORT void dds_listener_merge (_Inout_ dds_listener_t * __restri
|
||||||
* @param listener The pointer to the listener structure, where the callback will be set
|
* @param listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_inconsistent_topic_fn callback);
|
DDS_EXPORT void dds_lset_inconsistent_topic (dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the liveliness_lost callback in the listener structure.
|
* @brief Set the liveliness_lost callback in the listener structure.
|
||||||
|
@ -115,7 +112,7 @@ DDS_EXPORT void dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict
|
||||||
* @param[out] listener The pointer to the listener structure, where the callback will be set
|
* @param[out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_lost_fn callback);
|
DDS_EXPORT void dds_lset_liveliness_lost (dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the offered_deadline_missed callback in the listener structure.
|
* @brief Set the offered_deadline_missed callback in the listener structure.
|
||||||
|
@ -123,7 +120,7 @@ DDS_EXPORT void dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict li
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_deadline_missed_fn callback);
|
DDS_EXPORT void dds_lset_offered_deadline_missed (dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the offered_incompatible_qos callback in the listener structure.
|
* @brief Set the offered_incompatible_qos callback in the listener structure.
|
||||||
|
@ -131,7 +128,7 @@ DDS_EXPORT void dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __res
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_incompatible_qos_fn callback);
|
DDS_EXPORT void dds_lset_offered_incompatible_qos (dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the data_on_readers callback in the listener structure.
|
* @brief Set the data_on_readers callback in the listener structure.
|
||||||
|
@ -139,7 +136,7 @@ DDS_EXPORT void dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __re
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_on_readers_fn callback);
|
DDS_EXPORT void dds_lset_data_on_readers (dds_listener_t * __restrict listener, dds_on_data_on_readers_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the sample_lost callback in the listener structure.
|
* @brief Set the sample_lost callback in the listener structure.
|
||||||
|
@ -147,7 +144,7 @@ DDS_EXPORT void dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict li
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_lost_fn callback);
|
DDS_EXPORT void dds_lset_sample_lost (dds_listener_t * __restrict listener, dds_on_sample_lost_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the data_available callback in the listener structure.
|
* @brief Set the data_available callback in the listener structure.
|
||||||
|
@ -155,7 +152,7 @@ DDS_EXPORT void dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listen
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_data_available (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_available_fn callback);
|
DDS_EXPORT void dds_lset_data_available (dds_listener_t * __restrict listener, dds_on_data_available_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the sample_rejected callback in the listener structure.
|
* @brief Set the sample_rejected callback in the listener structure.
|
||||||
|
@ -163,7 +160,7 @@ DDS_EXPORT void dds_lset_data_available (_Inout_ dds_listener_t * __restrict lis
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_rejected_fn callback);
|
DDS_EXPORT void dds_lset_sample_rejected (dds_listener_t * __restrict listener, dds_on_sample_rejected_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the liveliness_changed callback in the listener structure.
|
* @brief Set the liveliness_changed callback in the listener structure.
|
||||||
|
@ -171,7 +168,7 @@ DDS_EXPORT void dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict li
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_changed_fn callback);
|
DDS_EXPORT void dds_lset_liveliness_changed (dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the requested_deadline_missed callback in the listener structure.
|
* @brief Set the requested_deadline_missed callback in the listener structure.
|
||||||
|
@ -179,7 +176,7 @@ DDS_EXPORT void dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_deadline_missed_fn callback);
|
DDS_EXPORT void dds_lset_requested_deadline_missed (dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the requested_incompatible_qos callback in the listener structure.
|
* @brief Set the requested_incompatible_qos callback in the listener structure.
|
||||||
|
@ -187,7 +184,7 @@ DDS_EXPORT void dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __r
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_incompatible_qos_fn callback);
|
DDS_EXPORT void dds_lset_requested_incompatible_qos (dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the publication_matched callback in the listener structure.
|
* @brief Set the publication_matched callback in the listener structure.
|
||||||
|
@ -195,7 +192,7 @@ DDS_EXPORT void dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_publication_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_publication_matched_fn callback);
|
DDS_EXPORT void dds_lset_publication_matched (dds_listener_t * __restrict listener, dds_on_publication_matched_fn callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the subscription_matched callback in the listener structure.
|
* @brief Set the subscription_matched callback in the listener structure.
|
||||||
|
@ -203,7 +200,7 @@ DDS_EXPORT void dds_lset_publication_matched (_Inout_ dds_listener_t * __restric
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be set
|
||||||
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback The callback to set in the listener, can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lset_subscription_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_subscription_matched_fn callback);
|
DDS_EXPORT void dds_lset_subscription_matched (dds_listener_t * __restrict listener, dds_on_subscription_matched_fn callback);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************************
|
/************************************************************************************************
|
||||||
|
@ -216,7 +213,7 @@ DDS_EXPORT void dds_lset_subscription_matched (_Inout_ dds_listener_t * __restri
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_inconsistent_topic_fn *callback);
|
DDS_EXPORT void dds_lget_inconsistent_topic (const dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the liveliness_lost callback from the listener structure.
|
* @brief Get the liveliness_lost callback from the listener structure.
|
||||||
|
@ -224,7 +221,7 @@ DDS_EXPORT void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restr
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_lost_fn *callback);
|
DDS_EXPORT void dds_lget_liveliness_lost (const dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the offered_deadline_missed callback from the listener structure.
|
* @brief Get the offered_deadline_missed callback from the listener structure.
|
||||||
|
@ -232,7 +229,7 @@ DDS_EXPORT void dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_deadline_missed_fn *callback);
|
DDS_EXPORT void dds_lget_offered_deadline_missed (const dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the offered_incompatible_qos callback from the listener structure.
|
* @brief Get the offered_incompatible_qos callback from the listener structure.
|
||||||
|
@ -240,7 +237,7 @@ DDS_EXPORT void dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_incompatible_qos_fn *callback);
|
DDS_EXPORT void dds_lget_offered_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the data_on_readers callback from the listener structure.
|
* @brief Get the data_on_readers callback from the listener structure.
|
||||||
|
@ -248,7 +245,7 @@ DDS_EXPORT void dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * _
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_on_readers_fn *callback);
|
DDS_EXPORT void dds_lget_data_on_readers (const dds_listener_t * __restrict listener, dds_on_data_on_readers_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the sample_lost callback from the listener structure.
|
* @brief Get the sample_lost callback from the listener structure.
|
||||||
|
@ -256,7 +253,7 @@ DDS_EXPORT void dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_sample_lost (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_lost_fn *callback);
|
DDS_EXPORT void dds_lget_sample_lost (const dds_listener_t *__restrict listener, dds_on_sample_lost_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the data_available callback from the listener structure.
|
* @brief Get the data_available callback from the listener structure.
|
||||||
|
@ -264,7 +261,7 @@ DDS_EXPORT void dds_lget_sample_lost (_In_ const dds_listener_t *__restrict list
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_data_available (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_data_available_fn *callback);
|
DDS_EXPORT void dds_lget_data_available (const dds_listener_t *__restrict listener, dds_on_data_available_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the sample_rejected callback from the listener structure.
|
* @brief Get the sample_rejected callback from the listener structure.
|
||||||
|
@ -272,7 +269,7 @@ DDS_EXPORT void dds_lget_data_available (_In_ const dds_listener_t *__restrict l
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_rejected_fn *callback);
|
DDS_EXPORT void dds_lget_sample_rejected (const dds_listener_t *__restrict listener, dds_on_sample_rejected_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the liveliness_changed callback from the listener structure.
|
* @brief Get the liveliness_changed callback from the listener structure.
|
||||||
|
@ -280,7 +277,7 @@ DDS_EXPORT void dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_liveliness_changed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_changed_fn *callback);
|
DDS_EXPORT void dds_lget_liveliness_changed (const dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the requested_deadline_missed callback from the listener structure.
|
* @brief Get the requested_deadline_missed callback from the listener structure.
|
||||||
|
@ -288,7 +285,7 @@ DDS_EXPORT void dds_lget_liveliness_changed (_In_ const dds_listener_t * __restr
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_requested_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_deadline_missed_fn *callback);
|
DDS_EXPORT void dds_lget_requested_deadline_missed (const dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the requested_incompatible_qos callback from the listener structure.
|
* @brief Get the requested_incompatible_qos callback from the listener structure.
|
||||||
|
@ -296,7 +293,7 @@ DDS_EXPORT void dds_lget_requested_deadline_missed (_In_ const dds_listener_t *
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_requested_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_incompatible_qos_fn *callback);
|
DDS_EXPORT void dds_lget_requested_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the publication_matched callback from the listener structure.
|
* @brief Get the publication_matched callback from the listener structure.
|
||||||
|
@ -304,7 +301,7 @@ DDS_EXPORT void dds_lget_requested_incompatible_qos (_In_ const dds_listener_t *
|
||||||
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in,out] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_publication_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_publication_matched_fn *callback);
|
DDS_EXPORT void dds_lget_publication_matched (const dds_listener_t * __restrict listener, dds_on_publication_matched_fn *callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the subscription_matched callback from the listener structure.
|
* @brief Get the subscription_matched callback from the listener structure.
|
||||||
|
@ -312,7 +309,7 @@ DDS_EXPORT void dds_lget_publication_matched (_In_ const dds_listener_t * __rest
|
||||||
* @param[in] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
* @param[in] callback Pointer where the retrieved callback can be stored; can be NULL, ::DDS_LUNSET or a valid callback pointer
|
||||||
* @param[in,out] listener The pointer to the listener structure, where the callback will be retrieved from
|
* @param[in,out] listener The pointer to the listener structure, where the callback will be retrieved from
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_lget_subscription_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_subscription_matched_fn *callback);
|
DDS_EXPORT void dds_lget_subscription_matched (const dds_listener_t * __restrict listener, dds_on_subscription_matched_fn *callback);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
|
@ -20,8 +20,7 @@
|
||||||
#ifndef DDS_QOS_H
|
#ifndef DDS_QOS_H
|
||||||
#define DDS_QOS_H
|
#define DDS_QOS_H
|
||||||
|
|
||||||
#include "os/os_public.h"
|
#include "dds/export.h"
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -142,10 +141,8 @@ dds_presentation_access_scope_kind_t;
|
||||||
*
|
*
|
||||||
* @returns - Pointer to the initialized dds_qos_t structure, NULL if unsuccessful.
|
* @returns - Pointer to the initialized dds_qos_t structure, NULL if unsuccessful.
|
||||||
*/
|
*/
|
||||||
_Ret_notnull_
|
|
||||||
DDS_EXPORT
|
DDS_EXPORT
|
||||||
dds_qos_t * dds_create_qos (void);
|
dds_qos_t * dds_create_qos (void);
|
||||||
_Ret_notnull_
|
|
||||||
DDS_DEPRECATED_EXPORT
|
DDS_DEPRECATED_EXPORT
|
||||||
dds_qos_t * dds_qos_create (void);
|
dds_qos_t * dds_qos_create (void);
|
||||||
|
|
||||||
|
@ -154,14 +151,11 @@ dds_qos_t * dds_qos_create (void);
|
||||||
*
|
*
|
||||||
* @param[in] qos - Pointer to dds_qos_t structure
|
* @param[in] qos - Pointer to dds_qos_t structure
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_delete_qos (
|
dds_delete_qos (dds_qos_t * __restrict qos);
|
||||||
_In_ _Post_invalid_ dds_qos_t * __restrict qos
|
|
||||||
);
|
DDS_DEPRECATED_EXPORT void
|
||||||
DDS_DEPRECATED_EXPORT
|
dds_qos_delete (dds_qos_t * __restrict qos);
|
||||||
void dds_qos_delete (
|
|
||||||
_In_ _Post_invalid_ dds_qos_t * __restrict qos
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset a QoS-policies structure to default values
|
* @brief Reset a QoS-policies structure to default values
|
||||||
|
@ -169,11 +163,10 @@ void dds_qos_delete (
|
||||||
* @param[in,out] qos - Pointer to the dds_qos_t structure
|
* @param[in,out] qos - Pointer to the dds_qos_t structure
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void
|
DDS_EXPORT void
|
||||||
dds_reset_qos(
|
dds_reset_qos(dds_qos_t * __restrict qos);
|
||||||
_Out_ dds_qos_t * __restrict qos);
|
|
||||||
DDS_DEPRECATED_EXPORT
|
DDS_DEPRECATED_EXPORT
|
||||||
void dds_qos_reset (
|
void dds_qos_reset (dds_qos_t * __restrict qos
|
||||||
_Out_ dds_qos_t * __restrict qos
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,16 +177,11 @@ void dds_qos_reset (
|
||||||
*
|
*
|
||||||
* @returns - Return-code indicating success or failure
|
* @returns - Return-code indicating success or failure
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT dds_return_t
|
||||||
dds_return_t dds_copy_qos (
|
dds_copy_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
|
||||||
_Out_ dds_qos_t * __restrict dst,
|
|
||||||
_In_ const dds_qos_t * __restrict src
|
DDS_DEPRECATED_EXPORT dds_return_t
|
||||||
);
|
dds_qos_copy (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
|
||||||
DDS_DEPRECATED_EXPORT
|
|
||||||
dds_return_t dds_qos_copy (
|
|
||||||
_Out_ dds_qos_t * __restrict dst,
|
|
||||||
_In_ const dds_qos_t * __restrict src
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copy all QoS-policies from one structure to another, unless already set
|
* @brief Copy all QoS-policies from one structure to another, unless already set
|
||||||
|
@ -203,18 +191,11 @@ dds_return_t dds_qos_copy (
|
||||||
* @param[in,out] dst - Pointer to the destination qos structure
|
* @param[in,out] dst - Pointer to the destination qos structure
|
||||||
* @param[in] src - Pointer to the source qos structure
|
* @param[in] src - Pointer to the source qos structure
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_merge_qos
|
dds_merge_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict dst,
|
DDS_DEPRECATED_EXPORT void
|
||||||
_In_ const dds_qos_t * __restrict src
|
dds_qos_merge (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src);
|
||||||
);
|
|
||||||
DDS_DEPRECATED_EXPORT
|
|
||||||
void dds_qos_merge
|
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict dst,
|
|
||||||
_In_ const dds_qos_t * __restrict src
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copy all QoS-policies from one structure to another, unless already set
|
* @brief Copy all QoS-policies from one structure to another, unless already set
|
||||||
|
@ -224,12 +205,8 @@ void dds_qos_merge
|
||||||
* @param[in,out] dst - Pointer to the destination qos structure
|
* @param[in,out] dst - Pointer to the destination qos structure
|
||||||
* @param[in] src - Pointer to the source qos structure
|
* @param[in] src - Pointer to the source qos structure
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT bool
|
||||||
bool dds_qos_equal
|
dds_qos_equal (const dds_qos_t * __restrict a, const dds_qos_t * __restrict b);
|
||||||
(
|
|
||||||
_In_ const dds_qos_t * __restrict a,
|
|
||||||
_In_ const dds_qos_t * __restrict b
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the userdata of a qos structure.
|
* @brief Set the userdata of a qos structure.
|
||||||
|
@ -238,13 +215,11 @@ bool dds_qos_equal
|
||||||
* @param[in] value - Pointer to the userdata
|
* @param[in] value - Pointer to the userdata
|
||||||
* @param[in] sz - Size of userdata stored in value
|
* @param[in] sz - Size of userdata stored in value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_userdata
|
dds_qset_userdata (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
const void * __restrict value,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
size_t sz);
|
||||||
_In_ size_t sz
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the topicdata of a qos structure.
|
* @brief Set the topicdata of a qos structure.
|
||||||
|
@ -253,13 +228,11 @@ void dds_qset_userdata
|
||||||
* @param[in] value - Pointer to the topicdata
|
* @param[in] value - Pointer to the topicdata
|
||||||
* @param[in] sz - Size of the topicdata stored in value
|
* @param[in] sz - Size of the topicdata stored in value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_topicdata
|
dds_qset_topicdata (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
const void * __restrict value,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
size_t sz);
|
||||||
_In_ size_t sz
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the groupdata of a qos structure.
|
* @brief Set the groupdata of a qos structure.
|
||||||
|
@ -268,13 +241,11 @@ void dds_qset_topicdata
|
||||||
* @param[in] value - Pointer to the group data
|
* @param[in] value - Pointer to the group data
|
||||||
* @param[in] sz - Size of groupdata stored in value
|
* @param[in] sz - Size of groupdata stored in value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_groupdata
|
dds_qset_groupdata (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
const void * __restrict value,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
size_t sz);
|
||||||
_In_ size_t sz
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the durability policy of a qos structure.
|
* @brief Set the durability policy of a qos structure.
|
||||||
|
@ -282,12 +253,8 @@ void dds_qset_groupdata
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] kind - Durability kind value \ref DCPS_QoS_Durability
|
* @param[in] kind - Durability kind value \ref DCPS_QoS_Durability
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_durability
|
dds_qset_durability (dds_qos_t * __restrict qos, dds_durability_kind_t kind);
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
|
||||||
_In_range_(DDS_DURABILITY_VOLATILE, DDS_DURABILITY_PERSISTENT) dds_durability_kind_t kind
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the history policy of a qos structure.
|
* @brief Set the history policy of a qos structure.
|
||||||
|
@ -296,13 +263,11 @@ void dds_qset_durability
|
||||||
* @param[in] kind - History kind value \ref DCPS_QoS_History
|
* @param[in] kind - History kind value \ref DCPS_QoS_History
|
||||||
* @param[in] depth - History depth value \ref DCPS_QoS_History
|
* @param[in] depth - History depth value \ref DCPS_QoS_History
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_history
|
dds_qset_history (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_history_kind_t kind,
|
||||||
_In_range_(DDS_HISTORY_KEEP_LAST, DDS_HISTORY_KEEP_ALL) dds_history_kind_t kind,
|
int32_t depth);
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t depth
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the resource limits policy of a qos structure.
|
* @brief Set the resource limits policy of a qos structure.
|
||||||
|
@ -312,15 +277,12 @@ void dds_qset_history
|
||||||
* @param[in] max_instances - Number of instances resource-limit value
|
* @param[in] max_instances - Number of instances resource-limit value
|
||||||
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit value
|
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_resource_limits
|
dds_qset_resource_limits (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
int32_t max_samples,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples,
|
int32_t max_instances,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_instances,
|
int32_t max_samples_per_instance);
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples_per_instance
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the presentation policy of a qos structure.
|
* @brief Set the presentation policy of a qos structure.
|
||||||
|
@ -330,13 +292,12 @@ void dds_qset_resource_limits
|
||||||
* @param[in] coherent_access - Coherent access enable value
|
* @param[in] coherent_access - Coherent access enable value
|
||||||
* @param[in] ordered_access - Ordered access enable value
|
* @param[in] ordered_access - Ordered access enable value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT void dds_qset_presentation
|
DDS_EXPORT void
|
||||||
(
|
dds_qset_presentation (
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_PRESENTATION_INSTANCE, DDS_PRESENTATION_GROUP) dds_presentation_access_scope_kind_t access_scope,
|
dds_presentation_access_scope_kind_t access_scope,
|
||||||
_In_ bool coherent_access,
|
bool coherent_access,
|
||||||
_In_ bool ordered_access
|
bool ordered_access);
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the lifespan policy of a qos structure.
|
* @brief Set the lifespan policy of a qos structure.
|
||||||
|
@ -344,12 +305,10 @@ DDS_EXPORT void dds_qset_presentation
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] lifespan - Lifespan duration (expiration time relative to source timestamp of a sample)
|
* @param[in] lifespan - Lifespan duration (expiration time relative to source timestamp of a sample)
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_lifespan
|
dds_qset_lifespan (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t lifespan);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t lifespan
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the deadline policy of a qos structure.
|
* @brief Set the deadline policy of a qos structure.
|
||||||
|
@ -357,12 +316,10 @@ void dds_qset_lifespan
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] deadline - Deadline duration
|
* @param[in] deadline - Deadline duration
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_deadline
|
dds_qset_deadline (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t deadline);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t deadline
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the latency-budget policy of a qos structure
|
* @brief Set the latency-budget policy of a qos structure
|
||||||
|
@ -370,12 +327,10 @@ void dds_qset_deadline
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] duration - Latency budget duration
|
* @param[in] duration - Latency budget duration
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_latency_budget
|
dds_qset_latency_budget (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t duration);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t duration
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the ownership policy of a qos structure
|
* @brief Set the ownership policy of a qos structure
|
||||||
|
@ -383,12 +338,10 @@ void dds_qset_latency_budget
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] kind - Ownership kind
|
* @param[in] kind - Ownership kind
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_ownership
|
dds_qset_ownership (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_ownership_kind_t kind);
|
||||||
_In_range_(DDS_OWNERSHIP_SHARED, DDS_OWNERSHIP_EXCLUSIVE) dds_ownership_kind_t kind
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the ownership strength policy of a qos structure
|
* @brief Set the ownership strength policy of a qos structure
|
||||||
|
@ -396,12 +349,8 @@ void dds_qset_ownership
|
||||||
* param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* param[in] value - Ownership strength value
|
* param[in] value - Ownership strength value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_ownership_strength
|
dds_qset_ownership_strength (dds_qos_t * __restrict qos, int32_t value);
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
|
||||||
_In_ int32_t value
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the liveliness policy of a qos structure
|
* @brief Set the liveliness policy of a qos structure
|
||||||
|
@ -410,13 +359,11 @@ void dds_qset_ownership_strength
|
||||||
* param[in] kind - Liveliness kind
|
* param[in] kind - Liveliness kind
|
||||||
* param[in[ lease_duration - Lease duration
|
* param[in[ lease_duration - Lease duration
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_liveliness
|
dds_qset_liveliness (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_liveliness_kind_t kind,
|
||||||
_In_range_(DDS_LIVELINESS_AUTOMATIC, DDS_LIVELINESS_MANUAL_BY_TOPIC) dds_liveliness_kind_t kind,
|
dds_duration_t lease_duration);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t lease_duration
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the time-based filter policy of a qos structure
|
* @brief Set the time-based filter policy of a qos structure
|
||||||
|
@ -424,12 +371,10 @@ void dds_qset_liveliness
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] minimum_separation - Minimum duration between sample delivery for an instance
|
* @param[in] minimum_separation - Minimum duration between sample delivery for an instance
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_time_based_filter
|
dds_qset_time_based_filter (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t minimum_separation);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t minimum_separation
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the partition policy of a qos structure
|
* @brief Set the partition policy of a qos structure
|
||||||
|
@ -438,13 +383,11 @@ void dds_qset_time_based_filter
|
||||||
* @param[in] n - Number of partitions stored in ps
|
* @param[in] n - Number of partitions stored in ps
|
||||||
* @param[in[ ps - Pointer to string(s) storing partition name(s)
|
* @param[in[ ps - Pointer to string(s) storing partition name(s)
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_partition
|
dds_qset_partition (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
uint32_t n,
|
||||||
_In_ uint32_t n,
|
const char ** __restrict ps);
|
||||||
_In_count_(n) _Deref_pre_z_ const char ** __restrict ps
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the reliability policy of a qos structure
|
* @brief Set the reliability policy of a qos structure
|
||||||
|
@ -453,13 +396,11 @@ void dds_qset_partition
|
||||||
* @param[in] kind - Reliability kind
|
* @param[in] kind - Reliability kind
|
||||||
* @param[in] max_blocking_time - Max blocking duration applied when kind is reliable.
|
* @param[in] max_blocking_time - Max blocking duration applied when kind is reliable.
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_reliability
|
dds_qset_reliability (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_reliability_kind_t kind,
|
||||||
_In_range_(DDS_RELIABILITY_BEST_EFFORT, DDS_RELIABILITY_RELIABLE) dds_reliability_kind_t kind,
|
dds_duration_t max_blocking_time);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t max_blocking_time
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the transport-priority policy of a qos structure
|
* @brief Set the transport-priority policy of a qos structure
|
||||||
|
@ -467,12 +408,8 @@ void dds_qset_reliability
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] value - Priority value
|
* @param[in] value - Priority value
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_transport_priority
|
dds_qset_transport_priority (dds_qos_t * __restrict qos, int32_t value);
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
|
||||||
_In_ int32_t value
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the destination-order policy of a qos structure
|
* @brief Set the destination-order policy of a qos structure
|
||||||
|
@ -480,13 +417,10 @@ void dds_qset_transport_priority
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] kind - Destination-order kind
|
* @param[in] kind - Destination-order kind
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_destination_order
|
dds_qset_destination_order (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_destination_order_kind_t kind);
|
||||||
_In_range_(DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP,
|
|
||||||
DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP) dds_destination_order_kind_t kind
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the writer data-lifecycle policy of a qos structure
|
* @brief Set the writer data-lifecycle policy of a qos structure
|
||||||
|
@ -494,12 +428,8 @@ void dds_qset_destination_order
|
||||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||||
* @param[in] autodispose_unregistered_instances - Automatic disposal of unregistered instances
|
* @param[in] autodispose_unregistered_instances - Automatic disposal of unregistered instances
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_writer_data_lifecycle
|
dds_qset_writer_data_lifecycle (dds_qos_t * __restrict qos, bool autodispose);
|
||||||
(
|
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
|
||||||
_In_ bool autodispose
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the reader data-lifecycle policy of a qos structure
|
* @brief Set the reader data-lifecycle policy of a qos structure
|
||||||
|
@ -508,13 +438,11 @@ void dds_qset_writer_data_lifecycle
|
||||||
* @param[in] autopurge_nowriter_samples_delay - Delay for purging of samples from instances in a no-writers state
|
* @param[in] autopurge_nowriter_samples_delay - Delay for purging of samples from instances in a no-writers state
|
||||||
* @param[in] autopurge_disposed_samples_delay - Delay for purging of samples from disposed instances
|
* @param[in] autopurge_disposed_samples_delay - Delay for purging of samples from disposed instances
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_reader_data_lifecycle
|
dds_qset_reader_data_lifecycle (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t autopurge_nowriter_samples_delay,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t autopurge_nowriter_samples_delay,
|
dds_duration_t autopurge_disposed_samples_delay);
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t autopurge_disposed_samples_delay
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the durability-service policy of a qos structure
|
* @brief Set the durability-service policy of a qos structure
|
||||||
|
@ -527,17 +455,15 @@ void dds_qset_reader_data_lifecycle
|
||||||
* @param[in] max_instances - Number of instances resource-limit policy applied by the durability service
|
* @param[in] max_instances - Number of instances resource-limit policy applied by the durability service
|
||||||
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit policy applied by the durability service
|
* @param[in] max_samples_per_instance - Number of samples per instance resource-limit policy applied by the durability service
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT
|
DDS_EXPORT void
|
||||||
void dds_qset_durability_service
|
dds_qset_durability_service (
|
||||||
(
|
dds_qos_t * __restrict qos,
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_duration_t service_cleanup_delay,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t service_cleanup_delay,
|
dds_history_kind_t history_kind,
|
||||||
_In_range_(DDS_HISTORY_KEEP_LAST, DDS_HISTORY_KEEP_ALL) dds_history_kind_t history_kind,
|
int32_t history_depth,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t history_depth,
|
int32_t max_samples,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples,
|
int32_t max_instances,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_instances,
|
int32_t max_samples_per_instance);
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples_per_instance
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the userdata from a qos structure
|
* @brief Get the userdata from a qos structure
|
||||||
|
@ -603,7 +529,12 @@ DDS_EXPORT bool dds_qget_history (const dds_qos_t * __restrict qos, dds_history_
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_resource_limits (const dds_qos_t * __restrict qos, int32_t *max_samples, int32_t *max_instances, int32_t *max_samples_per_instance);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_resource_limits (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
int32_t *max_samples,
|
||||||
|
int32_t *max_instances,
|
||||||
|
int32_t *max_samples_per_instance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the presentation policy from a qos structure
|
* @brief Get the presentation policy from a qos structure
|
||||||
|
@ -615,7 +546,12 @@ DDS_EXPORT bool dds_qget_resource_limits (const dds_qos_t * __restrict qos, int3
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_presentation (const dds_qos_t * __restrict qos, dds_presentation_access_scope_kind_t *access_scope, bool *coherent_access, bool *ordered_access);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_presentation (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_presentation_access_scope_kind_t *access_scope,
|
||||||
|
bool *coherent_access,
|
||||||
|
bool *ordered_access);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the lifespan policy from a qos structure
|
* @brief Get the lifespan policy from a qos structure
|
||||||
|
@ -625,7 +561,10 @@ DDS_EXPORT bool dds_qget_presentation (const dds_qos_t * __restrict qos, dds_pre
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_lifespan (const dds_qos_t * __restrict qos, dds_duration_t *lifespan);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_lifespan (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *lifespan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the deadline policy from a qos structure
|
* @brief Get the deadline policy from a qos structure
|
||||||
|
@ -635,7 +574,10 @@ DDS_EXPORT bool dds_qget_lifespan (const dds_qos_t * __restrict qos, dds_duratio
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_deadline (const dds_qos_t * __restrict qos, dds_duration_t *deadline);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_deadline (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *deadline);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the latency-budget policy from a qos structure
|
* @brief Get the latency-budget policy from a qos structure
|
||||||
|
@ -645,7 +587,10 @@ DDS_EXPORT bool dds_qget_deadline (const dds_qos_t * __restrict qos, dds_duratio
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_latency_budget (const dds_qos_t * __restrict qos, dds_duration_t *duration);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_latency_budget (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *duration);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the ownership policy from a qos structure
|
* @brief Get the ownership policy from a qos structure
|
||||||
|
@ -655,7 +600,10 @@ DDS_EXPORT bool dds_qget_latency_budget (const dds_qos_t * __restrict qos, dds_d
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_ownership (const dds_qos_t * __restrict qos, dds_ownership_kind_t *kind);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_ownership (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_ownership_kind_t *kind);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the ownership strength qos policy
|
* @brief Get the ownership strength qos policy
|
||||||
|
@ -665,7 +613,10 @@ DDS_EXPORT bool dds_qget_ownership (const dds_qos_t * __restrict qos, dds_owners
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_ownership_strength (const dds_qos_t * __restrict qos, int32_t *value);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_ownership_strength (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
int32_t *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the liveliness qos policy
|
* @brief Get the liveliness qos policy
|
||||||
|
@ -676,7 +627,11 @@ DDS_EXPORT bool dds_qget_ownership_strength (const dds_qos_t * __restrict qos, i
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_liveliness (const dds_qos_t * __restrict qos, dds_liveliness_kind_t *kind, dds_duration_t *lease_duration);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_liveliness (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_liveliness_kind_t *kind,
|
||||||
|
dds_duration_t *lease_duration);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the time-based filter qos policy
|
* @brief Get the time-based filter qos policy
|
||||||
|
@ -686,7 +641,10 @@ DDS_EXPORT bool dds_qget_liveliness (const dds_qos_t * __restrict qos, dds_livel
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_time_based_filter (const dds_qos_t * __restrict qos, dds_duration_t *minimum_separation);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_time_based_filter (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *minimum_separation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the partition qos policy
|
* @brief Get the partition qos policy
|
||||||
|
@ -697,7 +655,11 @@ DDS_EXPORT bool dds_qget_time_based_filter (const dds_qos_t * __restrict qos, dd
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_partition (const dds_qos_t * __restrict qos, uint32_t *n, char ***ps);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_partition (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
uint32_t *n,
|
||||||
|
char ***ps);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the reliability qos policy
|
* @brief Get the reliability qos policy
|
||||||
|
@ -708,7 +670,11 @@ DDS_EXPORT bool dds_qget_partition (const dds_qos_t * __restrict qos, uint32_t *
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_reliability (const dds_qos_t * __restrict qos, dds_reliability_kind_t *kind, dds_duration_t *max_blocking_time);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_reliability (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_reliability_kind_t *kind,
|
||||||
|
dds_duration_t *max_blocking_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the transport priority qos policy
|
* @brief Get the transport priority qos policy
|
||||||
|
@ -718,7 +684,10 @@ DDS_EXPORT bool dds_qget_reliability (const dds_qos_t * __restrict qos, dds_reli
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_transport_priority (const dds_qos_t * __restrict qos, int32_t *value);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_transport_priority (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
int32_t *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the destination-order qos policy
|
* @brief Get the destination-order qos policy
|
||||||
|
@ -728,7 +697,10 @@ DDS_EXPORT bool dds_qget_transport_priority (const dds_qos_t * __restrict qos, i
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_destination_order (const dds_qos_t * __restrict qos, dds_destination_order_kind_t *kind);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_destination_order (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_destination_order_kind_t *kind);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the writer data-lifecycle qos policy
|
* @brief Get the writer data-lifecycle qos policy
|
||||||
|
@ -738,7 +710,10 @@ DDS_EXPORT bool dds_qget_destination_order (const dds_qos_t * __restrict qos, dd
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_writer_data_lifecycle (const dds_qos_t * __restrict qos, bool *autodispose);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_writer_data_lifecycle (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
bool *autodispose);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the reader data-lifecycle qos policy
|
* @brief Get the reader data-lifecycle qos policy
|
||||||
|
@ -749,7 +724,11 @@ DDS_EXPORT bool dds_qget_writer_data_lifecycle (const dds_qos_t * __restrict qos
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_reader_data_lifecycle (const dds_qos_t * __restrict qos, dds_duration_t *autopurge_nowriter_samples_delay, dds_duration_t *autopurge_disposed_samples_delay);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_reader_data_lifecycle (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *autopurge_nowriter_samples_delay,
|
||||||
|
dds_duration_t *autopurge_disposed_samples_delay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the durability-service qos policy values.
|
* @brief Get the durability-service qos policy values.
|
||||||
|
@ -764,7 +743,15 @@ DDS_EXPORT bool dds_qget_reader_data_lifecycle (const dds_qos_t * __restrict qos
|
||||||
*
|
*
|
||||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||||
*/
|
*/
|
||||||
DDS_EXPORT bool dds_qget_durability_service (const dds_qos_t * __restrict qos, dds_duration_t *service_cleanup_delay, dds_history_kind_t *history_kind, int32_t *history_depth, int32_t *max_samples, int32_t *max_instances, int32_t *max_samples_per_instance);
|
DDS_EXPORT bool
|
||||||
|
dds_qget_durability_service (
|
||||||
|
const dds_qos_t * __restrict qos,
|
||||||
|
dds_duration_t *service_cleanup_delay,
|
||||||
|
dds_history_kind_t *history_kind,
|
||||||
|
int32_t *history_depth,
|
||||||
|
int32_t *max_samples,
|
||||||
|
int32_t *max_instances,
|
||||||
|
int32_t *max_samples_per_instance);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
|
@ -20,8 +20,7 @@
|
||||||
#ifndef DDS_STATUS_H
|
#ifndef DDS_STATUS_H
|
||||||
#define DDS_STATUS_H
|
#define DDS_STATUS_H
|
||||||
|
|
||||||
#include "os/os_public.h"
|
#include "dds/export.h"
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -197,11 +196,10 @@ dds_inconsistent_topic_status_t;
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_inconsistent_topic_status (
|
dds_get_inconsistent_topic_status (
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_Out_opt_ dds_inconsistent_topic_status_t * status);
|
dds_inconsistent_topic_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get PUBLICATION_MATCHED status
|
* @brief Get PUBLICATION_MATCHED status
|
||||||
|
@ -225,11 +223,10 @@ dds_get_inconsistent_topic_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_publication_matched_status (
|
dds_get_publication_matched_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_publication_matched_status_t * status);
|
dds_publication_matched_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get LIVELINESS_LOST status
|
* @brief Get LIVELINESS_LOST status
|
||||||
|
@ -253,10 +250,10 @@ dds_get_publication_matched_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
DDS_EXPORT dds_return_t
|
||||||
DDS_EXPORT dds_return_t dds_get_liveliness_lost_status (
|
dds_get_liveliness_lost_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_liveliness_lost_status_t * status);
|
dds_liveliness_lost_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get OFFERED_DEADLINE_MISSED status
|
* @brief Get OFFERED_DEADLINE_MISSED status
|
||||||
|
@ -280,11 +277,10 @@ DDS_EXPORT dds_return_t dds_get_liveliness_lost_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_offered_deadline_missed_status(
|
dds_get_offered_deadline_missed_status(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_offered_deadline_missed_status_t *status);
|
dds_offered_deadline_missed_status_t *status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get OFFERED_INCOMPATIBLE_QOS status
|
* @brief Get OFFERED_INCOMPATIBLE_QOS status
|
||||||
|
@ -308,11 +304,10 @@ dds_get_offered_deadline_missed_status(
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_offered_incompatible_qos_status (
|
dds_get_offered_incompatible_qos_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_offered_incompatible_qos_status_t * status);
|
dds_offered_incompatible_qos_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get SUBSCRIPTION_MATCHED status
|
* @brief Get SUBSCRIPTION_MATCHED status
|
||||||
|
@ -336,11 +331,10 @@ dds_get_offered_incompatible_qos_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_subscription_matched_status (
|
dds_get_subscription_matched_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_subscription_matched_status_t * status);
|
dds_subscription_matched_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get LIVELINESS_CHANGED status
|
* @brief Get LIVELINESS_CHANGED status
|
||||||
|
@ -364,11 +358,10 @@ dds_get_subscription_matched_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_liveliness_changed_status (
|
dds_get_liveliness_changed_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_liveliness_changed_status_t * status);
|
dds_liveliness_changed_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get SAMPLE_REJECTED status
|
* @brief Get SAMPLE_REJECTED status
|
||||||
|
@ -392,11 +385,10 @@ dds_get_liveliness_changed_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_sample_rejected_status (
|
dds_get_sample_rejected_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_sample_rejected_status_t * status);
|
dds_sample_rejected_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get SAMPLE_LOST status
|
* @brief Get SAMPLE_LOST status
|
||||||
|
@ -421,11 +413,10 @@ dds_get_sample_rejected_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_sample_lost_status (
|
dds_get_sample_lost_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_sample_lost_status_t * status);
|
dds_sample_lost_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get REQUESTED_DEADLINE_MISSED status
|
* @brief Get REQUESTED_DEADLINE_MISSED status
|
||||||
|
@ -450,11 +441,10 @@ dds_get_sample_lost_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_requested_deadline_missed_status (
|
dds_get_requested_deadline_missed_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_requested_deadline_missed_status_t * status);
|
dds_requested_deadline_missed_status_t * status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get REQUESTED_INCOMPATIBLE_QOS status
|
* @brief Get REQUESTED_INCOMPATIBLE_QOS status
|
||||||
|
@ -479,11 +469,10 @@ dds_get_requested_deadline_missed_status (
|
||||||
* @retval DDS_RETCODE_ALREADY_DELETED
|
* @retval DDS_RETCODE_ALREADY_DELETED
|
||||||
* The entity has already been deleted.
|
* The entity has already been deleted.
|
||||||
*/
|
*/
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_requested_incompatible_qos_status (
|
dds_get_requested_incompatible_qos_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_requested_incompatible_qos_status_t * status);
|
dds_requested_incompatible_qos_status_t * status);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
|
@ -20,9 +20,11 @@
|
||||||
#ifndef DDS_STREAM_H
|
#ifndef DDS_STREAM_H
|
||||||
#define DDS_STREAM_H
|
#define DDS_STREAM_H
|
||||||
|
|
||||||
#include "os/os_public.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "ddsc/dds_export.h"
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "dds/export.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
File diff suppressed because it is too large
Load diff
|
@ -1,155 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* @brief DDS C Error API
|
|
||||||
*
|
|
||||||
* This header file defines the public API of error values and convenience
|
|
||||||
* functions in the CycloneDDS C language binding.
|
|
||||||
*/
|
|
||||||
#ifndef DDS_ERROR_H
|
|
||||||
#define DDS_ERROR_H
|
|
||||||
|
|
||||||
#include "os/os_public.h"
|
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Error masks for returned status values */
|
|
||||||
|
|
||||||
#define DDS_ERR_NR_MASK 0x000000ff
|
|
||||||
#define DDS_ERR_LINE_MASK 0x003fff00
|
|
||||||
#define DDS_ERR_FILE_ID_MASK 0x7fc00000
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
State is unchanged following a function call returning an error
|
|
||||||
other than UNSPECIFIED, OUT_OF_RESOURCES and ALREADY_DELETED.
|
|
||||||
|
|
||||||
Error handling functions. Three components to returned int status value.
|
|
||||||
|
|
||||||
1 - The DDS_ERR_xxx error number
|
|
||||||
2 - The file identifier
|
|
||||||
3 - The line number
|
|
||||||
|
|
||||||
All functions return >= 0 on success, < 0 on error
|
|
||||||
*/
|
|
||||||
/** @name Return codes
|
|
||||||
@{**/
|
|
||||||
#define DDS_RETCODE_OK 0 /**< Success */
|
|
||||||
#define DDS_RETCODE_ERROR 1 /**< Non specific error */
|
|
||||||
#define DDS_RETCODE_UNSUPPORTED 2 /**< Feature unsupported */
|
|
||||||
#define DDS_RETCODE_BAD_PARAMETER 3 /**< Bad parameter value */
|
|
||||||
#define DDS_RETCODE_PRECONDITION_NOT_MET 4 /**< Precondition for operation not met */
|
|
||||||
#define DDS_RETCODE_OUT_OF_RESOURCES 5 /**< When an operation fails because of a lack of resources */
|
|
||||||
#define DDS_RETCODE_NOT_ENABLED 6 /**< When a configurable feature is not enabled */
|
|
||||||
#define DDS_RETCODE_IMMUTABLE_POLICY 7 /**< When an attempt is made to modify an immutable policy */
|
|
||||||
#define DDS_RETCODE_INCONSISTENT_POLICY 8 /**< When a policy is used with inconsistent values */
|
|
||||||
#define DDS_RETCODE_ALREADY_DELETED 9 /**< When an attempt is made to delete something more than once */
|
|
||||||
#define DDS_RETCODE_TIMEOUT 10 /**< When a timeout has occurred */
|
|
||||||
#define DDS_RETCODE_NO_DATA 11 /**< When expected data is not provided */
|
|
||||||
#define DDS_RETCODE_ILLEGAL_OPERATION 12 /**< When a function is called when it should not be */
|
|
||||||
#define DDS_RETCODE_NOT_ALLOWED_BY_SECURITY 13 /**< When credentials are not enough to use the function */
|
|
||||||
|
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
||||||
/* For backwards compatability */
|
|
||||||
|
|
||||||
#define DDS_SUCCESS DDS_RETCODE_OK
|
|
||||||
|
|
||||||
/** @name DDS_Error_Type
|
|
||||||
@{**/
|
|
||||||
#define DDS_CHECK_REPORT 0x01
|
|
||||||
#define DDS_CHECK_FAIL 0x02
|
|
||||||
#define DDS_CHECK_EXIT 0x04
|
|
||||||
/** @}*/
|
|
||||||
|
|
||||||
/* Error code handling functions */
|
|
||||||
|
|
||||||
/** @name Macros for error handling
|
|
||||||
@{**/
|
|
||||||
#define DDS_TO_STRING(n) #n
|
|
||||||
#define DDS_INT_TO_STRING(n) DDS_TO_STRING(n)
|
|
||||||
/** @}*/
|
|
||||||
|
|
||||||
/** Macro to extract error number */
|
|
||||||
#define dds_err_nr(e) ((-(e)) & DDS_ERR_NR_MASK)
|
|
||||||
|
|
||||||
/** Macro to extract line number */
|
|
||||||
#define dds_err_line(e) (((-(e)) & DDS_ERR_LINE_MASK) >> 8)
|
|
||||||
|
|
||||||
/** Macro to extract file identifier */
|
|
||||||
#define dds_err_file_id(e) (((-(e)) & DDS_ERR_FILE_ID_MASK) >> 22)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Takes the error value and outputs a string corresponding to it.
|
|
||||||
*
|
|
||||||
* @param[in] err Error value to be converted to a string
|
|
||||||
* @returns String corresponding to the error value
|
|
||||||
*/
|
|
||||||
DDS_EXPORT const char * dds_err_str (dds_return_t err);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Takes the error number, error type and filename and line number and formats it to
|
|
||||||
* a string which can be used for debugging.
|
|
||||||
*
|
|
||||||
* @param[in] err Error value
|
|
||||||
* @param[in] flags Indicates Fail, Exit or Report
|
|
||||||
* @param[in] where File and line number
|
|
||||||
* @returns true - True
|
|
||||||
* @returns false - False
|
|
||||||
*/
|
|
||||||
|
|
||||||
DDS_EXPORT bool dds_err_check (dds_return_t err, unsigned flags, const char * where);
|
|
||||||
|
|
||||||
/** Macro that defines dds_err_check function */
|
|
||||||
#define DDS_ERR_CHECK(e, f) (dds_err_check ((e), (f), __FILE__ ":" DDS_INT_TO_STRING(__LINE__)))
|
|
||||||
|
|
||||||
/* Failure handling */
|
|
||||||
|
|
||||||
/** Failure handler */
|
|
||||||
typedef void (*dds_fail_fn) (const char *, const char *);
|
|
||||||
|
|
||||||
/** Macro that defines dds_fail function */
|
|
||||||
#define DDS_FAIL(m) (dds_fail (m, __FILE__ ":" DDS_INT_TO_STRING (__LINE__)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the failure function
|
|
||||||
*
|
|
||||||
* @param[in] fn Function to invoke on failure
|
|
||||||
*/
|
|
||||||
DDS_EXPORT void dds_fail_set (dds_fail_fn fn);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the failure function
|
|
||||||
*
|
|
||||||
* @returns Failure function
|
|
||||||
*/
|
|
||||||
DDS_EXPORT dds_fail_fn dds_fail_get (void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handles failure through an installed failure handler
|
|
||||||
*
|
|
||||||
* @params[in] msg String containing failure message
|
|
||||||
* @params[in] where String containing file and location
|
|
||||||
*/
|
|
||||||
DDS_EXPORT void dds_fail (const char * msg, const char * where);
|
|
||||||
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,96 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* @brief DDS C Time support API
|
|
||||||
*
|
|
||||||
* This header file defines the public API of the in the
|
|
||||||
* Eclipse Cyclone DDS C language binding.
|
|
||||||
*/
|
|
||||||
#ifndef DDS_TIME_H
|
|
||||||
#define DDS_TIME_H
|
|
||||||
|
|
||||||
#include "os/os_public.h"
|
|
||||||
#include "ddsc/dds_export.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
Times are represented using a 64-bit signed integer, encoding
|
|
||||||
nanoseconds since the epoch. Considering the nature of these
|
|
||||||
systems, one would best use TAI, International Atomic Time, rather
|
|
||||||
than something UTC, but availability may be limited.
|
|
||||||
|
|
||||||
Valid times are non-negative and times up to 2**63-2 can be
|
|
||||||
represented. 2**63-1 is defined to represent, essentially, "never".
|
|
||||||
This is good enough for a couple of centuries.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Absolute Time definition */
|
|
||||||
typedef int64_t dds_time_t;
|
|
||||||
|
|
||||||
/** Relative Time definition */
|
|
||||||
typedef int64_t dds_duration_t;
|
|
||||||
|
|
||||||
/** @name Macro definition for time units in nanoseconds.
|
|
||||||
@{**/
|
|
||||||
#define DDS_NSECS_IN_SEC 1000000000LL
|
|
||||||
#define DDS_NSECS_IN_MSEC 1000000LL
|
|
||||||
#define DDS_NSECS_IN_USEC 1000LL
|
|
||||||
/** @}*/
|
|
||||||
|
|
||||||
/** @name Infinite timeout for indicate absolute time */
|
|
||||||
#define DDS_NEVER ((dds_time_t) INT64_MAX)
|
|
||||||
|
|
||||||
/** @name Infinite timeout for relative time */
|
|
||||||
#define DDS_INFINITY ((dds_duration_t) INT64_MAX)
|
|
||||||
|
|
||||||
/** @name Macro definition for time conversion from nanoseconds
|
|
||||||
@{**/
|
|
||||||
#define DDS_SECS(n) ((n) * DDS_NSECS_IN_SEC)
|
|
||||||
#define DDS_MSECS(n) ((n) * DDS_NSECS_IN_MSEC)
|
|
||||||
#define DDS_USECS(n) ((n) * DDS_NSECS_IN_USEC)
|
|
||||||
/** @}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description : This operation returns the current time (in nanoseconds)
|
|
||||||
*
|
|
||||||
* Arguments :
|
|
||||||
* -# Returns current time
|
|
||||||
*/
|
|
||||||
DDS_EXPORT dds_time_t dds_time (void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description : This operation blocks the calling thread until the relative time
|
|
||||||
* n has elapsed
|
|
||||||
*
|
|
||||||
* Arguments :
|
|
||||||
* -# n Relative Time to block a thread
|
|
||||||
*/
|
|
||||||
DDS_EXPORT void dds_sleepfor (dds_duration_t n);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description : This operation blocks the calling thread until the absolute time
|
|
||||||
* n has elapsed
|
|
||||||
*
|
|
||||||
* Arguments :
|
|
||||||
* -# n absolute Time to block a thread
|
|
||||||
*/
|
|
||||||
DDS_EXPORT void dds_sleepuntil (dds_time_t n);
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef _DDS_BUILTIN_H_
|
#ifndef _DDS_BUILTIN_H_
|
||||||
#define _DDS_BUILTIN_H_
|
#define _DDS_BUILTIN_H_
|
||||||
|
|
||||||
#include "ddsi/q_time.h"
|
#include "dds/ddsi/q_time.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
@ -13,35 +13,31 @@
|
||||||
#define _DDS_ENTITY_H_
|
#define _DDS_ENTITY_H_
|
||||||
|
|
||||||
#include "dds__types.h"
|
#include "dds__types.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Check_return_
|
|
||||||
DDS_EXPORT dds_entity_t
|
DDS_EXPORT dds_entity_t
|
||||||
dds_entity_init(
|
dds_entity_init(
|
||||||
_In_ dds_entity * e,
|
dds_entity * e,
|
||||||
_When_(kind != DDS_KIND_PARTICIPANT, _Notnull_)
|
dds_entity * parent,
|
||||||
_When_(kind == DDS_KIND_PARTICIPANT, _Null_)
|
dds_entity_kind_t kind,
|
||||||
_In_opt_ dds_entity * parent,
|
dds_qos_t * qos,
|
||||||
_In_ dds_entity_kind_t kind,
|
const dds_listener_t *listener,
|
||||||
_In_opt_ dds_qos_t * qos,
|
uint32_t mask);
|
||||||
_In_opt_ const dds_listener_t *listener,
|
|
||||||
_In_ uint32_t mask);
|
|
||||||
|
|
||||||
DDS_EXPORT void
|
DDS_EXPORT void
|
||||||
dds_entity_add_ref(
|
dds_entity_add_ref(dds_entity *e);
|
||||||
_In_ dds_entity *e);
|
|
||||||
DDS_EXPORT void
|
DDS_EXPORT void
|
||||||
dds_entity_add_ref_nolock(
|
dds_entity_add_ref_nolock(dds_entity *e);
|
||||||
_In_ dds_entity *e);
|
|
||||||
|
|
||||||
#define DEFINE_ENTITY_LOCK_UNLOCK(qualifier_, type_, kind_) \
|
#define DEFINE_ENTITY_LOCK_UNLOCK(qualifier_, type_, kind_) \
|
||||||
qualifier_ dds__retcode_t type_##_lock (dds_entity_t hdl, type_ **x) \
|
qualifier_ dds_retcode_t type_##_lock (dds_entity_t hdl, type_ **x) \
|
||||||
{ \
|
{ \
|
||||||
dds__retcode_t rc; \
|
dds_retcode_t rc; \
|
||||||
dds_entity *e; \
|
dds_entity *e; \
|
||||||
if ((rc = dds_entity_lock (hdl, kind_, &e)) != DDS_RETCODE_OK) \
|
if ((rc = dds_entity_lock (hdl, kind_, &e)) != DDS_RETCODE_OK) \
|
||||||
return rc; \
|
return rc; \
|
||||||
|
@ -54,7 +50,7 @@ dds_entity_add_ref_nolock(
|
||||||
dds_entity_unlock (&x->m_entity); \
|
dds_entity_unlock (&x->m_entity); \
|
||||||
}
|
}
|
||||||
#define DECL_ENTITY_LOCK_UNLOCK(qualifier_, type_) \
|
#define DECL_ENTITY_LOCK_UNLOCK(qualifier_, type_) \
|
||||||
qualifier_ dds__retcode_t type_##_lock (dds_entity_t hdl, type_ **x); \
|
qualifier_ dds_retcode_t type_##_lock (dds_entity_t hdl, type_ **x); \
|
||||||
qualifier_ void type_##_unlock (type_ *x);
|
qualifier_ void type_##_unlock (type_ *x);
|
||||||
|
|
||||||
DDS_EXPORT inline bool dds_entity_is_enabled (const dds_entity *e) {
|
DDS_EXPORT inline bool dds_entity_is_enabled (const dds_entity *e) {
|
||||||
|
@ -83,58 +79,52 @@ DDS_EXPORT void dds_entity_status_signal (dds_entity *e);
|
||||||
|
|
||||||
DDS_EXPORT void dds_entity_invoke_listener (const dds_entity *entity, enum dds_status_id which, const void *vst);
|
DDS_EXPORT void dds_entity_invoke_listener (const dds_entity *entity, enum dds_status_id which, const void *vst);
|
||||||
|
|
||||||
_Check_return_ DDS_EXPORT dds__retcode_t
|
DDS_EXPORT dds_retcode_t
|
||||||
dds_valid_hdl(
|
dds_valid_hdl(dds_entity_t hdl, dds_entity_kind_t kind);
|
||||||
_In_ dds_entity_t hdl,
|
|
||||||
_In_ dds_entity_kind_t kind);
|
|
||||||
|
|
||||||
_Acquires_exclusive_lock_(*e)
|
DDS_EXPORT dds_retcode_t
|
||||||
_Check_return_ DDS_EXPORT dds__retcode_t
|
|
||||||
dds_entity_lock(
|
dds_entity_lock(
|
||||||
_In_ dds_entity_t hdl,
|
dds_entity_t hdl,
|
||||||
_In_ dds_entity_kind_t kind,
|
dds_entity_kind_t kind,
|
||||||
_Out_ dds_entity **e);
|
dds_entity **e);
|
||||||
|
|
||||||
_Releases_exclusive_lock_(e)
|
|
||||||
DDS_EXPORT void
|
DDS_EXPORT void
|
||||||
dds_entity_unlock(
|
dds_entity_unlock(dds_entity *e);
|
||||||
_Inout_ dds_entity *e);
|
|
||||||
|
|
||||||
_Check_return_ DDS_EXPORT dds__retcode_t
|
DDS_EXPORT dds_retcode_t
|
||||||
dds_entity_observer_register_nl(
|
dds_entity_observer_register_nl(
|
||||||
_In_ dds_entity* observed,
|
dds_entity *observed,
|
||||||
_In_ dds_entity_t observer,
|
dds_entity_t observer,
|
||||||
_In_ dds_entity_callback cb);
|
dds_entity_callback cb);
|
||||||
|
|
||||||
_Check_return_ DDS_EXPORT dds__retcode_t
|
DDS_EXPORT dds_retcode_t
|
||||||
dds_entity_observer_register(
|
dds_entity_observer_register(
|
||||||
_In_ dds_entity_t observed,
|
dds_entity_t observed,
|
||||||
_In_ dds_entity_t observer,
|
dds_entity_t observer,
|
||||||
_In_ dds_entity_callback cb);
|
dds_entity_callback cb);
|
||||||
|
|
||||||
DDS_EXPORT dds__retcode_t
|
DDS_EXPORT dds_retcode_t
|
||||||
dds_entity_observer_unregister_nl(
|
dds_entity_observer_unregister_nl(
|
||||||
_In_ dds_entity* observed,
|
dds_entity *observed,
|
||||||
_In_ dds_entity_t observer);
|
dds_entity_t observer);
|
||||||
|
|
||||||
DDS_EXPORT dds__retcode_t
|
DDS_EXPORT dds_retcode_t
|
||||||
dds_entity_observer_unregister(
|
dds_entity_observer_unregister(
|
||||||
_In_ dds_entity_t observed,
|
dds_entity_t observed,
|
||||||
_In_ dds_entity_t observer);
|
dds_entity_t observer);
|
||||||
|
|
||||||
_Pre_satisfies_(entity & DDS_ENTITY_KIND_MASK)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_delete_impl(
|
dds_delete_impl(
|
||||||
_In_ dds_entity_t entity,
|
dds_entity_t entity,
|
||||||
_In_ bool keep_if_explicit);
|
bool keep_if_explicit);
|
||||||
|
|
||||||
DDS_EXPORT const char *
|
DDS_EXPORT const char *
|
||||||
dds__entity_kind_str(
|
dds__entity_kind_str(
|
||||||
_In_ dds_entity_t e);
|
dds_entity_t e);
|
||||||
|
|
||||||
DDS_EXPORT dds_domain *
|
DDS_EXPORT dds_domain *
|
||||||
dds__entity_domain(
|
dds__entity_domain(
|
||||||
_In_ dds_entity* e);
|
dds_entity* e);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
#define _DDS_ERR_H_
|
#define _DDS_ERR_H_
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/ddsrt/retcode.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
|
|
||||||
_Must_inspect_result_ dds_guardcond*
|
dds_guardcond*
|
||||||
dds_create_guardcond(
|
dds_create_guardcond(
|
||||||
_In_ dds_participant *pp);
|
dds_participant *pp);
|
||||||
|
|
||||||
DEFINE_ENTITY_LOCK_UNLOCK(inline, dds_guardcond, DDS_KIND_COND_GUARD)
|
DEFINE_ENTITY_LOCK_UNLOCK(inline, dds_guardcond, DDS_KIND_COND_GUARD)
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds__check_domain(
|
dds__check_domain(dds_domainid_t domain);
|
||||||
_In_ dds_domainid_t domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Description : Initialization function, called from main. This operation
|
*Description : Initialization function, called from main. This operation
|
||||||
|
@ -46,8 +45,6 @@ dds_init(dds_domainid_t domain);
|
||||||
void
|
void
|
||||||
dds_fini(void);
|
dds_fini(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description : Function that provides the explicit ID of default domain
|
* Description : Function that provides the explicit ID of default domain
|
||||||
* It should be called after DDS initialization.
|
* It should be called after DDS initialization.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define _DDS_LISTENER_H_
|
#define _DDS_LISTENER_H_
|
||||||
|
|
||||||
#include "dds__types.h"
|
#include "dds__types.h"
|
||||||
#include "ddsc/dds_public_listener.h"
|
#include "dds/ddsc/dds_public_listener.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef _DDS_PUBLISHER_H_
|
#ifndef _DDS_PUBLISHER_H_
|
||||||
#define _DDS_PUBLISHER_H_
|
#define _DDS_PUBLISHER_H_
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#define _DDS_QOS_H_
|
#define _DDS_QOS_H_
|
||||||
|
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "ddsi/q_xqos.h"
|
#include "dds/ddsi/q_xqos.h"
|
||||||
#include "ddsi/q_time.h"
|
#include "dds/ddsi/q_time.h"
|
||||||
#include "ddsi/q_plist.h"
|
#include "dds/ddsi/q_plist.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -24,12 +24,12 @@ extern "C" {
|
||||||
bool validate_deadline_and_timebased_filter (const nn_duration_t deadline, const nn_duration_t minimum_separation);
|
bool validate_deadline_and_timebased_filter (const nn_duration_t deadline, const nn_duration_t minimum_separation);
|
||||||
bool validate_entityfactory_qospolicy (const nn_entity_factory_qospolicy_t * entityfactory);
|
bool validate_entityfactory_qospolicy (const nn_entity_factory_qospolicy_t * entityfactory);
|
||||||
bool validate_octetseq (const nn_octetseq_t* seq);
|
bool validate_octetseq (const nn_octetseq_t* seq);
|
||||||
bool validate_partition_qospolicy (_In_ const nn_partition_qospolicy_t * partition);
|
bool validate_partition_qospolicy (const nn_partition_qospolicy_t * partition);
|
||||||
bool validate_reliability_qospolicy (const nn_reliability_qospolicy_t * reliability);
|
bool validate_reliability_qospolicy (const nn_reliability_qospolicy_t * reliability);
|
||||||
bool validate_stringseq (const nn_stringseq_t* seq);
|
bool validate_stringseq (const nn_stringseq_t* seq);
|
||||||
|
|
||||||
bool dds_qos_validate_common (const dds_qos_t *qos);
|
bool dds_qos_validate_common (const dds_qos_t *qos);
|
||||||
dds_return_t dds_qos_validate_mutable_common (_In_ const dds_qos_t *qos);
|
dds_return_t dds_qos_validate_mutable_common (const dds_qos_t *qos);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
|
|
||||||
_Must_inspect_result_ dds_readcond*
|
dds_readcond *
|
||||||
dds_create_readcond(
|
dds_create_readcond(
|
||||||
_In_ dds_reader *rd,
|
dds_reader *rd,
|
||||||
_In_ dds_entity_kind_t kind,
|
dds_entity_kind_t kind,
|
||||||
_In_ uint32_t mask,
|
uint32_t mask,
|
||||||
_In_opt_ dds_querycondition_filter_fn filter);
|
dds_querycondition_filter_fn filter);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,11 +12,8 @@
|
||||||
#ifndef _DDS_RHC_H_
|
#ifndef _DDS_RHC_H_
|
||||||
#define _DDS_RHC_H_
|
#define _DDS_RHC_H_
|
||||||
|
|
||||||
#include "os/os_defs.h"
|
|
||||||
|
|
||||||
#define NO_STATE_MASK_SET (DDS_ANY_STATE + 1)
|
#define NO_STATE_MASK_SET (DDS_ANY_STATE + 1)
|
||||||
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
#ifndef DDSI_SERDATA_BUILTINTOPIC_H
|
#ifndef DDSI_SERDATA_BUILTINTOPIC_H
|
||||||
#define DDSI_SERDATA_BUILTINTOPIC_H
|
#define DDSI_SERDATA_BUILTINTOPIC_H
|
||||||
|
|
||||||
#include "ddsi/q_xqos.h"
|
#include "dds/ddsi/q_xqos.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
|
|
||||||
struct ddsi_serdata_builtintopic {
|
struct ddsi_serdata_builtintopic {
|
||||||
struct ddsi_serdata c;
|
struct ddsi_serdata c;
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
#ifndef _DDS_STREAM_H_
|
#ifndef _DDS_STREAM_H_
|
||||||
#define _DDS_STREAM_H_
|
#define _DDS_STREAM_H_
|
||||||
|
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h"
|
#include "dds/ddsi/ddsi_serdata_default.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -32,7 +32,7 @@ void dds_stream_read_sample
|
||||||
const struct ddsi_sertopic_default * topic
|
const struct ddsi_sertopic_default * topic
|
||||||
);
|
);
|
||||||
|
|
||||||
size_t dds_stream_check_optimize (_In_ const dds_topic_descriptor_t * desc);
|
size_t dds_stream_check_optimize (const dds_topic_descriptor_t * desc);
|
||||||
void dds_stream_from_serdata_default (dds_stream_t * s, const struct ddsi_serdata_default *d);
|
void dds_stream_from_serdata_default (dds_stream_t * s, const struct ddsi_serdata_default *d);
|
||||||
void dds_stream_add_to_serdata_default (dds_stream_t * s, struct ddsi_serdata_default **d);
|
void dds_stream_add_to_serdata_default (dds_stream_t * s, struct ddsi_serdata_default **d);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef _DDS_SUBSCRIBER_H_
|
#ifndef _DDS_SUBSCRIBER_H_
|
||||||
#define _DDS_SUBSCRIBER_H_
|
#define _DDS_SUBSCRIBER_H_
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -20,20 +20,19 @@ extern "C" {
|
||||||
|
|
||||||
struct dds_entity;
|
struct dds_entity;
|
||||||
|
|
||||||
_Requires_exclusive_lock_held_(participant)
|
dds_entity_t
|
||||||
_Check_return_ dds_entity_t
|
|
||||||
dds__create_subscriber_l(
|
dds__create_subscriber_l(
|
||||||
_Inout_ struct dds_entity *participant, /* entity-lock must be held */
|
struct dds_entity *participant, /* entity-lock must be held */
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener);
|
const dds_listener_t *listener);
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_subscriber_begin_coherent(
|
dds_subscriber_begin_coherent(
|
||||||
_In_ dds_entity_t e);
|
dds_entity_t e);
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_subscriber_end_coherent (
|
dds_subscriber_end_coherent (
|
||||||
_In_ dds_entity_t e);
|
dds_entity_t e);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,18 +14,16 @@
|
||||||
|
|
||||||
/* DDS internal type definitions */
|
/* DDS internal type definitions */
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/dds.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/ddsrt/sync.h"
|
||||||
#include "ddsi/q_rtps.h"
|
#include "dds/ddsi/q_rtps.h"
|
||||||
#include "util/ut_avl.h"
|
#include "dds/util/ut_avl.h"
|
||||||
#include "util/ut_handleserver.h"
|
#include "dds/util/ut_handleserver.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef _Return_type_success_(return == DDS_RETCODE_OK) int32_t dds__retcode_t;
|
|
||||||
|
|
||||||
struct dds_domain;
|
struct dds_domain;
|
||||||
struct dds_entity;
|
struct dds_entity;
|
||||||
struct dds_participant;
|
struct dds_participant;
|
||||||
|
@ -139,11 +137,11 @@ typedef struct dds_entity
|
||||||
dds_domainid_t m_domainid;
|
dds_domainid_t m_domainid;
|
||||||
nn_guid_t m_guid;
|
nn_guid_t m_guid;
|
||||||
uint32_t m_flags;
|
uint32_t m_flags;
|
||||||
os_mutex m_mutex;
|
ddsrt_mutex_t m_mutex;
|
||||||
os_cond m_cond;
|
ddsrt_cond_t m_cond;
|
||||||
|
|
||||||
os_mutex m_observers_lock;
|
ddsrt_mutex_t m_observers_lock;
|
||||||
os_cond m_observers_cond;
|
ddsrt_cond_t m_observers_cond;
|
||||||
dds_listener_t m_listener;
|
dds_listener_t m_listener;
|
||||||
uint32_t m_trigger;
|
uint32_t m_trigger;
|
||||||
uint32_t m_status_enable;
|
uint32_t m_status_enable;
|
||||||
|
@ -287,7 +285,7 @@ typedef struct dds_globals
|
||||||
void (*m_dur_init) (void);
|
void (*m_dur_init) (void);
|
||||||
void (*m_dur_fini) (void);
|
void (*m_dur_fini) (void);
|
||||||
ut_avlTree_t m_domains;
|
ut_avlTree_t m_domains;
|
||||||
os_mutex m_mutex;
|
ddsrt_mutex_t m_mutex;
|
||||||
}
|
}
|
||||||
dds_globals;
|
dds_globals;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef DDS__WHC_H
|
#ifndef DDS__WHC_H
|
||||||
#define DDS__WHC_H
|
#define DDS__WHC_H
|
||||||
|
|
||||||
#include "ddsi/q_whc.h"
|
#include "dds/ddsi/q_whc.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef DDS_WHC_BUILTINTOPIC_H
|
#ifndef DDS_WHC_BUILTINTOPIC_H
|
||||||
#define DDS_WHC_BUILTINTOPIC_H
|
#define DDS_WHC_BUILTINTOPIC_H
|
||||||
|
|
||||||
#include "ddsi/q_whc.h"
|
#include "dds/ddsi/q_whc.h"
|
||||||
#include "dds__serdata_builtintopic.h"
|
#include "dds__serdata_builtintopic.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "dds__alloc.h"
|
#include "dds__alloc.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "os/os_heap.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define OP_DEBUG_FREE 1
|
#define OP_DEBUG_FREE 1
|
||||||
|
@ -28,26 +29,24 @@ static const char * stream_op_type[11] =
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static dds_allocator_t dds_allocator_fns = { os_malloc, os_realloc, os_free };
|
static dds_allocator_t dds_allocator_fns = { ddsrt_malloc, ddsrt_realloc, ddsrt_free };
|
||||||
|
|
||||||
void * dds_alloc (size_t size)
|
void * dds_alloc (size_t size)
|
||||||
{
|
{
|
||||||
void * ret = (dds_allocator_fns.malloc) (size);
|
void * ret = (dds_allocator_fns.malloc) (size);
|
||||||
if (ret)
|
if (ret == NULL) {
|
||||||
{
|
DDS_FATAL("dds_alloc");
|
||||||
|
} else {
|
||||||
memset (ret, 0, size);
|
memset (ret, 0, size);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DDS_FAIL ("dds_alloc");
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * dds_realloc (void * ptr, size_t size)
|
void * dds_realloc (void * ptr, size_t size)
|
||||||
{
|
{
|
||||||
void * ret = (dds_allocator_fns.realloc) (ptr, size);
|
void * ret = (dds_allocator_fns.realloc) (ptr, size);
|
||||||
if (ret == NULL) DDS_FAIL ("dds_realloc");
|
if (ret == NULL)
|
||||||
|
DDS_FATAL("dds_realloc");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
|
@ -26,8 +26,8 @@
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__whc_builtintopic.h"
|
#include "dds__whc_builtintopic.h"
|
||||||
#include "dds__serdata_builtintopic.h"
|
#include "dds__serdata_builtintopic.h"
|
||||||
#include "ddsi/q_qosmatch.h"
|
#include "dds/ddsi/q_qosmatch.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
static struct ddsi_sertopic *builtin_participant_topic;
|
static struct ddsi_sertopic *builtin_participant_topic;
|
||||||
static struct ddsi_sertopic *builtin_reader_topic;
|
static struct ddsi_sertopic *builtin_reader_topic;
|
||||||
|
|
|
@ -11,70 +11,62 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__subscriber.h"
|
#include "dds__subscriber.h"
|
||||||
#include "dds__publisher.h"
|
#include "dds__publisher.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
|
|
||||||
_Pre_satisfies_(((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER ) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_begin_coherent(
|
dds_begin_coherent(
|
||||||
_In_ dds_entity_t entity)
|
dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
switch(dds_entity_kind_from_handle(entity)) {
|
switch(dds_entity_kind_from_handle(entity)) {
|
||||||
case DDS_KIND_READER:
|
case DDS_KIND_READER:
|
||||||
case DDS_KIND_WRITER:
|
case DDS_KIND_WRITER:
|
||||||
/* Invoking on a writer/reader behaves as if invoked on
|
/* Invoking on a writer/reader behaves as if invoked on
|
||||||
* its parent publisher/subscriber. */
|
* its parent publisher/subscriber. */
|
||||||
ret = dds_begin_coherent(dds_get_parent(entity));
|
ret = dds_begin_coherent(dds_get_parent(entity));
|
||||||
break;
|
break;
|
||||||
case DDS_KIND_PUBLISHER:
|
case DDS_KIND_PUBLISHER:
|
||||||
ret = dds_publisher_begin_coherent(entity);
|
ret = dds_publisher_begin_coherent(entity);
|
||||||
break;
|
break;
|
||||||
case DDS_KIND_SUBSCRIBER:
|
case DDS_KIND_SUBSCRIBER:
|
||||||
ret = dds_subscriber_begin_coherent(entity);
|
ret = dds_subscriber_begin_coherent(entity);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DDS_ERROR("Given entity can not control coherency\n");
|
DDS_ERROR("Given entity can not control coherency\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
|
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER ) || \
|
|
||||||
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_end_coherent(
|
dds_end_coherent(
|
||||||
_In_ dds_entity_t entity)
|
dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
switch(dds_entity_kind_from_handle(entity)) {
|
switch(dds_entity_kind_from_handle(entity)) {
|
||||||
case DDS_KIND_READER:
|
case DDS_KIND_READER:
|
||||||
case DDS_KIND_WRITER:
|
case DDS_KIND_WRITER:
|
||||||
/* Invoking on a writer/reader behaves as if invoked on
|
/* Invoking on a writer/reader behaves as if invoked on
|
||||||
* its parent publisher/subscriber. */
|
* its parent publisher/subscriber. */
|
||||||
ret = dds_end_coherent(dds_get_parent(entity));
|
ret = dds_end_coherent(dds_get_parent(entity));
|
||||||
break;
|
break;
|
||||||
case DDS_KIND_PUBLISHER:
|
case DDS_KIND_PUBLISHER:
|
||||||
ret = dds_publisher_end_coherent(entity);
|
ret = dds_publisher_end_coherent(entity);
|
||||||
break;
|
break;
|
||||||
case DDS_KIND_SUBSCRIBER:
|
case DDS_KIND_SUBSCRIBER:
|
||||||
ret = dds_subscriber_end_coherent(entity);
|
ret = dds_subscriber_end_coherent(entity);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DDS_ERROR("Given entity can not control coherency\n");
|
DDS_ERROR("Given entity can not control coherency\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
|
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
static int dds_domain_compare (const int32_t * a, const int32_t * b)
|
static int dds_domain_compare (const int32_t * a, const int32_t * b)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ dds_domain * dds_domain_find_locked (dds_domainid_t id)
|
||||||
dds_domain * dds_domain_create (dds_domainid_t id)
|
dds_domain * dds_domain_create (dds_domainid_t id)
|
||||||
{
|
{
|
||||||
dds_domain * domain;
|
dds_domain * domain;
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
domain = dds_domain_find_locked (id);
|
domain = dds_domain_find_locked (id);
|
||||||
if (domain == NULL)
|
if (domain == NULL)
|
||||||
{
|
{
|
||||||
|
@ -43,17 +43,17 @@ dds_domain * dds_domain_create (dds_domainid_t id)
|
||||||
ut_avlInsert (&dds_domaintree_def, &dds_global.m_domains, domain);
|
ut_avlInsert (&dds_domaintree_def, &dds_global.m_domains, domain);
|
||||||
}
|
}
|
||||||
domain->m_refc++;
|
domain->m_refc++;
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_domain_free (dds_domain * domain)
|
void dds_domain_free (dds_domain * domain)
|
||||||
{
|
{
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
if (--domain->m_refc == 0)
|
if (--domain->m_refc == 0)
|
||||||
{
|
{
|
||||||
ut_avlDelete (&dds_domaintree_def, &dds_global.m_domains, domain);
|
ut_avlDelete (&dds_domaintree_def, &dds_global.m_domains, domain);
|
||||||
dds_free (domain);
|
dds_free (domain);
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,16 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "dds/ddsrt/heap.h"
|
||||||
|
#include "dds/ddsrt/log.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__write.h"
|
#include "dds__write.h"
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
#include "dds/version.h"
|
||||||
|
|
||||||
/* Sanity check. */
|
/* Sanity check. */
|
||||||
#if DDS_ENTITY_KIND_MASK != UT_HANDLE_KIND_MASK
|
#if DDS_ENTITY_KIND_MASK != UT_HANDLE_KIND_MASK
|
||||||
|
@ -40,9 +43,9 @@ void dds_entity_add_ref_nolock (dds_entity *e)
|
||||||
|
|
||||||
void dds_entity_add_ref (dds_entity *e)
|
void dds_entity_add_ref (dds_entity *e)
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_mutex);
|
ddsrt_mutex_lock (&e->m_mutex);
|
||||||
dds_entity_add_ref_nolock (e);
|
dds_entity_add_ref_nolock (e);
|
||||||
os_mutexUnlock (&e->m_mutex);
|
ddsrt_mutex_unlock (&e->m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
dds_domain *dds__entity_domain (dds_entity *e)
|
dds_domain *dds__entity_domain (dds_entity *e)
|
||||||
|
@ -53,7 +56,7 @@ dds_domain *dds__entity_domain (dds_entity *e)
|
||||||
static void dds_set_explicit (dds_entity_t entity)
|
static void dds_set_explicit (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) == DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
e->m_flags &= ~DDS_ENTITY_IMPLICIT;
|
e->m_flags &= ~DDS_ENTITY_IMPLICIT;
|
||||||
|
@ -83,10 +86,10 @@ dds_entity_t dds_entity_init (dds_entity *e, dds_entity *parent, dds_entity_kind
|
||||||
/* set the status enable based on kind */
|
/* set the status enable based on kind */
|
||||||
e->m_status_enable = mask | DDS_INTERNAL_STATUS_MASK;
|
e->m_status_enable = mask | DDS_INTERNAL_STATUS_MASK;
|
||||||
|
|
||||||
os_mutexInit (&e->m_mutex);
|
ddsrt_mutex_init (&e->m_mutex);
|
||||||
os_mutexInit (&e->m_observers_lock);
|
ddsrt_mutex_init (&e->m_observers_lock);
|
||||||
os_condInit (&e->m_cond, &e->m_mutex);
|
ddsrt_cond_init (&e->m_cond);
|
||||||
os_condInit (&e->m_observers_cond, &e->m_observers_lock);
|
ddsrt_cond_init (&e->m_observers_cond);
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
@ -108,9 +111,9 @@ dds_entity_t dds_entity_init (dds_entity *e, dds_entity *parent, dds_entity_kind
|
||||||
dds_merge_listener (&e->m_listener, listener);
|
dds_merge_listener (&e->m_listener, listener);
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
dds_inherit_listener (&e->m_listener, &parent->m_listener);
|
dds_inherit_listener (&e->m_listener, &parent->m_listener);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
e->m_hdllink = NULL;
|
e->m_hdllink = NULL;
|
||||||
|
@ -126,7 +129,7 @@ dds_entity_t dds_entity_init (dds_entity *e, dds_entity *parent, dds_entity_kind
|
||||||
DDS_ERROR ("Can not create new entity; too many where created previously\n");
|
DDS_ERROR ("Can not create new entity; too many where created previously\n");
|
||||||
e->m_hdl = DDS_ERRNO (DDS_RETCODE_OUT_OF_RESOURCES);
|
e->m_hdl = DDS_ERRNO (DDS_RETCODE_OUT_OF_RESOURCES);
|
||||||
} else if (e->m_hdl == UT_HANDLE_NOT_INITALIZED) {
|
} else if (e->m_hdl == UT_HANDLE_NOT_INITALIZED) {
|
||||||
DDS_ERROR (DDSC_PROJECT_NAME" is not yet initialized. Please create a participant before executing an other method\n");
|
DDS_ERROR (DDS_PROJECT_NAME" is not yet initialized. Please create a participant before executing an other method\n");
|
||||||
e->m_hdl = DDS_ERRNO (DDS_RETCODE_PRECONDITION_NOT_MET);
|
e->m_hdl = DDS_ERRNO (DDS_RETCODE_PRECONDITION_NOT_MET);
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR ("An internal error has occurred\n");
|
DDS_ERROR ("An internal error has occurred\n");
|
||||||
|
@ -152,14 +155,14 @@ static dds_entity *next_non_topic_child (dds_entity *remaining_children)
|
||||||
|
|
||||||
dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
{
|
{
|
||||||
os_time timeout = { 10, 0 };
|
dds_time_t timeout = DDS_SECS(10);
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds_entity *child;
|
dds_entity *child;
|
||||||
dds_entity *parent;
|
dds_entity *parent;
|
||||||
dds_entity *prev = NULL;
|
dds_entity *prev = NULL;
|
||||||
dds_entity *next = NULL;
|
dds_entity *next = NULL;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
rc = dds_entity_lock (entity, UT_HANDLE_DONTCARE_KIND, &e);
|
rc = dds_entity_lock (entity, UT_HANDLE_DONTCARE_KIND, &e);
|
||||||
if (rc != DDS_RETCODE_OK)
|
if (rc != DDS_RETCODE_OK)
|
||||||
|
@ -181,13 +184,13 @@ dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_handle_close (e->m_hdl, e->m_hdllink);
|
ut_handle_close (e->m_hdl, e->m_hdllink);
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
while (e->m_cb_count > 0)
|
while (e->m_cb_count > 0)
|
||||||
os_condWait (&e->m_observers_cond, &e->m_observers_lock);
|
ddsrt_cond_wait (&e->m_observers_cond, &e->m_observers_lock);
|
||||||
e->m_status_enable = 0;
|
e->m_status_enable = 0;
|
||||||
dds_reset_listener (&e->m_listener);
|
dds_reset_listener (&e->m_listener);
|
||||||
e->m_trigger |= DDS_DELETING_STATUS;
|
e->m_trigger |= DDS_DELETING_STATUS;
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
dds_entity_unlock(e);
|
dds_entity_unlock(e);
|
||||||
|
|
||||||
/* Signal observers that this entity will be deleted. */
|
/* Signal observers that this entity will be deleted. */
|
||||||
|
@ -251,7 +254,7 @@ dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
/* Remove from parent */
|
/* Remove from parent */
|
||||||
if ((parent = dds__nonself_parent(e)) != NULL)
|
if ((parent = dds__nonself_parent(e)) != NULL)
|
||||||
{
|
{
|
||||||
os_mutexLock (&parent->m_mutex);
|
ddsrt_mutex_lock (&parent->m_mutex);
|
||||||
child = parent->m_children;
|
child = parent->m_children;
|
||||||
while (child && child != e)
|
while (child && child != e)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +266,7 @@ dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
prev->m_next = e->m_next;
|
prev->m_next = e->m_next;
|
||||||
else
|
else
|
||||||
parent->m_children = e->m_next;
|
parent->m_children = e->m_next;
|
||||||
os_mutexUnlock (&parent->m_mutex);
|
ddsrt_mutex_unlock (&parent->m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do some specific deletion when needed. */
|
/* Do some specific deletion when needed. */
|
||||||
|
@ -274,10 +277,10 @@ dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
if (ret == DDS_RETCODE_OK)
|
if (ret == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
dds_delete_qos (e->m_qos);
|
dds_delete_qos (e->m_qos);
|
||||||
os_condDestroy (&e->m_cond);
|
ddsrt_cond_destroy (&e->m_cond);
|
||||||
os_condDestroy (&e->m_observers_cond);
|
ddsrt_cond_destroy (&e->m_observers_cond);
|
||||||
os_mutexDestroy (&e->m_mutex);
|
ddsrt_mutex_destroy (&e->m_mutex);
|
||||||
os_mutexDestroy (&e->m_observers_lock);
|
ddsrt_mutex_destroy (&e->m_observers_lock);
|
||||||
dds_free (e);
|
dds_free (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +290,7 @@ dds_return_t dds_delete_impl (dds_entity_t entity, bool keep_if_explicit)
|
||||||
dds_entity_t dds_get_parent (dds_entity_t entity)
|
dds_entity_t dds_get_parent (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
else
|
else
|
||||||
|
@ -309,7 +312,7 @@ dds_entity_t dds_get_parent (dds_entity_t entity)
|
||||||
dds_entity_t dds_get_participant (dds_entity_t entity)
|
dds_entity_t dds_get_participant (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
else
|
else
|
||||||
|
@ -323,7 +326,7 @@ dds_entity_t dds_get_participant (dds_entity_t entity)
|
||||||
dds_return_t dds_get_children (dds_entity_t entity, dds_entity_t *children, size_t size)
|
dds_return_t dds_get_children (dds_entity_t entity, dds_entity_t *children, size_t size)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (children != NULL && (size <= 0 || size >= INT32_MAX))
|
if (children != NULL && (size <= 0 || size >= INT32_MAX))
|
||||||
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
||||||
|
@ -354,7 +357,7 @@ dds_return_t dds_get_children (dds_entity_t entity, dds_entity_t *children, size
|
||||||
dds_return_t dds_get_qos (dds_entity_t entity, dds_qos_t *qos)
|
dds_return_t dds_get_qos (dds_entity_t entity, dds_qos_t *qos)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (qos == NULL)
|
if (qos == NULL)
|
||||||
|
@ -377,7 +380,7 @@ dds_return_t dds_get_qos (dds_entity_t entity, dds_qos_t *qos)
|
||||||
dds_return_t dds_set_qos (dds_entity_t entity, const dds_qos_t *qos)
|
dds_return_t dds_set_qos (dds_entity_t entity, const dds_qos_t *qos)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (qos == NULL)
|
if (qos == NULL)
|
||||||
|
@ -406,14 +409,14 @@ dds_return_t dds_get_listener (dds_entity_t entity, dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (listener != NULL) {
|
if (listener != NULL) {
|
||||||
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
|
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
dds_copy_listener (listener, &e->m_listener);
|
dds_copy_listener (listener, &e->m_listener);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
dds_entity_unlock(e);
|
dds_entity_unlock(e);
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR("Error occurred on locking entity\n");
|
DDS_ERROR("Error occurred on locking entity\n");
|
||||||
|
@ -538,7 +541,7 @@ static void pushdown_listener (dds_entity_t entity)
|
||||||
while ((ncs = dds_get_children (entity, cs, (size_t) size)) > size)
|
while ((ncs = dds_get_children (entity, cs, (size_t) size)) > size)
|
||||||
{
|
{
|
||||||
size = ncs;
|
size = ncs;
|
||||||
cs = os_realloc (cs, (size_t) size * sizeof (*cs));
|
cs = ddsrt_realloc (cs, (size_t) size * sizeof (*cs));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ncs; i++)
|
for (int i = 0; i < ncs; i++)
|
||||||
{
|
{
|
||||||
|
@ -546,30 +549,30 @@ static void pushdown_listener (dds_entity_t entity)
|
||||||
if (dds_entity_lock (cs[i], DDS_KIND_DONTCARE, &e) == DDS_RETCODE_OK)
|
if (dds_entity_lock (cs[i], DDS_KIND_DONTCARE, &e) == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
dds_listener_t tmp;
|
dds_listener_t tmp;
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
while (e->m_cb_count > 0)
|
while (e->m_cb_count > 0)
|
||||||
os_condWait (&e->m_observers_cond, &e->m_observers_lock);
|
ddsrt_cond_wait (&e->m_observers_cond, &e->m_observers_lock);
|
||||||
dds_get_listener (entity, &tmp);
|
dds_get_listener (entity, &tmp);
|
||||||
dds_override_inherited_listener (&e->m_listener, &tmp);
|
dds_override_inherited_listener (&e->m_listener, &tmp);
|
||||||
clear_status_with_listener (e);
|
clear_status_with_listener (e);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
dds_entity_unlock (e);
|
dds_entity_unlock (e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_free (cs);
|
ddsrt_free (cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
dds_return_t dds_set_listener (dds_entity_t entity, const dds_listener_t *listener)
|
dds_return_t dds_set_listener (dds_entity_t entity, const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_entity *e, *x;
|
dds_entity *e, *x;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
|
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
while (e->m_cb_count > 0)
|
while (e->m_cb_count > 0)
|
||||||
os_condWait (&e->m_observers_cond, &e->m_observers_lock);
|
ddsrt_cond_wait (&e->m_observers_cond, &e->m_observers_lock);
|
||||||
|
|
||||||
/* new listener is constructed by combining "listener" with the ancestral listeners;
|
/* new listener is constructed by combining "listener" with the ancestral listeners;
|
||||||
the new set of listeners is then pushed down into the descendant entities, overriding
|
the new set of listeners is then pushed down into the descendant entities, overriding
|
||||||
|
@ -584,7 +587,7 @@ dds_return_t dds_set_listener (dds_entity_t entity, const dds_listener_t *listen
|
||||||
dds_inherit_listener (&e->m_listener, &x->m_listener);
|
dds_inherit_listener (&e->m_listener, &x->m_listener);
|
||||||
}
|
}
|
||||||
clear_status_with_listener (e);
|
clear_status_with_listener (e);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
dds_entity_unlock (e);
|
dds_entity_unlock (e);
|
||||||
pushdown_listener (entity);
|
pushdown_listener (entity);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
|
@ -593,7 +596,7 @@ dds_return_t dds_set_listener (dds_entity_t entity, const dds_listener_t *listen
|
||||||
dds_return_t dds_enable (dds_entity_t entity)
|
dds_return_t dds_enable (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
|
@ -611,7 +614,7 @@ dds_return_t dds_enable (dds_entity_t entity)
|
||||||
dds_return_t dds_get_status_changes (dds_entity_t entity, uint32_t *status)
|
dds_return_t dds_get_status_changes (dds_entity_t entity, uint32_t *status)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (status == NULL)
|
if (status == NULL)
|
||||||
|
@ -624,9 +627,9 @@ dds_return_t dds_get_status_changes (dds_entity_t entity, uint32_t *status)
|
||||||
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
*status = e->m_trigger;
|
*status = e->m_trigger;
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
ret = DDS_RETCODE_OK;
|
ret = DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
dds_entity_unlock(e);
|
dds_entity_unlock(e);
|
||||||
|
@ -636,7 +639,7 @@ dds_return_t dds_get_status_changes (dds_entity_t entity, uint32_t *status)
|
||||||
dds_return_t dds_get_status_mask (dds_entity_t entity, uint32_t *mask)
|
dds_return_t dds_get_status_mask (dds_entity_t entity, uint32_t *mask)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (mask == NULL)
|
if (mask == NULL)
|
||||||
|
@ -649,9 +652,9 @@ dds_return_t dds_get_status_mask (dds_entity_t entity, uint32_t *mask)
|
||||||
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
*mask = (e->m_status_enable & ~DDS_INTERNAL_STATUS_MASK);
|
*mask = (e->m_status_enable & ~DDS_INTERNAL_STATUS_MASK);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
ret = DDS_RETCODE_OK;
|
ret = DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
dds_entity_unlock(e);
|
dds_entity_unlock(e);
|
||||||
|
@ -666,7 +669,7 @@ dds_return_t dds_get_enabled_status (dds_entity_t entity, uint32_t *status)
|
||||||
dds_return_t dds_set_status_mask (dds_entity_t entity, uint32_t mask)
|
dds_return_t dds_set_status_mask (dds_entity_t entity, uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
|
@ -676,12 +679,12 @@ dds_return_t dds_set_status_mask (dds_entity_t entity, uint32_t mask)
|
||||||
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
else if ((ret = e->m_deriver.validate_status (mask)) == DDS_RETCODE_OK)
|
else if ((ret = e->m_deriver.validate_status (mask)) == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
/* Don't block internal status triggers. */
|
/* Don't block internal status triggers. */
|
||||||
mask |= DDS_INTERNAL_STATUS_MASK;
|
mask |= DDS_INTERNAL_STATUS_MASK;
|
||||||
e->m_status_enable = mask;
|
e->m_status_enable = mask;
|
||||||
e->m_trigger &= mask;
|
e->m_trigger &= mask;
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
}
|
}
|
||||||
dds_entity_unlock(e);
|
dds_entity_unlock(e);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -695,7 +698,7 @@ dds_return_t dds_set_enabled_status(dds_entity_t entity, uint32_t mask)
|
||||||
static dds_return_t dds_readtake_status (dds_entity_t entity, uint32_t *status, uint32_t mask, bool reset)
|
static dds_return_t dds_readtake_status (dds_entity_t entity, uint32_t *status, uint32_t mask, bool reset)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (status == NULL)
|
if (status == NULL)
|
||||||
|
@ -708,11 +711,11 @@ static dds_return_t dds_readtake_status (dds_entity_t entity, uint32_t *status,
|
||||||
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
else if ((ret = e->m_deriver.validate_status (mask)) == DDS_RETCODE_OK)
|
else if ((ret = e->m_deriver.validate_status (mask)) == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
*status = e->m_trigger & mask;
|
*status = e->m_trigger & mask;
|
||||||
if (reset)
|
if (reset)
|
||||||
e->m_trigger &= ~mask;
|
e->m_trigger &= ~mask;
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
}
|
}
|
||||||
dds_entity_unlock (e);
|
dds_entity_unlock (e);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -732,7 +735,7 @@ dds_return_t dds_take_status (dds_entity_t entity, uint32_t *status, uint32_t ma
|
||||||
dds_return_t dds_get_domainid (dds_entity_t entity, dds_domainid_t *id)
|
dds_return_t dds_get_domainid (dds_entity_t entity, dds_domainid_t *id)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (id == NULL)
|
if (id == NULL)
|
||||||
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
||||||
|
@ -748,7 +751,7 @@ dds_return_t dds_get_domainid (dds_entity_t entity, dds_domainid_t *id)
|
||||||
dds_return_t dds_get_instance_handle (dds_entity_t entity, dds_instance_handle_t *ihdl)
|
dds_return_t dds_get_instance_handle (dds_entity_t entity, dds_instance_handle_t *ihdl)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if (ihdl == NULL)
|
if (ihdl == NULL)
|
||||||
|
@ -766,7 +769,7 @@ dds_return_t dds_get_instance_handle (dds_entity_t entity, dds_instance_handle_t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dds__retcode_t dds_valid_hdl (dds_entity_t hdl, dds_entity_kind_t kind)
|
dds_retcode_t dds_valid_hdl (dds_entity_t hdl, dds_entity_kind_t kind)
|
||||||
{
|
{
|
||||||
ut_handle_t utr;
|
ut_handle_t utr;
|
||||||
if ((utr = ut_handle_status (hdl, NULL, (int32_t) kind)) == UT_HANDLE_OK)
|
if ((utr = ut_handle_status (hdl, NULL, (int32_t) kind)) == UT_HANDLE_OK)
|
||||||
|
@ -793,7 +796,7 @@ dds__retcode_t dds_valid_hdl (dds_entity_t hdl, dds_entity_kind_t kind)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dds__retcode_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_entity **eptr)
|
dds_retcode_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_entity **eptr)
|
||||||
{
|
{
|
||||||
ut_handle_t utr;
|
ut_handle_t utr;
|
||||||
void *raw;
|
void *raw;
|
||||||
|
@ -804,7 +807,7 @@ dds__retcode_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_en
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
*eptr = e = raw;
|
*eptr = e = raw;
|
||||||
os_mutexLock (&e->m_mutex);
|
ddsrt_mutex_lock (&e->m_mutex);
|
||||||
/* FIXME: The handle could have been closed while we were waiting for the mutex -- that should be handled differently!
|
/* FIXME: The handle could have been closed while we were waiting for the mutex -- that should be handled differently!
|
||||||
|
|
||||||
For now, however, it is really important at two points in the logic:
|
For now, however, it is really important at two points in the logic:
|
||||||
|
@ -845,7 +848,7 @@ dds__retcode_t dds_entity_lock (dds_entity_t hdl, dds_entity_kind_t kind, dds_en
|
||||||
|
|
||||||
void dds_entity_unlock (dds_entity *e)
|
void dds_entity_unlock (dds_entity *e)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&e->m_mutex);
|
ddsrt_mutex_unlock (&e->m_mutex);
|
||||||
ut_handle_release (e->m_hdl, e->m_hdllink);
|
ut_handle_release (e->m_hdl, e->m_hdllink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,13 +856,13 @@ dds_return_t dds_triggered (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
ret = (e->m_trigger != 0);
|
ret = (e->m_trigger != 0);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
dds_entity_unlock (e);
|
dds_entity_unlock (e);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -873,29 +876,29 @@ static bool in_observer_list_p (const struct dds_entity *observed, const dds_ent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dds__retcode_t dds_entity_observer_register_nl (dds_entity *observed, dds_entity_t observer, dds_entity_callback cb)
|
dds_retcode_t dds_entity_observer_register_nl (dds_entity *observed, dds_entity_t observer, dds_entity_callback cb)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
assert (observed);
|
assert (observed);
|
||||||
os_mutexLock (&observed->m_observers_lock);
|
ddsrt_mutex_lock (&observed->m_observers_lock);
|
||||||
if (in_observer_list_p (observed, observer))
|
if (in_observer_list_p (observed, observer))
|
||||||
rc = DDS_RETCODE_PRECONDITION_NOT_MET;
|
rc = DDS_RETCODE_PRECONDITION_NOT_MET;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dds_entity_observer *o = os_malloc (sizeof (dds_entity_observer));
|
dds_entity_observer *o = ddsrt_malloc (sizeof (dds_entity_observer));
|
||||||
o->m_cb = cb;
|
o->m_cb = cb;
|
||||||
o->m_observer = observer;
|
o->m_observer = observer;
|
||||||
o->m_next = observed->m_observers;
|
o->m_next = observed->m_observers;
|
||||||
observed->m_observers = o;
|
observed->m_observers = o;
|
||||||
rc = DDS_RETCODE_OK;
|
rc = DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&observed->m_observers_lock);
|
ddsrt_mutex_unlock (&observed->m_observers_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
dds__retcode_t dds_entity_observer_register (dds_entity_t observed, dds_entity_t observer, dds_entity_callback cb)
|
dds_retcode_t dds_entity_observer_register (dds_entity_t observed, dds_entity_t observer, dds_entity_callback cb)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
assert (cb);
|
assert (cb);
|
||||||
if ((rc = dds_entity_lock (observed, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (observed, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
|
@ -905,12 +908,12 @@ dds__retcode_t dds_entity_observer_register (dds_entity_t observed, dds_entity_t
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
dds__retcode_t dds_entity_observer_unregister_nl (dds_entity *observed, dds_entity_t observer)
|
dds_retcode_t dds_entity_observer_unregister_nl (dds_entity *observed, dds_entity_t observer)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity_observer *prev, *idx;
|
dds_entity_observer *prev, *idx;
|
||||||
|
|
||||||
os_mutexLock (&observed->m_observers_lock);
|
ddsrt_mutex_lock (&observed->m_observers_lock);
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
idx = observed->m_observers;
|
idx = observed->m_observers;
|
||||||
while (idx != NULL && idx->m_observer != observer)
|
while (idx != NULL && idx->m_observer != observer)
|
||||||
|
@ -926,16 +929,16 @@ dds__retcode_t dds_entity_observer_unregister_nl (dds_entity *observed, dds_enti
|
||||||
observed->m_observers = idx->m_next;
|
observed->m_observers = idx->m_next;
|
||||||
else
|
else
|
||||||
prev->m_next = idx->m_next;
|
prev->m_next = idx->m_next;
|
||||||
os_free (idx);
|
ddsrt_free (idx);
|
||||||
rc = DDS_RETCODE_OK;
|
rc = DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&observed->m_observers_lock);
|
ddsrt_mutex_unlock (&observed->m_observers_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
dds__retcode_t dds_entity_observer_unregister (dds_entity_t observed, dds_entity_t observer)
|
dds_retcode_t dds_entity_observer_unregister (dds_entity_t observed, dds_entity_t observer)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
if ((rc = dds_entity_lock (observed, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (observed, DDS_KIND_DONTCARE, &e)) != DDS_RETCODE_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -947,16 +950,16 @@ dds__retcode_t dds_entity_observer_unregister (dds_entity_t observed, dds_entity
|
||||||
static void dds_entity_observers_delete (dds_entity *observed)
|
static void dds_entity_observers_delete (dds_entity *observed)
|
||||||
{
|
{
|
||||||
dds_entity_observer *idx;
|
dds_entity_observer *idx;
|
||||||
os_mutexLock (&observed->m_observers_lock);
|
ddsrt_mutex_lock (&observed->m_observers_lock);
|
||||||
idx = observed->m_observers;
|
idx = observed->m_observers;
|
||||||
while (idx != NULL)
|
while (idx != NULL)
|
||||||
{
|
{
|
||||||
dds_entity_observer *next = idx->m_next;
|
dds_entity_observer *next = idx->m_next;
|
||||||
os_free (idx);
|
ddsrt_free (idx);
|
||||||
idx = next;
|
idx = next;
|
||||||
}
|
}
|
||||||
observed->m_observers = NULL;
|
observed->m_observers = NULL;
|
||||||
os_mutexUnlock (&observed->m_observers_lock);
|
ddsrt_mutex_unlock (&observed->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dds_entity_observers_signal (dds_entity *observed, uint32_t status)
|
static void dds_entity_observers_signal (dds_entity *observed, uint32_t status)
|
||||||
|
@ -967,9 +970,9 @@ static void dds_entity_observers_signal (dds_entity *observed, uint32_t status)
|
||||||
|
|
||||||
void dds_entity_status_signal (dds_entity *e)
|
void dds_entity_status_signal (dds_entity *e)
|
||||||
{
|
{
|
||||||
os_mutexLock (&e->m_observers_lock);
|
ddsrt_mutex_lock (&e->m_observers_lock);
|
||||||
dds_entity_observers_signal (e, e->m_trigger);
|
dds_entity_observers_signal (e, e->m_trigger);
|
||||||
os_mutexUnlock (&e->m_observers_lock);
|
ddsrt_mutex_unlock (&e->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_entity_status_set (dds_entity *e, uint32_t t)
|
void dds_entity_status_set (dds_entity *e, uint32_t t)
|
||||||
|
@ -983,7 +986,7 @@ void dds_entity_status_set (dds_entity *e, uint32_t t)
|
||||||
|
|
||||||
dds_entity_t dds_get_topic (dds_entity_t entity)
|
dds_entity_t dds_get_topic (dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds_entity *e;
|
dds_entity *e;
|
||||||
|
|
||||||
|
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "os/os.h"
|
|
||||||
#include "dds__types.h"
|
|
||||||
#include "dds__err.h"
|
|
||||||
|
|
||||||
#define DDS_ERR_CODE_NUM 12
|
|
||||||
#define DDS_ERR_MSG_MAX 128
|
|
||||||
|
|
||||||
#define DDS_ERR_NR_INDEX(e) (((-e) & DDS_ERR_NR_MASK) -1)
|
|
||||||
|
|
||||||
static const char * dds_err_code_array[DDS_ERR_CODE_NUM] =
|
|
||||||
{
|
|
||||||
"Error",
|
|
||||||
"Unsupported",
|
|
||||||
"Bad Parameter",
|
|
||||||
"Precondition Not Met",
|
|
||||||
"Out Of Resources",
|
|
||||||
"Not Enabled",
|
|
||||||
"Immutable Policy",
|
|
||||||
"Inconsistent Policy",
|
|
||||||
"Already Deleted",
|
|
||||||
"Timeout",
|
|
||||||
"No Data",
|
|
||||||
"Illegal Operation"
|
|
||||||
};
|
|
||||||
|
|
||||||
const char * dds_err_str (dds_return_t err)
|
|
||||||
{
|
|
||||||
unsigned index = (unsigned)DDS_ERR_NR_INDEX (err);
|
|
||||||
if (err >= 0)
|
|
||||||
{
|
|
||||||
return "Success";
|
|
||||||
}
|
|
||||||
if (index >= DDS_ERR_CODE_NUM)
|
|
||||||
{
|
|
||||||
return "Unknown";
|
|
||||||
}
|
|
||||||
return dds_err_code_array[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool dds_err_check (dds_return_t err, unsigned flags, const char * where)
|
|
||||||
{
|
|
||||||
if (err < 0)
|
|
||||||
{
|
|
||||||
if (flags & (DDS_CHECK_REPORT | DDS_CHECK_FAIL))
|
|
||||||
{
|
|
||||||
char msg[DDS_ERR_MSG_MAX];
|
|
||||||
(void) snprintf (msg, DDS_ERR_MSG_MAX, "Error %d:M%d:%s", dds_err_file_id(err), dds_err_line(err), dds_err_str(err));
|
|
||||||
if (flags & DDS_CHECK_REPORT)
|
|
||||||
{
|
|
||||||
printf ("%s: %s\n", where, msg);
|
|
||||||
}
|
|
||||||
if (flags & DDS_CHECK_FAIL)
|
|
||||||
{
|
|
||||||
dds_fail (msg, where);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flags & DDS_CHECK_EXIT)
|
|
||||||
{
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (err >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void dds_fail_default (const char * msg, const char * where)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Aborting Failure: %s %s\n", where, msg);
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static dds_fail_fn dds_fail_func = dds_fail_default;
|
|
||||||
|
|
||||||
void dds_fail_set (dds_fail_fn fn)
|
|
||||||
{
|
|
||||||
dds_fail_func = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
dds_fail_fn dds_fail_get (void)
|
|
||||||
{
|
|
||||||
return dds_fail_func;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dds_fail (const char * msg, const char * where)
|
|
||||||
{
|
|
||||||
if (dds_fail_func)
|
|
||||||
{
|
|
||||||
(dds_fail_func) (msg, where);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,16 +15,16 @@
|
||||||
#include "dds__guardcond.h"
|
#include "dds__guardcond.h"
|
||||||
#include "dds__participant.h"
|
#include "dds__participant.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_ephash.h"
|
#include "dds/ddsi/q_ephash.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
|
||||||
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_guardcond)
|
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_guardcond)
|
||||||
|
|
||||||
dds_entity_t dds_create_guardcondition (dds_entity_t participant)
|
dds_entity_t dds_create_guardcondition (dds_entity_t participant)
|
||||||
{
|
{
|
||||||
dds_participant *pp;
|
dds_participant *pp;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_participant_lock (participant, &pp)) != DDS_RETCODE_OK)
|
if ((rc = dds_participant_lock (participant, &pp)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
|
@ -40,18 +40,18 @@ dds_entity_t dds_create_guardcondition (dds_entity_t participant)
|
||||||
dds_return_t dds_set_guardcondition (dds_entity_t condition, bool triggered)
|
dds_return_t dds_set_guardcondition (dds_entity_t condition, bool triggered)
|
||||||
{
|
{
|
||||||
dds_guardcond *gcond;
|
dds_guardcond *gcond;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_guardcond_lock (condition, &gcond)) != DDS_RETCODE_OK)
|
if ((rc = dds_guardcond_lock (condition, &gcond)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_mutexLock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&gcond->m_entity.m_observers_lock);
|
||||||
if (triggered)
|
if (triggered)
|
||||||
dds_entity_status_set (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
dds_entity_status_set (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
else
|
else
|
||||||
dds_entity_status_reset (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
dds_entity_status_reset (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
os_mutexUnlock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&gcond->m_entity.m_observers_lock);
|
||||||
dds_guardcond_unlock (gcond);
|
dds_guardcond_unlock (gcond);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ dds_return_t dds_set_guardcondition (dds_entity_t condition, bool triggered)
|
||||||
dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered)
|
dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered)
|
||||||
{
|
{
|
||||||
dds_guardcond *gcond;
|
dds_guardcond *gcond;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (triggered == NULL)
|
if (triggered == NULL)
|
||||||
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
||||||
|
@ -70,9 +70,9 @@ dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered)
|
||||||
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_mutexLock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&gcond->m_entity.m_observers_lock);
|
||||||
*triggered = dds_entity_status_match (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
*triggered = dds_entity_status_match (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
os_mutexUnlock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&gcond->m_entity.m_observers_lock);
|
||||||
dds_guardcond_unlock (gcond);
|
dds_guardcond_unlock (gcond);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ dds_return_t dds_read_guardcondition (dds_entity_t condition, bool *triggered)
|
||||||
dds_return_t dds_take_guardcondition (dds_entity_t condition, bool *triggered)
|
dds_return_t dds_take_guardcondition (dds_entity_t condition, bool *triggered)
|
||||||
{
|
{
|
||||||
dds_guardcond *gcond;
|
dds_guardcond *gcond;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (triggered == NULL)
|
if (triggered == NULL)
|
||||||
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
||||||
|
@ -91,10 +91,10 @@ dds_return_t dds_take_guardcondition (dds_entity_t condition, bool *triggered)
|
||||||
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
return DDS_ERRNO (dds_valid_hdl (condition, DDS_KIND_COND_GUARD));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_mutexLock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&gcond->m_entity.m_observers_lock);
|
||||||
*triggered = dds_entity_status_match (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
*triggered = dds_entity_status_match (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
dds_entity_status_reset (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
dds_entity_status_reset (&gcond->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
os_mutexUnlock (&gcond->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&gcond->m_entity.m_observers_lock);
|
||||||
dds_guardcond_unlock (gcond);
|
dds_guardcond_unlock (gcond);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,24 +12,23 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/ddsrt/cdtors.h"
|
||||||
|
#include "dds/ddsrt/environ.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "dds__builtin.h"
|
#include "dds__builtin.h"
|
||||||
#include "dds__whc_builtintopic.h"
|
#include "dds__whc_builtintopic.h"
|
||||||
#include "ddsi/ddsi_iid.h"
|
#include "dds/ddsi/ddsi_iid.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_servicelease.h"
|
#include "dds/ddsi/q_servicelease.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
#include "dds/version.h"
|
||||||
|
|
||||||
#ifdef _WRS_KERNEL
|
|
||||||
char *os_environ[] = { NULL };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DOMAIN_ID_MIN 0
|
#define DOMAIN_ID_MIN 0
|
||||||
#define DOMAIN_ID_MAX 230
|
#define DOMAIN_ID_MAX 230
|
||||||
|
@ -43,17 +42,17 @@ dds_return_t
|
||||||
dds_init(dds_domainid_t domain)
|
dds_init(dds_domainid_t domain)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
const char * uri;
|
char * uri = NULL;
|
||||||
char progname[50] = "UNKNOWN"; /* FIXME: once retrieving process names is back in */
|
char progname[50] = "UNKNOWN"; /* FIXME: once retrieving process names is back in */
|
||||||
char hostname[64];
|
char hostname[64];
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
os_mutex *init_mutex;
|
ddsrt_mutex_t *init_mutex;
|
||||||
|
|
||||||
/* Be sure the DDS lifecycle resources are initialized. */
|
/* Be sure the DDS lifecycle resources are initialized. */
|
||||||
os_osInit();
|
ddsrt_init();
|
||||||
init_mutex = os_getSingletonMutex();
|
init_mutex = ddsrt_get_singleton_mutex();
|
||||||
|
|
||||||
os_mutexLock(init_mutex);
|
ddsrt_mutex_lock(init_mutex);
|
||||||
|
|
||||||
dds_global.m_init_count++;
|
dds_global.m_init_count++;
|
||||||
if (dds_global.m_init_count > 1)
|
if (dds_global.m_init_count > 1)
|
||||||
|
@ -70,10 +69,10 @@ dds_init(dds_domainid_t domain)
|
||||||
|
|
||||||
gv.tstart = now ();
|
gv.tstart = now ();
|
||||||
gv.exception = false;
|
gv.exception = false;
|
||||||
os_mutexInit (&dds_global.m_mutex);
|
ddsrt_mutex_init (&dds_global.m_mutex);
|
||||||
thread_states_init_static();
|
thread_states_init_static();
|
||||||
|
|
||||||
uri = os_getenv (DDSC_PROJECT_NAME_NOSPACE_CAPS"_URI");
|
(void)ddsrt_getenv (DDS_PROJECT_NAME_NOSPACE_CAPS"_URI", &uri);
|
||||||
dds_cfgst = config_init (uri);
|
dds_cfgst = config_init (uri);
|
||||||
if (dds_cfgst == NULL)
|
if (dds_cfgst == NULL)
|
||||||
{
|
{
|
||||||
|
@ -150,13 +149,13 @@ dds_init(dds_domainid_t domain)
|
||||||
|
|
||||||
/* Set additional default participant properties */
|
/* Set additional default participant properties */
|
||||||
|
|
||||||
gv.default_plist_pp.process_id = (unsigned)os_getpid();
|
gv.default_plist_pp.process_id = (unsigned)ddsrt_getpid();
|
||||||
gv.default_plist_pp.present |= PP_PRISMTECH_PROCESS_ID;
|
gv.default_plist_pp.present |= PP_PRISMTECH_PROCESS_ID;
|
||||||
gv.default_plist_pp.exec_name = dds_string_alloc(32);
|
gv.default_plist_pp.exec_name = dds_string_alloc(32);
|
||||||
(void) snprintf(gv.default_plist_pp.exec_name, 32, "%s: %u", DDSC_PROJECT_NAME, gv.default_plist_pp.process_id);
|
(void) snprintf(gv.default_plist_pp.exec_name, 32, "%s: %u", DDS_PROJECT_NAME, gv.default_plist_pp.process_id);
|
||||||
len = (uint32_t) (13 + strlen(gv.default_plist_pp.exec_name));
|
len = (uint32_t) (13 + strlen(gv.default_plist_pp.exec_name));
|
||||||
gv.default_plist_pp.present |= PP_PRISMTECH_EXEC_NAME;
|
gv.default_plist_pp.present |= PP_PRISMTECH_EXEC_NAME;
|
||||||
if (os_gethostname(hostname, sizeof(hostname)) == os_resultSuccess)
|
if (ddsrt_gethostname(hostname, sizeof(hostname)) == DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
gv.default_plist_pp.node_name = dds_string_dup(hostname);
|
gv.default_plist_pp.node_name = dds_string_dup(hostname);
|
||||||
gv.default_plist_pp.present |= PP_PRISMTECH_NODE_NAME;
|
gv.default_plist_pp.present |= PP_PRISMTECH_NODE_NAME;
|
||||||
|
@ -167,7 +166,7 @@ dds_init(dds_domainid_t domain)
|
||||||
gv.default_plist_pp.present |= PP_ENTITY_NAME;
|
gv.default_plist_pp.present |= PP_ENTITY_NAME;
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
os_mutexUnlock(init_mutex);
|
ddsrt_mutex_unlock(init_mutex);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
|
|
||||||
fail_servicelease_start:
|
fail_servicelease_start:
|
||||||
|
@ -189,20 +188,20 @@ fail_config_domainid:
|
||||||
config_fini (dds_cfgst);
|
config_fini (dds_cfgst);
|
||||||
dds_cfgst = NULL;
|
dds_cfgst = NULL;
|
||||||
fail_config:
|
fail_config:
|
||||||
os_mutexDestroy (&dds_global.m_mutex);
|
ddsrt_mutex_destroy (&dds_global.m_mutex);
|
||||||
ut_handleserver_fini();
|
ut_handleserver_fini();
|
||||||
fail_handleserver:
|
fail_handleserver:
|
||||||
dds_global.m_init_count--;
|
dds_global.m_init_count--;
|
||||||
os_mutexUnlock(init_mutex);
|
ddsrt_mutex_unlock(init_mutex);
|
||||||
os_osExit();
|
ddsrt_fini();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void dds_fini (void)
|
extern void dds_fini (void)
|
||||||
{
|
{
|
||||||
os_mutex *init_mutex;
|
ddsrt_mutex_t *init_mutex;
|
||||||
init_mutex = os_getSingletonMutex();
|
init_mutex = ddsrt_get_singleton_mutex();
|
||||||
os_mutexLock(init_mutex);
|
ddsrt_mutex_lock(init_mutex);
|
||||||
assert(dds_global.m_init_count > 0);
|
assert(dds_global.m_init_count > 0);
|
||||||
dds_global.m_init_count--;
|
dds_global.m_init_count--;
|
||||||
if (dds_global.m_init_count == 0)
|
if (dds_global.m_init_count == 0)
|
||||||
|
@ -220,18 +219,14 @@ extern void dds_fini (void)
|
||||||
|
|
||||||
config_fini (dds_cfgst);
|
config_fini (dds_cfgst);
|
||||||
dds_cfgst = NULL;
|
dds_cfgst = NULL;
|
||||||
os_mutexDestroy (&dds_global.m_mutex);
|
ddsrt_mutex_destroy (&dds_global.m_mutex);
|
||||||
ut_handleserver_fini();
|
ut_handleserver_fini();
|
||||||
dds_global.m_default_domain = DDS_DOMAIN_DEFAULT;
|
dds_global.m_default_domain = DDS_DOMAIN_DEFAULT;
|
||||||
}
|
}
|
||||||
os_mutexUnlock(init_mutex);
|
ddsrt_mutex_unlock(init_mutex);
|
||||||
os_osExit();
|
ddsrt_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int dds__init_plugin (void)
|
static int dds__init_plugin (void)
|
||||||
{
|
{
|
||||||
if (dds_global.m_dur_init) (dds_global.m_dur_init) ();
|
if (dds_global.m_dur_init) (dds_global.m_dur_init) ();
|
||||||
|
@ -260,18 +255,15 @@ void ddsi_plugin_init (void)
|
||||||
ddsi_plugin.rhc_plugin.rhc_set_qos_fn = dds_rhc_set_qos;
|
ddsi_plugin.rhc_plugin.rhc_set_qos_fn = dds_rhc_set_qos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//provides explicit default domain id.
|
//provides explicit default domain id.
|
||||||
dds_domainid_t dds_domain_default (void)
|
dds_domainid_t dds_domain_default (void)
|
||||||
{
|
{
|
||||||
return dds_global.m_default_domain;
|
return dds_global.m_default_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds__check_domain(
|
dds__check_domain(
|
||||||
_In_ dds_domainid_t domain)
|
dds_domainid_t domain)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
/* If domain is default: use configured id. */
|
/* If domain is default: use configured id. */
|
||||||
|
|
|
@ -11,50 +11,48 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ddsc/dds.h"
|
|
||||||
|
#include "dds/dds.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__write.h"
|
#include "dds__write.h"
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_writedispose(
|
dds_writedispose(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
return dds_writedispose_ts(writer, data, dds_time());
|
return dds_writedispose_ts(writer, data, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_dispose(
|
dds_dispose(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
return dds_dispose_ts(writer, data, dds_time());
|
return dds_dispose_ts(writer, data, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_dispose_ih(
|
dds_dispose_ih(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
return dds_dispose_ih_ts(writer, handle, dds_time());
|
return dds_dispose_ih_ts(writer, handle, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ddsi_tkmap_instance*
|
static struct ddsi_tkmap_instance*
|
||||||
dds_instance_find(
|
dds_instance_find(
|
||||||
_In_ const dds_topic *topic,
|
const dds_topic *topic,
|
||||||
_In_ const void *data,
|
const void *data,
|
||||||
_In_ const bool create)
|
const bool create)
|
||||||
{
|
{
|
||||||
struct ddsi_serdata *sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
struct ddsi_serdata *sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
||||||
struct ddsi_tkmap_instance * inst = ddsi_tkmap_find (sd, false, create);
|
struct ddsi_tkmap_instance * inst = ddsi_tkmap_find (sd, false, create);
|
||||||
|
@ -64,73 +62,77 @@ dds_instance_find(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_instance_remove(
|
dds_instance_remove(
|
||||||
_In_ const dds_topic *topic,
|
const dds_topic *topic,
|
||||||
_In_opt_ const void *data,
|
const void *data,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
struct ddsi_tkmap_instance * inst;
|
struct ddsi_tkmap_instance * inst;
|
||||||
|
|
||||||
if (handle != DDS_HANDLE_NIL) {
|
if (handle != DDS_HANDLE_NIL)
|
||||||
|
{
|
||||||
inst = ddsi_tkmap_find_by_id (gv.m_tkmap, handle);
|
inst = ddsi_tkmap_find_by_id (gv.m_tkmap, handle);
|
||||||
} else {
|
|
||||||
assert (data);
|
|
||||||
inst = dds_instance_find (topic, data, false);
|
|
||||||
}
|
}
|
||||||
if (inst) {
|
else
|
||||||
|
{
|
||||||
|
assert (data);
|
||||||
|
inst = dds_instance_find (topic, data, false);
|
||||||
|
}
|
||||||
|
if (inst)
|
||||||
|
{
|
||||||
ddsi_tkmap_instance_unref (inst);
|
ddsi_tkmap_instance_unref (inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const dds_topic *dds_instance_info (dds_entity *e)
|
static const dds_topic *dds_instance_info (dds_entity *e)
|
||||||
{
|
{
|
||||||
const dds_topic *topic;
|
const dds_topic *topic;
|
||||||
switch (dds_entity_kind (e))
|
switch (dds_entity_kind (e))
|
||||||
{
|
{
|
||||||
case DDS_KIND_READER:
|
case DDS_KIND_READER:
|
||||||
topic = ((dds_reader*) e)->m_topic;
|
topic = ((dds_reader*) e)->m_topic;
|
||||||
break;
|
break;
|
||||||
case DDS_KIND_WRITER:
|
case DDS_KIND_WRITER:
|
||||||
topic = ((dds_writer*) e)->m_topic;
|
topic = ((dds_writer*) e)->m_topic;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert (0);
|
assert (0);
|
||||||
topic = NULL;
|
topic = NULL;
|
||||||
}
|
}
|
||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const dds_topic * dds_instance_info_by_hdl (dds_entity_t e)
|
static const dds_topic * dds_instance_info_by_hdl (dds_entity_t e)
|
||||||
{
|
{
|
||||||
const dds_topic * topic = NULL;
|
const dds_topic * topic = NULL;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity *w_or_r;
|
dds_entity *w_or_r;
|
||||||
|
|
||||||
rc = dds_entity_lock(e, DDS_KIND_WRITER, &w_or_r);
|
rc = dds_entity_lock(e, DDS_KIND_WRITER, &w_or_r);
|
||||||
if (rc == DDS_RETCODE_ILLEGAL_OPERATION) {
|
if (rc == DDS_RETCODE_ILLEGAL_OPERATION)
|
||||||
|
{
|
||||||
rc = dds_entity_lock(e, DDS_KIND_READER, &w_or_r);
|
rc = dds_entity_lock(e, DDS_KIND_READER, &w_or_r);
|
||||||
}
|
}
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc != DDS_RETCODE_OK)
|
||||||
topic = dds_instance_info(w_or_r);
|
{
|
||||||
dds_entity_unlock(w_or_r);
|
return NULL;
|
||||||
} else {
|
|
||||||
DDS_ERROR("Error occurred on locking entity");
|
|
||||||
}
|
}
|
||||||
|
topic = dds_instance_info(w_or_r);
|
||||||
|
dds_entity_unlock(w_or_r);
|
||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_register_instance(
|
dds_register_instance(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_ dds_instance_handle_t *handle,
|
dds_instance_handle_t *handle,
|
||||||
_In_ const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
struct thread_state1 * const thr = lookup_thread_state();
|
struct thread_state1 * const thr = lookup_thread_state();
|
||||||
const bool asleep = !vtime_awake_p(thr->vtime);
|
const bool asleep = !vtime_awake_p(thr->vtime);
|
||||||
struct ddsi_tkmap_instance * inst;
|
struct ddsi_tkmap_instance * inst;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if(data == NULL){
|
if(data == NULL){
|
||||||
DDS_ERROR("Argument data is NULL\n");
|
DDS_ERROR("Argument data is NULL\n");
|
||||||
|
@ -167,35 +169,32 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_unregister_instance(
|
dds_unregister_instance(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_opt_ const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
return dds_unregister_instance_ts (writer, data, dds_time());
|
return dds_unregister_instance_ts (writer, data, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_unregister_instance_ih(
|
dds_unregister_instance_ih(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_opt_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
return dds_unregister_instance_ih_ts(writer, handle, dds_time());
|
return dds_unregister_instance_ih_ts(writer, handle, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_unregister_instance_ts(
|
dds_unregister_instance_ts(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_opt_ const void *data,
|
const void *data,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
struct thread_state1 * const thr = lookup_thread_state();
|
struct thread_state1 * const thr = lookup_thread_state();
|
||||||
const bool asleep = !vtime_awake_p(thr->vtime);
|
const bool asleep = !vtime_awake_p(thr->vtime);
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
bool autodispose = true;
|
bool autodispose = true;
|
||||||
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
@ -236,17 +235,16 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_unregister_instance_ih_ts(
|
dds_unregister_instance_ih_ts(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_opt_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
struct thread_state1 * const thr = lookup_thread_state();
|
struct thread_state1 * const thr = lookup_thread_state();
|
||||||
const bool asleep = !vtime_awake_p(thr->vtime);
|
const bool asleep = !vtime_awake_p(thr->vtime);
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
bool autodispose = true;
|
bool autodispose = true;
|
||||||
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
@ -290,15 +288,14 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_writedispose_ts(
|
dds_writedispose_ts(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ const void *data,
|
const void *data,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
rc = dds_writer_lock(writer, &wr);
|
rc = dds_writer_lock(writer, &wr);
|
||||||
|
@ -326,10 +323,10 @@ dds_writedispose_ts(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_dispose_impl(
|
dds_dispose_impl(
|
||||||
_In_ dds_writer *wr,
|
dds_writer *wr,
|
||||||
_In_ const void *data,
|
const void *data,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
assert(vtime_awake_p(lookup_thread_state()->vtime));
|
assert(vtime_awake_p(lookup_thread_state()->vtime));
|
||||||
|
@ -341,15 +338,14 @@ dds_dispose_impl(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_dispose_ts(
|
dds_dispose_ts(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ const void *data,
|
const void *data,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
rc = dds_writer_lock(writer, &wr);
|
rc = dds_writer_lock(writer, &wr);
|
||||||
|
@ -372,15 +368,14 @@ dds_dispose_ts(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_dispose_ih_ts(
|
dds_dispose_ih_ts(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ dds_time_t timestamp)
|
dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
rc = dds_writer_lock(writer, &wr);
|
rc = dds_writer_lock(writer, &wr);
|
||||||
|
@ -414,11 +409,10 @@ dds_dispose_ih_ts(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(entity & DDS_ENTITY_KIND_MASK)
|
|
||||||
dds_instance_handle_t
|
dds_instance_handle_t
|
||||||
dds_lookup_instance(
|
dds_lookup_instance(
|
||||||
dds_entity_t entity,
|
dds_entity_t entity,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
dds_instance_handle_t ih = DDS_HANDLE_NIL;
|
dds_instance_handle_t ih = DDS_HANDLE_NIL;
|
||||||
const dds_topic * topic;
|
const dds_topic * topic;
|
||||||
|
@ -450,21 +444,19 @@ err:
|
||||||
return ih;
|
return ih;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(entity & DDS_ENTITY_KIND_MASK)
|
|
||||||
dds_instance_handle_t
|
dds_instance_handle_t
|
||||||
dds_instance_lookup (
|
dds_instance_lookup (
|
||||||
dds_entity_t entity,
|
dds_entity_t entity,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
return dds_lookup_instance(entity, data);
|
return dds_lookup_instance(entity, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(entity & DDS_ENTITY_KIND_MASK)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_instance_get_key(
|
dds_instance_get_key(
|
||||||
dds_entity_t entity,
|
dds_entity_t entity,
|
||||||
dds_instance_handle_t ih,
|
dds_instance_handle_t ih,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct thread_state1 * const thr = lookup_thread_state();
|
struct thread_state1 * const thr = lookup_thread_state();
|
||||||
const bool asleep = !vtime_awake_p(thr->vtime);
|
const bool asleep = !vtime_awake_p(thr->vtime);
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__key.h"
|
#include "dds__key.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_bswap.h"
|
#include "dds/ddsi/q_bswap.h"
|
||||||
#include "ddsi/q_md5.h"
|
#include "dds/ddsi/q_md5.h"
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
static bool keyhash_is_reset(const dds_key_hash_t *kh)
|
static bool keyhash_is_reset(const dds_key_hash_t *kh)
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "ddsc/dds.h"
|
|
||||||
|
#include "dds/dds.h"
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
|
|
||||||
dds_listener_t *dds_create_listener (void* arg)
|
dds_listener_t *dds_create_listener (void* arg)
|
||||||
|
@ -204,7 +205,7 @@ void dds_merge_listener (dds_listener_t * __restrict dst, const dds_listener_t *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_listener_merge (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src)
|
void dds_listener_merge (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src)
|
||||||
{
|
{
|
||||||
dds_merge_listener(dst, src);
|
dds_merge_listener(dst, src);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +215,7 @@ void dds_listener_merge (_Inout_ dds_listener_t * __restrict dst, _In_ const dds
|
||||||
************************************************************************************************/
|
************************************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_data_available (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_available_fn callback)
|
dds_lset_data_available (dds_listener_t * __restrict listener, dds_on_data_available_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_data_available = callback;
|
listener->on_data_available = callback;
|
||||||
|
@ -224,7 +225,7 @@ dds_lset_data_available (_Inout_ dds_listener_t * __restrict listener, _In_opt_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_data_on_readers_fn callback)
|
dds_lset_data_on_readers (dds_listener_t * __restrict listener, dds_on_data_on_readers_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_data_on_readers = callback;
|
listener->on_data_on_readers = callback;
|
||||||
|
@ -234,7 +235,7 @@ dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict listener, _In_opt_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_inconsistent_topic_fn callback)
|
dds_lset_inconsistent_topic (dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_inconsistent_topic = callback;
|
listener->on_inconsistent_topic = callback;
|
||||||
|
@ -244,7 +245,7 @@ dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict listener, _In_o
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_changed_fn callback)
|
dds_lset_liveliness_changed (dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_liveliness_changed = callback;
|
listener->on_liveliness_changed = callback;
|
||||||
|
@ -254,7 +255,7 @@ dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict listener, _In_o
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_liveliness_lost_fn callback)
|
dds_lset_liveliness_lost (dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_liveliness_lost = callback;
|
listener->on_liveliness_lost = callback;
|
||||||
|
@ -264,7 +265,7 @@ dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_deadline_missed_fn callback)
|
dds_lset_offered_deadline_missed (dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_offered_deadline_missed = callback;
|
listener->on_offered_deadline_missed = callback;
|
||||||
|
@ -274,7 +275,7 @@ dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __restrict listener,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_offered_incompatible_qos_fn callback)
|
dds_lset_offered_incompatible_qos (dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_offered_incompatible_qos = callback;
|
listener->on_offered_incompatible_qos = callback;
|
||||||
|
@ -284,7 +285,7 @@ dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __restrict listener,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_publication_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_publication_matched_fn callback)
|
dds_lset_publication_matched (dds_listener_t * __restrict listener, dds_on_publication_matched_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_publication_matched = callback;
|
listener->on_publication_matched = callback;
|
||||||
|
@ -294,7 +295,7 @@ dds_lset_publication_matched (_Inout_ dds_listener_t * __restrict listener, _In_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_deadline_missed_fn callback)
|
dds_lset_requested_deadline_missed (dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_requested_deadline_missed = callback;
|
listener->on_requested_deadline_missed = callback;
|
||||||
|
@ -304,7 +305,7 @@ dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __restrict listener
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_requested_incompatible_qos_fn callback)
|
dds_lset_requested_incompatible_qos (dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_requested_incompatible_qos = callback;
|
listener->on_requested_incompatible_qos = callback;
|
||||||
|
@ -314,7 +315,7 @@ dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __restrict listene
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_lost_fn callback)
|
dds_lset_sample_lost (dds_listener_t * __restrict listener, dds_on_sample_lost_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_sample_lost = callback;
|
listener->on_sample_lost = callback;
|
||||||
|
@ -324,7 +325,7 @@ dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_sample_rejected_fn callback)
|
dds_lset_sample_rejected (dds_listener_t * __restrict listener, dds_on_sample_rejected_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_sample_rejected = callback;
|
listener->on_sample_rejected = callback;
|
||||||
|
@ -334,7 +335,7 @@ dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict listener, _In_opt_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lset_subscription_matched (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds_on_subscription_matched_fn callback)
|
dds_lset_subscription_matched (dds_listener_t * __restrict listener, dds_on_subscription_matched_fn callback)
|
||||||
{
|
{
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->on_subscription_matched = callback;
|
listener->on_subscription_matched = callback;
|
||||||
|
@ -348,7 +349,7 @@ dds_lset_subscription_matched (_Inout_ dds_listener_t * __restrict listener, _In
|
||||||
************************************************************************************************/
|
************************************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_data_available (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_available_fn *callback)
|
dds_lget_data_available (const dds_listener_t * __restrict listener, dds_on_data_available_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -362,7 +363,7 @@ dds_lget_data_available (_In_ const dds_listener_t * __restrict listener, _Outpt
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_on_readers_fn *callback)
|
dds_lget_data_on_readers (const dds_listener_t * __restrict listener, dds_on_data_on_readers_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -375,7 +376,7 @@ dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outp
|
||||||
*callback = listener->on_data_on_readers;
|
*callback = listener->on_data_on_readers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_inconsistent_topic_fn *callback)
|
void dds_lget_inconsistent_topic (const dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -389,7 +390,7 @@ void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restrict listene
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_liveliness_changed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_changed_fn *callback)
|
dds_lget_liveliness_changed (const dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -403,7 +404,7 @@ dds_lget_liveliness_changed (_In_ const dds_listener_t * __restrict listener, _O
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_lost_fn *callback)
|
dds_lget_liveliness_lost (const dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -417,7 +418,7 @@ dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict listener, _Outp
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_deadline_missed_fn *callback)
|
dds_lget_offered_deadline_missed (const dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -431,7 +432,7 @@ dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __restrict listene
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_incompatible_qos_fn *callback)
|
dds_lget_offered_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -445,7 +446,7 @@ dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * __restrict listen
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_publication_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_publication_matched_fn *callback)
|
dds_lget_publication_matched (const dds_listener_t * __restrict listener, dds_on_publication_matched_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback){
|
if(!callback){
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -459,7 +460,7 @@ dds_lget_publication_matched (_In_ const dds_listener_t * __restrict listener, _
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_requested_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_deadline_missed_fn *callback)
|
dds_lget_requested_deadline_missed (const dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback) {
|
if(!callback) {
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -473,7 +474,7 @@ dds_lget_requested_deadline_missed (_In_ const dds_listener_t * __restrict liste
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_requested_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_incompatible_qos_fn *callback)
|
dds_lget_requested_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback) {
|
if(!callback) {
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -487,7 +488,7 @@ dds_lget_requested_incompatible_qos (_In_ const dds_listener_t * __restrict list
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_sample_lost (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_lost_fn *callback)
|
dds_lget_sample_lost (const dds_listener_t *__restrict listener, dds_on_sample_lost_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback) {
|
if(!callback) {
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -501,7 +502,7 @@ dds_lget_sample_lost (_In_ const dds_listener_t *__restrict listener, _Outptr_re
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_rejected_fn *callback)
|
dds_lget_sample_rejected (const dds_listener_t *__restrict listener, dds_on_sample_rejected_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback) {
|
if(!callback) {
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
@ -515,7 +516,7 @@ dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict listener, _Outp
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_lget_subscription_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_subscription_matched_fn *callback)
|
dds_lget_subscription_matched (const dds_listener_t * __restrict listener, dds_on_subscription_matched_fn *callback)
|
||||||
{
|
{
|
||||||
if(!callback) {
|
if(!callback) {
|
||||||
DDS_ERROR("Argument callback is NULL\n");
|
DDS_ERROR("Argument callback is NULL\n");
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "ddsi/q_entity.h"
|
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsrt/cdtors.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
|
@ -30,7 +32,7 @@ static dds_entity * dds_pp_head = NULL;
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_participant_status_validate(
|
dds_participant_status_validate(
|
||||||
uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ dds_participant_status_validate(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_participant_delete(
|
dds_participant_delete(
|
||||||
dds_entity *e)
|
dds_entity *e)
|
||||||
{
|
{
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
const bool asleep = !vtime_awake_p (thr->vtime);
|
const bool asleep = !vtime_awake_p (thr->vtime);
|
||||||
|
@ -61,7 +63,7 @@ dds_participant_delete(
|
||||||
|
|
||||||
dds_domain_free (e->m_domain);
|
dds_domain_free (e->m_domain);
|
||||||
|
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
iter = dds_pp_head;
|
iter = dds_pp_head;
|
||||||
while (iter) {
|
while (iter) {
|
||||||
if (iter == e) {
|
if (iter == e) {
|
||||||
|
@ -75,7 +77,7 @@ dds_participant_delete(
|
||||||
prev = iter;
|
prev = iter;
|
||||||
iter = iter->m_next;
|
iter = iter->m_next;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
|
|
||||||
assert (iter);
|
assert (iter);
|
||||||
|
|
||||||
|
@ -91,8 +93,8 @@ dds_participant_delete(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_participant_instance_hdl(
|
dds_participant_instance_hdl(
|
||||||
dds_entity *e,
|
dds_entity *e,
|
||||||
dds_instance_handle_t *i)
|
dds_instance_handle_t *i)
|
||||||
{
|
{
|
||||||
assert(e);
|
assert(e);
|
||||||
assert(i);
|
assert(i);
|
||||||
|
@ -102,8 +104,8 @@ dds_participant_instance_hdl(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_participant_qos_validate(
|
dds_participant_qos_validate(
|
||||||
const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
bool enabled)
|
bool enabled)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
assert(qos);
|
assert(qos);
|
||||||
|
@ -124,9 +126,9 @@ dds_participant_qos_validate(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_participant_qos_set(
|
dds_participant_qos_set(
|
||||||
dds_entity *e,
|
dds_entity *e,
|
||||||
const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
bool enabled)
|
bool enabled)
|
||||||
{
|
{
|
||||||
dds_return_t ret = dds_participant_qos_validate(qos, enabled);
|
dds_return_t ret = dds_participant_qos_validate(qos, enabled);
|
||||||
(void)e;
|
(void)e;
|
||||||
|
@ -140,11 +142,11 @@ dds_participant_qos_set(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Must_inspect_result_ dds_entity_t
|
dds_entity_t
|
||||||
dds_create_participant(
|
dds_create_participant(
|
||||||
_In_ const dds_domainid_t domain,
|
const dds_domainid_t domain,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
int q_rc;
|
int q_rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
@ -222,10 +224,10 @@ dds_create_participant(
|
||||||
pp->m_builtin_subscriber = 0;
|
pp->m_builtin_subscriber = 0;
|
||||||
|
|
||||||
/* Add participant to extent */
|
/* Add participant to extent */
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
pp->m_entity.m_next = dds_pp_head;
|
pp->m_entity.m_next = dds_pp_head;
|
||||||
dds_pp_head = &pp->m_entity;
|
dds_pp_head = &pp->m_entity;
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
|
|
||||||
|
@ -240,18 +242,18 @@ fail_dds_init:
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Check_return_ dds_return_t
|
dds_entity_t
|
||||||
dds_lookup_participant(
|
dds_lookup_participant(
|
||||||
_In_ dds_domainid_t domain_id,
|
dds_domainid_t domain_id,
|
||||||
_Out_opt_ dds_entity_t *participants,
|
dds_entity_t *participants,
|
||||||
_In_ size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
dds_return_t ret = 0;
|
dds_return_t ret = 0;
|
||||||
os_mutex *init_mutex;
|
ddsrt_mutex_t *init_mutex;
|
||||||
|
|
||||||
/* Be sure the DDS lifecycle resources are initialized. */
|
/* Be sure the DDS lifecycle resources are initialized. */
|
||||||
os_osInit();
|
ddsrt_init();
|
||||||
init_mutex = os_getSingletonMutex();
|
init_mutex = ddsrt_get_singleton_mutex();
|
||||||
|
|
||||||
if ((participants != NULL) && ((size <= 0) || (size >= INT32_MAX))) {
|
if ((participants != NULL) && ((size <= 0) || (size >= INT32_MAX))) {
|
||||||
DDS_ERROR("Array is given, but with invalid size\n");
|
DDS_ERROR("Array is given, but with invalid size\n");
|
||||||
|
@ -268,12 +270,12 @@ dds_lookup_participant(
|
||||||
participants[0] = 0;
|
participants[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_mutexLock (init_mutex);
|
ddsrt_mutex_lock (init_mutex);
|
||||||
|
|
||||||
/* Check if dds is intialized. */
|
/* Check if dds is intialized. */
|
||||||
if (dds_global.m_init_count > 0) {
|
if (dds_global.m_init_count > 0) {
|
||||||
dds_entity* iter;
|
dds_entity* iter;
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
iter = dds_pp_head;
|
iter = dds_pp_head;
|
||||||
while (iter) {
|
while (iter) {
|
||||||
if(iter->m_domainid == domain_id) {
|
if(iter->m_domainid == domain_id) {
|
||||||
|
@ -284,12 +286,12 @@ dds_lookup_participant(
|
||||||
}
|
}
|
||||||
iter = iter->m_next;
|
iter = iter->m_next;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_mutexUnlock (init_mutex);
|
ddsrt_mutex_unlock (init_mutex);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
os_osExit();
|
ddsrt_fini();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,15 +14,15 @@
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
#include "dds/version.h"
|
||||||
|
|
||||||
#define DDS_PUBLISHER_STATUS_MASK 0u
|
#define DDS_PUBLISHER_STATUS_MASK 0u
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_publisher_instance_hdl(
|
dds_publisher_instance_hdl(
|
||||||
dds_entity *e,
|
dds_entity *e,
|
||||||
dds_instance_handle_t *i)
|
dds_instance_handle_t *i)
|
||||||
{
|
{
|
||||||
(void)e;
|
(void)e;
|
||||||
(void)i;
|
(void)i;
|
||||||
|
@ -33,8 +33,8 @@ dds_publisher_instance_hdl(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_publisher_qos_validate(
|
dds_publisher_qos_validate(
|
||||||
_In_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_ bool enabled)
|
bool enabled)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
assert(qos);
|
assert(qos);
|
||||||
|
@ -66,16 +66,16 @@ dds_publisher_qos_validate(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_publisher_qos_set(
|
dds_publisher_qos_set(
|
||||||
dds_entity *e,
|
dds_entity *e,
|
||||||
const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
bool enabled)
|
bool enabled)
|
||||||
{
|
{
|
||||||
dds_return_t ret = dds_publisher_qos_validate(qos, enabled);
|
dds_return_t ret = dds_publisher_qos_validate(qos, enabled);
|
||||||
(void)e;
|
(void)e;
|
||||||
if (ret == DDS_RETCODE_OK) {
|
if (ret == DDS_RETCODE_OK) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
||||||
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
|
DDS_ERROR(DDS_PROJECT_NAME" does not support changing QoS policies yet\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,19 +94,18 @@ static dds_return_t dds_publisher_status_validate (uint32_t mask)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
dds_entity_t
|
||||||
_Must_inspect_result_ dds_entity_t
|
|
||||||
dds_create_publisher(
|
dds_create_publisher(
|
||||||
_In_ dds_entity_t participant,
|
dds_entity_t participant,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_entity * par;
|
dds_entity * par;
|
||||||
dds_publisher * pub;
|
dds_publisher * pub;
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds_qos_t * new_qos = NULL;
|
dds_qos_t * new_qos = NULL;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
||||||
if (rc != DDS_RETCODE_OK) {
|
if (rc != DDS_RETCODE_OK) {
|
||||||
|
@ -141,11 +140,9 @@ lock_err:
|
||||||
return hdl;
|
return hdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_((publisher & DDS_ENTITY_KIND_MASK) == DDS_KIND_PUBLISHER)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_suspend(
|
dds_suspend(
|
||||||
_In_ dds_entity_t publisher)
|
dds_entity_t publisher)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
|
@ -161,11 +158,9 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_((publisher & DDS_ENTITY_KIND_MASK) == DDS_KIND_PUBLISHER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_resume(
|
dds_resume(
|
||||||
_In_ dds_entity_t publisher)
|
dds_entity_t publisher)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -181,18 +176,15 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((publisher_or_writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER ) ||\
|
|
||||||
((publisher_or_writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_PUBLISHER) )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_wait_for_acks(
|
dds_wait_for_acks(
|
||||||
_In_ dds_entity_t publisher_or_writer,
|
dds_entity_t publisher_or_writer,
|
||||||
_In_ dds_duration_t timeout)
|
dds_duration_t timeout)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
/* TODO: CHAM-125 Currently unsupported. */
|
/* TODO: CHAM-125 Currently unsupported. */
|
||||||
OS_UNUSED_ARG(timeout);
|
DDSRT_UNUSED_ARG(timeout);
|
||||||
|
|
||||||
switch(dds_entity_kind_from_handle(publisher_or_writer)) {
|
switch(dds_entity_kind_from_handle(publisher_or_writer)) {
|
||||||
case DDS_KIND_WRITER:
|
case DDS_KIND_WRITER:
|
||||||
|
@ -214,7 +206,7 @@ dds_wait_for_acks(
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_publisher_begin_coherent(
|
dds_publisher_begin_coherent(
|
||||||
_In_ dds_entity_t e)
|
dds_entity_t e)
|
||||||
{
|
{
|
||||||
/* TODO: CHAM-124 Currently unsupported. */
|
/* TODO: CHAM-124 Currently unsupported. */
|
||||||
(void)e;
|
(void)e;
|
||||||
|
@ -224,7 +216,7 @@ dds_publisher_begin_coherent(
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_publisher_end_coherent(
|
dds_publisher_end_coherent(
|
||||||
_In_ dds_entity_t e)
|
dds_entity_t e)
|
||||||
{
|
{
|
||||||
/* TODO: CHAM-124 Currently unsupported. */
|
/* TODO: CHAM-124 Currently unsupported. */
|
||||||
(void)e;
|
(void)e;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
|
|
||||||
/* TODO: dd_duration_t is converted to nn_ddsi_time_t declared in q_time.h
|
/* TODO: dd_duration_t is converted to nn_ddsi_time_t declared in q_time.h
|
||||||
This structure contain seconds and fractions.
|
This structure contain seconds and fractions.
|
||||||
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_qos_data_copy_in(
|
dds_qos_data_copy_in(
|
||||||
_Inout_ nn_octetseq_t * data,
|
nn_octetseq_t * data,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
const void * __restrict value,
|
||||||
_In_ size_t sz)
|
size_t sz)
|
||||||
{
|
{
|
||||||
if (data->value) {
|
if (data->value) {
|
||||||
dds_free (data->value);
|
dds_free (data->value);
|
||||||
|
@ -39,11 +39,9 @@ dds_qos_data_copy_in(
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
dds_qos_data_copy_out(
|
dds_qos_data_copy_out(
|
||||||
_In_ const nn_octetseq_t * data,
|
const nn_octetseq_t * data,
|
||||||
_When_(*sz == 0, _At_(*value, _Post_null_))
|
void ** value,
|
||||||
_When_(*sz > 0, _At_(*value, _Post_notnull_))
|
size_t * sz)
|
||||||
_Outptr_result_bytebuffer_all_maybenull_(*sz) void ** value,
|
|
||||||
_Out_ size_t * sz)
|
|
||||||
{
|
{
|
||||||
if (sz == NULL && value != NULL) {
|
if (sz == NULL && value != NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -137,7 +135,7 @@ dds_qos_validate_common (
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_qos_validate_mutable_common (
|
dds_qos_validate_mutable_common (
|
||||||
_In_ const dds_qos_t *qos)
|
const dds_qos_t *qos)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -176,7 +174,7 @@ dds_qos_validate_mutable_common (
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_qos_init_defaults (
|
dds_qos_init_defaults (
|
||||||
_Inout_ dds_qos_t * __restrict qos)
|
dds_qos_t * __restrict qos)
|
||||||
{
|
{
|
||||||
assert (qos);
|
assert (qos);
|
||||||
memset (qos, 0, sizeof (*qos));
|
memset (qos, 0, sizeof (*qos));
|
||||||
|
@ -208,7 +206,6 @@ dds_qos_init_defaults (
|
||||||
qos->reader_data_lifecycle.autopurge_disposed_samples_delay = nn_to_ddsi_duration (DDS_INFINITY);
|
qos->reader_data_lifecycle.autopurge_disposed_samples_delay = nn_to_ddsi_duration (DDS_INFINITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Ret_notnull_
|
|
||||||
dds_qos_t * dds_create_qos (void)
|
dds_qos_t * dds_create_qos (void)
|
||||||
{
|
{
|
||||||
dds_qos_t *qos = dds_alloc (sizeof (dds_qos_t));
|
dds_qos_t *qos = dds_alloc (sizeof (dds_qos_t));
|
||||||
|
@ -216,7 +213,6 @@ dds_qos_t * dds_create_qos (void)
|
||||||
return qos;
|
return qos;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Ret_notnull_
|
|
||||||
dds_qos_t * dds_qos_create (void)
|
dds_qos_t * dds_qos_create (void)
|
||||||
{
|
{
|
||||||
return dds_create_qos ();
|
return dds_create_qos ();
|
||||||
|
@ -224,7 +220,7 @@ dds_qos_t * dds_qos_create (void)
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_reset_qos(
|
dds_reset_qos(
|
||||||
_Out_ dds_qos_t * __restrict qos)
|
dds_qos_t * __restrict qos)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
nn_xqos_fini (qos);
|
nn_xqos_fini (qos);
|
||||||
|
@ -236,14 +232,14 @@ dds_reset_qos(
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_qos_reset(
|
dds_qos_reset(
|
||||||
_Out_ dds_qos_t * __restrict qos)
|
dds_qos_t * __restrict qos)
|
||||||
{
|
{
|
||||||
dds_reset_qos (qos);
|
dds_reset_qos (qos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_delete_qos(
|
dds_delete_qos(
|
||||||
_In_ _Post_invalid_ dds_qos_t * __restrict qos)
|
dds_qos_t * __restrict qos)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
dds_reset_qos(qos);
|
dds_reset_qos(qos);
|
||||||
|
@ -253,15 +249,15 @@ dds_delete_qos(
|
||||||
|
|
||||||
void
|
void
|
||||||
dds_qos_delete(
|
dds_qos_delete(
|
||||||
_In_ _Post_invalid_ dds_qos_t * __restrict qos)
|
dds_qos_t * __restrict qos)
|
||||||
{
|
{
|
||||||
dds_delete_qos (qos);
|
dds_delete_qos (qos);
|
||||||
}
|
}
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_copy_qos (
|
dds_copy_qos (
|
||||||
_Out_ dds_qos_t * __restrict dst,
|
dds_qos_t * __restrict dst,
|
||||||
_In_ const dds_qos_t * __restrict src)
|
const dds_qos_t * __restrict src)
|
||||||
{
|
{
|
||||||
if(!src){
|
if(!src){
|
||||||
DDS_ERROR("Argument source(src) is NULL\n");
|
DDS_ERROR("Argument source(src) is NULL\n");
|
||||||
|
@ -277,15 +273,15 @@ dds_copy_qos (
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_qos_copy (
|
dds_qos_copy (
|
||||||
_Out_ dds_qos_t * __restrict dst,
|
dds_qos_t * __restrict dst,
|
||||||
_In_ const dds_qos_t * __restrict src)
|
const dds_qos_t * __restrict src)
|
||||||
{
|
{
|
||||||
return dds_copy_qos (dst, src);
|
return dds_copy_qos (dst, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_merge_qos (
|
void dds_merge_qos (
|
||||||
_Inout_ dds_qos_t * __restrict dst,
|
dds_qos_t * __restrict dst,
|
||||||
_In_ const dds_qos_t * __restrict src)
|
const dds_qos_t * __restrict src)
|
||||||
{
|
{
|
||||||
if(!src){
|
if(!src){
|
||||||
DDS_ERROR("Argument source(src) is NULL\n");
|
DDS_ERROR("Argument source(src) is NULL\n");
|
||||||
|
@ -300,15 +296,15 @@ void dds_merge_qos (
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_qos_merge (
|
void dds_qos_merge (
|
||||||
_Inout_ dds_qos_t * __restrict dst,
|
dds_qos_t * __restrict dst,
|
||||||
_In_ const dds_qos_t * __restrict src)
|
const dds_qos_t * __restrict src)
|
||||||
{
|
{
|
||||||
dds_merge_qos (dst, src);
|
dds_merge_qos (dst, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dds_qos_equal (
|
bool dds_qos_equal (
|
||||||
_In_opt_ const dds_qos_t * __restrict a,
|
const dds_qos_t * __restrict a,
|
||||||
_In_opt_ const dds_qos_t * __restrict b)
|
const dds_qos_t * __restrict b)
|
||||||
{
|
{
|
||||||
/* FIXME: a bit of a hack - and I am not so sure I like accepting null pointers here anyway */
|
/* FIXME: a bit of a hack - and I am not so sure I like accepting null pointers here anyway */
|
||||||
if (a == NULL && b == NULL) {
|
if (a == NULL && b == NULL) {
|
||||||
|
@ -321,9 +317,9 @@ bool dds_qos_equal (
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_qset_userdata(
|
void dds_qset_userdata(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
const void * __restrict value,
|
||||||
_In_ size_t sz)
|
size_t sz)
|
||||||
{
|
{
|
||||||
if (!qos) {
|
if (!qos) {
|
||||||
DDS_ERROR("Argument qos is NULL\n");
|
DDS_ERROR("Argument qos is NULL\n");
|
||||||
|
@ -334,9 +330,9 @@ void dds_qset_userdata(
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_qset_topicdata(
|
void dds_qset_topicdata(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
const void * __restrict value,
|
||||||
_In_ size_t sz)
|
size_t sz)
|
||||||
{
|
{
|
||||||
if (!qos) {
|
if (!qos) {
|
||||||
DDS_ERROR("Argument qos is NULL\n");
|
DDS_ERROR("Argument qos is NULL\n");
|
||||||
|
@ -347,9 +343,9 @@ void dds_qset_topicdata(
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_qset_groupdata(
|
void dds_qset_groupdata(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_reads_bytes_opt_(sz) const void * __restrict value,
|
const void * __restrict value,
|
||||||
_In_ size_t sz)
|
size_t sz)
|
||||||
{
|
{
|
||||||
if (!qos) {
|
if (!qos) {
|
||||||
DDS_ERROR("Argument qos is NULL\n");
|
DDS_ERROR("Argument qos is NULL\n");
|
||||||
|
@ -361,8 +357,8 @@ void dds_qset_groupdata(
|
||||||
|
|
||||||
void dds_qset_durability
|
void dds_qset_durability
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_DURABILITY_VOLATILE, DDS_DURABILITY_PERSISTENT) dds_durability_kind_t kind
|
dds_durability_kind_t kind
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -375,9 +371,9 @@ void dds_qset_durability
|
||||||
|
|
||||||
void dds_qset_history
|
void dds_qset_history
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_HISTORY_KEEP_LAST, DDS_HISTORY_KEEP_ALL) dds_history_kind_t kind,
|
dds_history_kind_t kind,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t depth
|
int32_t depth
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -391,10 +387,10 @@ void dds_qset_history
|
||||||
|
|
||||||
void dds_qset_resource_limits
|
void dds_qset_resource_limits
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples,
|
int32_t max_samples,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_instances,
|
int32_t max_instances,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples_per_instance
|
int32_t max_samples_per_instance
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -409,10 +405,10 @@ void dds_qset_resource_limits
|
||||||
|
|
||||||
void dds_qset_presentation
|
void dds_qset_presentation
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_PRESENTATION_INSTANCE, DDS_PRESENTATION_GROUP) dds_presentation_access_scope_kind_t access_scope,
|
dds_presentation_access_scope_kind_t access_scope,
|
||||||
_In_ bool coherent_access,
|
bool coherent_access,
|
||||||
_In_ bool ordered_access
|
bool ordered_access
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -427,8 +423,8 @@ void dds_qset_presentation
|
||||||
|
|
||||||
void dds_qset_lifespan
|
void dds_qset_lifespan
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t lifespan
|
dds_duration_t lifespan
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -441,8 +437,8 @@ void dds_qset_lifespan
|
||||||
|
|
||||||
void dds_qset_deadline
|
void dds_qset_deadline
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t deadline
|
dds_duration_t deadline
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -455,8 +451,8 @@ void dds_qset_deadline
|
||||||
|
|
||||||
void dds_qset_latency_budget
|
void dds_qset_latency_budget
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t duration
|
dds_duration_t duration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -469,8 +465,8 @@ void dds_qset_latency_budget
|
||||||
|
|
||||||
void dds_qset_ownership
|
void dds_qset_ownership
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_OWNERSHIP_SHARED, DDS_OWNERSHIP_EXCLUSIVE) dds_ownership_kind_t kind
|
dds_ownership_kind_t kind
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -483,8 +479,8 @@ void dds_qset_ownership
|
||||||
|
|
||||||
void dds_qset_ownership_strength
|
void dds_qset_ownership_strength
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_ int32_t value
|
int32_t value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -497,9 +493,9 @@ void dds_qset_ownership_strength
|
||||||
|
|
||||||
void dds_qset_liveliness
|
void dds_qset_liveliness
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_LIVELINESS_AUTOMATIC, DDS_LIVELINESS_MANUAL_BY_TOPIC) dds_liveliness_kind_t kind,
|
dds_liveliness_kind_t kind,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t lease_duration
|
dds_duration_t lease_duration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -513,8 +509,8 @@ void dds_qset_liveliness
|
||||||
|
|
||||||
void dds_qset_time_based_filter
|
void dds_qset_time_based_filter
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t minimum_separation
|
dds_duration_t minimum_separation
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -527,9 +523,9 @@ void dds_qset_time_based_filter
|
||||||
|
|
||||||
void dds_qset_partition
|
void dds_qset_partition
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_ uint32_t n,
|
uint32_t n,
|
||||||
_In_count_(n) _Deref_pre_z_ const char ** __restrict ps
|
const char ** __restrict ps
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -564,9 +560,9 @@ void dds_qset_partition
|
||||||
|
|
||||||
void dds_qset_reliability
|
void dds_qset_reliability
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_RELIABILITY_BEST_EFFORT, DDS_RELIABILITY_RELIABLE) dds_reliability_kind_t kind,
|
dds_reliability_kind_t kind,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t max_blocking_time
|
dds_duration_t max_blocking_time
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -580,8 +576,8 @@ void dds_qset_reliability
|
||||||
|
|
||||||
void dds_qset_transport_priority
|
void dds_qset_transport_priority
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_ int32_t value
|
int32_t value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -594,9 +590,8 @@ void dds_qset_transport_priority
|
||||||
|
|
||||||
void dds_qset_destination_order
|
void dds_qset_destination_order
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP,
|
dds_destination_order_kind_t kind
|
||||||
DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP) dds_destination_order_kind_t kind
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -609,8 +604,8 @@ void dds_qset_destination_order
|
||||||
|
|
||||||
void dds_qset_writer_data_lifecycle
|
void dds_qset_writer_data_lifecycle
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_ bool autodispose
|
bool autodispose
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(qos) {
|
if(qos) {
|
||||||
|
@ -623,9 +618,9 @@ void dds_qset_writer_data_lifecycle
|
||||||
|
|
||||||
void dds_qset_reader_data_lifecycle
|
void dds_qset_reader_data_lifecycle
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t autopurge_nowriter_samples_delay,
|
dds_duration_t autopurge_nowriter_samples_delay,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t autopurge_disposed_samples_delay
|
dds_duration_t autopurge_disposed_samples_delay
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
@ -641,13 +636,13 @@ void dds_qset_reader_data_lifecycle
|
||||||
|
|
||||||
void dds_qset_durability_service
|
void dds_qset_durability_service
|
||||||
(
|
(
|
||||||
_Inout_ dds_qos_t * __restrict qos,
|
dds_qos_t * __restrict qos,
|
||||||
_In_range_(0, DDS_INFINITY) dds_duration_t service_cleanup_delay,
|
dds_duration_t service_cleanup_delay,
|
||||||
_In_range_(DDS_HISTORY_KEEP_LAST, DDS_HISTORY_KEEP_ALL) dds_history_kind_t history_kind,
|
dds_history_kind_t history_kind,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t history_depth,
|
int32_t history_depth,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples,
|
int32_t max_samples,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_instances,
|
int32_t max_instances,
|
||||||
_In_range_(>=, DDS_LENGTH_UNLIMITED) int32_t max_samples_per_instance
|
int32_t max_samples_per_instance
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (qos) {
|
if (qos) {
|
||||||
|
|
|
@ -10,24 +10,26 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "dds/ddsrt/atomics.h"
|
||||||
|
#include "dds/ddsrt/log.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__topic.h"
|
#include "dds__topic.h"
|
||||||
#include "dds__querycond.h"
|
#include "dds__querycond.h"
|
||||||
#include "dds__readcond.h"
|
#include "dds__readcond.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
DDS_EXPORT dds_entity_t
|
DDS_EXPORT dds_entity_t
|
||||||
dds_create_querycondition(
|
dds_create_querycondition(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_In_ uint32_t mask,
|
uint32_t mask,
|
||||||
_In_ dds_querycondition_filter_fn filter)
|
dds_querycondition_filter_fn filter)
|
||||||
{
|
{
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *r;
|
dds_reader *r;
|
||||||
|
|
||||||
rc = dds_reader_lock(reader, &r);
|
rc = dds_reader_lock(reader, &r);
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
#include "ddsi/q_ephash.h"
|
#include "dds/ddsi/q_ephash.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
|
|
||||||
static dds__retcode_t dds_read_lock (dds_entity_t hdl, dds_reader **reader, dds_readcond **condition, bool only_reader)
|
static dds_retcode_t dds_read_lock (dds_entity_t hdl, dds_reader **reader, dds_readcond **condition, bool only_reader)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity *entity, *parent_entity;
|
dds_entity *entity, *parent_entity;
|
||||||
if ((rc = dds_entity_lock (hdl, DDS_KIND_DONTCARE, &entity)) != DDS_RETCODE_OK)
|
if ((rc = dds_entity_lock (hdl, DDS_KIND_DONTCARE, &entity)) != DDS_RETCODE_OK)
|
||||||
{
|
{
|
||||||
|
@ -77,19 +77,19 @@ static void dds_read_unlock (dds_reader *reader, dds_readcond *condition)
|
||||||
*/
|
*/
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_read_impl(
|
dds_read_impl(
|
||||||
_In_ bool take,
|
bool take,
|
||||||
_In_ dds_entity_t reader_or_condition,
|
dds_entity_t reader_or_condition,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ uint32_t mask,
|
uint32_t mask,
|
||||||
_In_ dds_instance_handle_t hand,
|
dds_instance_handle_t hand,
|
||||||
_In_ bool lock,
|
bool lock,
|
||||||
_In_ bool only_reader)
|
bool only_reader)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
struct dds_reader * rd;
|
struct dds_reader * rd;
|
||||||
struct dds_readcond * cond;
|
struct dds_readcond * cond;
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
|
@ -182,17 +182,17 @@ fail:
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_readcdr_impl(
|
dds_readcdr_impl(
|
||||||
_In_ bool take,
|
bool take,
|
||||||
_In_ dds_entity_t reader_or_condition,
|
dds_entity_t reader_or_condition,
|
||||||
_Out_ struct ddsi_serdata ** buf,
|
struct ddsi_serdata ** buf,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ uint32_t mask,
|
uint32_t mask,
|
||||||
_In_ dds_instance_handle_t hand,
|
dds_instance_handle_t hand,
|
||||||
_In_ bool lock)
|
bool lock)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
struct dds_reader * rd;
|
struct dds_reader * rd;
|
||||||
struct dds_readcond * cond;
|
struct dds_readcond * cond;
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
|
@ -243,16 +243,13 @@ dds_readcdr_impl(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read(
|
dds_read(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs)
|
uint32_t maxs)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -265,15 +262,12 @@ dds_read(
|
||||||
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_wl(
|
dds_read_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ uint32_t maxs)
|
uint32_t maxs)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -286,17 +280,14 @@ dds_read_wl(
|
||||||
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_mask(
|
dds_read_mask(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -309,16 +300,13 @@ dds_read_mask(
|
||||||
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_mask_wl(
|
dds_read_mask_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -331,17 +319,14 @@ dds_read_mask_wl(
|
||||||
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_instance(
|
dds_read_instance(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -363,16 +348,13 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_instance_wl(
|
dds_read_instance_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -394,19 +376,15 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_instance_mask(
|
dds_read_instance_mask(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -428,18 +406,14 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_instance_mask_wl(
|
dds_read_instance_mask_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -460,38 +434,33 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_next(
|
dds_read_next(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si)
|
dds_sample_info_t *si)
|
||||||
{
|
{
|
||||||
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
||||||
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_read_next_wl(
|
dds_read_next_wl(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si)
|
dds_sample_info_t *si)
|
||||||
{
|
{
|
||||||
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
||||||
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take(
|
dds_take(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs)
|
uint32_t maxs)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -504,15 +473,12 @@ dds_take(
|
||||||
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_wl(
|
dds_take_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ uint32_t maxs)
|
uint32_t maxs)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -525,17 +491,14 @@ dds_take_wl(
|
||||||
return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_mask(
|
dds_take_mask(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -548,16 +511,13 @@ dds_take_mask(
|
||||||
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_mask_wl(
|
dds_take_mask_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void ** buf,
|
void ** buf,
|
||||||
_Out_ dds_sample_info_t * si,
|
dds_sample_info_t * si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
|
||||||
|
@ -589,18 +549,14 @@ dds_takecdr(
|
||||||
return dds_readcdr_impl (true, rd_or_cnd, buf, maxs, si, mask, DDS_HANDLE_NIL, lock);
|
return dds_readcdr_impl (true, rd_or_cnd, buf, maxs, si, mask, DDS_HANDLE_NIL, lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_instance(
|
dds_take_instance(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -622,16 +578,13 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_instance_wl(
|
dds_take_instance_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle)
|
dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -652,19 +605,15 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_instance_mask(
|
dds_take_instance_mask(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ size_t bufsz,
|
size_t bufsz,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -685,18 +634,14 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_instance_mask_wl(
|
dds_take_instance_mask_wl(
|
||||||
_In_ dds_entity_t rd_or_cnd,
|
dds_entity_t rd_or_cnd,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si,
|
dds_sample_info_t *si,
|
||||||
_In_ uint32_t maxs,
|
uint32_t maxs,
|
||||||
_In_ dds_instance_handle_t handle,
|
dds_instance_handle_t handle,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
bool lock = true;
|
bool lock = true;
|
||||||
|
@ -717,38 +662,33 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_next(
|
dds_take_next(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si)
|
dds_sample_info_t *si)
|
||||||
{
|
{
|
||||||
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
||||||
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_take_next_wl(
|
dds_take_next_wl(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Inout_ void **buf,
|
void **buf,
|
||||||
_Out_ dds_sample_info_t *si)
|
dds_sample_info_t *si)
|
||||||
{
|
{
|
||||||
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
||||||
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((reader_or_condition & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
|
dds_return_t
|
||||||
((reader_or_condition & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_READ ) || \
|
|
||||||
((reader_or_condition & DDS_ENTITY_KIND_MASK) == DDS_KIND_COND_QUERY ))
|
|
||||||
_Must_inspect_result_ dds_return_t
|
|
||||||
dds_return_loan(
|
dds_return_loan(
|
||||||
_In_ dds_entity_t reader_or_condition,
|
dds_entity_t reader_or_condition,
|
||||||
_Inout_updates_(bufsz) void **buf,
|
void **buf,
|
||||||
_In_ int32_t bufsz)
|
int32_t bufsz)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
const struct ddsi_sertopic *st;
|
const struct ddsi_sertopic *st;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_readcond *cond;
|
dds_readcond *cond;
|
||||||
|
|
|
@ -15,24 +15,24 @@
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_ephash.h"
|
#include "dds/ddsi/q_ephash.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_readcond_delete(
|
dds_readcond_delete(
|
||||||
dds_entity *e)
|
dds_entity *e)
|
||||||
{
|
{
|
||||||
dds_rhc_remove_readcondition((dds_readcond*)e);
|
dds_rhc_remove_readcondition((dds_readcond*)e);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Must_inspect_result_ dds_readcond*
|
dds_readcond*
|
||||||
dds_create_readcond(
|
dds_create_readcond(
|
||||||
_In_ dds_reader *rd,
|
dds_reader *rd,
|
||||||
_In_ dds_entity_kind_t kind,
|
dds_entity_kind_t kind,
|
||||||
_In_ uint32_t mask,
|
uint32_t mask,
|
||||||
_In_opt_ dds_querycondition_filter_fn filter)
|
dds_querycondition_filter_fn filter)
|
||||||
{
|
{
|
||||||
dds_readcond * cond = dds_alloc(sizeof(*cond));
|
dds_readcond * cond = dds_alloc(sizeof(*cond));
|
||||||
assert((kind == DDS_KIND_COND_READ && filter == 0) || (kind == DDS_KIND_COND_QUERY && filter != 0));
|
assert((kind == DDS_KIND_COND_READ && filter == 0) || (kind == DDS_KIND_COND_QUERY && filter != 0));
|
||||||
|
@ -56,15 +56,14 @@ dds_create_readcond(
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
dds_entity_t
|
||||||
_Must_inspect_result_ dds_entity_t
|
|
||||||
dds_create_readcondition(
|
dds_create_readcondition(
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_In_ uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds_reader * rd;
|
dds_reader * rd;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
rc = dds_reader_lock(reader, &rd);
|
rc = dds_reader_lock(reader, &rd);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
|
@ -100,7 +99,7 @@ dds_entity_t dds_get_datareader (dds_entity_t condition)
|
||||||
dds_return_t dds_get_mask (dds_entity_t condition, uint32_t *mask)
|
dds_return_t dds_get_mask (dds_entity_t condition, uint32_t *mask)
|
||||||
{
|
{
|
||||||
dds_entity *entity;
|
dds_entity *entity;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (mask == NULL)
|
if (mask == NULL)
|
||||||
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
return DDS_ERRNO (DDS_RETCODE_BAD_PARAMETER);
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
#include "dds/version.h"
|
||||||
#include "dds__subscriber.h"
|
#include "dds__subscriber.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
|
@ -20,13 +21,10 @@
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "dds__topic.h"
|
#include "dds__topic.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
#include "dds__builtin.h"
|
#include "dds__builtin.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
|
||||||
|
|
||||||
#include "os/os.h"
|
|
||||||
|
|
||||||
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_reader)
|
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_reader)
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ static dds_return_t
|
||||||
dds_reader_close(
|
dds_reader_close(
|
||||||
dds_entity *e)
|
dds_entity *e)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
struct thread_state1 * const thr = lookup_thread_state();
|
struct thread_state1 * const thr = lookup_thread_state();
|
||||||
const bool asleep = !vtime_awake_p(thr->vtime);
|
const bool asleep = !vtime_awake_p(thr->vtime);
|
||||||
|
@ -146,7 +144,7 @@ dds_reader_qos_set(
|
||||||
if (ret == DDS_RETCODE_OK) {
|
if (ret == DDS_RETCODE_OK) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
||||||
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies\n");
|
DDS_ERROR(DDS_PROJECT_NAME" does not support changing QoS policies\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,47 +170,47 @@ void dds_reader_data_available_cb (struct dds_reader *rd)
|
||||||
struct dds_listener const * const lst = &rd->m_entity.m_listener;
|
struct dds_listener const * const lst = &rd->m_entity.m_listener;
|
||||||
dds_entity * const sub = rd->m_entity.m_parent;
|
dds_entity * const sub = rd->m_entity.m_parent;
|
||||||
|
|
||||||
os_mutexLock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&rd->m_entity.m_observers_lock);
|
||||||
while (rd->m_entity.m_cb_count > 0)
|
while (rd->m_entity.m_cb_count > 0)
|
||||||
os_condWait (&rd->m_entity.m_observers_cond, &rd->m_entity.m_observers_lock);
|
ddsrt_cond_wait (&rd->m_entity.m_observers_cond, &rd->m_entity.m_observers_lock);
|
||||||
rd->m_entity.m_cb_count++;
|
rd->m_entity.m_cb_count++;
|
||||||
|
|
||||||
if (lst->on_data_on_readers)
|
if (lst->on_data_on_readers)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&rd->m_entity.m_observers_lock);
|
||||||
|
|
||||||
os_mutexLock (&sub->m_observers_lock);
|
ddsrt_mutex_lock (&sub->m_observers_lock);
|
||||||
while (sub->m_cb_count > 0)
|
while (sub->m_cb_count > 0)
|
||||||
os_condWait (&sub->m_observers_cond, &sub->m_observers_lock);
|
ddsrt_cond_wait (&sub->m_observers_cond, &sub->m_observers_lock);
|
||||||
sub->m_cb_count++;
|
sub->m_cb_count++;
|
||||||
os_mutexUnlock (&sub->m_observers_lock);
|
ddsrt_mutex_unlock (&sub->m_observers_lock);
|
||||||
|
|
||||||
lst->on_data_on_readers (sub->m_hdl, lst->on_data_on_readers_arg);
|
lst->on_data_on_readers (sub->m_hdl, lst->on_data_on_readers_arg);
|
||||||
|
|
||||||
os_mutexLock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&rd->m_entity.m_observers_lock);
|
||||||
os_mutexLock (&sub->m_observers_lock);
|
ddsrt_mutex_lock (&sub->m_observers_lock);
|
||||||
sub->m_cb_count--;
|
sub->m_cb_count--;
|
||||||
os_condBroadcast (&sub->m_observers_cond);
|
ddsrt_cond_broadcast (&sub->m_observers_cond);
|
||||||
os_mutexUnlock (&sub->m_observers_lock);
|
ddsrt_mutex_unlock (&sub->m_observers_lock);
|
||||||
}
|
}
|
||||||
else if (rd->m_entity.m_listener.on_data_available)
|
else if (rd->m_entity.m_listener.on_data_available)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&rd->m_entity.m_observers_lock);
|
||||||
lst->on_data_available (rd->m_entity.m_hdl, lst->on_data_available_arg);
|
lst->on_data_available (rd->m_entity.m_hdl, lst->on_data_available_arg);
|
||||||
os_mutexLock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&rd->m_entity.m_observers_lock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dds_entity_status_set (&rd->m_entity, DDS_DATA_AVAILABLE_STATUS);
|
dds_entity_status_set (&rd->m_entity, DDS_DATA_AVAILABLE_STATUS);
|
||||||
|
|
||||||
os_mutexLock (&sub->m_observers_lock);
|
ddsrt_mutex_lock (&sub->m_observers_lock);
|
||||||
dds_entity_status_set (sub, DDS_DATA_ON_READERS_STATUS);
|
dds_entity_status_set (sub, DDS_DATA_ON_READERS_STATUS);
|
||||||
os_mutexUnlock (&sub->m_observers_lock);
|
ddsrt_mutex_unlock (&sub->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
rd->m_entity.m_cb_count--;
|
rd->m_entity.m_cb_count--;
|
||||||
os_condBroadcast (&rd->m_entity.m_observers_cond);
|
ddsrt_cond_broadcast (&rd->m_entity.m_observers_cond);
|
||||||
os_mutexUnlock (&rd->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&rd->m_entity.m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
|
@ -245,9 +243,9 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
m_observers_lock for the duration of the listener call itself,
|
m_observers_lock for the duration of the listener call itself,
|
||||||
and that similarly the listener function and argument pointers
|
and that similarly the listener function and argument pointers
|
||||||
are stable */
|
are stable */
|
||||||
os_mutexLock (&entity->m_observers_lock);
|
ddsrt_mutex_lock (&entity->m_observers_lock);
|
||||||
while (entity->m_cb_count > 0)
|
while (entity->m_cb_count > 0)
|
||||||
os_condWait (&entity->m_observers_cond, &entity->m_observers_lock);
|
ddsrt_cond_wait (&entity->m_observers_cond, &entity->m_observers_lock);
|
||||||
entity->m_cb_count++;
|
entity->m_cb_count++;
|
||||||
|
|
||||||
/* Update status metrics. */
|
/* Update status metrics. */
|
||||||
|
@ -337,9 +335,9 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
|
|
||||||
if (invoke)
|
if (invoke)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&entity->m_observers_lock);
|
ddsrt_mutex_unlock (&entity->m_observers_lock);
|
||||||
dds_entity_invoke_listener(entity, status_id, vst);
|
dds_entity_invoke_listener(entity, status_id, vst);
|
||||||
os_mutexLock (&entity->m_observers_lock);
|
ddsrt_mutex_lock (&entity->m_observers_lock);
|
||||||
*reset[0] = 0;
|
*reset[0] = 0;
|
||||||
if (reset[1])
|
if (reset[1])
|
||||||
*reset[1] = 0;
|
*reset[1] = 0;
|
||||||
|
@ -350,23 +348,19 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->m_cb_count--;
|
entity->m_cb_count--;
|
||||||
os_condBroadcast (&entity->m_observers_cond);
|
ddsrt_cond_broadcast (&entity->m_observers_cond);
|
||||||
os_mutexUnlock (&entity->m_observers_lock);
|
ddsrt_mutex_unlock (&entity->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((participant_or_subscriber & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER ) ||\
|
|
||||||
((participant_or_subscriber & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT) )
|
|
||||||
_Pre_satisfies_(((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC ) ||\
|
|
||||||
((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_INTERNAL) )
|
|
||||||
dds_entity_t
|
dds_entity_t
|
||||||
dds_create_reader(
|
dds_create_reader(
|
||||||
_In_ dds_entity_t participant_or_subscriber,
|
dds_entity_t participant_or_subscriber,
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_qos_t * rqos;
|
dds_qos_t * rqos;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity * sub = NULL;
|
dds_entity * sub = NULL;
|
||||||
dds_entity_t subscriber;
|
dds_entity_t subscriber;
|
||||||
dds_reader * rd;
|
dds_reader * rd;
|
||||||
|
@ -467,16 +461,16 @@ dds_create_reader(
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_mutexUnlock(&tp->m_entity.m_mutex);
|
ddsrt_mutex_unlock(&tp->m_entity.m_mutex);
|
||||||
os_mutexUnlock(&sub->m_mutex);
|
ddsrt_mutex_unlock(&sub->m_mutex);
|
||||||
|
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_awake (thr);
|
thread_state_awake (thr);
|
||||||
}
|
}
|
||||||
rd->m_rd = new_reader(&rd->m_entity.m_guid, NULL, &sub->m_participant->m_guid, tp->m_stopic,
|
rd->m_rd = new_reader(&rd->m_entity.m_guid, NULL, &sub->m_participant->m_guid, tp->m_stopic,
|
||||||
rqos, rhc, dds_reader_status_cb, rd);
|
rqos, rhc, dds_reader_status_cb, rd);
|
||||||
os_mutexLock(&sub->m_mutex);
|
ddsrt_mutex_lock(&sub->m_mutex);
|
||||||
os_mutexLock(&tp->m_entity.m_mutex);
|
ddsrt_mutex_lock(&tp->m_entity.m_mutex);
|
||||||
assert (rd->m_rd);
|
assert (rd->m_rd);
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep (thr);
|
thread_state_asleep (thr);
|
||||||
|
@ -524,7 +518,7 @@ void dds_reader_ddsi2direct (dds_entity_t entity, ddsi2direct_directread_cb_t cb
|
||||||
struct proxy_writer *pwr;
|
struct proxy_writer *pwr;
|
||||||
struct rd_pwr_match *m;
|
struct rd_pwr_match *m;
|
||||||
memset (&pwrguid, 0, sizeof (pwrguid));
|
memset (&pwrguid, 0, sizeof (pwrguid));
|
||||||
os_mutexLock (&rd->e.lock);
|
ddsrt_mutex_lock (&rd->e.lock);
|
||||||
|
|
||||||
rd->ddsi2direct_cb = cb;
|
rd->ddsi2direct_cb = cb;
|
||||||
rd->ddsi2direct_cbarg = cbarg;
|
rd->ddsi2direct_cbarg = cbarg;
|
||||||
|
@ -542,18 +536,18 @@ void dds_reader_ddsi2direct (dds_entity_t entity, ddsi2direct_directread_cb_t cb
|
||||||
memset (&pwrguid_next, 0xff, sizeof (pwrguid_next));
|
memset (&pwrguid_next, 0xff, sizeof (pwrguid_next));
|
||||||
pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~(uint32_t)0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
|
pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~(uint32_t)0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&rd->e.lock);
|
ddsrt_mutex_unlock (&rd->e.lock);
|
||||||
if ((pwr = ephash_lookup_proxy_writer_guid (&pwrguid)) != NULL)
|
if ((pwr = ephash_lookup_proxy_writer_guid (&pwrguid)) != NULL)
|
||||||
{
|
{
|
||||||
os_mutexLock (&pwr->e.lock);
|
ddsrt_mutex_lock (&pwr->e.lock);
|
||||||
pwr->ddsi2direct_cb = cb;
|
pwr->ddsi2direct_cb = cb;
|
||||||
pwr->ddsi2direct_cbarg = cbarg;
|
pwr->ddsi2direct_cbarg = cbarg;
|
||||||
os_mutexUnlock (&pwr->e.lock);
|
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||||
}
|
}
|
||||||
pwrguid = pwrguid_next;
|
pwrguid = pwrguid_next;
|
||||||
os_mutexLock (&rd->e.lock);
|
ddsrt_mutex_lock (&rd->e.lock);
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&rd->e.lock);
|
ddsrt_mutex_unlock (&rd->e.lock);
|
||||||
ut_handle_release(entity, dds_rd->m_entity.m_hdllink);
|
ut_handle_release(entity, dds_rd->m_entity.m_hdllink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,13 +606,12 @@ dds_entity_t dds_get_subscriber (dds_entity_t entity)
|
||||||
return hdl;
|
return hdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_subscription_matched_status (
|
dds_get_subscription_matched_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_subscription_matched_status_t * status)
|
dds_subscription_matched_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -642,13 +635,12 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_liveliness_changed_status (
|
dds_get_liveliness_changed_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_liveliness_changed_status_t * status)
|
dds_liveliness_changed_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -672,12 +664,11 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t dds_get_sample_rejected_status (
|
dds_return_t dds_get_sample_rejected_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_sample_rejected_status_t * status)
|
dds_sample_rejected_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -701,12 +692,11 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t dds_get_sample_lost_status (
|
dds_return_t dds_get_sample_lost_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_sample_lost_status_t * status)
|
dds_sample_lost_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -729,12 +719,11 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t dds_get_requested_deadline_missed_status (
|
dds_return_t dds_get_requested_deadline_missed_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_requested_deadline_missed_status_t * status)
|
dds_requested_deadline_missed_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -757,12 +746,11 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
|
|
||||||
dds_return_t dds_get_requested_incompatible_qos_status (
|
dds_return_t dds_get_requested_incompatible_qos_status (
|
||||||
_In_ dds_entity_t reader,
|
dds_entity_t reader,
|
||||||
_Out_opt_ dds_requested_incompatible_qos_status_t * status)
|
dds_requested_incompatible_qos_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_reader *rd;
|
dds_reader *rd;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
|
|
@ -19,25 +19,25 @@
|
||||||
#define USE_VALGRIND 0
|
#define USE_VALGRIND 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
|
#include "dds/ddsrt/sync.h"
|
||||||
|
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "util/ut_hopscotch.h"
|
#include "dds/util/ut_hopscotch.h"
|
||||||
|
#include "dds/util/ut_avl.h"
|
||||||
#include "util/ut_avl.h"
|
#include "dds/ddsi/q_xqos.h"
|
||||||
#include "ddsi/q_xqos.h"
|
#include "dds/ddsi/q_error.h"
|
||||||
#include "ddsi/q_error.h"
|
#include "dds/ddsi/q_unused.h"
|
||||||
#include "ddsi/q_unused.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_globals.h"
|
||||||
#include "ddsi/q_globals.h"
|
#include "dds/ddsi/q_radmin.h" /* sampleinfo */
|
||||||
#include "ddsi/q_radmin.h" /* sampleinfo */
|
#include "dds/ddsi/q_entity.h" /* proxy_writer_info */
|
||||||
#include "ddsi/q_entity.h" /* proxy_writer_info */
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata_default.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h"
|
#include "dds/ddsi/sysdeps.h"
|
||||||
#include "ddsi/sysdeps.h"
|
|
||||||
|
|
||||||
/* INSTANCE MANAGEMENT
|
/* INSTANCE MANAGEMENT
|
||||||
===================
|
===================
|
||||||
|
@ -277,7 +277,7 @@ struct rhc {
|
||||||
|
|
||||||
/* Instance/Sample maximums from resource limits QoS */
|
/* Instance/Sample maximums from resource limits QoS */
|
||||||
|
|
||||||
os_atomic_uint32_t n_cbs; /* # callbacks in progress */
|
ddsrt_atomic_uint32_t n_cbs; /* # callbacks in progress */
|
||||||
int32_t max_instances; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
int32_t max_instances; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
||||||
int32_t max_samples; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
int32_t max_samples; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
||||||
int32_t max_samples_per_instance; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
int32_t max_samples_per_instance; /* FIXME: probably better as uint32_t with MAX_UINT32 for unlimited */
|
||||||
|
@ -300,7 +300,7 @@ struct rhc {
|
||||||
const struct ddsi_sertopic *topic; /* topic description */
|
const struct ddsi_sertopic *topic; /* topic description */
|
||||||
unsigned history_depth; /* depth, 1 for KEEP_LAST_1, 2**32-1 for KEEP_ALL */
|
unsigned history_depth; /* depth, 1 for KEEP_LAST_1, 2**32-1 for KEEP_ALL */
|
||||||
|
|
||||||
os_mutex lock;
|
ddsrt_mutex_t lock;
|
||||||
dds_readcond * conds; /* List of associated read conditions */
|
dds_readcond * conds; /* List of associated read conditions */
|
||||||
uint32_t nconds; /* Number of associated read conditions */
|
uint32_t nconds; /* Number of associated read conditions */
|
||||||
uint32_t nqconds; /* Number of associated query conditions */
|
uint32_t nqconds; /* Number of associated query conditions */
|
||||||
|
@ -400,7 +400,7 @@ static int instance_iid_eq (const void *va, const void *vb)
|
||||||
return (a->iid == b->iid);
|
return (a->iid == b->iid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_inst_to_nonempty_list (_Inout_ struct rhc *rhc, _Inout_ struct rhc_instance *inst)
|
static void add_inst_to_nonempty_list (struct rhc *rhc, struct rhc_instance *inst)
|
||||||
{
|
{
|
||||||
if (rhc->nonempty_instances == NULL)
|
if (rhc->nonempty_instances == NULL)
|
||||||
{
|
{
|
||||||
|
@ -455,11 +455,11 @@ static void remove_inst_from_nonempty_list (struct rhc *rhc, struct rhc_instance
|
||||||
|
|
||||||
struct rhc * dds_rhc_new (dds_reader * reader, const struct ddsi_sertopic * topic)
|
struct rhc * dds_rhc_new (dds_reader * reader, const struct ddsi_sertopic * topic)
|
||||||
{
|
{
|
||||||
struct rhc * rhc = os_malloc (sizeof (*rhc));
|
struct rhc * rhc = ddsrt_malloc (sizeof (*rhc));
|
||||||
memset (rhc, 0, sizeof (*rhc));
|
memset (rhc, 0, sizeof (*rhc));
|
||||||
|
|
||||||
lwregs_init (&rhc->registrations);
|
lwregs_init (&rhc->registrations);
|
||||||
os_mutexInit (&rhc->lock);
|
ddsrt_mutex_init (&rhc->lock);
|
||||||
rhc->instances = ut_hhNew (1, instance_iid_hash, instance_iid_eq);
|
rhc->instances = ut_hhNew (1, instance_iid_hash, instance_iid_eq);
|
||||||
rhc->topic = topic;
|
rhc->topic = topic;
|
||||||
rhc->reader = reader;
|
rhc->reader = reader;
|
||||||
|
@ -509,7 +509,7 @@ static struct rhc_sample *alloc_sample (struct rhc_instance *inst)
|
||||||
{
|
{
|
||||||
/* This instead of sizeof(rhc_sample) gets us type checking */
|
/* This instead of sizeof(rhc_sample) gets us type checking */
|
||||||
struct rhc_sample *s;
|
struct rhc_sample *s;
|
||||||
s = os_malloc (sizeof (*s));
|
s = ddsrt_malloc (sizeof (*s));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ static void free_sample (struct rhc_instance *inst, struct rhc_sample *s)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os_free (s);
|
ddsrt_free (s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ static void free_empty_instance (struct rhc_instance *inst)
|
||||||
{
|
{
|
||||||
assert (inst_is_empty (inst));
|
assert (inst_is_empty (inst));
|
||||||
ddsi_tkmap_instance_unref (inst->tk);
|
ddsi_tkmap_instance_unref (inst->tk);
|
||||||
os_free (inst);
|
ddsrt_free (inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_instance_rhc_free (struct rhc_instance *inst, struct rhc *rhc)
|
static void free_instance_rhc_free (struct rhc_instance *inst, struct rhc *rhc)
|
||||||
|
@ -598,17 +598,17 @@ static void free_instance_rhc_free (struct rhc_instance *inst, struct rhc *rhc)
|
||||||
remove_inst_from_nonempty_list (rhc, inst);
|
remove_inst_from_nonempty_list (rhc, inst);
|
||||||
}
|
}
|
||||||
ddsi_tkmap_instance_unref (inst->tk);
|
ddsi_tkmap_instance_unref (inst->tk);
|
||||||
os_free (inst);
|
ddsrt_free (inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t dds_rhc_lock_samples (struct rhc *rhc)
|
uint32_t dds_rhc_lock_samples (struct rhc *rhc)
|
||||||
{
|
{
|
||||||
uint32_t no;
|
uint32_t no;
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
no = rhc->n_vsamples + rhc->n_invsamples;
|
no = rhc->n_vsamples + rhc->n_invsamples;
|
||||||
if (no == 0)
|
if (no == 0)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
}
|
}
|
||||||
return no;
|
return no;
|
||||||
}
|
}
|
||||||
|
@ -627,19 +627,19 @@ void dds_rhc_free (struct rhc *rhc)
|
||||||
lwregs_fini (&rhc->registrations);
|
lwregs_fini (&rhc->registrations);
|
||||||
if (rhc->qcond_eval_samplebuf != NULL)
|
if (rhc->qcond_eval_samplebuf != NULL)
|
||||||
ddsi_sertopic_free_sample (rhc->topic, rhc->qcond_eval_samplebuf, DDS_FREE_ALL);
|
ddsi_sertopic_free_sample (rhc->topic, rhc->qcond_eval_samplebuf, DDS_FREE_ALL);
|
||||||
os_mutexDestroy (&rhc->lock);
|
ddsrt_mutex_destroy (&rhc->lock);
|
||||||
os_free (rhc);
|
ddsrt_free (rhc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_rhc_fini (struct rhc * rhc)
|
void dds_rhc_fini (struct rhc * rhc)
|
||||||
{
|
{
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
rhc->reader = NULL;
|
rhc->reader = NULL;
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
/* Wait for all callbacks to complete */
|
/* Wait for all callbacks to complete */
|
||||||
|
|
||||||
while (os_atomic_ld32 (&rhc->n_cbs) > 0)
|
while (ddsrt_atomic_ld32 (&rhc->n_cbs) > 0)
|
||||||
{
|
{
|
||||||
dds_sleepfor (DDS_MSECS (1));
|
dds_sleepfor (DDS_MSECS (1));
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1130,7 @@ static struct rhc_instance *alloc_new_instance (const struct rhc *rhc, const str
|
||||||
struct rhc_instance *inst;
|
struct rhc_instance *inst;
|
||||||
|
|
||||||
ddsi_tkmap_instance_ref (tk);
|
ddsi_tkmap_instance_ref (tk);
|
||||||
inst = os_malloc (sizeof (*inst));
|
inst = ddsrt_malloc (sizeof (*inst));
|
||||||
memset (inst, 0, sizeof (*inst));
|
memset (inst, 0, sizeof (*inst));
|
||||||
inst->iid = tk->m_iid;
|
inst->iid = tk->m_iid;
|
||||||
inst->tk = tk;
|
inst->tk = tk;
|
||||||
|
@ -1258,7 +1258,7 @@ bool dds_rhc_store (struct rhc * __restrict rhc, const struct proxy_writer_info
|
||||||
|
|
||||||
init_trigger_info_qcond (&trig_qc);
|
init_trigger_info_qcond (&trig_qc);
|
||||||
|
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
|
|
||||||
inst = ut_hhLookup (rhc->instances, &dummy_instance);
|
inst = ut_hhLookup (rhc->instances, &dummy_instance);
|
||||||
if (inst == NULL)
|
if (inst == NULL)
|
||||||
|
@ -1463,15 +1463,15 @@ bool dds_rhc_store (struct rhc * __restrict rhc, const struct proxy_writer_info
|
||||||
|
|
||||||
assert (rhc_check_counts_locked (rhc, true, true));
|
assert (rhc_check_counts_locked (rhc, true, true));
|
||||||
|
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
if (rhc->reader)
|
if (rhc->reader)
|
||||||
{
|
{
|
||||||
if (notify_data_available && (rhc->reader->m_entity.m_status_enable & DDS_DATA_AVAILABLE_STATUS))
|
if (notify_data_available && (rhc->reader->m_entity.m_status_enable & DDS_DATA_AVAILABLE_STATUS))
|
||||||
{
|
{
|
||||||
os_atomic_inc32 (&rhc->n_cbs);
|
ddsrt_atomic_inc32 (&rhc->n_cbs);
|
||||||
dds_reader_data_available_cb (rhc->reader);
|
dds_reader_data_available_cb (rhc->reader);
|
||||||
os_atomic_dec32 (&rhc->n_cbs);
|
ddsrt_atomic_dec32 (&rhc->n_cbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trigger_waitsets)
|
if (trigger_waitsets)
|
||||||
|
@ -1489,16 +1489,16 @@ error_or_nochange:
|
||||||
delivered = false;
|
delivered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
TRACE (")\n");
|
TRACE (")\n");
|
||||||
|
|
||||||
/* Make any reader status callback */
|
/* Make any reader status callback */
|
||||||
|
|
||||||
if (cb_data.raw_status_id >= 0 && rhc->reader && rhc->reader->m_entity.m_status_enable)
|
if (cb_data.raw_status_id >= 0 && rhc->reader && rhc->reader->m_entity.m_status_enable)
|
||||||
{
|
{
|
||||||
os_atomic_inc32 (&rhc->n_cbs);
|
ddsrt_atomic_inc32 (&rhc->n_cbs);
|
||||||
dds_reader_status_cb (&rhc->reader->m_entity, &cb_data);
|
dds_reader_status_cb (&rhc->reader->m_entity, &cb_data);
|
||||||
os_atomic_dec32 (&rhc->n_cbs);
|
ddsrt_atomic_dec32 (&rhc->n_cbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return delivered;
|
return delivered;
|
||||||
|
@ -1527,7 +1527,7 @@ void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writ
|
||||||
const uint64_t wr_iid = pwr_info->iid;
|
const uint64_t wr_iid = pwr_info->iid;
|
||||||
const int auto_dispose = pwr_info->auto_dispose;
|
const int auto_dispose = pwr_info->auto_dispose;
|
||||||
|
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
TRACE ("rhc_unregister_wr_iid(%"PRIx64",%d:\n", wr_iid, auto_dispose);
|
TRACE ("rhc_unregister_wr_iid(%"PRIx64",%d:\n", wr_iid, auto_dispose);
|
||||||
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
|
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
|
||||||
{
|
{
|
||||||
|
@ -1573,7 +1573,7 @@ void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE (")\n");
|
TRACE (")\n");
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
if (trigger_waitsets)
|
if (trigger_waitsets)
|
||||||
dds_entity_status_signal (&rhc->reader->m_entity);
|
dds_entity_status_signal (&rhc->reader->m_entity);
|
||||||
|
@ -1583,7 +1583,7 @@ void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t w
|
||||||
{
|
{
|
||||||
struct rhc_instance *inst;
|
struct rhc_instance *inst;
|
||||||
struct ut_hhIter iter;
|
struct ut_hhIter iter;
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
TRACE ("rhc_relinquish_ownership(%"PRIx64":\n", wr_iid);
|
TRACE ("rhc_relinquish_ownership(%"PRIx64":\n", wr_iid);
|
||||||
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
|
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
|
||||||
{
|
{
|
||||||
|
@ -1594,7 +1594,7 @@ void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t w
|
||||||
}
|
}
|
||||||
TRACE (")\n");
|
TRACE (")\n");
|
||||||
assert (rhc_check_counts_locked (rhc, true, false));
|
assert (rhc_check_counts_locked (rhc, true, false));
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STATUSES:
|
/* STATUSES:
|
||||||
|
@ -1778,7 +1778,7 @@ static int dds_rhc_read_w_qminv (struct rhc *rhc, bool lock, void **values, dds_
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
{
|
{
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE ("read_w_qminv(%p,%p,%p,%u,%x,%p) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
TRACE ("read_w_qminv(%p,%p,%p,%u,%x,%p) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
||||||
|
@ -1884,7 +1884,7 @@ static int dds_rhc_read_w_qminv (struct rhc *rhc, bool lock, void **values, dds_
|
||||||
}
|
}
|
||||||
TRACE ("read: returning %u\n", n);
|
TRACE ("read: returning %u\n", n);
|
||||||
assert (rhc_check_counts_locked (rhc, true, false));
|
assert (rhc_check_counts_locked (rhc, true, false));
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
if (trigger_waitsets)
|
if (trigger_waitsets)
|
||||||
dds_entity_status_signal (&rhc->reader->m_entity);
|
dds_entity_status_signal (&rhc->reader->m_entity);
|
||||||
|
@ -1901,7 +1901,7 @@ static int dds_rhc_take_w_qminv (struct rhc *rhc, bool lock, void **values, dds_
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
{
|
{
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE ("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
TRACE ("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
||||||
|
@ -2046,7 +2046,7 @@ static int dds_rhc_take_w_qminv (struct rhc *rhc, bool lock, void **values, dds_
|
||||||
}
|
}
|
||||||
TRACE ("take: returning %u\n", n);
|
TRACE ("take: returning %u\n", n);
|
||||||
assert (rhc_check_counts_locked (rhc, true, false));
|
assert (rhc_check_counts_locked (rhc, true, false));
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
if (trigger_waitsets)
|
if (trigger_waitsets)
|
||||||
dds_entity_status_signal(&rhc->reader->m_entity);
|
dds_entity_status_signal(&rhc->reader->m_entity);
|
||||||
|
@ -2064,7 +2064,7 @@ static int dds_rhc_takecdr_w_qminv (struct rhc *rhc, bool lock, struct ddsi_serd
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
{
|
{
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE ("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
TRACE ("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
|
||||||
|
@ -2198,7 +2198,7 @@ static int dds_rhc_takecdr_w_qminv (struct rhc *rhc, bool lock, struct ddsi_serd
|
||||||
}
|
}
|
||||||
TRACE ("take: returning %u\n", n);
|
TRACE ("take: returning %u\n", n);
|
||||||
assert (rhc_check_counts_locked (rhc, true, false));
|
assert (rhc_check_counts_locked (rhc, true, false));
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
|
|
||||||
if (trigger_waitsets)
|
if (trigger_waitsets)
|
||||||
dds_entity_status_signal (&rhc->reader->m_entity);
|
dds_entity_status_signal (&rhc->reader->m_entity);
|
||||||
|
@ -2267,7 +2267,7 @@ bool dds_rhc_add_readcondition (dds_readcond *cond)
|
||||||
|
|
||||||
cond->m_qminv = qmask_from_dcpsquery (cond->m_sample_states, cond->m_view_states, cond->m_instance_states);
|
cond->m_qminv = qmask_from_dcpsquery (cond->m_sample_states, cond->m_view_states, cond->m_instance_states);
|
||||||
|
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
|
|
||||||
/* Allocate a slot in the condition bitmasks; return an error no more slots are available */
|
/* Allocate a slot in the condition bitmasks; return an error no more slots are available */
|
||||||
if (cond->m_query.m_filter != 0)
|
if (cond->m_query.m_filter != 0)
|
||||||
|
@ -2281,7 +2281,7 @@ bool dds_rhc_add_readcondition (dds_readcond *cond)
|
||||||
if (avail_qcmask == 0)
|
if (avail_qcmask == 0)
|
||||||
{
|
{
|
||||||
/* no available indices */
|
/* no available indices */
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2350,7 +2350,7 @@ bool dds_rhc_add_readcondition (dds_readcond *cond)
|
||||||
(void *) rhc, cond->m_sample_states, cond->m_view_states,
|
(void *) rhc, cond->m_sample_states, cond->m_view_states,
|
||||||
cond->m_instance_states, (void *) cond, cond->m_qminv, rhc->nconds);
|
cond->m_instance_states, (void *) cond, cond->m_qminv, rhc->nconds);
|
||||||
|
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2358,7 +2358,7 @@ void dds_rhc_remove_readcondition (dds_readcond *cond)
|
||||||
{
|
{
|
||||||
struct rhc *rhc = cond->m_rhc;
|
struct rhc *rhc = cond->m_rhc;
|
||||||
dds_readcond **ptr;
|
dds_readcond **ptr;
|
||||||
os_mutexLock (&rhc->lock);
|
ddsrt_mutex_lock (&rhc->lock);
|
||||||
ptr = &rhc->conds;
|
ptr = &rhc->conds;
|
||||||
while (*ptr != cond)
|
while (*ptr != cond)
|
||||||
ptr = &(*ptr)->m_next;
|
ptr = &(*ptr)->m_next;
|
||||||
|
@ -2376,7 +2376,7 @@ void dds_rhc_remove_readcondition (dds_readcond *cond)
|
||||||
rhc->qcond_eval_samplebuf = NULL;
|
rhc->qcond_eval_samplebuf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&rhc->lock);
|
ddsrt_mutex_unlock (&rhc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool update_conditions_locked (struct rhc *rhc, bool called_from_insert, const struct trigger_info_pre *pre, const struct trigger_info_post *post, const struct trigger_info_qcond *trig_qc, const struct rhc_instance *inst)
|
static bool update_conditions_locked (struct rhc *rhc, bool called_from_insert, const struct trigger_info_pre *pre, const struct trigger_info_post *post, const struct trigger_info_qcond *trig_qc, const struct rhc_instance *inst)
|
||||||
|
|
|
@ -14,19 +14,16 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
#include "ddsi/q_md5.h"
|
#include "dds/ddsi/q_md5.h"
|
||||||
#include "ddsi/q_bswap.h"
|
#include "dds/ddsi/q_bswap.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/q_freelist.h"
|
#include "dds/ddsi/q_freelist.h"
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "os/os.h"
|
|
||||||
#include "dds__key.h"
|
#include "dds__key.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "dds__serdata_builtintopic.h"
|
#include "dds__serdata_builtintopic.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
|
|
||||||
static const uint64_t unihashconsts[] = {
|
static const uint64_t unihashconsts[] = {
|
||||||
UINT64_C (16292676669999574021),
|
UINT64_C (16292676669999574021),
|
||||||
|
@ -63,12 +60,12 @@ static void serdata_builtin_free(struct ddsi_serdata *dcmn)
|
||||||
struct ddsi_serdata_builtintopic *d = (struct ddsi_serdata_builtintopic *)dcmn;
|
struct ddsi_serdata_builtintopic *d = (struct ddsi_serdata_builtintopic *)dcmn;
|
||||||
if (d->c.kind == SDK_DATA)
|
if (d->c.kind == SDK_DATA)
|
||||||
nn_xqos_fini (&d->xqos);
|
nn_xqos_fini (&d->xqos);
|
||||||
os_free (d);
|
ddsrt_free (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ddsi_serdata_builtintopic *serdata_builtin_new(const struct ddsi_sertopic_builtintopic *tp, enum ddsi_serdata_kind kind)
|
static struct ddsi_serdata_builtintopic *serdata_builtin_new(const struct ddsi_sertopic_builtintopic *tp, enum ddsi_serdata_kind kind)
|
||||||
{
|
{
|
||||||
struct ddsi_serdata_builtintopic *d = os_malloc(sizeof (*d));
|
struct ddsi_serdata_builtintopic *d = ddsrt_malloc(sizeof (*d));
|
||||||
ddsi_serdata_init (&d->c, &tp->c, kind);
|
ddsi_serdata_init (&d->c, &tp->c, kind);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +185,7 @@ static dds_qos_t *dds_qos_from_xqos_reuse (dds_qos_t *old, const nn_xqos_t *src)
|
||||||
{
|
{
|
||||||
if (old == NULL)
|
if (old == NULL)
|
||||||
{
|
{
|
||||||
old = os_malloc (sizeof (*old));
|
old = ddsrt_malloc (sizeof (*old));
|
||||||
nn_xqos_init_empty (old);
|
nn_xqos_init_empty (old);
|
||||||
old->present |= QP_TOPIC_NAME | QP_TYPE_NAME;
|
old->present |= QP_TOPIC_NAME | QP_TYPE_NAME;
|
||||||
nn_xqos_mergein_missing (old, src);
|
nn_xqos_mergein_missing (old, src);
|
||||||
|
@ -267,13 +264,13 @@ static void serdata_builtin_to_ser (const struct ddsi_serdata *serdata_common, s
|
||||||
(void)serdata_common; (void)off; (void)sz; (void)buf;
|
(void)serdata_common; (void)off; (void)sz; (void)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ddsi_serdata *serdata_builtin_to_ser_ref (const struct ddsi_serdata *serdata_common, size_t off, size_t sz, os_iovec_t *ref)
|
static struct ddsi_serdata *serdata_builtin_to_ser_ref (const struct ddsi_serdata *serdata_common, size_t off, size_t sz, ddsrt_iovec_t *ref)
|
||||||
{
|
{
|
||||||
(void)serdata_common; (void)off; (void)sz; (void)ref;
|
(void)serdata_common; (void)off; (void)sz; (void)ref;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serdata_builtin_to_ser_unref (struct ddsi_serdata *serdata_common, const os_iovec_t *ref)
|
static void serdata_builtin_to_ser_unref (struct ddsi_serdata *serdata_common, const ddsrt_iovec_t *ref)
|
||||||
{
|
{
|
||||||
(void)serdata_common; (void)ref;
|
(void)serdata_common; (void)ref;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,20 +14,20 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/dds.h"
|
||||||
#include "ddsi/q_md5.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
#include "ddsi/q_bswap.h"
|
#include "dds/ddsi/q_md5.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_bswap.h"
|
||||||
#include "ddsi/q_freelist.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/q_freelist.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
#include "dds__serdata_builtintopic.h"
|
#include "dds__serdata_builtintopic.h"
|
||||||
|
|
||||||
/* FIXME: sertopic /= ddstopic so a lot of stuff needs to be moved here from dds_topic.c and the free function needs to be implemented properly */
|
/* FIXME: sertopic /= ddstopic so a lot of stuff needs to be moved here from dds_topic.c and the free function needs to be implemented properly */
|
||||||
|
|
||||||
struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic_type type, const char *name, const char *typename)
|
struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic_type type, const char *name, const char *typename)
|
||||||
{
|
{
|
||||||
struct ddsi_sertopic_builtintopic *tp = os_malloc (sizeof (*tp));
|
struct ddsi_sertopic_builtintopic *tp = ddsrt_malloc (sizeof (*tp));
|
||||||
tp->c.iid = ddsi_iid_gen();
|
tp->c.iid = ddsi_iid_gen();
|
||||||
tp->c.name = dds_string_dup (name);
|
tp->c.name = dds_string_dup (name);
|
||||||
tp->c.typename = dds_string_dup (typename);
|
tp->c.typename = dds_string_dup (typename);
|
||||||
|
@ -39,7 +39,7 @@ struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic
|
||||||
tp->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (tp->c.serdata_ops);
|
tp->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (tp->c.serdata_ops);
|
||||||
tp->c.status_cb = 0;
|
tp->c.status_cb = 0;
|
||||||
tp->c.status_cb_entity = NULL;
|
tp->c.status_cb_entity = NULL;
|
||||||
os_atomic_st32 (&tp->c.refc, 1);
|
ddsrt_atomic_st32 (&tp->c.refc, 1);
|
||||||
tp->type = type;
|
tp->type = type;
|
||||||
return &tp->c;
|
return &tp->c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ddsi/q_bswap.h"
|
#include "dds/ddsi/q_bswap.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "dds__key.h"
|
#include "dds__key.h"
|
||||||
#include "dds__alloc.h"
|
#include "dds__alloc.h"
|
||||||
#include "os/os.h"
|
#include "dds/ddsi/q_md5.h"
|
||||||
#include "ddsi/q_md5.h"
|
#include "dds/ddsrt/endian.h"
|
||||||
|
|
||||||
//#define OP_DEBUG_READ 1
|
//#define OP_DEBUG_READ 1
|
||||||
//#define OP_DEBUG_WRITE 1
|
//#define OP_DEBUG_WRITE 1
|
||||||
|
@ -32,7 +32,7 @@ static const char * stream_op_type[11] =
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OS_ENDIANNESS == OS_LITTLE_ENDIAN
|
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
|
||||||
#define DDS_ENDIAN true
|
#define DDS_ENDIAN true
|
||||||
#else
|
#else
|
||||||
#define DDS_ENDIAN false
|
#define DDS_ENDIAN false
|
||||||
|
@ -139,7 +139,7 @@ bool dds_stream_endian (void)
|
||||||
return DDS_ENDIAN;
|
return DDS_ENDIAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t dds_stream_check_optimize (_In_ const dds_topic_descriptor_t * desc)
|
size_t dds_stream_check_optimize (const dds_topic_descriptor_t * desc)
|
||||||
{
|
{
|
||||||
dds_stream_t os;
|
dds_stream_t os;
|
||||||
void * sample = dds_alloc (desc->m_size);
|
void * sample = dds_alloc (desc->m_size);
|
||||||
|
@ -1193,7 +1193,7 @@ void dds_stream_write_sample (dds_stream_t * os, const void * data, const struct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_stream_from_serdata_default (_Out_ dds_stream_t * s, _In_ const struct ddsi_serdata_default *d)
|
void dds_stream_from_serdata_default (dds_stream_t * s, const struct ddsi_serdata_default *d)
|
||||||
{
|
{
|
||||||
s->m_failed = false;
|
s->m_failed = false;
|
||||||
s->m_buffer.p8 = (uint8_t*) d;
|
s->m_buffer.p8 = (uint8_t*) d;
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
#include "dds/version.h"
|
||||||
|
|
||||||
#define DDS_SUBSCRIBER_STATUS_MASK \
|
#define DDS_SUBSCRIBER_STATUS_MASK \
|
||||||
DDS_DATA_ON_READERS_STATUS
|
DDS_DATA_ON_READERS_STATUS
|
||||||
|
@ -33,8 +33,8 @@ dds_subscriber_instance_hdl(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds__subscriber_qos_validate(
|
dds__subscriber_qos_validate(
|
||||||
_In_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_ bool enabled)
|
bool enabled)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ dds_subscriber_qos_set(
|
||||||
if (ret == DDS_RETCODE_OK) {
|
if (ret == DDS_RETCODE_OK) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
|
||||||
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
|
DDS_ERROR(DDS_PROJECT_NAME" does not support changing QoS policies yet\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,11 @@ dds_subscriber_status_validate(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Requires_exclusive_lock_held_(participant)
|
dds_entity_t
|
||||||
_Check_return_ dds_entity_t
|
|
||||||
dds__create_subscriber_l(
|
dds__create_subscriber_l(
|
||||||
_Inout_ dds_entity *participant, /* entity-lock must be held */
|
dds_entity *participant, /* entity-lock must be held */
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_subscriber * sub;
|
dds_subscriber * sub;
|
||||||
dds_entity_t subscriber;
|
dds_entity_t subscriber;
|
||||||
|
@ -136,16 +135,15 @@ err_param:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
dds_entity_t
|
||||||
_Must_inspect_result_ dds_entity_t
|
|
||||||
dds_create_subscriber(
|
dds_create_subscriber(
|
||||||
_In_ dds_entity_t participant,
|
dds_entity_t participant,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds_entity * par;
|
dds_entity * par;
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds__retcode_t errnr;
|
dds_retcode_t errnr;
|
||||||
|
|
||||||
errnr = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
errnr = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
||||||
if (errnr != DDS_RETCODE_OK) {
|
if (errnr != DDS_RETCODE_OK) {
|
||||||
|
@ -160,14 +158,13 @@ dds_create_subscriber(
|
||||||
return hdl;
|
return hdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((subscriber & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_notify_readers(
|
dds_notify_readers(
|
||||||
_In_ dds_entity_t subscriber)
|
dds_entity_t subscriber)
|
||||||
{
|
{
|
||||||
dds_entity *iter;
|
dds_entity *iter;
|
||||||
dds_entity *sub;
|
dds_entity *sub;
|
||||||
dds__retcode_t errnr;
|
dds_retcode_t errnr;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
errnr = dds_entity_lock(subscriber, DDS_KIND_SUBSCRIBER, &sub);
|
errnr = dds_entity_lock(subscriber, DDS_KIND_SUBSCRIBER, &sub);
|
||||||
|
@ -177,9 +174,9 @@ dds_notify_readers(
|
||||||
ret = DDS_ERRNO(errnr);
|
ret = DDS_ERRNO(errnr);
|
||||||
iter = sub->m_children;
|
iter = sub->m_children;
|
||||||
while (iter) {
|
while (iter) {
|
||||||
os_mutexLock(&iter->m_mutex);
|
ddsrt_mutex_lock(&iter->m_mutex);
|
||||||
// TODO: check if reader has data available, call listener
|
// TODO: check if reader has data available, call listener
|
||||||
os_mutexUnlock(&iter->m_mutex);
|
ddsrt_mutex_unlock(&iter->m_mutex);
|
||||||
iter = iter->m_next;
|
iter = iter->m_next;
|
||||||
}
|
}
|
||||||
dds_entity_unlock(sub);
|
dds_entity_unlock(sub);
|
||||||
|
@ -193,7 +190,7 @@ dds_notify_readers(
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_subscriber_begin_coherent(
|
dds_subscriber_begin_coherent(
|
||||||
_In_ dds_entity_t e)
|
dds_entity_t e)
|
||||||
{
|
{
|
||||||
/* TODO: CHAM-124 Currently unsupported. */
|
/* TODO: CHAM-124 Currently unsupported. */
|
||||||
(void)e;
|
(void)e;
|
||||||
|
@ -203,7 +200,7 @@ dds_subscriber_begin_coherent(
|
||||||
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_subscriber_end_coherent(
|
dds_subscriber_end_coherent(
|
||||||
_In_ dds_entity_t e)
|
dds_entity_t e)
|
||||||
{
|
{
|
||||||
/* TODO: CHAM-124 Currently unsupported. */
|
/* TODO: CHAM-124 Currently unsupported. */
|
||||||
(void)e;
|
(void)e;
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
#include "ddsc/dds.h"
|
|
||||||
#include "os/os.h"
|
|
||||||
|
|
||||||
dds_time_t dds_time (void)
|
|
||||||
{
|
|
||||||
os_time time;
|
|
||||||
|
|
||||||
/* Get the current time */
|
|
||||||
time = os_timeGet ();
|
|
||||||
|
|
||||||
/* convert os_time to dds_time_t */
|
|
||||||
dds_time_t dds_time = time.tv_nsec + (time.tv_sec * DDS_NSECS_IN_SEC);
|
|
||||||
|
|
||||||
return dds_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dds_sleepfor (dds_duration_t n)
|
|
||||||
{
|
|
||||||
os_time interval = { (os_timeSec) (n / DDS_NSECS_IN_SEC), (int32_t) (n % DDS_NSECS_IN_SEC) };
|
|
||||||
os_nanoSleep (interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dds_sleepuntil (dds_time_t n)
|
|
||||||
{
|
|
||||||
dds_time_t interval = n - dds_time ();
|
|
||||||
if (interval > 0)
|
|
||||||
{
|
|
||||||
dds_sleepfor (interval);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "dds/ddsrt/atomics.h"
|
||||||
#include "dds__topic.h"
|
#include "dds__topic.h"
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
|
@ -19,12 +21,11 @@
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "dds/ddsi/ddsi_sertopic.h"
|
||||||
#include "ddsi/q_ddsi_discovery.h"
|
#include "dds/ddsi/q_ddsi_discovery.h"
|
||||||
#include "os/os_atomics.h"
|
#include "dds/ddsi/ddsi_iid.h"
|
||||||
#include "ddsi/ddsi_iid.h"
|
|
||||||
|
|
||||||
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_topic)
|
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_topic)
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ const dds_entity_t DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION = (DDS_KIND_INTERNAL + 4);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_valid_name(
|
is_valid_name(
|
||||||
_In_ const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
/* DDS Spec:
|
/* DDS Spec:
|
||||||
|
@ -75,7 +76,7 @@ is_valid_name(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_topic_status_validate(
|
dds_topic_status_validate(
|
||||||
uint32_t mask)
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -96,25 +97,25 @@ static void dds_topic_status_cb (struct dds_topic *tp)
|
||||||
{
|
{
|
||||||
struct dds_listener const * const lst = &tp->m_entity.m_listener;
|
struct dds_listener const * const lst = &tp->m_entity.m_listener;
|
||||||
|
|
||||||
os_mutexLock (&tp->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&tp->m_entity.m_observers_lock);
|
||||||
while (tp->m_entity.m_cb_count > 0)
|
while (tp->m_entity.m_cb_count > 0)
|
||||||
os_condWait (&tp->m_entity.m_observers_cond, &tp->m_entity.m_observers_lock);
|
ddsrt_cond_wait (&tp->m_entity.m_observers_cond, &tp->m_entity.m_observers_lock);
|
||||||
tp->m_entity.m_cb_count++;
|
tp->m_entity.m_cb_count++;
|
||||||
|
|
||||||
tp->m_inconsistent_topic_status.total_count++;
|
tp->m_inconsistent_topic_status.total_count++;
|
||||||
tp->m_inconsistent_topic_status.total_count_change++;
|
tp->m_inconsistent_topic_status.total_count_change++;
|
||||||
if (lst->on_inconsistent_topic)
|
if (lst->on_inconsistent_topic)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&tp->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&tp->m_entity.m_observers_lock);
|
||||||
dds_entity_invoke_listener(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS_ID, &tp->m_inconsistent_topic_status);
|
dds_entity_invoke_listener(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS_ID, &tp->m_inconsistent_topic_status);
|
||||||
os_mutexLock (&tp->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&tp->m_entity.m_observers_lock);
|
||||||
tp->m_inconsistent_topic_status.total_count_change = 0;
|
tp->m_inconsistent_topic_status.total_count_change = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dds_entity_status_set(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS);
|
dds_entity_status_set(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS);
|
||||||
tp->m_entity.m_cb_count--;
|
tp->m_entity.m_cb_count--;
|
||||||
os_condBroadcast (&tp->m_entity.m_observers_cond);
|
ddsrt_cond_broadcast (&tp->m_entity.m_observers_cond);
|
||||||
os_mutexUnlock (&tp->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&tp->m_entity.m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ddsi_sertopic *
|
struct ddsi_sertopic *
|
||||||
|
@ -144,9 +145,9 @@ dds_topic_lookup(
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct ddsi_sertopic *st;
|
struct ddsi_sertopic *st;
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
st = dds_topic_lookup_locked(domain, name);
|
st = dds_topic_lookup_locked(domain, name);
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,12 +160,12 @@ dds_topic_free(
|
||||||
|
|
||||||
assert (st);
|
assert (st);
|
||||||
|
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
domain = ut_avlLookup (&dds_domaintree_def, &dds_global.m_domains, &domainid);
|
domain = ut_avlLookup (&dds_domaintree_def, &dds_global.m_domains, &domainid);
|
||||||
if (domain != NULL) {
|
if (domain != NULL) {
|
||||||
ut_avlDelete (&dds_topictree_def, &domain->m_topics, st);
|
ut_avlDelete (&dds_topictree_def, &domain->m_topics, st);
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
st->status_cb_entity = NULL;
|
st->status_cb_entity = NULL;
|
||||||
ddsi_sertopic_unref (st);
|
ddsi_sertopic_unref (st);
|
||||||
}
|
}
|
||||||
|
@ -180,21 +181,20 @@ dds_topic_add_locked(
|
||||||
ut_avlInsert (&dds_topictree_def, &dom->m_topics, st);
|
ut_avlInsert (&dds_topictree_def, &dom->m_topics, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
|
||||||
DDS_EXPORT dds_entity_t
|
DDS_EXPORT dds_entity_t
|
||||||
dds_find_topic(
|
dds_find_topic(
|
||||||
_In_ dds_entity_t participant,
|
dds_entity_t participant,
|
||||||
_In_z_ const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
dds_entity_t tp;
|
dds_entity_t tp;
|
||||||
dds_entity *p = NULL;
|
dds_entity *p = NULL;
|
||||||
struct ddsi_sertopic *st;
|
struct ddsi_sertopic *st;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &p);
|
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &p);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
st = dds_topic_lookup_locked (p->m_domain, name);
|
st = dds_topic_lookup_locked (p->m_domain, name);
|
||||||
if (st) {
|
if (st) {
|
||||||
dds_entity_add_ref (&st->status_cb_entity->m_entity);
|
dds_entity_add_ref (&st->status_cb_entity->m_entity);
|
||||||
|
@ -203,7 +203,7 @@ dds_find_topic(
|
||||||
DDS_ERROR("Topic is not being created yet\n");
|
DDS_ERROR("Topic is not being created yet\n");
|
||||||
tp = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
|
tp = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
dds_entity_unlock(p);
|
dds_entity_unlock(p);
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR("Error occurred on locking entity\n");
|
DDS_ERROR("Error occurred on locking entity\n");
|
||||||
|
@ -303,18 +303,17 @@ static bool sertopic_equivalent (const struct ddsi_sertopic *a, const struct dds
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
|
||||||
DDS_EXPORT dds_entity_t
|
DDS_EXPORT dds_entity_t
|
||||||
dds_create_topic_arbitrary (
|
dds_create_topic_arbitrary (
|
||||||
_In_ dds_entity_t participant,
|
dds_entity_t participant,
|
||||||
_In_ struct ddsi_sertopic *sertopic,
|
struct ddsi_sertopic *sertopic,
|
||||||
_In_z_ const char *name,
|
const char *name,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener,
|
const dds_listener_t *listener,
|
||||||
_In_opt_ const nn_plist_t *sedp_plist)
|
const nn_plist_t *sedp_plist)
|
||||||
{
|
{
|
||||||
struct ddsi_sertopic *stgeneric;
|
struct ddsi_sertopic *stgeneric;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_entity *par;
|
dds_entity *par;
|
||||||
dds_topic *top;
|
dds_topic *top;
|
||||||
dds_qos_t *new_qos = NULL;
|
dds_qos_t *new_qos = NULL;
|
||||||
|
@ -359,7 +358,7 @@ dds_create_topic_arbitrary (
|
||||||
/* FIXME: I find it weird that qos may be NULL in the entity */
|
/* FIXME: I find it weird that qos may be NULL in the entity */
|
||||||
|
|
||||||
/* Check if topic already exists with same name */
|
/* Check if topic already exists with same name */
|
||||||
os_mutexLock (&dds_global.m_mutex);
|
ddsrt_mutex_lock (&dds_global.m_mutex);
|
||||||
if ((stgeneric = dds_topic_lookup_locked (par->m_domain, name)) != NULL) {
|
if ((stgeneric = dds_topic_lookup_locked (par->m_domain, name)) != NULL) {
|
||||||
if (!sertopic_equivalent (stgeneric,sertopic)) {
|
if (!sertopic_equivalent (stgeneric,sertopic)) {
|
||||||
/* FIXME: should copy the type, perhaps? but then the pointers will no longer be the same */
|
/* FIXME: should copy the type, perhaps? but then the pointers will no longer be the same */
|
||||||
|
@ -373,7 +372,7 @@ dds_create_topic_arbitrary (
|
||||||
dds_entity_add_ref (&stgeneric->status_cb_entity->m_entity);
|
dds_entity_add_ref (&stgeneric->status_cb_entity->m_entity);
|
||||||
hdl = stgeneric->status_cb_entity->m_entity.m_hdl;
|
hdl = stgeneric->status_cb_entity->m_entity.m_hdl;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
} else {
|
} else {
|
||||||
if (qos) {
|
if (qos) {
|
||||||
new_qos = dds_create_qos();
|
new_qos = dds_create_qos();
|
||||||
|
@ -393,7 +392,7 @@ dds_create_topic_arbitrary (
|
||||||
|
|
||||||
/* Add topic to extent */
|
/* Add topic to extent */
|
||||||
dds_topic_add_locked (par->m_domainid, sertopic);
|
dds_topic_add_locked (par->m_domainid, sertopic);
|
||||||
os_mutexUnlock (&dds_global.m_mutex);
|
ddsrt_mutex_unlock (&dds_global.m_mutex);
|
||||||
|
|
||||||
/* Publish Topic */
|
/* Publish Topic */
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
|
@ -416,14 +415,13 @@ bad_param_err:
|
||||||
return hdl;
|
return hdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
|
||||||
DDS_EXPORT dds_entity_t
|
DDS_EXPORT dds_entity_t
|
||||||
dds_create_topic(
|
dds_create_topic(
|
||||||
_In_ dds_entity_t participant,
|
dds_entity_t participant,
|
||||||
_In_ const dds_topic_descriptor_t *desc,
|
const dds_topic_descriptor_t *desc,
|
||||||
_In_z_ const char *name,
|
const char *name,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
char *key = NULL;
|
char *key = NULL;
|
||||||
struct ddsi_sertopic_default *st;
|
struct ddsi_sertopic_default *st;
|
||||||
|
@ -459,7 +457,7 @@ dds_create_topic(
|
||||||
|
|
||||||
st = dds_alloc (sizeof (*st));
|
st = dds_alloc (sizeof (*st));
|
||||||
|
|
||||||
os_atomic_st32 (&st->c.refc, 1);
|
ddsrt_atomic_st32 (&st->c.refc, 1);
|
||||||
st->c.iid = ddsi_iid_gen ();
|
st->c.iid = ddsi_iid_gen ();
|
||||||
st->c.status_cb = dds_topic_status_cb;
|
st->c.status_cb = dds_topic_status_cb;
|
||||||
st->c.status_cb_entity = NULL; /* set by dds_create_topic_arbitrary */
|
st->c.status_cb_entity = NULL; /* set by dds_create_topic_arbitrary */
|
||||||
|
@ -469,7 +467,7 @@ dds_create_topic(
|
||||||
st->c.ops = &ddsi_sertopic_ops_default;
|
st->c.ops = &ddsi_sertopic_ops_default;
|
||||||
st->c.serdata_ops = desc->m_nkeys ? &ddsi_serdata_ops_cdr : &ddsi_serdata_ops_cdr_nokey;
|
st->c.serdata_ops = desc->m_nkeys ? &ddsi_serdata_ops_cdr : &ddsi_serdata_ops_cdr_nokey;
|
||||||
st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
|
st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
|
||||||
st->native_encoding_identifier = (PLATFORM_IS_LITTLE_ENDIAN ? CDR_LE : CDR_BE);
|
st->native_encoding_identifier = (DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN ? CDR_LE : CDR_BE);
|
||||||
|
|
||||||
st->type = (void*) desc;
|
st->type = (void*) desc;
|
||||||
st->nkeys = desc->m_nkeys;
|
st->nkeys = desc->m_nkeys;
|
||||||
|
@ -543,7 +541,6 @@ dds_topic_mod_filter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
void
|
void
|
||||||
dds_set_topic_filter(
|
dds_set_topic_filter(
|
||||||
dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
|
@ -554,7 +551,6 @@ dds_set_topic_filter(
|
||||||
dds_topic_mod_filter (topic, &chaining, &realf, true);
|
dds_topic_mod_filter (topic, &chaining, &realf, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
void
|
void
|
||||||
dds_topic_set_filter(
|
dds_topic_set_filter(
|
||||||
dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
|
@ -563,7 +559,6 @@ dds_topic_set_filter(
|
||||||
dds_set_topic_filter(topic, filter);
|
dds_set_topic_filter(topic, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
dds_topic_filter_fn
|
dds_topic_filter_fn
|
||||||
dds_get_topic_filter(
|
dds_get_topic_filter(
|
||||||
dds_entity_t topic)
|
dds_entity_t topic)
|
||||||
|
@ -574,7 +569,6 @@ dds_get_topic_filter(
|
||||||
return (filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : 0;
|
return (filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
dds_topic_filter_fn
|
dds_topic_filter_fn
|
||||||
dds_topic_get_filter(
|
dds_topic_get_filter(
|
||||||
dds_entity_t topic)
|
dds_entity_t topic)
|
||||||
|
@ -601,16 +595,15 @@ dds_topic_get_filter_with_ctx(
|
||||||
return (filter == dds_topic_chaining_filter) ? 0 : filter;
|
return (filter == dds_topic_chaining_filter) ? 0 : filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_name(
|
dds_get_name(
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_Out_writes_z_(size) char *name,
|
char *name,
|
||||||
_In_ size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
dds_topic *t;
|
dds_topic *t;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if(size <= 0){
|
if(size <= 0){
|
||||||
DDS_ERROR("Argument size is smaller than 0\n");
|
DDS_ERROR("Argument size is smaller than 0\n");
|
||||||
|
@ -637,15 +630,14 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_get_type_name(
|
dds_get_type_name(
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_Out_writes_z_(size) char *name,
|
char *name,
|
||||||
_In_ size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
dds_topic *t;
|
dds_topic *t;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
if(size <= 0){
|
if(size <= 0){
|
||||||
|
@ -671,13 +663,13 @@ dds_get_type_name(
|
||||||
fail:
|
fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_inconsistent_topic_status(
|
dds_get_inconsistent_topic_status(
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_Out_opt_ dds_inconsistent_topic_status_t *status)
|
dds_inconsistent_topic_status_t *status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_topic *t;
|
dds_topic *t;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/ddsrt/heap.h"
|
||||||
|
#include "dds/ddsrt/log.h"
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__querycond.h"
|
#include "dds__querycond.h"
|
||||||
#include "dds__readcond.h"
|
#include "dds__readcond.h"
|
||||||
|
@ -21,10 +23,10 @@ DEFINE_ENTITY_LOCK_UNLOCK(static, dds_waitset, DDS_KIND_WAITSET)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_waitset_swap(
|
dds_waitset_swap(
|
||||||
_Inout_ dds_attachment **dst,
|
dds_attachment **dst,
|
||||||
_In_ dds_attachment **src,
|
dds_attachment **src,
|
||||||
_In_opt_ dds_attachment *prev,
|
dds_attachment *prev,
|
||||||
_In_ dds_attachment *idx)
|
dds_attachment *idx)
|
||||||
{
|
{
|
||||||
/* Remove from source. */
|
/* Remove from source. */
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
|
@ -40,15 +42,15 @@ dds_waitset_swap(
|
||||||
|
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
dds_waitset_wait_impl(
|
dds_waitset_wait_impl(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_Out_writes_to_opt_(nxs, return < 0 ? 0 : return) dds_attach_t *xs,
|
dds_attach_t *xs,
|
||||||
_In_ size_t nxs,
|
size_t nxs,
|
||||||
_In_ dds_time_t abstimeout,
|
dds_time_t abstimeout,
|
||||||
_In_ dds_time_t tnow)
|
dds_time_t tnow)
|
||||||
{
|
{
|
||||||
dds_waitset *ws;
|
dds_waitset *ws;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_attachment *idx;
|
dds_attachment *idx;
|
||||||
dds_attachment *next;
|
dds_attachment *next;
|
||||||
dds_attachment *prev;
|
dds_attachment *prev;
|
||||||
|
@ -98,20 +100,12 @@ dds_waitset_wait_impl(
|
||||||
rc = DDS_RETCODE_OK;
|
rc = DDS_RETCODE_OK;
|
||||||
while ((ws->observed != NULL) && (ws->triggered == NULL) && (rc == DDS_RETCODE_OK)) {
|
while ((ws->observed != NULL) && (ws->triggered == NULL) && (rc == DDS_RETCODE_OK)) {
|
||||||
if (abstimeout == DDS_NEVER) {
|
if (abstimeout == DDS_NEVER) {
|
||||||
os_condWait(&ws->m_entity.m_cond, &ws->m_entity.m_mutex);
|
ddsrt_cond_wait(&ws->m_entity.m_cond, &ws->m_entity.m_mutex);
|
||||||
} else if (abstimeout <= tnow) {
|
} else if (abstimeout <= tnow) {
|
||||||
rc = DDS_RETCODE_TIMEOUT;
|
rc = DDS_RETCODE_TIMEOUT;
|
||||||
} else {
|
} else {
|
||||||
dds_duration_t dt = abstimeout - tnow;
|
dds_duration_t dt = abstimeout - tnow;
|
||||||
os_time to;
|
(void)ddsrt_cond_waitfor(&ws->m_entity.m_cond, &ws->m_entity.m_mutex, dt);
|
||||||
if ((dt / (dds_duration_t)DDS_NSECS_IN_SEC) >= (dds_duration_t)OS_TIME_INFINITE_SEC) {
|
|
||||||
to.tv_sec = OS_TIME_INFINITE_SEC;
|
|
||||||
to.tv_nsec = DDS_NSECS_IN_SEC - 1;
|
|
||||||
} else {
|
|
||||||
to.tv_sec = (os_timeSec) (dt / DDS_NSECS_IN_SEC);
|
|
||||||
to.tv_nsec = (int32_t) (dt % DDS_NSECS_IN_SEC);
|
|
||||||
}
|
|
||||||
(void)os_condTimedWait(&ws->m_entity.m_cond, &ws->m_entity.m_mutex, &to);
|
|
||||||
tnow = dds_time();
|
tnow = dds_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,15 +145,15 @@ dds_waitset_wait_impl(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_waitset_close_list(
|
dds_waitset_close_list(
|
||||||
_In_ dds_attachment **list,
|
dds_attachment **list,
|
||||||
_In_ dds_entity_t waitset)
|
dds_entity_t waitset)
|
||||||
{
|
{
|
||||||
dds_attachment *idx = *list;
|
dds_attachment *idx = *list;
|
||||||
dds_attachment *next;
|
dds_attachment *next;
|
||||||
while (idx != NULL) {
|
while (idx != NULL) {
|
||||||
next = idx->next;
|
next = idx->next;
|
||||||
(void)dds_entity_observer_unregister(idx->entity->m_hdl, waitset);
|
(void)dds_entity_observer_unregister(idx->entity->m_hdl, waitset);
|
||||||
os_free(idx);
|
ddsrt_free(idx);
|
||||||
idx = next;
|
idx = next;
|
||||||
}
|
}
|
||||||
*list = NULL;
|
*list = NULL;
|
||||||
|
@ -167,8 +161,8 @@ dds_waitset_close_list(
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
dds_waitset_remove_from_list(
|
dds_waitset_remove_from_list(
|
||||||
_In_ dds_attachment **list,
|
dds_attachment **list,
|
||||||
_In_ dds_entity_t observed)
|
dds_entity_t observed)
|
||||||
{
|
{
|
||||||
dds_attachment *idx = *list;
|
dds_attachment *idx = *list;
|
||||||
dds_attachment *prev = NULL;
|
dds_attachment *prev = NULL;
|
||||||
|
@ -180,7 +174,7 @@ dds_waitset_remove_from_list(
|
||||||
} else {
|
} else {
|
||||||
prev->next = idx->next;
|
prev->next = idx->next;
|
||||||
}
|
}
|
||||||
os_free(idx);
|
ddsrt_free(idx);
|
||||||
|
|
||||||
/* We're done. */
|
/* We're done. */
|
||||||
return true;
|
return true;
|
||||||
|
@ -201,19 +195,18 @@ dds_waitset_close(
|
||||||
dds_waitset_close_list(&ws->triggered, e->m_hdl);
|
dds_waitset_close_list(&ws->triggered, e->m_hdl);
|
||||||
|
|
||||||
/* Trigger waitset to wake up. */
|
/* Trigger waitset to wake up. */
|
||||||
os_condBroadcast(&e->m_cond);
|
ddsrt_cond_broadcast(&e->m_cond);
|
||||||
|
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
|
DDS_EXPORT dds_entity_t
|
||||||
DDS_EXPORT _Must_inspect_result_ dds_entity_t
|
|
||||||
dds_create_waitset(
|
dds_create_waitset(
|
||||||
_In_ dds_entity_t participant)
|
dds_entity_t participant)
|
||||||
{
|
{
|
||||||
dds_entity_t hdl;
|
dds_entity_t hdl;
|
||||||
dds_entity *par;
|
dds_entity *par;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
|
@ -232,15 +225,14 @@ dds_create_waitset(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_waitset_get_entities(
|
dds_waitset_get_entities(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_Out_writes_to_(size, return < 0 ? 0 : return) dds_entity_t *entities,
|
dds_entity_t *entities,
|
||||||
_In_ size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
dds_return_t ret = 0;
|
dds_return_t ret = 0;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_waitset *ws;
|
dds_waitset *ws;
|
||||||
|
|
||||||
rc = dds_waitset_lock(waitset, &ws);
|
rc = dds_waitset_lock(waitset, &ws);
|
||||||
|
@ -276,9 +268,9 @@ dds_waitset_get_entities(
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_waitset_move(
|
dds_waitset_move(
|
||||||
_In_ dds_attachment **src,
|
dds_attachment **src,
|
||||||
_Inout_ dds_attachment **dst,
|
dds_attachment **dst,
|
||||||
_In_ dds_entity_t entity)
|
dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_attachment *idx = *src;
|
dds_attachment *idx = *src;
|
||||||
dds_attachment *prev = NULL;
|
dds_attachment *prev = NULL;
|
||||||
|
@ -326,21 +318,20 @@ dds_waitset_observer(
|
||||||
dds_waitset_move(&(ws->triggered), &(ws->observed), observed);
|
dds_waitset_move(&(ws->triggered), &(ws->observed), observed);
|
||||||
}
|
}
|
||||||
/* Trigger waitset to wake up. */
|
/* Trigger waitset to wake up. */
|
||||||
os_condBroadcast(&ws->m_entity.m_cond);
|
ddsrt_cond_broadcast(&ws->m_entity.m_cond);
|
||||||
dds_waitset_unlock(ws);
|
dds_waitset_unlock(ws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_waitset_attach(
|
dds_waitset_attach(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_In_ dds_entity_t entity,
|
dds_entity_t entity,
|
||||||
_In_ dds_attach_t x)
|
dds_attach_t x)
|
||||||
{
|
{
|
||||||
dds_entity *e = NULL;
|
dds_entity *e = NULL;
|
||||||
dds_waitset *ws;
|
dds_waitset *ws;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
rc = dds_waitset_lock(waitset, &ws);
|
rc = dds_waitset_lock(waitset, &ws);
|
||||||
|
@ -360,7 +351,7 @@ dds_waitset_attach(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
dds_attachment *a = os_malloc(sizeof(dds_attachment));
|
dds_attachment *a = ddsrt_malloc(sizeof(dds_attachment));
|
||||||
a->arg = x;
|
a->arg = x;
|
||||||
a->entity = e;
|
a->entity = e;
|
||||||
if (e->m_trigger > 0) {
|
if (e->m_trigger > 0) {
|
||||||
|
@ -390,14 +381,13 @@ dds_waitset_attach(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
|
|
||||||
DDS_EXPORT dds_return_t
|
DDS_EXPORT dds_return_t
|
||||||
dds_waitset_detach(
|
dds_waitset_detach(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_In_ dds_entity_t entity)
|
dds_entity_t entity)
|
||||||
{
|
{
|
||||||
dds_waitset *ws;
|
dds_waitset *ws;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
rc = dds_waitset_lock(waitset, &ws);
|
rc = dds_waitset_lock(waitset, &ws);
|
||||||
|
@ -427,24 +417,22 @@ dds_waitset_detach(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_waitset_wait_until(
|
dds_waitset_wait_until(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_Out_writes_to_opt_(nxs, return < 0 ? 0 : return) dds_attach_t *xs,
|
dds_attach_t *xs,
|
||||||
_In_ size_t nxs,
|
size_t nxs,
|
||||||
_In_ dds_time_t abstimeout)
|
dds_time_t abstimeout)
|
||||||
{
|
{
|
||||||
return dds_waitset_wait_impl(waitset, xs, nxs, abstimeout, dds_time());
|
return dds_waitset_wait_impl(waitset, xs, nxs, abstimeout, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_waitset_wait(
|
dds_waitset_wait(
|
||||||
_In_ dds_entity_t waitset,
|
dds_entity_t waitset,
|
||||||
_Out_writes_to_opt_(nxs, return < 0 ? 0 : return) dds_attach_t *xs,
|
dds_attach_t *xs,
|
||||||
_In_ size_t nxs,
|
size_t nxs,
|
||||||
_In_ dds_duration_t reltimeout)
|
dds_duration_t reltimeout)
|
||||||
{
|
{
|
||||||
dds_entity_t ret;
|
dds_entity_t ret;
|
||||||
|
|
||||||
|
@ -463,21 +451,21 @@ dds_waitset_wait(
|
||||||
dds_return_t dds_waitset_set_trigger (dds_entity_t waitset, bool trigger)
|
dds_return_t dds_waitset_set_trigger (dds_entity_t waitset, bool trigger)
|
||||||
{
|
{
|
||||||
dds_waitset *ws;
|
dds_waitset *ws;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if ((rc = dds_waitset_lock (waitset, &ws)) != DDS_RETCODE_OK)
|
if ((rc = dds_waitset_lock (waitset, &ws)) != DDS_RETCODE_OK)
|
||||||
return DDS_ERRNO (rc);
|
return DDS_ERRNO (rc);
|
||||||
|
|
||||||
os_mutexUnlock (&ws->m_entity.m_mutex);
|
ddsrt_mutex_unlock (&ws->m_entity.m_mutex);
|
||||||
|
|
||||||
os_mutexLock (&ws->m_entity.m_observers_lock);
|
ddsrt_mutex_lock (&ws->m_entity.m_observers_lock);
|
||||||
if (trigger)
|
if (trigger)
|
||||||
dds_entity_status_set (&ws->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
dds_entity_status_set (&ws->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
else
|
else
|
||||||
dds_entity_status_reset (&ws->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
dds_entity_status_reset (&ws->m_entity, DDS_WAITSET_TRIGGER_STATUS);
|
||||||
os_mutexUnlock (&ws->m_entity.m_observers_lock);
|
ddsrt_mutex_unlock (&ws->m_entity.m_observers_lock);
|
||||||
|
|
||||||
os_mutexLock (&ws->m_entity.m_mutex);
|
ddsrt_mutex_lock (&ws->m_entity.m_mutex);
|
||||||
dds_waitset_unlock (ws);
|
dds_waitset_unlock (ws);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,18 +13,19 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsrt/sync.h"
|
||||||
#include "ddsi/q_unused.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_unused.h"
|
||||||
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
#include "util/ut_avl.h"
|
#include "dds/util/ut_avl.h"
|
||||||
#include "util/ut_hopscotch.h"
|
#include "dds/util/ut_hopscotch.h"
|
||||||
#include "ddsi/q_time.h"
|
#include "dds/ddsi/q_time.h"
|
||||||
#include "ddsi/q_rtps.h"
|
#include "dds/ddsi/q_rtps.h"
|
||||||
#include "ddsi/q_freelist.h"
|
#include "dds/ddsi/q_freelist.h"
|
||||||
|
|
||||||
#define USE_EHH 0
|
#define USE_EHH 0
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ struct whc_seq_entry {
|
||||||
|
|
||||||
struct whc_impl {
|
struct whc_impl {
|
||||||
struct whc common;
|
struct whc common;
|
||||||
os_mutex lock;
|
ddsrt_mutex_t lock;
|
||||||
unsigned seq_size;
|
unsigned seq_size;
|
||||||
size_t unacked_bytes;
|
size_t unacked_bytes;
|
||||||
size_t sample_overhead;
|
size_t sample_overhead;
|
||||||
|
@ -343,9 +344,9 @@ struct whc *whc_new (int is_transient_local, unsigned hdepth, unsigned tldepth)
|
||||||
|
|
||||||
assert((hdepth == 0 || tldepth <= hdepth) || is_transient_local);
|
assert((hdepth == 0 || tldepth <= hdepth) || is_transient_local);
|
||||||
|
|
||||||
whc = os_malloc (sizeof (*whc));
|
whc = ddsrt_malloc (sizeof (*whc));
|
||||||
whc->common.ops = &whc_ops;
|
whc->common.ops = &whc_ops;
|
||||||
os_mutexInit (&whc->lock);
|
ddsrt_mutex_init (&whc->lock);
|
||||||
whc->is_transient_local = is_transient_local ? 1 : 0;
|
whc->is_transient_local = is_transient_local ? 1 : 0;
|
||||||
whc->hdepth = hdepth;
|
whc->hdepth = hdepth;
|
||||||
whc->tldepth = tldepth;
|
whc->tldepth = tldepth;
|
||||||
|
@ -368,7 +369,7 @@ struct whc *whc_new (int is_transient_local, unsigned hdepth, unsigned tldepth)
|
||||||
|
|
||||||
/* seq interval tree: always has an "open" node */
|
/* seq interval tree: always has an "open" node */
|
||||||
ut_avlInit (&whc_seq_treedef, &whc->seq);
|
ut_avlInit (&whc_seq_treedef, &whc->seq);
|
||||||
intv = os_malloc (sizeof (*intv));
|
intv = ddsrt_malloc (sizeof (*intv));
|
||||||
intv->min = intv->maxp1 = 1;
|
intv->min = intv->maxp1 = 1;
|
||||||
intv->first = intv->last = NULL;
|
intv->first = intv->last = NULL;
|
||||||
ut_avlInsert (&whc_seq_treedef, &whc->seq, intv);
|
ut_avlInsert (&whc_seq_treedef, &whc->seq, intv);
|
||||||
|
@ -387,7 +388,7 @@ static void free_whc_node_contents (struct whc_node *whcn)
|
||||||
ddsi_serdata_unref (whcn->serdata);
|
ddsi_serdata_unref (whcn->serdata);
|
||||||
if (whcn->plist) {
|
if (whcn->plist) {
|
||||||
nn_plist_fini (whcn->plist);
|
nn_plist_fini (whcn->plist);
|
||||||
os_free (whcn->plist);
|
ddsrt_free (whcn->plist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +403,7 @@ void whc_default_free (struct whc *whc_generic)
|
||||||
struct ut_hhIter it;
|
struct ut_hhIter it;
|
||||||
struct whc_idxnode *n;
|
struct whc_idxnode *n;
|
||||||
for (n = ut_hhIterFirst(whc->idx_hash, &it); n != NULL; n = ut_hhIterNext(&it))
|
for (n = ut_hhIterFirst(whc->idx_hash, &it); n != NULL; n = ut_hhIterNext(&it))
|
||||||
os_free(n);
|
ddsrt_free(n);
|
||||||
ut_hhFree(whc->idx_hash);
|
ut_hhFree(whc->idx_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,24 +413,24 @@ void whc_default_free (struct whc *whc_generic)
|
||||||
{
|
{
|
||||||
struct whc_node *tmp = whcn;
|
struct whc_node *tmp = whcn;
|
||||||
/* The compiler doesn't realize that whcn->prev_seq is always initialized. */
|
/* The compiler doesn't realize that whcn->prev_seq is always initialized. */
|
||||||
OS_WARNING_MSVC_OFF(6001);
|
DDSRT_WARNING_MSVC_OFF(6001);
|
||||||
whcn = whcn->prev_seq;
|
whcn = whcn->prev_seq;
|
||||||
OS_WARNING_MSVC_ON(6001);
|
DDSRT_WARNING_MSVC_ON(6001);
|
||||||
free_whc_node_contents (tmp);
|
free_whc_node_contents (tmp);
|
||||||
os_free (tmp);
|
ddsrt_free (tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_avlFree (&whc_seq_treedef, &whc->seq, os_free);
|
ut_avlFree (&whc_seq_treedef, &whc->seq, ddsrt_free);
|
||||||
nn_freelist_fini (&whc->freelist, os_free);
|
nn_freelist_fini (&whc->freelist, ddsrt_free);
|
||||||
|
|
||||||
#if USE_EHH
|
#if USE_EHH
|
||||||
ut_ehhFree (whc->seq_hash);
|
ut_ehhFree (whc->seq_hash);
|
||||||
#else
|
#else
|
||||||
ut_hhFree (whc->seq_hash);
|
ut_hhFree (whc->seq_hash);
|
||||||
#endif
|
#endif
|
||||||
os_mutexDestroy (&whc->lock);
|
ddsrt_mutex_destroy (&whc->lock);
|
||||||
os_free (whc);
|
ddsrt_free (whc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_state_locked(const struct whc_impl *whc, struct whc_state *st)
|
static void get_state_locked(const struct whc_impl *whc, struct whc_state *st)
|
||||||
|
@ -456,10 +457,10 @@ static void get_state_locked(const struct whc_impl *whc, struct whc_state *st)
|
||||||
static void whc_default_get_state(const struct whc *whc_generic, struct whc_state *st)
|
static void whc_default_get_state(const struct whc *whc_generic, struct whc_state *st)
|
||||||
{
|
{
|
||||||
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
||||||
os_mutexLock ((struct os_mutex *)&whc->lock);
|
ddsrt_mutex_lock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
get_state_locked(whc, st);
|
get_state_locked(whc, st);
|
||||||
os_mutexUnlock ((struct os_mutex *)&whc->lock);
|
ddsrt_mutex_unlock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct whc_node *find_nextseq_intv (struct whc_intvnode **p_intv, const struct whc_impl *whc, seqno_t seq)
|
static struct whc_node *find_nextseq_intv (struct whc_intvnode **p_intv, const struct whc_impl *whc, seqno_t seq)
|
||||||
|
@ -510,13 +511,13 @@ static seqno_t whc_default_next_seq (const struct whc *whc_generic, seqno_t seq)
|
||||||
struct whc_node *n;
|
struct whc_node *n;
|
||||||
struct whc_intvnode *intv;
|
struct whc_intvnode *intv;
|
||||||
seqno_t nseq;
|
seqno_t nseq;
|
||||||
os_mutexLock ((struct os_mutex *)&whc->lock);
|
ddsrt_mutex_lock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
if ((n = find_nextseq_intv (&intv, whc, seq)) == NULL)
|
if ((n = find_nextseq_intv (&intv, whc, seq)) == NULL)
|
||||||
nseq = MAX_SEQ_NUMBER;
|
nseq = MAX_SEQ_NUMBER;
|
||||||
else
|
else
|
||||||
nseq = n->seq;
|
nseq = n->seq;
|
||||||
os_mutexUnlock ((struct os_mutex *)&whc->lock);
|
ddsrt_mutex_unlock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
return nseq;
|
return nseq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +539,7 @@ static void delete_one_sample_from_idx (struct whc_impl *whc, struct whc_node *w
|
||||||
if (!ut_hhRemove (whc->idx_hash, idxn))
|
if (!ut_hhRemove (whc->idx_hash, idxn))
|
||||||
assert (0);
|
assert (0);
|
||||||
ddsi_tkmap_instance_unref(idxn->tk);
|
ddsi_tkmap_instance_unref(idxn->tk);
|
||||||
os_free (idxn);
|
ddsrt_free (idxn);
|
||||||
}
|
}
|
||||||
whcn->idxnode = NULL;
|
whcn->idxnode = NULL;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +561,7 @@ static void free_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_free(idxn);
|
ddsrt_free(idxn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delete_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_seq, struct whc_idxnode *idxn)
|
static void delete_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_seq, struct whc_idxnode *idxn)
|
||||||
|
@ -591,14 +592,14 @@ static unsigned whc_default_downgrade_to_volatile (struct whc *whc_generic, stru
|
||||||
|
|
||||||
/* We only remove them from whc->tlidx: we don't remove them from
|
/* We only remove them from whc->tlidx: we don't remove them from
|
||||||
whc->seq yet. That'll happen eventually. */
|
whc->seq yet. That'll happen eventually. */
|
||||||
os_mutexLock (&whc->lock);
|
ddsrt_mutex_lock (&whc->lock);
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
|
|
||||||
if (whc->idxdepth == 0)
|
if (whc->idxdepth == 0)
|
||||||
{
|
{
|
||||||
/* if not maintaining an index at all, this is nonsense */
|
/* if not maintaining an index at all, this is nonsense */
|
||||||
get_state_locked(whc, st);
|
get_state_locked(whc, st);
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +629,7 @@ static unsigned whc_default_downgrade_to_volatile (struct whc *whc_generic, stru
|
||||||
whc_default_free_deferred_free_list (whc_generic, deferred_free_list);
|
whc_default_free_deferred_free_list (whc_generic, deferred_free_list);
|
||||||
assert (whc->max_drop_seq == old_max_drop_seq);
|
assert (whc->max_drop_seq == old_max_drop_seq);
|
||||||
get_state_locked(whc, st);
|
get_state_locked(whc, st);
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,7 +681,7 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
|
||||||
*p_intv = ut_avlFindSucc (&whc_seq_treedef, &whc->seq, intv);
|
*p_intv = ut_avlFindSucc (&whc_seq_treedef, &whc->seq, intv);
|
||||||
/* only sample in interval and not the open interval => delete interval */
|
/* only sample in interval and not the open interval => delete interval */
|
||||||
ut_avlDelete (&whc_seq_treedef, &whc->seq, tmp);
|
ut_avlDelete (&whc_seq_treedef, &whc->seq, tmp);
|
||||||
os_free (tmp);
|
ddsrt_free (tmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -711,7 +712,7 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
|
||||||
struct whc_intvnode *new_intv;
|
struct whc_intvnode *new_intv;
|
||||||
ut_avlIPath_t path;
|
ut_avlIPath_t path;
|
||||||
|
|
||||||
new_intv = os_malloc (sizeof (*new_intv));
|
new_intv = ddsrt_malloc (sizeof (*new_intv));
|
||||||
|
|
||||||
/* new interval starts at the next node */
|
/* new interval starts at the next node */
|
||||||
assert (whcn->next_seq);
|
assert (whcn->next_seq);
|
||||||
|
@ -770,7 +771,7 @@ static void free_deferred_free_list (struct whc_impl *whc, struct whc_node *defe
|
||||||
{
|
{
|
||||||
struct whc_node *tmp = cur;
|
struct whc_node *tmp = cur;
|
||||||
cur = cur->next_seq;
|
cur = cur->next_seq;
|
||||||
os_free (tmp);
|
ddsrt_free (tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,7 +997,7 @@ static unsigned whc_default_remove_acked_messages (struct whc *whc_generic, seqn
|
||||||
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
||||||
unsigned cnt;
|
unsigned cnt;
|
||||||
|
|
||||||
os_mutexLock (&whc->lock);
|
ddsrt_mutex_lock (&whc->lock);
|
||||||
assert (max_drop_seq < MAX_SEQ_NUMBER);
|
assert (max_drop_seq < MAX_SEQ_NUMBER);
|
||||||
assert (max_drop_seq >= whc->max_drop_seq);
|
assert (max_drop_seq >= whc->max_drop_seq);
|
||||||
|
|
||||||
|
@ -1016,7 +1017,7 @@ static unsigned whc_default_remove_acked_messages (struct whc *whc_generic, seqn
|
||||||
else
|
else
|
||||||
cnt = whc_default_remove_acked_messages_full (whc, max_drop_seq, deferred_free_list);
|
cnt = whc_default_remove_acked_messages_full (whc, max_drop_seq, deferred_free_list);
|
||||||
get_state_locked(whc, whcst);
|
get_state_locked(whc, whcst);
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,7 +1026,7 @@ static struct whc_node *whc_default_insert_seq (struct whc_impl *whc, seqno_t ma
|
||||||
struct whc_node *newn = NULL;
|
struct whc_node *newn = NULL;
|
||||||
|
|
||||||
if ((newn = nn_freelist_pop (&whc->freelist)) == NULL)
|
if ((newn = nn_freelist_pop (&whc->freelist)) == NULL)
|
||||||
newn = os_malloc (sizeof (*newn));
|
newn = ddsrt_malloc (sizeof (*newn));
|
||||||
newn->seq = seq;
|
newn->seq = seq;
|
||||||
newn->plist = plist;
|
newn->plist = plist;
|
||||||
newn->unacked = (seq > max_drop_seq);
|
newn->unacked = (seq > max_drop_seq);
|
||||||
|
@ -1067,7 +1068,7 @@ static struct whc_node *whc_default_insert_seq (struct whc_impl *whc, seqno_t ma
|
||||||
/* gap => need new open_intv */
|
/* gap => need new open_intv */
|
||||||
struct whc_intvnode *intv1;
|
struct whc_intvnode *intv1;
|
||||||
ut_avlIPath_t path;
|
ut_avlIPath_t path;
|
||||||
intv1 = os_malloc (sizeof (*intv1));
|
intv1 = ddsrt_malloc (sizeof (*intv1));
|
||||||
intv1->min = seq;
|
intv1->min = seq;
|
||||||
intv1->maxp1 = seq + 1;
|
intv1->maxp1 = seq + 1;
|
||||||
intv1->first = intv1->last = newn;
|
intv1->first = intv1->last = newn;
|
||||||
|
@ -1091,7 +1092,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
|
||||||
char pad[sizeof(struct whc_idxnode) + sizeof(struct whc_node *)];
|
char pad[sizeof(struct whc_idxnode) + sizeof(struct whc_node *)];
|
||||||
} template;
|
} template;
|
||||||
|
|
||||||
os_mutexLock (&whc->lock);
|
ddsrt_mutex_lock (&whc->lock);
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
|
|
||||||
if (dds_get_log_mask() & DDS_LC_WHC)
|
if (dds_get_log_mask() & DDS_LC_WHC)
|
||||||
|
@ -1120,7 +1121,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
|
||||||
if (serdata->kind == SDK_EMPTY || whc->idxdepth == 0)
|
if (serdata->kind == SDK_EMPTY || whc->idxdepth == 0)
|
||||||
{
|
{
|
||||||
DDS_LOG(DDS_LC_WHC, " empty or no hist\n");
|
DDS_LOG(DDS_LC_WHC, " empty or no hist\n");
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1188,7 +1189,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
|
||||||
if (!(serdata->statusinfo & NN_STATUSINFO_UNREGISTER))
|
if (!(serdata->statusinfo & NN_STATUSINFO_UNREGISTER))
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
idxn = os_malloc (sizeof (*idxn) + whc->idxdepth * sizeof (idxn->hist[0]));
|
idxn = ddsrt_malloc (sizeof (*idxn) + whc->idxdepth * sizeof (idxn->hist[0]));
|
||||||
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
|
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
|
||||||
ddsi_tkmap_instance_ref(tk);
|
ddsi_tkmap_instance_ref(tk);
|
||||||
idxn->iid = tk->m_iid;
|
idxn->iid = tk->m_iid;
|
||||||
|
@ -1216,7 +1217,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
|
||||||
}
|
}
|
||||||
DDS_LOG(DDS_LC_WHC, "\n");
|
DDS_LOG(DDS_LC_WHC, "\n");
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1237,7 +1238,7 @@ static bool whc_default_borrow_sample (const struct whc *whc_generic, seqno_t se
|
||||||
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
||||||
struct whc_node *whcn;
|
struct whc_node *whcn;
|
||||||
bool found;
|
bool found;
|
||||||
os_mutexLock ((os_mutex *)&whc->lock);
|
ddsrt_mutex_lock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
if ((whcn = whc_findseq(whc, seq)) == NULL)
|
if ((whcn = whc_findseq(whc, seq)) == NULL)
|
||||||
found = false;
|
found = false;
|
||||||
else
|
else
|
||||||
|
@ -1245,7 +1246,7 @@ static bool whc_default_borrow_sample (const struct whc *whc_generic, seqno_t se
|
||||||
make_borrowed_sample(sample, whcn);
|
make_borrowed_sample(sample, whcn);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
os_mutexUnlock ((os_mutex *)&whc->lock);
|
ddsrt_mutex_unlock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,7 +1255,7 @@ static bool whc_default_borrow_sample_key (const struct whc *whc_generic, const
|
||||||
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
const struct whc_impl * const whc = (const struct whc_impl *)whc_generic;
|
||||||
struct whc_node *whcn;
|
struct whc_node *whcn;
|
||||||
bool found;
|
bool found;
|
||||||
os_mutexLock ((os_mutex *)&whc->lock);
|
ddsrt_mutex_lock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
if ((whcn = whc_findkey(whc, serdata_key)) == NULL)
|
if ((whcn = whc_findkey(whc, serdata_key)) == NULL)
|
||||||
found = false;
|
found = false;
|
||||||
else
|
else
|
||||||
|
@ -1262,7 +1263,7 @@ static bool whc_default_borrow_sample_key (const struct whc *whc_generic, const
|
||||||
make_borrowed_sample(sample, whcn);
|
make_borrowed_sample(sample, whcn);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
os_mutexUnlock ((os_mutex *)&whc->lock);
|
ddsrt_mutex_unlock ((ddsrt_mutex_t *)&whc->lock);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1275,7 +1276,7 @@ static void return_sample_locked (struct whc_impl *whc, struct whc_borrowed_samp
|
||||||
ddsi_serdata_unref (sample->serdata);
|
ddsi_serdata_unref (sample->serdata);
|
||||||
if (sample->plist) {
|
if (sample->plist) {
|
||||||
nn_plist_fini (sample->plist);
|
nn_plist_fini (sample->plist);
|
||||||
os_free (sample->plist);
|
ddsrt_free (sample->plist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1293,9 +1294,9 @@ static void return_sample_locked (struct whc_impl *whc, struct whc_borrowed_samp
|
||||||
static void whc_default_return_sample (struct whc *whc_generic, struct whc_borrowed_sample *sample, bool update_retransmit_info)
|
static void whc_default_return_sample (struct whc *whc_generic, struct whc_borrowed_sample *sample, bool update_retransmit_info)
|
||||||
{
|
{
|
||||||
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
||||||
os_mutexLock (&whc->lock);
|
ddsrt_mutex_lock (&whc->lock);
|
||||||
return_sample_locked (whc, sample, update_retransmit_info);
|
return_sample_locked (whc, sample, update_retransmit_info);
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void whc_default_sample_iter_init (const struct whc *whc_generic, struct whc_sample_iter *opaque_it)
|
static void whc_default_sample_iter_init (const struct whc *whc_generic, struct whc_sample_iter *opaque_it)
|
||||||
|
@ -1313,7 +1314,7 @@ static bool whc_default_sample_iter_borrow_next (struct whc_sample_iter *opaque_
|
||||||
struct whc_intvnode *intv;
|
struct whc_intvnode *intv;
|
||||||
seqno_t seq;
|
seqno_t seq;
|
||||||
bool valid;
|
bool valid;
|
||||||
os_mutexLock (&whc->lock);
|
ddsrt_mutex_lock (&whc->lock);
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
if (!it->first)
|
if (!it->first)
|
||||||
{
|
{
|
||||||
|
@ -1332,6 +1333,6 @@ static bool whc_default_sample_iter_borrow_next (struct whc_sample_iter *opaque_
|
||||||
make_borrowed_sample(sample, whcn);
|
make_borrowed_sample(sample, whcn);
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&whc->lock);
|
ddsrt_mutex_unlock (&whc->lock);
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/heap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_unused.h"
|
#include "dds/ddsi/q_unused.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/q_ephash.h"
|
#include "dds/ddsi/q_ephash.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__serdata_builtintopic.h"
|
#include "dds__serdata_builtintopic.h"
|
||||||
#include "dds__whc_builtintopic.h"
|
#include "dds__whc_builtintopic.h"
|
||||||
#include "dds__builtin.h"
|
#include "dds__builtin.h"
|
||||||
|
@ -50,7 +50,7 @@ struct bwhc_sample_iter_sizecheck {
|
||||||
|
|
||||||
static void bwhc_free (struct whc *whc_generic)
|
static void bwhc_free (struct whc *whc_generic)
|
||||||
{
|
{
|
||||||
os_free (whc_generic);
|
ddsrt_free (whc_generic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bwhc_sample_iter_init (const struct whc *whc_generic, struct whc_sample_iter *opaque_it)
|
static void bwhc_sample_iter_init (const struct whc *whc_generic, struct whc_sample_iter *opaque_it)
|
||||||
|
@ -151,7 +151,7 @@ static int bwhc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, stru
|
||||||
(void)serdata;
|
(void)serdata;
|
||||||
(void)tk;
|
(void)tk;
|
||||||
if (plist)
|
if (plist)
|
||||||
os_free (plist);
|
ddsrt_free (plist);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static const struct whc_ops bwhc_ops = {
|
||||||
|
|
||||||
struct whc *builtintopic_whc_new (enum ddsi_sertopic_builtintopic_type type)
|
struct whc *builtintopic_whc_new (enum ddsi_sertopic_builtintopic_type type)
|
||||||
{
|
{
|
||||||
struct bwhc *whc = os_malloc (sizeof (*whc));
|
struct bwhc *whc = ddsrt_malloc (sizeof (*whc));
|
||||||
whc->common.ops = &bwhc_ops;
|
whc->common.ops = &bwhc_ops;
|
||||||
whc->type = type;
|
whc->type = type;
|
||||||
return (struct whc *) whc;
|
return (struct whc *) whc;
|
||||||
|
|
|
@ -13,23 +13,23 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__write.h"
|
#include "dds__write.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/q_error.h"
|
#include "dds/ddsi/q_error.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_thread.h"
|
||||||
#include "ddsi/q_xmsg.h"
|
#include "dds/ddsi/q_xmsg.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "dds/ddsi/ddsi_serdata.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_transmit.h"
|
#include "dds/ddsi/q_transmit.h"
|
||||||
#include "ddsi/q_ephash.h"
|
#include "dds/ddsi/q_ephash.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
#include "ddsi/q_radmin.h"
|
#include "dds/ddsi/q_radmin.h"
|
||||||
|
|
||||||
dds_return_t dds_write (dds_entity_t writer, const void *data)
|
dds_return_t dds_write (dds_entity_t writer, const void *data)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
|
@ -45,7 +45,7 @@ dds_return_t dds_write (dds_entity_t writer, const void *data)
|
||||||
dds_return_t dds_writecdr (dds_entity_t writer, struct ddsi_serdata *serdata)
|
dds_return_t dds_writecdr (dds_entity_t writer, struct ddsi_serdata *serdata)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
if (serdata == NULL)
|
if (serdata == NULL)
|
||||||
|
@ -61,7 +61,7 @@ dds_return_t dds_writecdr (dds_entity_t writer, struct ddsi_serdata *serdata)
|
||||||
dds_return_t dds_write_ts (dds_entity_t writer, const void *data, dds_time_t timestamp)
|
dds_return_t dds_write_ts (dds_entity_t writer, const void *data, dds_time_t timestamp)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
|
|
||||||
if (data == NULL || timestamp < 0)
|
if (data == NULL || timestamp < 0)
|
||||||
|
@ -95,7 +95,7 @@ static dds_return_t try_store (struct rhc *rhc, const struct proxy_writer_info *
|
||||||
static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *payload, struct ddsi_tkmap_instance *tk)
|
static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *payload, struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
os_mutexLock (&wr->rdary.rdary_lock);
|
ddsrt_mutex_lock (&wr->rdary.rdary_lock);
|
||||||
if (wr->rdary.fastpath_ok)
|
if (wr->rdary.fastpath_ok)
|
||||||
{
|
{
|
||||||
struct reader ** const rdary = wr->rdary.rdary;
|
struct reader ** const rdary = wr->rdary.rdary;
|
||||||
|
@ -111,7 +111,7 @@ static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *pay
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&wr->rdary.rdary_lock);
|
ddsrt_mutex_unlock (&wr->rdary.rdary_lock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -127,9 +127,9 @@ static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *pay
|
||||||
struct pwr_rd_match *m;
|
struct pwr_rd_match *m;
|
||||||
struct proxy_writer_info pwr_info;
|
struct proxy_writer_info pwr_info;
|
||||||
dds_duration_t max_block_ms = nn_from_ddsi_duration (wr->xqos->reliability.max_blocking_time);
|
dds_duration_t max_block_ms = nn_from_ddsi_duration (wr->xqos->reliability.max_blocking_time);
|
||||||
os_mutexUnlock (&wr->rdary.rdary_lock);
|
ddsrt_mutex_unlock (&wr->rdary.rdary_lock);
|
||||||
make_proxy_writer_info (&pwr_info, &wr->e, wr->xqos);
|
make_proxy_writer_info (&pwr_info, &wr->e, wr->xqos);
|
||||||
os_mutexLock (&wr->e.lock);
|
ddsrt_mutex_lock (&wr->e.lock);
|
||||||
for (m = ut_avlIterFirst (&wr_local_readers_treedef, &wr->local_readers, &it); m != NULL; m = ut_avlIterNext (&it))
|
for (m = ut_avlIterFirst (&wr_local_readers_treedef, &wr->local_readers, &it); m != NULL; m = ut_avlIterNext (&it))
|
||||||
{
|
{
|
||||||
struct reader *rd;
|
struct reader *rd;
|
||||||
|
@ -141,7 +141,7 @@ static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *pay
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&wr->e.lock);
|
ddsrt_mutex_unlock (&wr->e.lock);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ void dds_write_flush (dds_entity_t writer)
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
const bool asleep = !vtime_awake_p (thr->vtime);
|
const bool asleep = !vtime_awake_p (thr->vtime);
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
if (asleep)
|
if (asleep)
|
||||||
thread_state_awake (thr);
|
thread_state_awake (thr);
|
||||||
|
|
|
@ -10,20 +10,21 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "ddsc/dds.h"
|
|
||||||
#include "ddsi/q_config.h"
|
#include "dds/dds.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "dds/version.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "dds/ddsi/q_config.h"
|
||||||
#include "ddsi/q_xmsg.h"
|
#include "dds/ddsi/q_entity.h"
|
||||||
|
#include "dds/ddsi/q_thread.h"
|
||||||
|
#include "dds/ddsi/q_xmsg.h"
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__listener.h"
|
#include "dds__listener.h"
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__topic.h"
|
#include "dds__topic.h"
|
||||||
#include "ddsi/ddsi_tkmap.h"
|
#include "dds/ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
|
||||||
|
|
||||||
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_writer)
|
DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_writer)
|
||||||
|
|
||||||
|
@ -84,9 +85,9 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
void *vst = NULL;
|
void *vst = NULL;
|
||||||
int32_t *reset[2] = { NULL, NULL };
|
int32_t *reset[2] = { NULL, NULL };
|
||||||
|
|
||||||
os_mutexLock (&entity->m_observers_lock);
|
ddsrt_mutex_lock (&entity->m_observers_lock);
|
||||||
while (entity->m_cb_count > 0)
|
while (entity->m_cb_count > 0)
|
||||||
os_condWait (&entity->m_observers_cond, &entity->m_observers_lock);
|
ddsrt_cond_wait (&entity->m_observers_cond, &entity->m_observers_lock);
|
||||||
entity->m_cb_count++;
|
entity->m_cb_count++;
|
||||||
|
|
||||||
/* Reset the status for possible Listener call.
|
/* Reset the status for possible Listener call.
|
||||||
|
@ -154,9 +155,9 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
|
|
||||||
if (invoke)
|
if (invoke)
|
||||||
{
|
{
|
||||||
os_mutexUnlock (&entity->m_observers_lock);
|
ddsrt_mutex_unlock (&entity->m_observers_lock);
|
||||||
dds_entity_invoke_listener(entity, status_id, vst);
|
dds_entity_invoke_listener(entity, status_id, vst);
|
||||||
os_mutexLock (&entity->m_observers_lock);
|
ddsrt_mutex_lock (&entity->m_observers_lock);
|
||||||
*reset[0] = 0;
|
*reset[0] = 0;
|
||||||
if (reset[1])
|
if (reset[1])
|
||||||
*reset[1] = 0;
|
*reset[1] = 0;
|
||||||
|
@ -167,8 +168,8 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->m_cb_count--;
|
entity->m_cb_count--;
|
||||||
os_condBroadcast (&entity->m_observers_cond);
|
ddsrt_cond_broadcast (&entity->m_observers_cond);
|
||||||
os_mutexUnlock (&entity->m_observers_lock);
|
ddsrt_mutex_unlock (&entity->m_observers_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
@ -313,11 +314,11 @@ dds_writer_qos_set(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: with QoS changes being unsupported by the underlying stack I wonder what will happen; locking the underlying DDSI writer is of doubtful value as well */
|
/* FIXME: with QoS changes being unsupported by the underlying stack I wonder what will happen; locking the underlying DDSI writer is of doubtful value as well */
|
||||||
os_mutexLock (&ddsi_wr->e.lock);
|
ddsrt_mutex_lock (&ddsi_wr->e.lock);
|
||||||
if (qos->ownership_strength.value != ddsi_wr->xqos->ownership_strength.value) {
|
if (qos->ownership_strength.value != ddsi_wr->xqos->ownership_strength.value) {
|
||||||
ddsi_wr->xqos->ownership_strength.value = qos->ownership_strength.value;
|
ddsi_wr->xqos->ownership_strength.value = qos->ownership_strength.value;
|
||||||
}
|
}
|
||||||
os_mutexUnlock (&ddsi_wr->e.lock);
|
ddsrt_mutex_unlock (&ddsi_wr->e.lock);
|
||||||
|
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep (thr);
|
thread_state_asleep (thr);
|
||||||
|
@ -328,7 +329,7 @@ dds_writer_qos_set(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
|
DDS_ERROR(DDS_PROJECT_NAME" does not support changing QoS policies yet\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,17 +388,14 @@ static struct whc *make_whc(const dds_qos_t *qos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((participant_or_publisher & DDS_ENTITY_KIND_MASK) == DDS_KIND_PUBLISHER) || \
|
|
||||||
((participant_or_publisher & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT))
|
|
||||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
|
|
||||||
dds_entity_t
|
dds_entity_t
|
||||||
dds_create_writer(
|
dds_create_writer(
|
||||||
_In_ dds_entity_t participant_or_publisher,
|
dds_entity_t participant_or_publisher,
|
||||||
_In_ dds_entity_t topic,
|
dds_entity_t topic,
|
||||||
_In_opt_ const dds_qos_t *qos,
|
const dds_qos_t *qos,
|
||||||
_In_opt_ const dds_listener_t *listener)
|
const dds_listener_t *listener)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_qos_t * wqos;
|
dds_qos_t * wqos;
|
||||||
dds_writer * wr;
|
dds_writer * wr;
|
||||||
dds_entity_t writer;
|
dds_entity_t writer;
|
||||||
|
@ -481,15 +479,15 @@ dds_create_writer(
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_mutexUnlock(&tp->m_entity.m_mutex);
|
ddsrt_mutex_unlock(&tp->m_entity.m_mutex);
|
||||||
os_mutexUnlock(&pub->m_mutex);
|
ddsrt_mutex_unlock(&pub->m_mutex);
|
||||||
|
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_awake(thr);
|
thread_state_awake(thr);
|
||||||
}
|
}
|
||||||
wr->m_wr = new_writer(&wr->m_entity.m_guid, NULL, &pub->m_participant->m_guid, tp->m_stopic, wqos, wr->m_whc, dds_writer_status_cb, wr);
|
wr->m_wr = new_writer(&wr->m_entity.m_guid, NULL, &pub->m_participant->m_guid, tp->m_stopic, wqos, wr->m_whc, dds_writer_status_cb, wr);
|
||||||
os_mutexLock(&pub->m_mutex);
|
ddsrt_mutex_lock(&pub->m_mutex);
|
||||||
os_mutexLock(&tp->m_entity.m_mutex);
|
ddsrt_mutex_lock(&tp->m_entity.m_mutex);
|
||||||
assert(wr->m_wr);
|
assert(wr->m_wr);
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep(thr);
|
thread_state_asleep(thr);
|
||||||
|
@ -509,12 +507,9 @@ err_pub_lock:
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
dds_entity_t
|
dds_entity_t
|
||||||
dds_get_publisher(
|
dds_get_publisher(
|
||||||
_In_ dds_entity_t writer)
|
dds_entity_t writer)
|
||||||
{
|
{
|
||||||
dds_entity_t hdl = DDS_RETCODE_OK;
|
dds_entity_t hdl = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -529,13 +524,12 @@ dds_get_publisher(
|
||||||
return hdl;
|
return hdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_publication_matched_status (
|
dds_get_publication_matched_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_publication_matched_status_t * status)
|
dds_publication_matched_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -559,13 +553,12 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_liveliness_lost_status (
|
dds_get_liveliness_lost_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_liveliness_lost_status_t * status)
|
dds_liveliness_lost_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -588,13 +581,12 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_offered_deadline_missed_status(
|
dds_get_offered_deadline_missed_status(
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_offered_deadline_missed_status_t *status)
|
dds_offered_deadline_missed_status_t *status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
@ -617,13 +609,12 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Pre_satisfies_(((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER))
|
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_get_offered_incompatible_qos_status (
|
dds_get_offered_incompatible_qos_status (
|
||||||
_In_ dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
_Out_opt_ dds_offered_incompatible_qos_status_t * status)
|
dds_offered_incompatible_qos_status_t * status)
|
||||||
{
|
{
|
||||||
dds__retcode_t rc;
|
dds_retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ set(ddsc_test_sources
|
||||||
"entity_api.c"
|
"entity_api.c"
|
||||||
"entity_hierarchy.c"
|
"entity_hierarchy.c"
|
||||||
"entity_status.c"
|
"entity_status.c"
|
||||||
"err.c"
|
|
||||||
"file_id.c"
|
"file_id.c"
|
||||||
"instance_get_key.c"
|
"instance_get_key.c"
|
||||||
"listener.c"
|
"listener.c"
|
||||||
|
@ -53,7 +52,7 @@ add_cunit_executable(cunit_ddsc ${ddsc_test_sources})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
cunit_ddsc PRIVATE
|
cunit_ddsc PRIVATE
|
||||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/include/>")
|
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/include/>")
|
||||||
target_link_libraries(cunit_ddsc RoundTrip Space TypesArrayKey ddsc OSAPI)
|
target_link_libraries(cunit_ddsc PRIVATE RoundTrip Space TypesArrayKey ddsc)
|
||||||
|
|
||||||
# Setup environment for config-tests
|
# Setup environment for config-tests
|
||||||
get_test_property(CUnit_ddsc_config_simple_udp ENVIRONMENT CUnit_ddsc_config_simple_udp_env)
|
get_test_property(CUnit_ddsc_config_simple_udp ENVIRONMENT CUnit_ddsc_config_simple_udp_env)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
CU_Test(ddsc_basic, test)
|
CU_Test(ddsc_basic, test)
|
||||||
|
|
|
@ -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/dds.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "ddsc/dds.h"
|
|
||||||
#include "os/os.h"
|
|
||||||
#include "test-common.h"
|
#include "test-common.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
|
||||||
|
|
||||||
static dds_entity_t g_participant = 0;
|
static dds_entity_t g_participant = 0;
|
||||||
static dds_entity_t g_subscriber = 0;
|
static dds_entity_t g_subscriber = 0;
|
||||||
|
|
|
@ -9,22 +9,28 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "config_env.h"
|
#include "config_env.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
|
||||||
|
#include "dds/version.h"
|
||||||
|
#include "dds/ddsrt/cdtors.h"
|
||||||
|
#include "dds/ddsrt/environ.h"
|
||||||
|
#include "dds/ddsrt/heap.h"
|
||||||
|
|
||||||
#define FORCE_ENV
|
#define FORCE_ENV
|
||||||
|
|
||||||
#define URI_VARIABLE DDSC_PROJECT_NAME_NOSPACE_CAPS"_URI"
|
#define URI_VARIABLE DDS_PROJECT_NAME_NOSPACE_CAPS"_URI"
|
||||||
#define MAX_PARTICIPANTS_VARIABLE "MAX_PARTICIPANTS"
|
#define MAX_PARTICIPANTS_VARIABLE "MAX_PARTICIPANTS"
|
||||||
|
|
||||||
static void config__check_env(
|
static void config__check_env(
|
||||||
_In_z_ const char * env_variable,
|
const char * env_variable,
|
||||||
_In_z_ const char * expected_value)
|
const char * expected_value)
|
||||||
{
|
{
|
||||||
const char * env_uri = os_getenv(env_variable);
|
char * env_uri = NULL;
|
||||||
|
ddsrt_getenv(env_variable, &env_uri);
|
||||||
#if 0
|
#if 0
|
||||||
const char * const env_not_set = "Environment variable '%s' isn't set. This needs to be set to '%s' for this test to run.";
|
const char * const env_not_set = "Environment variable '%s' isn't set. This needs to be set to '%s' for this test to run.";
|
||||||
const char * const env_not_as_expected = "Environment variable '%s' has an unexpected value: '%s' (expected: '%s')";
|
const char * const env_not_as_expected = "Environment variable '%s' has an unexpected value: '%s' (expected: '%s')";
|
||||||
|
@ -43,17 +49,10 @@ static void config__check_env(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !env_ok ) {
|
if ( !env_ok ) {
|
||||||
os_result r;
|
dds_retcode_t r;
|
||||||
char *envstr;
|
|
||||||
size_t len = strlen(env_variable) + strlen("=") + strlen(expected_value) + 1;
|
|
||||||
|
|
||||||
envstr = os_malloc(len);
|
r = ddsrt_setenv(env_variable, expected_value);
|
||||||
(void)snprintf(envstr, len, "%s=%s", env_variable, expected_value);
|
CU_ASSERT_EQUAL_FATAL(r, DDS_RETCODE_OK);
|
||||||
|
|
||||||
r = os_putenv(envstr);
|
|
||||||
CU_ASSERT_EQUAL_FATAL(r, os_resultSuccess);
|
|
||||||
|
|
||||||
os_free(envstr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -63,7 +62,7 @@ static void config__check_env(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CU_Test(ddsc_config, simple_udp, .init = os_osInit, .fini = os_osExit) {
|
CU_Test(ddsc_config, simple_udp, .init = ddsrt_init, .fini = ddsrt_fini) {
|
||||||
|
|
||||||
dds_entity_t participant;
|
dds_entity_t participant;
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,16 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include <limits.h>
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -41,9 +45,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,9 +150,9 @@ CU_Test(ddsc_writedispose, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds_delete(g_writer);
|
dds_delete(g_writer);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose(g_writer, NULL);
|
ret = dds_writedispose(g_writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -157,9 +161,9 @@ CU_Test(ddsc_writedispose, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
CU_Test(ddsc_writedispose, null, .init=disposing_init, .fini=disposing_fini)
|
CU_Test(ddsc_writedispose, null, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose(g_writer, NULL);
|
ret = dds_writedispose(g_writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -173,9 +177,9 @@ CU_Theory((dds_entity_t writer), ddsc_writedispose, invalid_writers, .init=dispo
|
||||||
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose(writer, NULL);
|
ret = dds_writedispose(writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -187,9 +191,9 @@ CU_TheoryDataPoints(ddsc_writedispose, non_writers) = {
|
||||||
CU_Theory((dds_entity_t *writer), ddsc_writedispose, non_writers, .init=disposing_init, .fini=disposing_fini)
|
CU_Theory((dds_entity_t *writer), ddsc_writedispose, non_writers, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose(*writer, NULL);
|
ret = dds_writedispose(*writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -303,9 +307,9 @@ CU_Test(ddsc_writedispose_ts, deleted, .init=disposing_init, .fini=disposing_fin
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds_delete(g_writer);
|
dds_delete(g_writer);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose_ts(g_writer, NULL, g_present);
|
ret = dds_writedispose_ts(g_writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
CU_ASSERT_EQUAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -314,9 +318,9 @@ CU_Test(ddsc_writedispose_ts, deleted, .init=disposing_init, .fini=disposing_fin
|
||||||
CU_Test(ddsc_writedispose_ts, null, .init=disposing_init, .fini=disposing_fini)
|
CU_Test(ddsc_writedispose_ts, null, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose_ts(g_writer, NULL, g_present);
|
ret = dds_writedispose_ts(g_writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -344,9 +348,9 @@ CU_Theory((dds_entity_t writer), ddsc_writedispose_ts, invalid_writers, .init=di
|
||||||
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose_ts(writer, NULL, g_present);
|
ret = dds_writedispose_ts(writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -358,9 +362,9 @@ CU_TheoryDataPoints(ddsc_writedispose_ts, non_writers) = {
|
||||||
CU_Theory((dds_entity_t *writer), ddsc_writedispose_ts, non_writers, .init=disposing_init, .fini=disposing_fini)
|
CU_Theory((dds_entity_t *writer), ddsc_writedispose_ts, non_writers, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_writedispose_ts(*writer, NULL, g_present);
|
ret = dds_writedispose_ts(*writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -503,9 +507,9 @@ CU_Test(ddsc_dispose, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds_delete(g_writer);
|
dds_delete(g_writer);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose(g_writer, NULL);
|
ret = dds_dispose(g_writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -514,9 +518,9 @@ CU_Test(ddsc_dispose, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
CU_Test(ddsc_dispose, null, .init=disposing_init, .fini=disposing_fini)
|
CU_Test(ddsc_dispose, null, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose(g_writer, NULL);
|
ret = dds_dispose(g_writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -544,9 +548,9 @@ CU_Theory((dds_entity_t writer), ddsc_dispose, invalid_writers, .init=disposing_
|
||||||
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose(writer, NULL);
|
ret = dds_dispose(writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -558,9 +562,9 @@ CU_TheoryDataPoints(ddsc_dispose, non_writers) = {
|
||||||
CU_Theory((dds_entity_t *writer), ddsc_dispose, non_writers, .init=disposing_init, .fini=disposing_fini)
|
CU_Theory((dds_entity_t *writer), ddsc_dispose, non_writers, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose(*writer, NULL);
|
ret = dds_dispose(*writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -658,9 +662,9 @@ CU_Test(ddsc_dispose_ts, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds_delete(g_writer);
|
dds_delete(g_writer);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose_ts(g_writer, NULL, g_present);
|
ret = dds_dispose_ts(g_writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_ON(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ALREADY_DELETED);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -669,9 +673,9 @@ CU_Test(ddsc_dispose_ts, deleted, .init=disposing_init, .fini=disposing_fini)
|
||||||
CU_Test(ddsc_dispose_ts, null, .init=disposing_init, .fini=disposing_fini)
|
CU_Test(ddsc_dispose_ts, null, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose_ts(g_writer, NULL, g_present);
|
ret = dds_dispose_ts(g_writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -699,9 +703,9 @@ CU_Theory((dds_entity_t writer), ddsc_dispose_ts, invalid_writers, .init=disposi
|
||||||
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
dds_entity_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose_ts(writer, NULL, g_present);
|
ret = dds_dispose_ts(writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), dds_err_nr(exp));
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -713,9 +717,9 @@ CU_TheoryDataPoints(ddsc_dispose_ts, non_writers) = {
|
||||||
CU_Theory((dds_entity_t *writer), ddsc_dispose_ts, non_writers, .init=disposing_init, .fini=disposing_fini)
|
CU_Theory((dds_entity_t *writer), ddsc_dispose_ts, non_writers, .init=disposing_init, .fini=disposing_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_dispose_ts(*writer, NULL, g_present);
|
ret = dds_dispose_ts(*writer, NULL, g_present);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_ILLEGAL_OPERATION);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
/* We are deliberately testing some bad arguments that SAL will complain about.
|
/* We are deliberately testing some bad arguments that SAL will complain about.
|
||||||
|
@ -338,7 +338,7 @@ CU_Test(ddsc_entity, get_entities, .init = create_entity, .fini = delete_entity)
|
||||||
CU_Test(ddsc_entity, get_domainid, .init = create_entity, .fini = delete_entity)
|
CU_Test(ddsc_entity, get_domainid, .init = create_entity, .fini = delete_entity)
|
||||||
{
|
{
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
dds_domainid_t id;
|
dds_domainid_t id = -1;
|
||||||
|
|
||||||
/* Check getting ID with bad parameters. */
|
/* Check getting ID with bad parameters. */
|
||||||
status = dds_get_domainid (0, NULL);
|
status = dds_get_domainid (0, NULL);
|
||||||
|
@ -351,7 +351,7 @@ CU_Test(ddsc_entity, get_domainid, .init = create_entity, .fini = delete_entity)
|
||||||
/* Get and check the domain id. */
|
/* Get and check the domain id. */
|
||||||
status = dds_get_domainid (entity, &id);
|
status = dds_get_domainid (entity, &id);
|
||||||
cu_assert_status_eq(status, DDS_RETCODE_OK);
|
cu_assert_status_eq(status, DDS_RETCODE_OK);
|
||||||
CU_ASSERT_EQUAL_FATAL(id, 0);
|
CU_ASSERT_FATAL(id != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CU_Test(ddsc_entity, delete, .init = create_entity)
|
CU_Test(ddsc_entity, delete, .init = create_entity)
|
||||||
|
|
|
@ -9,15 +9,16 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include <limits.h>
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
/* Add --verbose command line argument to get the cr_log_info traces (if there are any). */
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -47,9 +48,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,10 +773,10 @@ CU_Test(ddsc_entity_implicit_publisher, invalid_topic)
|
||||||
CU_ASSERT_FATAL(participant > 0);
|
CU_ASSERT_FATAL(participant > 0);
|
||||||
|
|
||||||
/* Disable SAL warning on intentional misuse of the API */
|
/* Disable SAL warning on intentional misuse of the API */
|
||||||
OS_WARNING_MSVC_OFF(28020);
|
DDSRT_WARNING_MSVC_OFF(28020);
|
||||||
writer = dds_create_writer(participant, 0, NULL, NULL);
|
writer = dds_create_writer(participant, 0, NULL, NULL);
|
||||||
/* Disable SAL warning on intentional misuse of the API */
|
/* Disable SAL warning on intentional misuse of the API */
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
CU_ASSERT_FATAL(writer < 0);
|
CU_ASSERT_FATAL(writer < 0);
|
||||||
|
|
||||||
dds_delete(writer);
|
dds_delete(writer);
|
||||||
|
@ -826,9 +827,9 @@ CU_Test(ddsc_entity_explicit_subscriber, invalid_topic)
|
||||||
|
|
||||||
subscriber = dds_create_subscriber(participant, NULL,NULL);
|
subscriber = dds_create_subscriber(participant, NULL,NULL);
|
||||||
/* Disable SAL warning on intentional misuse of the API */
|
/* Disable SAL warning on intentional misuse of the API */
|
||||||
OS_WARNING_MSVC_OFF(28020);
|
DDSRT_WARNING_MSVC_OFF(28020);
|
||||||
reader = dds_create_reader(subscriber, 0, NULL, NULL);
|
reader = dds_create_reader(subscriber, 0, NULL, NULL);
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
CU_ASSERT_FATAL(reader < 0);
|
CU_ASSERT_FATAL(reader < 0);
|
||||||
|
|
||||||
dds_delete(reader);
|
dds_delete(reader);
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Test globals.
|
* Test globals.
|
||||||
|
@ -51,9 +53,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
#include "ddsc/dds.h"
|
|
||||||
#include "CUnit/Test.h"
|
|
||||||
|
|
||||||
CU_Test(ddsc_err, str)
|
|
||||||
{
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(1 ), "Success");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(-255 ), "Unknown");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_OK * -1), "Success");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_ERROR * -1), "Error");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_UNSUPPORTED * -1), "Unsupported");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_BAD_PARAMETER * -1), "Bad Parameter");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_PRECONDITION_NOT_MET * -1), "Precondition Not Met");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_OUT_OF_RESOURCES * -1), "Out Of Resources");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_NOT_ENABLED * -1), "Not Enabled");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_IMMUTABLE_POLICY * -1), "Immutable Policy");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_INCONSISTENT_POLICY * -1), "Inconsistent Policy");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_ALREADY_DELETED * -1), "Already Deleted");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_TIMEOUT * -1), "Timeout");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_NO_DATA * -1), "No Data");
|
|
||||||
CU_ASSERT_STRING_EQUAL(dds_err_str(DDS_RETCODE_ILLEGAL_OPERATION * -1), "Illegal Operation");
|
|
||||||
}
|
|
|
@ -9,9 +9,10 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
|
||||||
CU_Test(ddsc_err, unique_file_id)
|
CU_Test(ddsc_err, unique_file_id)
|
||||||
{
|
{
|
||||||
|
@ -21,14 +22,14 @@ CU_Test(ddsc_err, unique_file_id)
|
||||||
CU_ASSERT_FATAL(participant > 0);
|
CU_ASSERT_FATAL(participant > 0);
|
||||||
|
|
||||||
/* Disable SAL warning on intentional misuse of the API */
|
/* Disable SAL warning on intentional misuse of the API */
|
||||||
OS_WARNING_MSVC_OFF(28020);
|
DDSRT_WARNING_MSVC_OFF(28020);
|
||||||
reader = dds_create_reader(0, 0, NULL, NULL);
|
reader = dds_create_reader(0, 0, NULL, NULL);
|
||||||
CU_ASSERT_FATAL(reader < 0);
|
CU_ASSERT_FATAL(reader < 0);
|
||||||
|
|
||||||
writer = dds_create_writer(0, 0, NULL, NULL);
|
writer = dds_create_writer(0, 0, NULL, NULL);
|
||||||
CU_ASSERT_FATAL(writer < 0);
|
CU_ASSERT_FATAL(writer < 0);
|
||||||
|
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
|
|
||||||
CU_ASSERT_NOT_EQUAL_FATAL(dds_err_file_id(reader), dds_err_file_id(writer));
|
CU_ASSERT_NOT_EQUAL_FATAL(dds_err_file_id(reader), dds_err_file_id(writer));
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "CUnit/Test.h"
|
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "CUnit/Test.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
#include "dds/ddsrt/string.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
static dds_entity_t participant = DDS_ENTITY_NIL;
|
static dds_entity_t participant = DDS_ENTITY_NIL;
|
||||||
|
@ -42,7 +42,7 @@ static void setup(void)
|
||||||
CU_ASSERT_FATAL(writer > 0);
|
CU_ASSERT_FATAL(writer > 0);
|
||||||
|
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.ip = os_strdup("some data");
|
data.ip = ddsrt_strdup("some data");
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(data.ip);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(data.ip);
|
||||||
data.port = 1;
|
data.port = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,23 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/cdtors.h"
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/sync.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* TODO: (CHAM-279) Add DDS_INCONSISTENT_TOPIC_STATUS test
|
* TODO: Add DDS_INCONSISTENT_TOPIC_STATUS test
|
||||||
* TODO: (CHAM-277) Add DDS_OFFERED/REQUESTED_DEADLINE_MISSED_STATUS test
|
* TODO: Add DDS_OFFERED/REQUESTED_DEADLINE_MISSED_STATUS test
|
||||||
* TODO: (CHAM-278) Add DDS_LIVELINESS_LOST_STATUS test
|
* TODO: Add DDS_LIVELINESS_LOST_STATUS test
|
||||||
* TODO: Check DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS intermittent fail (total_count != 1)
|
* TODO: Check DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS intermittent fail (total_count != 1)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Convenience test macros.
|
* Convenience test macros.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -68,8 +71,8 @@ static dds_entity_t g_reader = 0;
|
||||||
|
|
||||||
static dds_listener_t *g_listener = NULL;
|
static dds_listener_t *g_listener = NULL;
|
||||||
static dds_qos_t *g_qos = NULL;
|
static dds_qos_t *g_qos = NULL;
|
||||||
static os_mutex g_mutex;
|
static ddsrt_mutex_t g_mutex;
|
||||||
static os_cond g_cond;
|
static ddsrt_cond_t g_cond;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,12 +104,12 @@ inconsistent_topic_cb(
|
||||||
const dds_inconsistent_topic_status_t status, void* arg)
|
const dds_inconsistent_topic_status_t status, void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_topic = topic;
|
cb_topic = topic;
|
||||||
cb_inconsistent_topic_status = status;
|
cb_inconsistent_topic_status = status;
|
||||||
cb_called |= DDS_INCONSISTENT_TOPIC_STATUS;
|
cb_called |= DDS_INCONSISTENT_TOPIC_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -116,12 +119,12 @@ liveliness_lost_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_writer = writer;
|
cb_writer = writer;
|
||||||
cb_liveliness_lost_status = status;
|
cb_liveliness_lost_status = status;
|
||||||
cb_called |= DDS_LIVELINESS_LOST_STATUS;
|
cb_called |= DDS_LIVELINESS_LOST_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -131,12 +134,12 @@ offered_deadline_missed_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_writer = writer;
|
cb_writer = writer;
|
||||||
cb_offered_deadline_missed_status = status;
|
cb_offered_deadline_missed_status = status;
|
||||||
cb_called |= DDS_OFFERED_DEADLINE_MISSED_STATUS;
|
cb_called |= DDS_OFFERED_DEADLINE_MISSED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -146,12 +149,12 @@ offered_incompatible_qos_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_writer = writer;
|
cb_writer = writer;
|
||||||
cb_offered_incompatible_qos_status = status;
|
cb_offered_incompatible_qos_status = status;
|
||||||
cb_called |= DDS_OFFERED_INCOMPATIBLE_QOS_STATUS;
|
cb_called |= DDS_OFFERED_INCOMPATIBLE_QOS_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -160,11 +163,11 @@ data_on_readers_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_subscriber = subscriber;
|
cb_subscriber = subscriber;
|
||||||
cb_called |= DDS_DATA_ON_READERS_STATUS;
|
cb_called |= DDS_DATA_ON_READERS_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -174,12 +177,12 @@ sample_lost_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_sample_lost_status = status;
|
cb_sample_lost_status = status;
|
||||||
cb_called |= DDS_SAMPLE_LOST_STATUS;
|
cb_called |= DDS_SAMPLE_LOST_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -188,11 +191,11 @@ data_available_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_called |= DDS_DATA_AVAILABLE_STATUS;
|
cb_called |= DDS_DATA_AVAILABLE_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -202,12 +205,12 @@ sample_rejected_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_sample_rejected_status = status;
|
cb_sample_rejected_status = status;
|
||||||
cb_called |= DDS_SAMPLE_REJECTED_STATUS;
|
cb_called |= DDS_SAMPLE_REJECTED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -217,12 +220,12 @@ liveliness_changed_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_liveliness_changed_status = status;
|
cb_liveliness_changed_status = status;
|
||||||
cb_called |= DDS_LIVELINESS_CHANGED_STATUS;
|
cb_called |= DDS_LIVELINESS_CHANGED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -232,12 +235,12 @@ requested_deadline_missed_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_requested_deadline_missed_status = status;
|
cb_requested_deadline_missed_status = status;
|
||||||
cb_called |= DDS_REQUESTED_DEADLINE_MISSED_STATUS;
|
cb_called |= DDS_REQUESTED_DEADLINE_MISSED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -247,12 +250,12 @@ requested_incompatible_qos_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_requested_incompatible_qos_status = status;
|
cb_requested_incompatible_qos_status = status;
|
||||||
cb_called |= DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS;
|
cb_called |= DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -262,12 +265,12 @@ publication_matched_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_writer = writer;
|
cb_writer = writer;
|
||||||
cb_publication_matched_status = status;
|
cb_publication_matched_status = status;
|
||||||
cb_called |= DDS_PUBLICATION_MATCHED_STATUS;
|
cb_called |= DDS_PUBLICATION_MATCHED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -277,12 +280,12 @@ subscription_matched_cb(
|
||||||
void* arg)
|
void* arg)
|
||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
cb_reader = reader;
|
cb_reader = reader;
|
||||||
cb_subscription_matched_status = status;
|
cb_subscription_matched_status = status;
|
||||||
cb_called |= DDS_SUBSCRIPTION_MATCHED_STATUS;
|
cb_called |= DDS_SUBSCRIPTION_MATCHED_STATUS;
|
||||||
os_condBroadcast(&g_cond);
|
ddsrt_cond_broadcast(&g_cond);
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -293,13 +296,13 @@ callback_dummy(void)
|
||||||
static uint32_t
|
static uint32_t
|
||||||
waitfor_cb(uint32_t expected)
|
waitfor_cb(uint32_t expected)
|
||||||
{
|
{
|
||||||
os_time timeout = { 5, 0 };
|
dds_time_t timeout = 5 * DDS_NSECS_IN_SEC;
|
||||||
os_result osr = os_resultSuccess;
|
bool signalled = true;
|
||||||
os_mutexLock(&g_mutex);
|
ddsrt_mutex_lock(&g_mutex);
|
||||||
while (((cb_called & expected) != expected) && (osr == os_resultSuccess)) {
|
while (((cb_called & expected) != expected) && (signalled)) {
|
||||||
osr = os_condTimedWait(&g_cond, &g_mutex, &timeout);
|
signalled = ddsrt_cond_waitfor(&g_cond, &g_mutex, timeout);
|
||||||
}
|
}
|
||||||
os_mutexUnlock(&g_mutex);
|
ddsrt_mutex_unlock(&g_mutex);
|
||||||
return cb_called;
|
return cb_called;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,9 +315,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,10 +326,10 @@ init_triggering_base(void)
|
||||||
{
|
{
|
||||||
char name[100];
|
char name[100];
|
||||||
|
|
||||||
os_osInit();
|
ddsrt_init();
|
||||||
|
|
||||||
os_mutexInit(&g_mutex);
|
ddsrt_mutex_init(&g_mutex);
|
||||||
os_condInit(&g_cond, &g_mutex);
|
ddsrt_cond_init(&g_cond);
|
||||||
|
|
||||||
g_participant = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL);
|
g_participant = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL);
|
||||||
CU_ASSERT_FATAL(g_participant > 0);
|
CU_ASSERT_FATAL(g_participant > 0);
|
||||||
|
@ -347,6 +350,8 @@ init_triggering_base(void)
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(g_qos);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(g_qos);
|
||||||
dds_qset_reliability(g_qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(1));
|
dds_qset_reliability(g_qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(1));
|
||||||
dds_qset_history(g_qos, DDS_HISTORY_KEEP_ALL, 0);
|
dds_qset_history(g_qos, DDS_HISTORY_KEEP_ALL, 0);
|
||||||
|
|
||||||
|
cb_called = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -386,9 +391,9 @@ fini_triggering_base(void)
|
||||||
dds_delete_qos(g_qos);
|
dds_delete_qos(g_qos);
|
||||||
dds_delete_listener(g_listener);
|
dds_delete_listener(g_listener);
|
||||||
dds_delete(g_participant);
|
dds_delete(g_participant);
|
||||||
os_condDestroy(&g_cond);
|
ddsrt_cond_destroy(&g_cond);
|
||||||
os_mutexDestroy(&g_mutex);
|
ddsrt_mutex_destroy(&g_mutex);
|
||||||
os_osExit();
|
ddsrt_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -426,9 +431,9 @@ CU_Test(ddsc_listener, create_and_delete)
|
||||||
ASSERT_CALLBACK_EQUAL(data_available, listener, DDS_LUNSET);
|
ASSERT_CALLBACK_EQUAL(data_available, listener, DDS_LUNSET);
|
||||||
|
|
||||||
dds_delete_listener(listener);
|
dds_delete_listener(listener);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_delete_listener(NULL);
|
dds_delete_listener(NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
}
|
}
|
||||||
|
|
||||||
CU_Test(ddsc_listener, reset)
|
CU_Test(ddsc_listener, reset)
|
||||||
|
@ -475,11 +480,11 @@ CU_Test(ddsc_listener, copy)
|
||||||
ASSERT_CALLBACK_EQUAL(sample_lost, listener2, sample_lost_cb);
|
ASSERT_CALLBACK_EQUAL(sample_lost, listener2, sample_lost_cb);
|
||||||
|
|
||||||
/* Calling copy with NULL should not crash and be noops. */
|
/* Calling copy with NULL should not crash and be noops. */
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_copy_listener(listener2, NULL);
|
dds_copy_listener(listener2, NULL);
|
||||||
dds_copy_listener(NULL, listener1);
|
dds_copy_listener(NULL, listener1);
|
||||||
dds_copy_listener(NULL, NULL);
|
dds_copy_listener(NULL, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
|
|
||||||
dds_delete_listener(listener1);
|
dds_delete_listener(listener1);
|
||||||
dds_delete_listener(listener2);
|
dds_delete_listener(listener2);
|
||||||
|
@ -568,7 +573,7 @@ CU_Test(ddsc_listener, getters_setters)
|
||||||
dds_listener_t *listener = dds_create_listener(NULL);
|
dds_listener_t *listener = dds_create_listener(NULL);
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(listener);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(listener);
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */ \
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */ \
|
||||||
TEST_GET_SET(listener, inconsistent_topic, inconsistent_topic_cb);
|
TEST_GET_SET(listener, inconsistent_topic, inconsistent_topic_cb);
|
||||||
TEST_GET_SET(listener, liveliness_lost, liveliness_lost_cb);
|
TEST_GET_SET(listener, liveliness_lost, liveliness_lost_cb);
|
||||||
TEST_GET_SET(listener, offered_deadline_missed, offered_deadline_missed_cb);
|
TEST_GET_SET(listener, offered_deadline_missed, offered_deadline_missed_cb);
|
||||||
|
@ -582,7 +587,7 @@ CU_Test(ddsc_listener, getters_setters)
|
||||||
TEST_GET_SET(listener, publication_matched, publication_matched_cb);
|
TEST_GET_SET(listener, publication_matched, publication_matched_cb);
|
||||||
TEST_GET_SET(listener, subscription_matched, subscription_matched_cb);
|
TEST_GET_SET(listener, subscription_matched, subscription_matched_cb);
|
||||||
TEST_GET_SET(listener, data_available, data_available_cb);
|
TEST_GET_SET(listener, data_available, data_available_cb);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
|
|
||||||
dds_delete_listener(listener);
|
dds_delete_listener(listener);
|
||||||
}
|
}
|
||||||
|
@ -1013,8 +1018,8 @@ Test(ddsc_listener, inconsistent_topic, .init=init_triggering_base, .fini=fini_t
|
||||||
|
|
||||||
os_osInit();
|
os_osInit();
|
||||||
|
|
||||||
os_mutexInit(&g_mutex);
|
ddsrt_mutex_init(&g_mutex);
|
||||||
os_condInit(&g_cond, &g_mutex);
|
ddsrt_cond_init(&g_cond);
|
||||||
|
|
||||||
g_qos = dds_create_qos();
|
g_qos = dds_create_qos();
|
||||||
cr_assert_not_null(g_qos, "Failed to create prerequisite g_qos");
|
cr_assert_not_null(g_qos, "Failed to create prerequisite g_qos");
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include <stdlib.h>
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include <os/os.h>
|
|
||||||
#include "config_env.h"
|
|
||||||
#include "ddsc/ddsc_project.h"
|
|
||||||
|
|
||||||
|
#include "dds/dds.h"
|
||||||
|
#include "CUnit/Test.h"
|
||||||
|
#include "config_env.h"
|
||||||
|
#include "dds/version.h"
|
||||||
|
#include "dds/ddsrt/environ.h"
|
||||||
|
|
||||||
#define cu_assert_status_eq(s1, s2) CU_ASSERT_EQUAL_FATAL(dds_err_nr(s1), s2)
|
#define cu_assert_status_eq(s1, s2) CU_ASSERT_EQUAL_FATAL(dds_err_nr(s1), s2)
|
||||||
|
|
||||||
|
@ -41,14 +42,14 @@ CU_Test(ddsc_participant, create_and_delete) {
|
||||||
|
|
||||||
|
|
||||||
/* Test for creating participant with no configuration file */
|
/* Test for creating participant with no configuration file */
|
||||||
CU_Test(ddsc_participant, create_with_no_conf_no_env) {
|
CU_Test(ddsc_participant, create_with_no_conf_no_env)
|
||||||
|
{
|
||||||
dds_entity_t participant, participant2, participant3;
|
dds_entity_t participant, participant2, participant3;
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
dds_domainid_t domain_id;
|
dds_domainid_t domain_id;
|
||||||
dds_domainid_t valid_domain=3;
|
dds_domainid_t valid_domain=3;
|
||||||
|
|
||||||
const char * env_uri = os_getenv(DDSC_PROJECT_NAME_NOSPACE_CAPS"_URI");
|
ddsrt_unsetenv(DDS_PROJECT_NAME_NOSPACE_CAPS"_URI");
|
||||||
CU_ASSERT_EQUAL_FATAL(env_uri, NULL);
|
|
||||||
|
|
||||||
//invalid domain
|
//invalid domain
|
||||||
participant = dds_create_participant (-2, NULL, NULL);
|
participant = dds_create_participant (-2, NULL, NULL);
|
||||||
|
@ -70,8 +71,6 @@ CU_Test(ddsc_participant, create_with_no_conf_no_env) {
|
||||||
|
|
||||||
dds_delete(participant2);
|
dds_delete(participant2);
|
||||||
dds_delete(participant3);
|
dds_delete(participant3);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,17 +83,12 @@ CU_Test(ddsc_participant, create_with_conf_no_env) {
|
||||||
dds_domainid_t domain_id;
|
dds_domainid_t domain_id;
|
||||||
dds_domainid_t valid_domain=3;
|
dds_domainid_t valid_domain=3;
|
||||||
|
|
||||||
static char env_uri_str[1000];
|
ddsrt_setenv(DDS_PROJECT_NAME_NOSPACE_CAPS"_URI", CONFIG_ENV_SIMPLE_UDP);
|
||||||
(void) snprintf(env_uri_str, sizeof(env_uri_str), "%s=%s", DDSC_PROJECT_NAME_NOSPACE_CAPS"_URI", CONFIG_ENV_SIMPLE_UDP);
|
ddsrt_setenv("MAX_PARTICIPANTS", CONFIG_ENV_MAX_PARTICIPANTS);
|
||||||
os_putenv(env_uri_str);
|
|
||||||
printf("env_uri_str %s\n", env_uri_str);
|
|
||||||
|
|
||||||
static char env_mp_str[100];
|
char * env_uri = NULL;
|
||||||
(void) snprintf(env_mp_str, sizeof(env_mp_str), "%s=%s", "MAX_PARTICIPANTS", CONFIG_ENV_MAX_PARTICIPANTS);
|
ddsrt_getenv(DDS_PROJECT_NAME_NOSPACE_CAPS"_URI", &env_uri);
|
||||||
os_putenv(env_mp_str);
|
CU_ASSERT_PTR_NOT_EQUAL_FATAL(env_uri, NULL);
|
||||||
|
|
||||||
const char * env_uri = os_getenv(DDSC_PROJECT_NAME_NOSPACE_CAPS"_URI");
|
|
||||||
CU_ASSERT_NOT_EQUAL_FATAL(env_uri, NULL);
|
|
||||||
|
|
||||||
//invalid domain
|
//invalid domain
|
||||||
participant = dds_create_participant (1, NULL, NULL);
|
participant = dds_create_participant (1, NULL, NULL);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
/* We are deliberately testing some bad arguments that SAL will complain about.
|
/* We are deliberately testing some bad arguments that SAL will complain about.
|
||||||
|
|
|
@ -10,16 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
|
|
||||||
/* We are deliberately testing some bad arguments that SAL will complain about.
|
|
||||||
* So, silence SAL regarding these issues. */
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 6387 28020)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Convenience global policies
|
* Convenience global policies
|
||||||
|
@ -655,6 +646,3 @@ CU_Test(ddsc_qos, durability_service, .init=qos_init, .fini=qos_fini)
|
||||||
CU_ASSERT_EQUAL_FATAL(p.max_samples_per_instance, g_pol_durability_service.max_samples_per_instance);
|
CU_ASSERT_EQUAL_FATAL(p.max_samples_per_instance, g_pol_durability_service.max_samples_per_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -9,12 +9,16 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include <limits.h>
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
#include "dds/dds.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -68,9 +72,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,9 +309,9 @@ CU_Test(ddsc_querycondition_get_mask, null, .init=querycondition_init, .fini=que
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
condition = dds_create_querycondition(g_reader, mask, filter_mod2);
|
condition = dds_create_querycondition(g_reader, mask, filter_mod2);
|
||||||
CU_ASSERT_FATAL(condition > 0);
|
CU_ASSERT_FATAL(condition > 0);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_get_mask(condition, NULL);
|
ret = dds_get_mask(condition, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
dds_delete(condition);
|
dds_delete(condition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,16 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "ddsc/dds.h"
|
#include <limits.h>
|
||||||
#include "os/os.h"
|
|
||||||
|
#include "dds/dds.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -68,9 +71,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,15 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -61,9 +64,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,9 +291,9 @@ CU_Test(ddsc_readcondition_get_mask, null, .init=readcondition_init, .fini=readc
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
condition = dds_create_readcondition(g_reader, mask);
|
condition = dds_create_readcondition(g_reader, mask);
|
||||||
CU_ASSERT_FATAL(condition > 0);
|
CU_ASSERT_FATAL(condition > 0);
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_get_mask(condition, NULL);
|
ret = dds_get_mask(condition, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
dds_delete(condition);
|
dds_delete(condition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,17 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -65,9 +68,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,9 +237,9 @@ CU_Test(ddsc_reader_create, invalid_qos_participant, .init=reader_init, .fini=re
|
||||||
dds_entity_t rdr;
|
dds_entity_t rdr;
|
||||||
dds_qos_t *qos = dds_create_qos();
|
dds_qos_t *qos = dds_create_qos();
|
||||||
/* Set invalid reader data lifecycle policy */
|
/* Set invalid reader data lifecycle policy */
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_qset_reader_data_lifecycle(qos, DDS_SECS(-1), DDS_SECS(-1));
|
dds_qset_reader_data_lifecycle(qos, DDS_SECS(-1), DDS_SECS(-1));
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
rdr = dds_create_reader(g_participant, g_topic, qos, NULL);
|
rdr = dds_create_reader(g_participant, g_topic, qos, NULL);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(rdr), DDS_RETCODE_INCONSISTENT_POLICY);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(rdr), DDS_RETCODE_INCONSISTENT_POLICY);
|
||||||
dds_delete_qos(qos);
|
dds_delete_qos(qos);
|
||||||
|
@ -249,9 +252,9 @@ CU_Test(ddsc_reader_create, invalid_qos_subscriber, .init=reader_init, .fini=rea
|
||||||
dds_entity_t rdr;
|
dds_entity_t rdr;
|
||||||
dds_qos_t *qos = dds_create_qos();
|
dds_qos_t *qos = dds_create_qos();
|
||||||
/* Set invalid reader data lifecycle policy */
|
/* Set invalid reader data lifecycle policy */
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_qset_reader_data_lifecycle(qos, DDS_SECS(-1), DDS_SECS(-1));
|
dds_qset_reader_data_lifecycle(qos, DDS_SECS(-1), DDS_SECS(-1));
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
rdr = dds_create_reader(g_subscriber, g_topic, qos, NULL);
|
rdr = dds_create_reader(g_subscriber, g_topic, qos, NULL);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(rdr), DDS_RETCODE_INCONSISTENT_POLICY);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(rdr), DDS_RETCODE_INCONSISTENT_POLICY);
|
||||||
dds_delete_qos(qos);
|
dds_delete_qos(qos);
|
||||||
|
|
|
@ -10,14 +10,16 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -85,9 +87,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -43,9 +45,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,9 +166,9 @@ CU_Theory((dds_instance_handle_t *hndl2, void *datap), ddsc_register_instance, i
|
||||||
/* Only test when the combination of parameters is actually invalid.*/
|
/* Only test when the combination of parameters is actually invalid.*/
|
||||||
CU_ASSERT_FATAL((hndl2 == NULL) || (datap == NULL));
|
CU_ASSERT_FATAL((hndl2 == NULL) || (datap == NULL));
|
||||||
|
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_register_instance(g_writer, hndl2, datap);
|
ret = dds_register_instance(g_writer, hndl2, datap);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "os/os.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
|
@ -10,14 +10,16 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -69,9 +71,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
entity_kind_str(dds_entity_t ent) {
|
entity_kind_str(dds_entity_t ent) {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
|
|
||||||
CU_Test(ddsc_time, request_time)
|
CU_Test(ddsc_time, request_time)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Test fixtures
|
* Test fixtures
|
||||||
|
@ -38,9 +40,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,9 +104,9 @@ CU_Test(ddsc_topic_create, invalid_qos, .init=ddsc_topic_init, .fini=ddsc_topic_
|
||||||
{
|
{
|
||||||
dds_entity_t topic;
|
dds_entity_t topic;
|
||||||
dds_qos_t *qos = dds_create_qos();
|
dds_qos_t *qos = dds_create_qos();
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_qset_lifespan(qos, DDS_SECS(-1));
|
dds_qset_lifespan(qos, DDS_SECS(-1));
|
||||||
OS_WARNING_MSVC_OFF(28020);
|
DDSRT_WARNING_MSVC_OFF(28020);
|
||||||
topic = dds_create_topic(g_participant, &RoundTripModule_DataType_desc, "inconsistent", qos, NULL);
|
topic = dds_create_topic(g_participant, &RoundTripModule_DataType_desc, "inconsistent", qos, NULL);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_INCONSISTENT_POLICY);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_INCONSISTENT_POLICY);
|
||||||
dds_delete_qos(qos);
|
dds_delete_qos(qos);
|
||||||
|
@ -164,9 +166,9 @@ CU_Test(ddsc_topic_create, recreate, .init=ddsc_topic_init, .fini=ddsc_topic_fin
|
||||||
CU_Test(ddsc_topic_create, desc_null, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
CU_Test(ddsc_topic_create, desc_null, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
||||||
{
|
{
|
||||||
dds_entity_t topic;
|
dds_entity_t topic;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
topic = dds_create_topic (g_participant, NULL, "desc_null", NULL, NULL);
|
topic = dds_create_topic (g_participant, NULL, "desc_null", NULL, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -219,9 +221,9 @@ CU_Test(ddsc_topic_find, non_participants, .init=ddsc_topic_init, .fini=ddsc_top
|
||||||
CU_Test(ddsc_topic_find, null, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
CU_Test(ddsc_topic_find, null, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
||||||
{
|
{
|
||||||
dds_entity_t topic;
|
dds_entity_t topic;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
topic = dds_find_topic(g_participant, NULL);
|
topic = dds_find_topic(g_participant, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(topic), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
|
@ -411,9 +413,9 @@ CU_Test(ddsc_topic_set_qos, valid, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
||||||
CU_Test(ddsc_topic_set_qos, inconsistent, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
CU_Test(ddsc_topic_set_qos, inconsistent, .init=ddsc_topic_init, .fini=ddsc_topic_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
dds_qset_lifespan(g_qos, DDS_SECS(-1));
|
dds_qset_lifespan(g_qos, DDS_SECS(-1));
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
ret = dds_set_qos(g_topicRtmDataType, g_qos);
|
ret = dds_set_qos(g_topicRtmDataType, g_qos);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_INCONSISTENT_POLICY);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(ret), DDS_RETCODE_INCONSISTENT_POLICY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "TypesArrayKey.h"
|
#include "TypesArrayKey.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -43,9 +45,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
#include "test-common.h"
|
#include "test-common.h"
|
||||||
|
|
|
@ -10,13 +10,18 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "os/os.h"
|
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
|
|
||||||
|
#include "dds/ddsrt/cdtors.h"
|
||||||
|
#include "dds/ddsrt/misc.h"
|
||||||
|
#include "dds/ddsrt/process.h"
|
||||||
|
#include "dds/ddsrt/threads.h"
|
||||||
|
#include "dds/ddsrt/time.h"
|
||||||
|
|
||||||
/**************************************************************************************************
|
/**************************************************************************************************
|
||||||
*
|
*
|
||||||
* Some thread related convenience stuff.
|
* Some thread related convenience stuff.
|
||||||
|
@ -30,7 +35,7 @@ typedef enum thread_state_t {
|
||||||
} thread_state_t;
|
} thread_state_t;
|
||||||
|
|
||||||
typedef struct thread_arg_t {
|
typedef struct thread_arg_t {
|
||||||
os_threadId tid;
|
ddsrt_thread_t tid;
|
||||||
thread_state_t state;
|
thread_state_t state;
|
||||||
dds_entity_t expected;
|
dds_entity_t expected;
|
||||||
} thread_arg_t;
|
} thread_arg_t;
|
||||||
|
@ -61,9 +66,9 @@ static char*
|
||||||
create_topic_name(const char *prefix, char *name, size_t size)
|
create_topic_name(const char *prefix, char *name, size_t size)
|
||||||
{
|
{
|
||||||
/* Get semi random g_topic name. */
|
/* Get semi random g_topic name. */
|
||||||
os_procId pid = os_getpid();
|
ddsrt_pid_t pid = ddsrt_getpid();
|
||||||
uintmax_t tid = os_threadIdToInteger(os_threadIdSelf());
|
ddsrt_tid_t tid = ddsrt_gettid();
|
||||||
(void) snprintf(name, size, "%s_pid%"PRIprocId"_tid%"PRIuMAX"", prefix, pid, tid);
|
(void) snprintf(name, size, "%s_pid%"PRIdPID"_tid%"PRIdTID"", prefix, pid, tid);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +98,7 @@ ddsc_waitset_init(void)
|
||||||
uint32_t mask = DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
uint32_t mask = DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
|
||||||
char name[100];
|
char name[100];
|
||||||
|
|
||||||
os_osInit();
|
ddsrt_init();
|
||||||
|
|
||||||
ddsc_waitset_basic_init();
|
ddsc_waitset_basic_init();
|
||||||
|
|
||||||
|
@ -128,7 +133,7 @@ ddsc_waitset_fini(void)
|
||||||
dds_delete(publisher);
|
dds_delete(publisher);
|
||||||
dds_delete(subscriber);
|
dds_delete(subscriber);
|
||||||
ddsc_waitset_basic_fini();
|
ddsc_waitset_basic_fini();
|
||||||
os_osExit();
|
ddsrt_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -823,9 +828,9 @@ CU_Theory((size_t size), ddsc_waitset_get_entities, array_sizes, .init=ddsc_wait
|
||||||
CU_Test(ddsc_waitset_get_entities, no_array, .init=ddsc_waitset_attached_init, .fini=ddsc_waitset_attached_fini)
|
CU_Test(ddsc_waitset_get_entities, no_array, .init=ddsc_waitset_attached_init, .fini=ddsc_waitset_attached_fini)
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
OS_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(6387); /* Disable SAL warning on intentional misuse of the API */
|
||||||
ret = dds_waitset_get_entities(waitset, NULL, 1);
|
ret = dds_waitset_get_entities(waitset, NULL, 1);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
/* ddsc_waitset_attached_init attached 7 entities. */
|
/* ddsc_waitset_attached_init attached 7 entities. */
|
||||||
CU_ASSERT_EQUAL_FATAL(ret, 7);
|
CU_ASSERT_EQUAL_FATAL(ret, 7);
|
||||||
}
|
}
|
||||||
|
@ -1068,41 +1073,41 @@ waiting_thread(void *a)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static os_result
|
static dds_retcode_t
|
||||||
thread_reached_state(thread_state_t *actual, thread_state_t expected, int32_t msec)
|
thread_reached_state(thread_state_t *actual, thread_state_t expected, int32_t msec)
|
||||||
{
|
{
|
||||||
/* Convenience function. */
|
/* Convenience function. */
|
||||||
os_time msec10 = { 0, 10000000 };
|
dds_time_t msec10 = DDS_MSECS(10);
|
||||||
while ((msec > 0) && (*actual != expected)) {
|
while ((msec > 0) && (*actual != expected)) {
|
||||||
os_nanoSleep(msec10);
|
dds_sleepfor(msec10);
|
||||||
msec -= 10;
|
msec -= 10;
|
||||||
}
|
}
|
||||||
return (*actual == expected) ? os_resultSuccess : os_resultTimeout;
|
return (*actual == expected) ? DDS_RETCODE_OK : DDS_RETCODE_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
waiting_thread_start(struct thread_arg_t *arg, dds_entity_t expected)
|
waiting_thread_start(struct thread_arg_t *arg, dds_entity_t expected)
|
||||||
{
|
{
|
||||||
os_threadId thread_id;
|
ddsrt_thread_t thread_id;
|
||||||
os_threadAttr thread_attr;
|
ddsrt_threadattr_t thread_attr;
|
||||||
os_result osr;
|
dds_retcode_t rc;
|
||||||
|
|
||||||
assert(arg);
|
assert(arg);
|
||||||
|
|
||||||
/* Create an other thread that will blocking wait on the waitset. */
|
/* Create an other thread that will blocking wait on the waitset. */
|
||||||
arg->expected = expected;
|
arg->expected = expected;
|
||||||
arg->state = STARTING;
|
arg->state = STARTING;
|
||||||
os_threadAttrInit(&thread_attr);
|
ddsrt_threadattr_init(&thread_attr);
|
||||||
osr = os_threadCreate(&thread_id, "waiting_thread", &thread_attr, waiting_thread, arg);
|
rc = ddsrt_thread_create(&thread_id, "waiting_thread", &thread_attr, waiting_thread, arg);
|
||||||
CU_ASSERT_EQUAL_FATAL(osr, os_resultSuccess);
|
CU_ASSERT_EQUAL_FATAL(rc, DDS_RETCODE_OK);
|
||||||
|
|
||||||
/* The thread should reach 'waiting' state. */
|
/* The thread should reach 'waiting' state. */
|
||||||
osr = thread_reached_state(&(arg->state), WAITING, 1000);
|
rc = thread_reached_state(&(arg->state), WAITING, 1000);
|
||||||
CU_ASSERT_EQUAL_FATAL(osr, os_resultSuccess);
|
CU_ASSERT_EQUAL_FATAL(rc, DDS_RETCODE_OK);
|
||||||
|
|
||||||
/* But thread should block and thus NOT reach 'stopped' state. */
|
/* But thread should block and thus NOT reach 'stopped' state. */
|
||||||
osr = thread_reached_state(&(arg->state), STOPPED, 100);
|
rc = thread_reached_state(&(arg->state), STOPPED, 100);
|
||||||
CU_ASSERT_EQUAL_FATAL(osr, os_resultTimeout);
|
CU_ASSERT_EQUAL_FATAL(rc, DDS_RETCODE_TIMEOUT);
|
||||||
|
|
||||||
arg->tid = thread_id;
|
arg->tid = thread_id;
|
||||||
}
|
}
|
||||||
|
@ -1110,11 +1115,11 @@ waiting_thread_start(struct thread_arg_t *arg, dds_entity_t expected)
|
||||||
static dds_return_t
|
static dds_return_t
|
||||||
waiting_thread_expect_exit(struct thread_arg_t *arg)
|
waiting_thread_expect_exit(struct thread_arg_t *arg)
|
||||||
{
|
{
|
||||||
os_result osr;
|
dds_retcode_t rc;
|
||||||
assert(arg);
|
assert(arg);
|
||||||
osr = thread_reached_state(&(arg->state), STOPPED, 5000);
|
rc = thread_reached_state(&(arg->state), STOPPED, 5000);
|
||||||
if (osr == os_resultSuccess) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
os_threadWaitExit(arg->tid, NULL);
|
ddsrt_thread_join(arg->tid, NULL);
|
||||||
return DDS_RETCODE_OK;
|
return DDS_RETCODE_OK;
|
||||||
}
|
}
|
||||||
return DDS_RETCODE_TIMEOUT;
|
return DDS_RETCODE_TIMEOUT;
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "CUnit/Test.h"
|
|
||||||
#include "CUnit/Theory.h"
|
#include "CUnit/Theory.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "Space.h"
|
#include "Space.h"
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/misc.h"
|
||||||
|
|
||||||
/* Tests in this file only concern themselves with very basic api tests of
|
/* Tests in this file only concern themselves with very basic api tests of
|
||||||
dds_write and dds_write_ts */
|
dds_write and dds_write_ts */
|
||||||
|
@ -73,9 +73,9 @@ CU_Test(ddsc_write, null_writer, .init = setup, .fini = teardown)
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
|
|
||||||
/* Disable warning related to improper API usage by passing incompatible parameter. */
|
/* Disable warning related to improper API usage by passing incompatible parameter. */
|
||||||
OS_WARNING_MSVC_OFF(28020);
|
DDSRT_WARNING_MSVC_OFF(28020);
|
||||||
status = dds_write(0, &data);
|
status = dds_write(0, &data);
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(status), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(status), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ CU_Test(ddsc_write, null_sample, .init = setup, .fini = teardown)
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
|
|
||||||
/* Disable warning related to improper API usage by passing NULL to a non-NULL parameter. */
|
/* Disable warning related to improper API usage by passing NULL to a non-NULL parameter. */
|
||||||
OS_WARNING_MSVC_OFF(6387);
|
DDSRT_WARNING_MSVC_OFF(6387);
|
||||||
status = dds_write(writer, NULL);
|
status = dds_write(writer, NULL);
|
||||||
OS_WARNING_MSVC_ON(6387);
|
DDSRT_WARNING_MSVC_ON(6387);
|
||||||
|
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(status), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(status), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "CUnit/Test.h"
|
#include "CUnit/Test.h"
|
||||||
#include "ddsc/dds.h"
|
#include "dds/dds.h"
|
||||||
#include "RoundTrip.h"
|
#include "RoundTrip.h"
|
||||||
#include "os/os.h"
|
#include "dds/ddsrt/misc.h"
|
||||||
|
|
||||||
static dds_entity_t participant = 0;
|
static dds_entity_t participant = 0;
|
||||||
static dds_entity_t topic = 0;
|
static dds_entity_t topic = 0;
|
||||||
|
@ -53,9 +54,9 @@ CU_Test(ddsc_create_writer, basic, .init = setup, .fini = teardown)
|
||||||
|
|
||||||
CU_Test(ddsc_create_writer, null_parent, .init = setup, .fini = teardown)
|
CU_Test(ddsc_create_writer, null_parent, .init = setup, .fini = teardown)
|
||||||
{
|
{
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
writer = dds_create_writer(0, topic, NULL, NULL);
|
writer = dds_create_writer(0, topic, NULL, NULL);
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(writer), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(writer), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +88,9 @@ CU_Test(ddsc_create_writer, deleted_publisher, .init = setup, .fini = teardown)
|
||||||
|
|
||||||
CU_Test(ddsc_create_writer, null_topic, .init = setup, .fini = teardown)
|
CU_Test(ddsc_create_writer, null_topic, .init = setup, .fini = teardown)
|
||||||
{
|
{
|
||||||
OS_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
DDSRT_WARNING_MSVC_OFF(28020); /* Disable SAL warning on intentional misuse of the API */
|
||||||
writer = dds_create_writer(publisher, 0, NULL, NULL);
|
writer = dds_create_writer(publisher, 0, NULL, NULL);
|
||||||
OS_WARNING_MSVC_ON(28020);
|
DDSRT_WARNING_MSVC_ON(28020);
|
||||||
CU_ASSERT_EQUAL_FATAL(dds_err_nr(writer), DDS_RETCODE_BAD_PARAMETER);
|
CU_ASSERT_EQUAL_FATAL(dds_err_nr(writer), DDS_RETCODE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ PREPEND(srcs_ddsi "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
|
|
||||||
# The includes should reside close to the code. As long as that's not the case,
|
# The includes should reside close to the code. As long as that's not the case,
|
||||||
# pull them in from this CMakeLists.txt.
|
# pull them in from this CMakeLists.txt.
|
||||||
PREPEND(hdrs_private_ddsi "${CMAKE_CURRENT_LIST_DIR}/include/ddsi"
|
PREPEND(hdrs_private_ddsi "${CMAKE_CURRENT_LIST_DIR}/include/dds/ddsi"
|
||||||
ddsi_ssl.h
|
ddsi_ssl.h
|
||||||
ddsi_tcp.h
|
ddsi_tcp.h
|
||||||
ddsi_tran.h
|
ddsi_tran.h
|
||||||
|
@ -124,11 +124,7 @@ PREPEND(hdrs_private_ddsi "${CMAKE_CURRENT_LIST_DIR}/include/ddsi"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(ddsc
|
target_sources(ddsc
|
||||||
PRIVATE
|
PRIVATE ${srcs_ddsi} ${hdrs_private_ddsi})
|
||||||
${srcs_ddsi}
|
|
||||||
${hdrs_private_ddsi}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(ddsc
|
target_include_directories(ddsc
|
||||||
PRIVATE
|
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include")
|
|
||||||
|
|
|
@ -12,18 +12,19 @@
|
||||||
#ifndef _DDS_IID_H_
|
#ifndef _DDS_IID_H_
|
||||||
#define _DDS_IID_H_
|
#define _DDS_IID_H_
|
||||||
|
|
||||||
#include "os/os.h"
|
#include "dds/export.h"
|
||||||
#include "ddsc/dds_export.h"
|
#include "dds/ddsrt/atomics.h"
|
||||||
|
#include "dds/ddsrt/sync.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ddsi_iid {
|
struct ddsi_iid {
|
||||||
#if OS_ATOMIC64_SUPPORT
|
#if DDSRT_ATOMIC64_SUPPORT
|
||||||
os_atomic_uint64_t counter;
|
ddsrt_atomic_uint64_t counter;
|
||||||
#else
|
#else
|
||||||
os_mutex lock;
|
ddsrt_mutex_t lock;
|
||||||
uint64_t counter;
|
uint64_t counter;
|
||||||
#endif
|
#endif
|
||||||
uint32_t key[4];
|
uint32_t key[4];
|
|
@ -12,13 +12,13 @@
|
||||||
#ifndef DDSI_IPADDR_H
|
#ifndef DDSI_IPADDR_H
|
||||||
#define DDSI_IPADDR_H
|
#define DDSI_IPADDR_H
|
||||||
|
|
||||||
#include "ddsi/ddsi_tran.h"
|
#include "dds/ddsi/ddsi_tran.h"
|
||||||
|
|
||||||
enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface interf[]);
|
enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (ddsi_tran_factory_t tran, const nn_locator_t *loc, size_t ninterf, const struct nn_interface interf[]);
|
||||||
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind);
|
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind);
|
||||||
int ddsi_ipaddr_compare (const os_sockaddr *const sa1, const os_sockaddr *const sa2);
|
int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2);
|
||||||
char *ddsi_ipaddr_to_string (ddsi_tran_factory_t tran, char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port);
|
char *ddsi_ipaddr_to_string (ddsi_tran_factory_t tran, char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port);
|
||||||
void ddsi_ipaddr_to_loc (nn_locator_t *dst, const os_sockaddr *src, int32_t kind);
|
void ddsi_ipaddr_to_loc (nn_locator_t *dst, const struct sockaddr *src, int32_t kind);
|
||||||
void ddsi_ipaddr_from_loc (os_sockaddr_storage *dst, const nn_locator_t *src);
|
void ddsi_ipaddr_from_loc (struct sockaddr_storage *dst, const nn_locator_t *src);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -12,7 +12,7 @@
|
||||||
#ifndef DDSI_MCGROUP_H
|
#ifndef DDSI_MCGROUP_H
|
||||||
#define DDSI_MCGROUP_H
|
#define DDSI_MCGROUP_H
|
||||||
|
|
||||||
#include "ddsi/ddsi_tran.h"
|
#include "dds/ddsi/ddsi_tran.h"
|
||||||
|
|
||||||
struct nn_group_membership;
|
struct nn_group_membership;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue