diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ade3753cfa..35fea802a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,12 @@ function(PREPEND var prefix) set(${var} "${listVar}" PARENT_SCOPE) endfunction() +# Durable support is currently under development (beta). +# Therefore it is disabled by default. To enable durable support +# in CycloneDDS use the build option '-DENABLE_DURABILITY' +# when building CycloneDDS + +option(ENABLE_DURABILITY "Enable Durable support" OFF) option(ENABLE_SECURITY "Enable OMG DDS Security support" ON) option(ENABLE_LIFESPAN "Enable Lifespan QoS support" ON) option(ENABLE_DEADLINE_MISSED "Enable Deadline Missed QoS support" ON) @@ -99,6 +105,10 @@ if(NOT ENABLE_SECURITY) message(STATUS "Building without OMG DDS Security support") endif() +if(ENABLE_DURABILITY) + message(STATUS "Building with Durable support") +endif() + if(BUILD_TESTING) add_subdirectory(ucunit) endif() @@ -108,4 +118,7 @@ if(BUILD_IDLC) add_subdirectory(idl) endif() add_subdirectory(security) +if(ENABLE_DURABILITY) + add_subdirectory(durability) +endif() add_subdirectory(core) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6e865fd845..6f79a7abcd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -62,6 +62,10 @@ if(ENABLE_SECURITY) $>) endif() +if(ENABLE_DURABILITY) + target_link_libraries(ddsc PRIVATE "$") +endif() + if(ENABLE_SHM) target_link_libraries(ddsc PRIVATE iceoryx_binding_c::iceoryx_binding_c) endif() diff --git a/src/core/ddsc/src/dds_domain.c b/src/core/ddsc/src/dds_domain.c index 415573445a..ac80258d9c 100644 --- a/src/core/ddsc/src/dds_domain.c +++ b/src/core/ddsc/src/dds_domain.c @@ -35,6 +35,10 @@ #include "dds__shm_monitor.h" #endif +#ifdef DDS_HAS_DURABILITY +#include "dds/durability/dds_durability.h" +#endif + static dds_return_t dds_domain_free (dds_entity *vdomain); const struct dds_entity_deriver dds_entity_deriver_domain = { @@ -295,6 +299,11 @@ dds_entity_t dds_create_domain (const dds_domainid_t domain, const char *config) const struct config_source config_src = { .kind = CFGKIND_XML, .u = { .xml = config } }; ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config_src); dds_entity_unpin_and_drop_ref (&dds_global.m_entity); + +#ifdef DDS_HAS_DURABILITY + dds_durability_init2(&dom->gv); +#endif + return ret; } diff --git a/src/ddsrt/CMakeLists.txt b/src/ddsrt/CMakeLists.txt index dbfc86a320..3a6b4082da 100644 --- a/src/ddsrt/CMakeLists.txt +++ b/src/ddsrt/CMakeLists.txt @@ -310,7 +310,7 @@ set(DDSRT_WITH_LWIP ${WITH_LWIP}) set(DDSRT_WITH_FREERTOS ${WITH_FREERTOS}) foreach(feature SSL SECURITY LIFESPAN DEADLINE_MISSED NETWORK_PARTITIONS - SSM TYPELIB TYPE_DISCOVERY TOPIC_DISCOVERY SHM) + SSM TYPELIB TYPE_DISCOVERY TOPIC_DISCOVERY SHM DURABILITY) set(DDS_HAS_${feature} ${ENABLE_${feature}}) endforeach() diff --git a/src/ddsrt/include/dds/features.h.in b/src/ddsrt/include/dds/features.h.in index 32b5c582d5..929a281134 100644 --- a/src/ddsrt/include/dds/features.h.in +++ b/src/ddsrt/include/dds/features.h.in @@ -41,4 +41,7 @@ /* Whether or not support for Iceoryx support is included */ #cmakedefine DDS_HAS_SHM 1 +/* Whether or not durable support is included */ +#cmakedefine DDS_HAS_DURABILITY 1 + #endif diff --git a/src/durability/CMakeLists.txt b/src/durability/CMakeLists.txt new file mode 100644 index 0000000000..30cba56886 --- /dev/null +++ b/src/durability/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright(c) 2006 to 2021 ZettaScale Technology 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 +# +set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}") +set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}") + +add_library(durability INTERFACE) + +target_include_directories( + durability INTERFACE + "$" + "$" + "$") + +set(headers + "${source_dir}/include/dds/durability/dds_durability.h") + +set(sources + "${source_dir}/src/dds_durability.c") + +target_sources(durability INTERFACE ${headers} ${sources}) + +install( + DIRECTORY + "${source_dir}/include/" + "${binary_dir}/include/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT dev + FILES_MATCHING PATTERN "*.h") \ No newline at end of file diff --git a/src/durability/include/dds/durability/dds_durability.h b/src/durability/include/dds/durability/dds_durability.h new file mode 100644 index 0000000000..65cf52600e --- /dev/null +++ b/src/durability/include/dds/durability/dds_durability.h @@ -0,0 +1,37 @@ +// Copyright(c) 2006 to 2020 ZettaScale Technology and others +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License +// v. 1.0 which is available at +// http://www.eclipse.org/org/documents/edl-v10.php. +// +// SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + +#ifndef DDS_DURABILITY_H +#define DDS_DURABILITY_H + +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsrt/retcode.h" +#include "ddsc/dds.h" +#include "dds__types.h" +#include "dds/ddsc/dds_rhc.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* Integration functions for durability plugins */ +typedef int (*plugin_init)(const char *argument, void **context, struct ddsi_domaingv *gv); +typedef int (*plugin_finalize)(void *context); + +dds_return_t dds_durability_init2 (struct ddsi_domaingv* gv); +dds_return_t dds_durability_fini2 (void); +void dds_durability_new_local_reader (struct dds_reader *reader, struct dds_rhc *rhc); +void dds_durability_wait_for_ds (uint32_t quorum, dds_time_t timeout); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDS_DURABILITY_H */ diff --git a/src/durability/src/dds_durability.c b/src/durability/src/dds_durability.c new file mode 100644 index 0000000000..471c12ea50 --- /dev/null +++ b/src/durability/src/dds_durability.c @@ -0,0 +1,44 @@ +/* + * Copyright(c) 2006 to 2019 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 "dds/durability/dds_durability.h" +#include "ddsc/dds.h" + + +dds_return_t dds_durability_init2 (struct ddsi_domaingv* gv) +{ + printf("!!!!!!!!!!!!!!!!!!! src/durability/core/src/dds_durability_init()\n"); + return DDS_RETCODE_OK; +} + +dds_return_t dds_durability_fini2 (void) +{ + printf("!!!!!!!!!!!!!!!!!!! src/durability/core/src/dds_durability_fini()\n"); + return DDS_RETCODE_OK; +} + +void dds_durability_new_local_reader (struct dds_reader *reader, struct dds_rhc *rhc) +{ + /* create the administration to store transient data */ + /* create a durability reader that sucks and stores it in the store */ + + DDSRT_UNUSED_ARG(reader); + return; +} + +void dds_durability_wait_for_ds (uint32_t quorum, dds_time_t timeout) +{ + (void)quorum; + (void)timeout; + return; +} + +