replace old builtin topics by new ones and add implementation of DCPSSubscription and DCPSPublication

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-12-03 17:40:39 +01:00
parent 78d49b52a0
commit 1a0fcea0c2
23 changed files with 1126 additions and 2828 deletions

View file

@ -89,12 +89,6 @@ target_include_directories(ddsc
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
# Generate builtin-topic sources
set(IDLC_ARGS "-dll" "FOO,ddsc/dds_export.h")
idlc_generate(BuiltinTypes ddsc/src/dds_dcps_builtintopics.idl ddsc/src/dds_builtinTopics.idl)
set(IDLC_ARGS)
target_link_libraries(ddsc PRIVATE BuiltinTypes)
target_include_directories(ddsc
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
@ -127,13 +121,6 @@ install(
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ddsc"
COMPONENT dev)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/dds_dcps_builtintopics.h"
"${CMAKE_CURRENT_BINARY_DIR}/dds_builtinTopics.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ddsc"
COMPONENT dev)
# TODO: improve test inclusion.
if((BUILD_TESTING) AND ((NOT DEFINED MSVC_VERSION) OR (MSVC_VERSION GREATER "1800")))
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tests")

View file

@ -48,7 +48,6 @@ typedef _Return_type_success_(return > 0) int32_t dds_entity_t;
#include "ddsc/dds_public_error.h"
#include "ddsc/dds_public_status.h"
#include "ddsc/dds_public_listener.h"
#include "dds_dcps_builtintopics.h"
#if defined (__cplusplus)
extern "C" {
@ -74,15 +73,9 @@ DDS_EXPORT dds_domainid_t dds_domain_default (void);
* @{
*/
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSPARTICIPANT;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_CMPARTICIPANT;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSTYPE;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSTOPIC;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSPUBLICATION;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_CMPUBLISHER;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_CMSUBSCRIBER;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_CMDATAWRITER;
extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_CMDATAREADER;
/** @}*/
/** @name Communication Status definitions

View file

@ -545,14 +545,10 @@ void dds_qset_durability_service
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the userdata
* @param[in,out] sz - Pointer that will store the size of userdata
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_userdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
);
DDS_EXPORT bool dds_qget_userdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the topicdata from a qos structure
@ -560,14 +556,10 @@ void dds_qget_userdata
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the topicdata
* @param[in,out] sz - Pointer that will store the size of topicdata
*/
DDS_EXPORT
void dds_qget_topicdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
);
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT bool dds_qget_topicdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the groupdata from a qos structure
@ -575,27 +567,20 @@ void dds_qget_topicdata
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the groupdata
* @param[in,out] sz - Pointer that will store the size of groupdata
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_groupdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
);
DDS_EXPORT bool dds_qget_groupdata (const dds_qos_t * __restrict qos, void **value, size_t *sz);
/**
* @brief Get the durability policy from a qos structure
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the durability kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_durability
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_durability_kind_t *kind
);
DDS_EXPORT bool dds_qget_durability (const dds_qos_t * __restrict qos, dds_durability_kind_t *kind);
/**
* @brief Get the history policy from a qos structure
@ -603,14 +588,10 @@ void dds_qget_durability
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the history kind (optional)
* @param[in,out] depth - Pointer that will store the history depth (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_history
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_history_kind_t * kind,
_Out_opt_ int32_t *depth
);
DDS_EXPORT bool dds_qget_history (const dds_qos_t * __restrict qos, dds_history_kind_t *kind, int32_t *depth);
/**
* @brief Get the resource-limits policy from a qos structure
@ -619,15 +600,10 @@ void dds_qget_history
* @param[in,out] max_samples - Pointer that will store the number of samples resource-limit (optional)
* @param[in,out] max_instances - Pointer that will store the number of instances resource-limit (optional)
* @param[in,out] max_samples_per_instance - Pointer that will store the number of samples per instance resource-limit (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_resource_limits
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ int32_t *max_samples,
_Out_opt_ int32_t *max_instances,
_Out_opt_ 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
@ -636,80 +612,60 @@ void dds_qget_resource_limits
* @param[in,out] access_scope - Pointer that will store access scope kind (optional)
* @param[in,out] coherent_access - Pointer that will store coherent access enable value (optional)
* @param[in,out] ordered_access - Pointer that will store orderede access enable value (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_presentation
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_presentation_access_scope_kind_t *access_scope,
_Out_opt_ bool *coherent_access,
_Out_opt_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] lifespan - Pointer that will store lifespan duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_lifespan
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] deadline - Pointer that will store deadline duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_deadline
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] duration - Pointer that will store latency-budget duration
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_latency_budget
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the ownership kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_ownership
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the ownership strength value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_ownership_strength
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
@ -717,27 +673,20 @@ void dds_qget_ownership_strength
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the liveliness kind (optional)
* @param[in,out] lease_duration - Pointer that will store the liveliness lease duration (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_liveliness
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_liveliness_kind_t *kind,
_Out_opt_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] minimum_separation - Pointer that will store the minimum separation duration (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_time_based_filter
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
@ -745,14 +694,10 @@ void dds_qget_time_based_filter
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] n - Pointer that will store the number of partitions (optional)
* @param[in,out] ps - Pointer that will store the string(s) containing partition name(s) (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_partition
(
_In_ const dds_qos_t * __restrict qos,
_Out_ uint32_t *n,
_Outptr_opt_result_buffer_all_maybenull_(*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
@ -760,53 +705,40 @@ void dds_qget_partition
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the reliability kind (optional)
* @param[in,out] max_blocking_time - Pointer that will store the max blocking time for reliable reliability (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_reliability
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_reliability_kind_t *kind,
_Out_opt_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] value - Pointer that will store the transport priority value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_transport_priority
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] kind - Pointer that will store the destination-order kind
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_destination_order
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
*
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] autodispose_unregistered_instances - Pointer that will store the autodispose unregistered instances enable value
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_writer_data_lifecycle
(
_In_ const dds_qos_t * __restrict qos,
_Out_ 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
@ -814,14 +746,10 @@ void dds_qget_writer_data_lifecycle
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
* @param[in,out] autopurge_nowriter_samples_delay - Pointer that will store the delay for auto-purging samples from instances in a no-writer state (optional)
* @param[in,out] autopurge_disposed_samples_delay - Pointer that will store the delay for auto-purging of disposed instances (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT
void dds_qget_reader_data_lifecycle
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_duration_t *autopurge_nowriter_samples_delay,
_Out_opt_ 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.
@ -833,17 +761,10 @@ void dds_qget_reader_data_lifecycle
* @param[in,out] max_samples - Pointer that will store number of samples resource-limit policy applied by the durability service (optional)
* @param[in,out] max_instances - Pointer that will store number of instances resource-limit policy applied by the durability service (optional)
* @param[in,out] max_samples_per_instance - Pointer that will store number of samples per instance resource-limit policy applied by the durability service (optional)
*
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
*/
DDS_EXPORT void dds_qget_durability_service
(
_In_ const dds_qos_t * qos,
_Out_opt_ dds_duration_t * service_cleanup_delay,
_Out_opt_ dds_history_kind_t * history_kind,
_Out_opt_ int32_t * history_depth,
_Out_opt_ int32_t * max_samples,
_Out_opt_ int32_t * max_instances,
_Out_opt_ 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)
}

View file

@ -13,7 +13,7 @@
#define _DDS_BUILTIN_H_
#include "ddsi/q_time.h"
#include "dds_builtinTopics.h"
#include "ddsi/ddsi_serdata_builtin.h"
#if defined (__cplusplus)
@ -22,7 +22,6 @@ extern "C"
#endif
/* Get actual topic in related participant related to topic 'id'. */
_Must_inspect_result_ dds_entity_t
dds__get_builtin_topic(
@ -39,7 +38,8 @@ _Must_inspect_result_ dds_entity_t
dds__get_builtin_subscriber(
_In_ dds_entity_t e);
/* Checks whether the reader QoS is valid for use with built-in topic TOPIC */
bool dds__validate_builtin_reader_qos(dds_entity_t topic, const dds_qos_t *qos);
/* Initialization and finalize functions. */
void
@ -50,19 +50,12 @@ void
dds__builtin_fini(
void);
/* Callback functions that contain received builtin data. */
void
dds__builtin_participant_cb(
DDS_ParticipantBuiltinTopicData *data,
nn_wctime_t timestamp);
void
dds__builtin_cmparticipant_cb(
DDS_CMParticipantBuiltinTopicData *data,
nn_wctime_t timestamp);
dds__builtin_write(
_In_ enum ddsi_sertopic_builtin_type type,
_In_ const nn_guid_t *guid,
_In_ nn_wctime_t timestamp,
_In_ bool alive);
#if defined (__cplusplus)
}

View file

@ -76,8 +76,9 @@ char * dds_string_dup (const char * str)
char * ret = NULL;
if (str)
{
ret = dds_alloc (strlen (str) + 1);
strcpy (ret, str);
size_t sz = strlen (str) + 1;
ret = dds_alloc (sz);
memcpy (ret, str, sz);
}
return ret;
}

View file

@ -14,7 +14,6 @@
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "ddsi/q_config.h"
#include "ddsi/q_builtin_topic.h"
#include "dds__init.h"
#include "dds__qos.h"
#include "dds__domain.h"
@ -23,7 +22,10 @@
#include "dds__types.h"
#include "dds__builtin.h"
#include "dds__subscriber.h"
#include "dds__write.h"
#include "dds__writer.h"
#include "ddsi/q_qosmatch.h"
#include "ddsi/ddsi_serdata_builtin.h"
static dds_return_t
dds__delete_builtin_participant(
@ -37,7 +39,7 @@ static _Must_inspect_result_ dds_entity_t
dds__create_builtin_publisher(
_In_ dds_entity_t participant);
static _Must_inspect_result_ dds_entity_t
static dds_entity_t
dds__create_builtin_writer(
_In_ dds_entity_t topic);
@ -56,17 +58,23 @@ static dds_entity_t g_builtin_local_participant = 0;
static dds_entity_t g_builtin_local_publisher = 0;
static dds_entity_t g_builtin_local_writers[] = {
0, /* index DDS_BUILTIN_TOPIC_DCPSPARTICIPANT - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_CMPARTICIPANT - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_DCPSTYPE - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_DCPSTOPIC - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_DCPSPUBLICATION - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_CMPUBLISHER - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_CMSUBSCRIBER - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_CMDATAWRITER - DDS_KIND_INTERNAL - 1 */
0, /* index DDS_BUILTIN_TOPIC_CMDATAREADER - DDS_KIND_INTERNAL - 1 */
};
static _Must_inspect_result_ dds_qos_t *
dds__create_builtin_qos(
void)
{
const char *partition = "__BUILT-IN PARTITION__";
dds_qos_t *qos = dds_create_qos();
dds_qset_durability(qos, DDS_DURABILITY_TRANSIENT_LOCAL);
dds_qset_presentation(qos, DDS_PRESENTATION_TOPIC, false, false);
dds_qset_reliability(qos, DDS_RELIABILITY_RELIABLE, DDS_MSECS(100));
dds_qset_partition(qos, 1, &partition);
return qos;
}
static dds_return_t
dds__delete_builtin_participant(
@ -148,17 +156,9 @@ static _Must_inspect_result_ dds_entity_t
dds__create_builtin_publisher(
_In_ dds_entity_t participant)
{
dds_entity_t pub;
dds_qos_t *qos;
const char *partition = "__BUILT-IN PARTITION__";
qos = dds_create_qos();
dds_qset_partition(qos, 1, &partition);
pub = dds_create_publisher(participant, qos, NULL);
dds_qos_t *qos = dds__create_builtin_qos();
dds_entity_t pub = dds_create_publisher(participant, qos, NULL);
dds_delete_qos(qos);
return pub;
}
@ -166,21 +166,13 @@ static _Must_inspect_result_ dds_entity_t
dds__create_builtin_subscriber(
_In_ dds_entity *participant)
{
dds_entity_t sub;
dds_qos_t *qos;
const char *partition = "__BUILT-IN PARTITION__";
qos = dds_create_qos();
dds_qset_partition(qos, 1, &partition);
/* Create builtin-subscriber */
sub = dds__create_subscriber_l(participant, qos, NULL);
dds_qos_t *qos = dds__create_builtin_qos();
dds_entity_t sub = dds__create_subscriber_l(participant, qos, NULL);
dds_delete_qos(qos);
return sub;
}
static _Must_inspect_result_ dds_entity_t
static dds_entity_t
dds__create_builtin_writer(
_In_ dds_entity_t topic)
{
@ -189,13 +181,7 @@ dds__create_builtin_writer(
if (pub > 0) {
dds_entity_t top = dds__get_builtin_topic(pub, topic);
if (top > 0) {
dds_qos_t *qos;
// TODO: set builtin qos
qos = dds_create_qos();
dds_qset_durability(qos, DDS_DURABILITY_TRANSIENT_LOCAL);
dds_qset_reliability(qos, DDS_RELIABILITY_RELIABLE, DDS_MSECS(100));
wr = dds_create_writer(pub, top, qos, NULL);
dds_delete_qos(qos);
wr = dds_create_writer(pub, top, NULL, NULL);
(void)dds_delete(top);
} else {
wr = top;
@ -213,6 +199,9 @@ dds__get_builtin_participant(
{
if (g_builtin_local_participant == 0) {
g_builtin_local_participant = dds__create_builtin_participant();
(void)dds__create_builtin_writer(DDS_BUILTIN_TOPIC_DCPSPARTICIPANT);
(void)dds__create_builtin_writer(DDS_BUILTIN_TOPIC_DCPSPUBLICATION);
(void)dds__create_builtin_writer(DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION);
}
return g_builtin_local_participant;
}
@ -277,57 +266,26 @@ dds__get_builtin_topic(
participant = dds_get_participant(e);
if (participant > 0) {
const dds_topic_descriptor_t *desc;
const char *name;
struct ddsi_sertopic *sertopic;
if (topic == DDS_BUILTIN_TOPIC_DCPSPARTICIPANT) {
desc = &DDS_ParticipantBuiltinTopicData_desc;
name = "DCPSParticipant";
} else if (topic == DDS_BUILTIN_TOPIC_CMPARTICIPANT) {
desc = &DDS_CMParticipantBuiltinTopicData_desc;
name = "CMParticipant";
} else if (topic == DDS_BUILTIN_TOPIC_DCPSTYPE) {
desc = &DDS_TypeBuiltinTopicData_desc;
name = "DCPSType";
} else if (topic == DDS_BUILTIN_TOPIC_DCPSTOPIC) {
desc = &DDS_TopicBuiltinTopicData_desc;
name = "DCPSTopic";
sertopic = gv.builtin_participant_topic;
} else if (topic == DDS_BUILTIN_TOPIC_DCPSPUBLICATION) {
desc = &DDS_PublicationBuiltinTopicData_desc;
name = "DCPSPublication";
} else if (topic == DDS_BUILTIN_TOPIC_CMPUBLISHER) {
desc = &DDS_CMPublisherBuiltinTopicData_desc;
name = "CMPublisher";
sertopic = gv.builtin_writer_topic;
} else if (topic == DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION) {
desc = &DDS_SubscriptionBuiltinTopicData_desc;
name = "DCPSSubscription";
} else if (topic == DDS_BUILTIN_TOPIC_CMSUBSCRIBER) {
desc = &DDS_CMSubscriberBuiltinTopicData_desc;
name = "CMSubscriber";
} else if (topic == DDS_BUILTIN_TOPIC_CMDATAWRITER) {
desc = &DDS_CMDataWriterBuiltinTopicData_desc;
name = "CMDataWriter";
} else if (topic == DDS_BUILTIN_TOPIC_CMDATAREADER) {
desc = &DDS_CMDataReaderBuiltinTopicData_desc;
name = "CMDataReader";
sertopic = gv.builtin_reader_topic;
} else {
DDS_ERROR("Invalid builtin-topic handle(%d)\n", topic);
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err_invalid_topic;
}
ret = dds_find_topic(participant, name);
ret = dds_find_topic (participant, sertopic->name);
if (ret < 0 && dds_err_nr(ret) == DDS_RETCODE_PRECONDITION_NOT_MET) {
dds_qos_t *tqos;
tqos = dds_create_qos();
dds_qset_durability(tqos, DDS_DURABILITY_TRANSIENT_LOCAL);
dds_qset_presentation(tqos, DDS_PRESENTATION_TOPIC, false, false);
dds_qset_reliability(tqos, DDS_RELIABILITY_RELIABLE, DDS_MSECS(100));
ret = dds_create_topic(participant, desc, name, tqos, NULL);
dds_delete_qos(tqos);
dds_qos_t *qos = dds__create_builtin_qos();
ret = dds_create_topic_arbitrary(participant, sertopic, sertopic->name, qos, NULL, NULL);
dds_delete_qos(qos);
}
} else {
/* Failed to get participant of provided entity */
ret = participant;
@ -343,7 +301,7 @@ dds__get_builtin_writer(
_In_ dds_entity_t topic)
{
dds_entity_t wr;
if ((topic >= DDS_BUILTIN_TOPIC_DCPSPARTICIPANT) && (topic <= DDS_BUILTIN_TOPIC_CMDATAREADER)) {
if ((topic >= DDS_BUILTIN_TOPIC_DCPSPARTICIPANT) && (topic <= DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION)) {
int index = (int)(topic - DDS_KIND_INTERNAL - 1);
os_mutexLock(&g_builtin_mutex);
wr = g_builtin_local_writers[index];
@ -362,21 +320,40 @@ dds__get_builtin_writer(
}
static dds_return_t
dds__builtin_write(
_In_ dds_entity_t topic,
_In_ const void *data,
_In_ dds_time_t timestamp,
_In_ int alive)
dds__builtin_write_int(
_In_ dds_entity_t topic,
_In_ const nn_guid_t *guid,
_In_ dds_time_t timestamp,
_In_ bool alive)
{
dds_return_t ret = DDS_RETCODE_OK;
if (os_atomic_inc32_nv(&m_call_count) > 1) {
dds_entity_t wr;
wr = dds__get_builtin_writer(topic);
if (wr > 0) {
if (alive) {
ret = dds_write_ts(wr, data, timestamp);
struct ddsi_sertopic *sertopic;
struct ddsi_serdata *serdata;
struct nn_keyhash keyhash;
struct dds_writer *wraddr;
if (topic == DDS_BUILTIN_TOPIC_DCPSPARTICIPANT) {
sertopic = gv.builtin_participant_topic;
} else if (topic == DDS_BUILTIN_TOPIC_DCPSPUBLICATION) {
sertopic = gv.builtin_writer_topic;
} else if (topic == DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION) {
sertopic = gv.builtin_reader_topic;
} else {
ret = dds_dispose_ts(wr, data, timestamp);
sertopic = NULL;
assert (0);
}
memcpy (&keyhash, guid, sizeof (keyhash));
serdata = ddsi_serdata_from_keyhash(sertopic, &keyhash);
ret = dds_writer_lock(wr, &wraddr);
if (ret == DDS_RETCODE_OK) {
ret = dds_writecdr_impl (wraddr, serdata, timestamp, alive ? 0 : (DDS_WR_DISPOSE_BIT | DDS_WR_UNREGISTER_BIT));
dds_writer_unlock(wraddr);
}
} else {
ret = wr;
@ -386,6 +363,56 @@ dds__builtin_write(
return ret;
}
void
dds__builtin_write(
_In_ enum ddsi_sertopic_builtin_type type,
_In_ const nn_guid_t *guid,
_In_ nn_wctime_t timestamp,
_In_ bool alive)
{
dds_entity_t topic;
switch (type)
{
case DSBT_PARTICIPANT:
topic = DDS_BUILTIN_TOPIC_DCPSPARTICIPANT;
break;
case DSBT_WRITER:
topic = DDS_BUILTIN_TOPIC_DCPSPUBLICATION;
break;
case DSBT_READER:
topic = DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION;
break;
}
(void)dds__builtin_write_int(topic, guid, timestamp.v, alive);
}
bool dds__validate_builtin_reader_qos(dds_entity_t topic, const dds_qos_t *qos)
{
if (qos == NULL) {
/* default QoS inherited from topic is ok by definition */
return true;
} else {
dds_entity_t wr = dds__get_builtin_writer(topic);
dds_qos_t *wrqos = dds_create_qos();
dds_return_t ret = dds_get_qos(wr, wrqos);
bool match;
assert (ret == DDS_RETCODE_OK);
(void)ret;
if (!qos_match_p (qos, wrqos)) {
match = false;
} else if (qos->resource_limits.max_samples != DDS_LENGTH_UNLIMITED ||
qos->resource_limits.max_instances != DDS_LENGTH_UNLIMITED ||
qos->resource_limits.max_samples_per_instance != DDS_LENGTH_UNLIMITED) {
/* this means a write on the built-in topic writer can't fail */
match = false;
} else {
match = true;
}
dds_delete_qos(wrqos);
return match;
}
}
void
dds__builtin_init(
void)
@ -410,22 +437,3 @@ dds__builtin_fini(
memset(g_builtin_local_writers, 0, sizeof(g_builtin_local_writers));
os_mutexDestroy(&g_builtin_mutex);
}
void
forward_builtin_participant(
_In_ DDS_ParticipantBuiltinTopicData *data,
_In_ nn_wctime_t timestamp,
_In_ int alive)
{
dds__builtin_write(DDS_BUILTIN_TOPIC_DCPSPARTICIPANT, data, timestamp.v, alive);
}
void
forward_builtin_cmparticipant(
_In_ DDS_CMParticipantBuiltinTopicData *data,
_In_ nn_wctime_t timestamp,
_In_ int alive)
{
dds__builtin_write(DDS_BUILTIN_TOPIC_CMPARTICIPANT, data, timestamp.v, alive);
}

View file

@ -1,371 +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
*/
#ifndef OSPL_DDS_BUILTINTOPICS_IDL
#define OSPL_DDS_BUILTINTOPICS_IDL
/*
This file was the one orginally in ./src/api/dcps/saj/code/.
(and therefore by implication ./src/api/dcps/cj/java/code).
*/
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE unsigned long
module DDS {
// Added octet sequence definition.
// Prevents IDL compiler warnings from deprecated anonymous types
// on composite type members.
typedef sequence<octet> octSeq;
typedef BUILTIN_TOPIC_KEY_TYPE_NATIVE BuiltinTopicKey_t[3];
typedef sequence<string> StringSeq;
typedef short DataRepresentationId_t;
const DataRepresentationId_t XCDR_REPRESENTATION = 0;
const DataRepresentationId_t XML_REPRESENTATION = 0x001;
const DataRepresentationId_t OSPL_REPRESENTATION = 0x400;
const DataRepresentationId_t GPB_REPRESENTATION = 0x401;
const DataRepresentationId_t INVALID_REPRESENTATION = 0x7FFF;
struct Duration_t {
long sec;
unsigned long nanosec;
};
struct UserDataQosPolicy {
octSeq value;
// replaced deprecated anonymous sequence<octet> value;
};
struct TopicDataQosPolicy {
octSeq value;
// replaced deprecated anonymous sequence<octet> value;
};
struct GroupDataQosPolicy {
octSeq value;
// replaced deprected anonymous sequence<octet> value;
};
struct TransportPriorityQosPolicy {
long value;
};
struct LifespanQosPolicy {
Duration_t duration;
};
enum DurabilityQosPolicyKind {
VOLATILE_DURABILITY_QOS,
TRANSIENT_LOCAL_DURABILITY_QOS,
TRANSIENT_DURABILITY_QOS,
PERSISTENT_DURABILITY_QOS
};
struct DurabilityQosPolicy {
DurabilityQosPolicyKind kind;
};
enum PresentationQosPolicyAccessScopeKind {
INSTANCE_PRESENTATION_QOS,
TOPIC_PRESENTATION_QOS,
GROUP_PRESENTATION_QOS
};
struct PresentationQosPolicy {
PresentationQosPolicyAccessScopeKind access_scope;
boolean coherent_access;
boolean ordered_access;
};
struct DeadlineQosPolicy {
Duration_t period;
};
struct LatencyBudgetQosPolicy {
Duration_t duration;
};
enum OwnershipQosPolicyKind {
SHARED_OWNERSHIP_QOS,
EXCLUSIVE_OWNERSHIP_QOS
};
struct OwnershipQosPolicy {
OwnershipQosPolicyKind kind;
};
struct OwnershipStrengthQosPolicy {
long value;
};
enum LivelinessQosPolicyKind {
AUTOMATIC_LIVELINESS_QOS,
MANUAL_BY_PARTICIPANT_LIVELINESS_QOS,
MANUAL_BY_TOPIC_LIVELINESS_QOS
};
struct LivelinessQosPolicy {
LivelinessQosPolicyKind kind;
Duration_t lease_duration;
};
struct TimeBasedFilterQosPolicy {
Duration_t minimum_separation;
};
struct PartitionQosPolicy {
StringSeq name;
};
enum ReliabilityQosPolicyKind {
BEST_EFFORT_RELIABILITY_QOS,
RELIABLE_RELIABILITY_QOS
};
struct ReliabilityQosPolicy {
ReliabilityQosPolicyKind kind;
Duration_t max_blocking_time;
boolean synchronous;
};
enum DestinationOrderQosPolicyKind {
BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS,
BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS
};
struct DestinationOrderQosPolicy {
DestinationOrderQosPolicyKind kind;
};
enum HistoryQosPolicyKind {
KEEP_LAST_HISTORY_QOS,
KEEP_ALL_HISTORY_QOS
};
struct HistoryQosPolicy {
HistoryQosPolicyKind kind;
long depth;
};
struct ResourceLimitsQosPolicy {
long max_samples;
long max_instances;
long max_samples_per_instance;
};
struct DurabilityServiceQosPolicy {
Duration_t service_cleanup_delay;
HistoryQosPolicyKind history_kind;
long history_depth;
long max_samples;
long max_instances;
long max_samples_per_instance;
};
struct ProductDataQosPolicy {
string value;
};
struct EntityFactoryQosPolicy {
boolean autoenable_created_entities;
};
struct ShareQosPolicy {
string name;
boolean enable;
};
struct WriterDataLifecycleQosPolicy {
boolean autodispose_unregistered_instances;
Duration_t autopurge_suspended_samples_delay;
Duration_t autounregister_instance_delay;
};
enum InvalidSampleVisibilityQosPolicyKind {
NO_INVALID_SAMPLES,
MINIMUM_INVALID_SAMPLES,
ALL_INVALID_SAMPLES
};
struct InvalidSampleVisibilityQosPolicy {
InvalidSampleVisibilityQosPolicyKind kind;
};
// @discrepancy The below QoS did not exist in ./etc/idlpp/dds_dcps.idl Retain ?
struct SubscriptionKeyQosPolicy {
boolean use_key_list;
StringSeq key_list;
};
// @discrepancy End of above discrepancy
struct ReaderDataLifecycleQosPolicy {
Duration_t autopurge_nowriter_samples_delay;
Duration_t autopurge_disposed_samples_delay;
boolean autopurge_dispose_all;
// @discrepancy The below member existed in this file but did not
// in ./etc/idlpp/dds_dcps.idl. Retain ?
boolean enable_invalid_samples; // @deprecated Will be replaced by invalid_sample_visibility in due time
InvalidSampleVisibilityQosPolicy invalid_sample_visibility;
};
struct UserKeyQosPolicy {
boolean enable;
string expression;
};
struct ReaderLifespanQosPolicy {
boolean use_lifespan;
Duration_t duration;
};
struct TypeHash {
unsigned long long msb;
unsigned long long lsb;
};
struct ParticipantBuiltinTopicData {
BuiltinTopicKey_t key;
UserDataQosPolicy user_data;
};
#pragma keylist ParticipantBuiltinTopicData key
struct TopicBuiltinTopicData {
BuiltinTopicKey_t key;
string name;
string type_name;
DurabilityQosPolicy durability;
DurabilityServiceQosPolicy durability_service;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
TransportPriorityQosPolicy transport_priority;
LifespanQosPolicy lifespan;
DestinationOrderQosPolicy destination_order;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
OwnershipQosPolicy ownership;
TopicDataQosPolicy topic_data;
};
#pragma keylist TopicBuiltinTopicData key
struct TypeBuiltinTopicData {
string name;
DataRepresentationId_t data_representation_id;
TypeHash type_hash;
octSeq meta_data;
octSeq extentions;
};
#pragma keylist TypeBuiltinTopicData name data_representation_id type_hash.msb type_hash.lsb
struct PublicationBuiltinTopicData {
BuiltinTopicKey_t key;
BuiltinTopicKey_t participant_key;
string topic_name;
string type_name;
DurabilityQosPolicy durability;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
LifespanQosPolicy lifespan;
DestinationOrderQosPolicy destination_order;
UserDataQosPolicy user_data;
OwnershipQosPolicy ownership;
OwnershipStrengthQosPolicy ownership_strength;
PresentationQosPolicy presentation;
PartitionQosPolicy partition;
TopicDataQosPolicy topic_data;
GroupDataQosPolicy group_data;
};
#pragma keylist PublicationBuiltinTopicData key
struct SubscriptionBuiltinTopicData {
BuiltinTopicKey_t key;
BuiltinTopicKey_t participant_key;
string topic_name;
string type_name;
DurabilityQosPolicy durability;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
OwnershipQosPolicy ownership;
DestinationOrderQosPolicy destination_order;
UserDataQosPolicy user_data;
TimeBasedFilterQosPolicy time_based_filter;
PresentationQosPolicy presentation;
PartitionQosPolicy partition;
TopicDataQosPolicy topic_data;
GroupDataQosPolicy group_data;
};
#pragma keylist SubscriptionBuiltinTopicData key
struct CMParticipantBuiltinTopicData {
BuiltinTopicKey_t key;
ProductDataQosPolicy product;
};
#pragma keylist CMParticipantBuiltinTopicData key
struct CMPublisherBuiltinTopicData {
BuiltinTopicKey_t key;
ProductDataQosPolicy product;
BuiltinTopicKey_t participant_key;
string name;
EntityFactoryQosPolicy entity_factory;
PartitionQosPolicy partition;
};
#pragma keylist CMPublisherBuiltinTopicData key
struct CMSubscriberBuiltinTopicData {
BuiltinTopicKey_t key;
ProductDataQosPolicy product;
BuiltinTopicKey_t participant_key;
string name;
EntityFactoryQosPolicy entity_factory;
ShareQosPolicy share;
PartitionQosPolicy partition;
};
#pragma keylist CMSubscriberBuiltinTopicData key
struct CMDataWriterBuiltinTopicData {
BuiltinTopicKey_t key;
ProductDataQosPolicy product;
BuiltinTopicKey_t publisher_key;
string name;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
WriterDataLifecycleQosPolicy writer_data_lifecycle;
};
#pragma keylist CMDataWriterBuiltinTopicData key
struct CMDataReaderBuiltinTopicData {
BuiltinTopicKey_t key;
ProductDataQosPolicy product;
BuiltinTopicKey_t subscriber_key;
string name;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
ReaderDataLifecycleQosPolicy reader_data_lifecycle;
UserKeyQosPolicy subscription_keys;
ReaderLifespanQosPolicy reader_lifespan;
ShareQosPolicy share;
};
#pragma keylist CMDataReaderBuiltinTopicData key
};
#endif /* OSPL_DDS_BUILTINTOPICS_IDL */

View file

@ -1,130 +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
*/
#ifndef OSPL_DDS_DCPS_BUILTINTOPICS_IDL
#define OSPL_DDS_DCPS_BUILTINTOPICS_IDL
/**
*This file (name) was orginally in ./src/api/dcps/ccpp/idl/.
*It's been modified to include from another file the base definitions
*required for this 'built in topics' superset... :
*/
#include "dds_builtinTopics.idl"
module DDS {
struct Time_t {
long sec;
unsigned long nanosec;
};
enum SchedulingClassQosPolicyKind {
SCHEDULE_DEFAULT,
SCHEDULE_TIMESHARING,
SCHEDULE_REALTIME
};
struct SchedulingClassQosPolicy {
SchedulingClassQosPolicyKind kind;
};
enum SchedulingPriorityQosPolicyKind {
PRIORITY_RELATIVE,
PRIORITY_ABSOLUTE
};
struct SchedulingPriorityQosPolicy {
SchedulingPriorityQosPolicyKind kind;
};
struct SchedulingQosPolicy {
SchedulingClassQosPolicy scheduling_class;
SchedulingPriorityQosPolicy scheduling_priority_kind;
long scheduling_priority;
};
struct DomainParticipantQos {
UserDataQosPolicy user_data;
EntityFactoryQosPolicy entity_factory;
SchedulingQosPolicy watchdog_scheduling;
SchedulingQosPolicy listener_scheduling;
};
struct TopicQos {
TopicDataQosPolicy topic_data;
DurabilityQosPolicy durability;
DurabilityServiceQosPolicy durability_service;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
DestinationOrderQosPolicy destination_order;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
TransportPriorityQosPolicy transport_priority;
LifespanQosPolicy lifespan;
OwnershipQosPolicy ownership;
};
struct DataWriterQos {
DurabilityQosPolicy durability;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
DestinationOrderQosPolicy destination_order;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
TransportPriorityQosPolicy transport_priority;
LifespanQosPolicy lifespan;
UserDataQosPolicy user_data;
OwnershipQosPolicy ownership;
OwnershipStrengthQosPolicy ownership_strength;
WriterDataLifecycleQosPolicy writer_data_lifecycle;
};
struct PublisherQos {
PresentationQosPolicy presentation;
PartitionQosPolicy partition;
GroupDataQosPolicy group_data;
EntityFactoryQosPolicy entity_factory;
};
struct DataReaderQos {
DurabilityQosPolicy durability;
DeadlineQosPolicy deadline;
LatencyBudgetQosPolicy latency_budget;
LivelinessQosPolicy liveliness;
ReliabilityQosPolicy reliability;
DestinationOrderQosPolicy destination_order;
HistoryQosPolicy history;
ResourceLimitsQosPolicy resource_limits;
UserDataQosPolicy user_data;
OwnershipQosPolicy ownership;
TimeBasedFilterQosPolicy time_based_filter;
ReaderDataLifecycleQosPolicy reader_data_lifecycle;
SubscriptionKeyQosPolicy subscription_keys;
ReaderLifespanQosPolicy reader_lifespan;
ShareQosPolicy share;
};
struct SubscriberQos {
PresentationQosPolicy presentation;
PartitionQosPolicy partition;
GroupDataQosPolicy group_data;
EntityFactoryQosPolicy entity_factory;
ShareQosPolicy share;
};
};
#endif /* DDS_DCPS_BUILTINTOPICS_IDL */

View file

@ -250,12 +250,10 @@ static void dds__fini_plugin (void)
void ddsi_plugin_init (void)
{
/* Register initialization/clean functions */
ddsi_plugin.init_fn = dds__init_plugin;
ddsi_plugin.fini_fn = dds__fini_plugin;
/* Register read cache functions */
ddsi_plugin.builtin_write = dds__builtin_write;
ddsi_plugin.rhc_plugin.rhc_free_fn = dds_rhc_free;
ddsi_plugin.rhc_plugin.rhc_fini_fn = dds_rhc_fini;

View file

@ -37,7 +37,7 @@ dds_qos_data_copy_in(
}
}
static void
static bool
dds_qos_data_copy_out(
_In_ const nn_octetseq_t * data,
_When_(*sz == 0, _At_(*value, _Post_null_))
@ -45,13 +45,22 @@ dds_qos_data_copy_out(
_Outptr_result_bytebuffer_all_maybenull_(*sz) void ** value,
_Out_ size_t * sz)
{
if ((*sz = data->length) != 0) {
assert(data->value);
*value = dds_alloc(data->length);
memcpy(*value, data->value, data->length);
} else {
*value = NULL;
if (sz == NULL && value != NULL) {
return false;
}
if (sz) {
*sz = data->length;
}
if (value) {
if (data->length != 0) {
assert(data->value);
*value = dds_alloc(data->length);
memcpy(*value, data->value, data->length);
} else {
*value = NULL;
}
}
return true;
}
bool
@ -657,397 +666,276 @@ void dds_qset_durability_service
}
}
void dds_qget_userdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
)
bool dds_qget_userdata (const dds_qos_t * __restrict qos, void **value, size_t *sz)
{
if(!qos) {
DDS_ERROR("Argument QoS is NULL\n");
return ;
if (!qos || !(qos->present & QP_USER_DATA)) {
return false;
}
if(!value) {
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->user_data, value, sz);
return dds_qos_data_copy_out (&qos->user_data, value, sz);
}
void dds_qget_topicdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
)
bool dds_qget_topicdata (const dds_qos_t * __restrict qos, void **value, size_t *sz)
{
if(!qos) {
DDS_ERROR("Argument QoS is NULL\n");
return ;
if (!qos || !(qos->present & QP_TOPIC_DATA)) {
return false;
}
if(!value) {
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->topic_data, value, sz);
return dds_qos_data_copy_out (&qos->topic_data, value, sz);
}
void dds_qget_groupdata
(
_In_ const dds_qos_t * __restrict qos,
_Outptr_result_bytebuffer_maybenull_(*sz) void ** value,
_Out_ size_t * sz
)
bool dds_qget_groupdata (const dds_qos_t * __restrict qos, void **value, size_t *sz)
{
if(!qos) {
DDS_ERROR("Argument QoS is NULL\n");
return ;
if (!qos || !(qos->present & QP_GROUP_DATA)) {
return false;
}
if(!value) {
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->group_data, value, sz);
return dds_qos_data_copy_out (&qos->group_data, value, sz);
}
void dds_qget_durability
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_durability_kind_t *kind
)
bool dds_qget_durability (const dds_qos_t * __restrict qos, dds_durability_kind_t *kind)
{
if(!qos) {
DDS_ERROR("Argument QoS is NULL\n");
return ;
if (!qos || !(qos->present & QP_DURABILITY)) {
return false;
}
if(!kind) {
DDS_ERROR("Argument kind is NULL\n");
return ;
if (kind) {
*kind = (dds_durability_kind_t) qos->durability.kind;
}
*kind = (dds_durability_kind_t) qos->durability.kind;
return true;
}
void dds_qget_history
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_history_kind_t * kind,
_Out_opt_ int32_t *depth
)
bool dds_qget_history (const dds_qos_t * __restrict qos, dds_history_kind_t *kind, int32_t *depth)
{
if (qos) {
if (kind) *kind = (dds_history_kind_t) qos->history.kind;
if (depth) *depth = qos->history.depth;
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_HISTORY)) {
return false;
}
if (kind) {
*kind = (dds_history_kind_t) qos->history.kind;
}
if (depth) {
*depth = qos->history.depth;
}
return true;
}
void dds_qget_resource_limits
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ int32_t *max_samples,
_Out_opt_ int32_t *max_instances,
_Out_opt_ int32_t *max_samples_per_instance
)
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)
{
if (qos) {
if (max_samples) *max_samples = qos->resource_limits.max_samples;
if (max_instances) *max_instances = qos->resource_limits.max_instances;
if (max_samples_per_instance) {
*max_samples_per_instance = qos->resource_limits.max_samples_per_instance;
}
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_RESOURCE_LIMITS)) {
return false;
}
if (max_samples) {
*max_samples = qos->resource_limits.max_samples;
}
if (max_instances) {
*max_instances = qos->resource_limits.max_instances;
}
if (max_samples_per_instance) {
*max_samples_per_instance = qos->resource_limits.max_samples_per_instance;
}
return true;
}
void dds_qget_presentation
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_presentation_access_scope_kind_t *access_scope,
_Out_opt_ bool *coherent_access,
_Out_opt_ bool *ordered_access
)
bool dds_qget_presentation (const dds_qos_t * __restrict qos, dds_presentation_access_scope_kind_t *access_scope, bool *coherent_access, bool *ordered_access)
{
if (qos) {
if (access_scope) *access_scope = (dds_presentation_access_scope_kind_t) qos->presentation.access_scope;
if (coherent_access) *coherent_access = qos->presentation.coherent_access;
if (ordered_access) *ordered_access = qos->presentation.ordered_access;
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_PRESENTATION)) {
return false;
}
if (access_scope) {
*access_scope = (dds_presentation_access_scope_kind_t) qos->presentation.access_scope;
}
if (coherent_access) {
*coherent_access = qos->presentation.coherent_access;
}
if (ordered_access) {
*ordered_access = qos->presentation.ordered_access;
}
return true;
}
void dds_qget_lifespan
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_duration_t * lifespan
)
bool dds_qget_lifespan (const dds_qos_t * __restrict qos, dds_duration_t *lifespan)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_LIFESPAN)) {
return false;
}
if(!lifespan){
DDS_ERROR("Argument lifespan is NULL\n");
return ;
if (lifespan) {
*lifespan = nn_from_ddsi_duration (qos->lifespan.duration);
}
*lifespan = nn_from_ddsi_duration (qos->lifespan.duration);
return true;
}
void dds_qget_deadline
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_duration_t * deadline
)
bool dds_qget_deadline (const dds_qos_t * __restrict qos, dds_duration_t *deadline)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_DEADLINE)) {
return false;
}
if(!deadline){
DDS_ERROR("Argument deadline is NULL\n");
return ;
if (deadline) {
*deadline = nn_from_ddsi_duration (qos->deadline.deadline);
}
*deadline = nn_from_ddsi_duration (qos->deadline.deadline);
return true;
}
void dds_qget_latency_budget
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_duration_t *duration
)
bool dds_qget_latency_budget (const dds_qos_t * __restrict qos, dds_duration_t *duration)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_LATENCY_BUDGET)) {
return false;
}
if(!duration){
DDS_ERROR("Argument duration is NULL\n");
return ;
if (duration) {
*duration = nn_from_ddsi_duration (qos->latency_budget.duration);
}
*duration = nn_from_ddsi_duration (qos->latency_budget.duration);
return true;
}
void dds_qget_ownership
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_ownership_kind_t *kind
)
bool dds_qget_ownership (const dds_qos_t * __restrict qos, dds_ownership_kind_t *kind)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_OWNERSHIP)) {
return false;
}
if(!kind){
DDS_ERROR("Argument kind is NULL\n");
return ;
if (kind) {
*kind = (dds_ownership_kind_t) qos->ownership.kind;
}
*kind = (dds_ownership_kind_t) qos->ownership.kind;
return true;
}
void dds_qget_ownership_strength
(
_In_ const dds_qos_t * __restrict qos,
_Out_ int32_t *value
)
bool dds_qget_ownership_strength (const dds_qos_t * __restrict qos, int32_t *value)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_OWNERSHIP_STRENGTH)) {
return false;
}
if(!value){
DDS_ERROR("Argument value is NULL\n");
return ;
if (value) {
*value = qos->ownership_strength.value;
}
*value = qos->ownership_strength.value;
return true;
}
void dds_qget_liveliness
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_liveliness_kind_t *kind,
_Out_opt_ dds_duration_t *lease_duration
)
bool dds_qget_liveliness (const dds_qos_t * __restrict qos, dds_liveliness_kind_t *kind, dds_duration_t *lease_duration)
{
if (qos) {
if (kind) *kind = (dds_liveliness_kind_t) qos->liveliness.kind;
if (lease_duration) *lease_duration = nn_from_ddsi_duration (qos->liveliness.lease_duration);
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_LIVELINESS)) {
return false;
}
if (kind) {
*kind = (dds_liveliness_kind_t) qos->liveliness.kind;
}
if (lease_duration) {
*lease_duration = nn_from_ddsi_duration (qos->liveliness.lease_duration);
}
return true;
}
void dds_qget_time_based_filter
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_duration_t *minimum_separation
)
bool dds_qget_time_based_filter (const dds_qos_t * __restrict qos, dds_duration_t *minimum_separation)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_TIME_BASED_FILTER)) {
return false;
}
if(!minimum_separation){
DDS_ERROR("Argument minimum_separation is NULL\n");
return ;
if (minimum_separation) {
*minimum_separation = nn_from_ddsi_duration (qos->time_based_filter.minimum_separation);
}
*minimum_separation = nn_from_ddsi_duration (qos->time_based_filter.minimum_separation);
return true;
}
void dds_qget_partition
(
_In_ const dds_qos_t * __restrict qos,
_Out_ uint32_t *n,
_Outptr_opt_result_buffer_all_maybenull_(*n) char *** ps
)
bool dds_qget_partition (const dds_qos_t * __restrict qos, uint32_t *n, char ***ps)
{
size_t len;
uint32_t i;
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_PARTITION)) {
return false;
}
if(!n){
DDS_ERROR("Argument n is NULL\n");
return ;
if (n == NULL && ps != NULL) {
return false;
}
*n = qos->partition.n;
if ( ps ) {
if ( qos->partition.n != 0 ) {
if (n) {
*n = qos->partition.n;
}
if (ps) {
if (qos->partition.n != 0) {
*ps = dds_alloc(sizeof(char*) * qos->partition.n);
for ( i = 0; i < qos->partition.n; i++ ) {
len = strlen(qos->partition.strs[i]) + 1;
(*ps)[i] = dds_alloc(len);
strncpy((*ps)[i], qos->partition.strs[i], len);
for (uint32_t i = 0; i < qos->partition.n; i++) {
(*ps)[i] = dds_string_dup(qos->partition.strs[i]);
}
} else {
*ps = NULL;
}
}
return true;
}
void dds_qget_reliability
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_reliability_kind_t *kind,
_Out_opt_ dds_duration_t *max_blocking_time
)
bool dds_qget_reliability (const dds_qos_t * __restrict qos, dds_reliability_kind_t *kind, dds_duration_t *max_blocking_time)
{
if (qos) {
if (kind) *kind = (dds_reliability_kind_t) qos->reliability.kind;
if (max_blocking_time) *max_blocking_time = nn_from_ddsi_duration (qos->reliability.max_blocking_time);
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_RELIABILITY)) {
return false;
}
if (kind) {
*kind = (dds_reliability_kind_t) qos->reliability.kind;
}
if (max_blocking_time) {
*max_blocking_time = nn_from_ddsi_duration (qos->reliability.max_blocking_time);
}
return true;
}
void dds_qget_transport_priority
(
_In_ const dds_qos_t * __restrict qos,
_Out_ int32_t *value
)
bool dds_qget_transport_priority (const dds_qos_t * __restrict qos, int32_t *value)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_TRANSPORT_PRIORITY)) {
return false;
}
if(!value){
DDS_ERROR("Argument value is NULL\n");
return ;
if (value) {
*value = qos->transport_priority.value;
}
*value = qos->transport_priority.value;
return true;
}
void dds_qget_destination_order
(
_In_ const dds_qos_t * __restrict qos,
_Out_ dds_destination_order_kind_t *kind
)
bool dds_qget_destination_order (const dds_qos_t * __restrict qos, dds_destination_order_kind_t *kind)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_DESTINATION_ORDER)) {
return false;
}
if(!kind){
DDS_ERROR("Argument kind is NULL\n");
return ;
if (kind) {
*kind = (dds_destination_order_kind_t) qos->destination_order.kind;
}
*kind = (dds_destination_order_kind_t) qos->destination_order.kind;
return true;
}
void dds_qget_writer_data_lifecycle
(
_In_ const dds_qos_t * __restrict qos,
_Out_ bool * autodispose
)
bool dds_qget_writer_data_lifecycle (const dds_qos_t * __restrict qos, bool *autodispose)
{
if(!qos){
DDS_ERROR("Argument qos is NULL\n");
return ;
if (!qos || !(qos->present & QP_PRISMTECH_WRITER_DATA_LIFECYCLE)) {
return false;
}
if(!autodispose){
DDS_ERROR("Argument autodispose is NULL\n");
return ;
if (autodispose) {
*autodispose = qos->writer_data_lifecycle.autodispose_unregistered_instances;
}
*autodispose = qos->writer_data_lifecycle.autodispose_unregistered_instances;
return true;
}
void dds_qget_reader_data_lifecycle
(
_In_ const dds_qos_t * __restrict qos,
_Out_opt_ dds_duration_t *autopurge_nowriter_samples_delay,
_Out_opt_ dds_duration_t *autopurge_disposed_samples_delay
)
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)
{
if (qos) {
if (autopurge_nowriter_samples_delay) {
*autopurge_nowriter_samples_delay = \
nn_from_ddsi_duration (qos->reader_data_lifecycle.autopurge_nowriter_samples_delay);
}
if (autopurge_disposed_samples_delay) {
*autopurge_disposed_samples_delay = \
nn_from_ddsi_duration (qos->reader_data_lifecycle.autopurge_disposed_samples_delay);
}
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_PRISMTECH_READER_DATA_LIFECYCLE)) {
return false;
}
if (autopurge_nowriter_samples_delay) {
*autopurge_nowriter_samples_delay = nn_from_ddsi_duration (qos->reader_data_lifecycle.autopurge_nowriter_samples_delay);
}
if (autopurge_disposed_samples_delay) {
*autopurge_disposed_samples_delay = nn_from_ddsi_duration (qos->reader_data_lifecycle.autopurge_disposed_samples_delay);
}
return true;
}
void dds_qget_durability_service
(
_In_ const dds_qos_t * qos,
_Out_opt_ dds_duration_t * service_cleanup_delay,
_Out_opt_ dds_history_kind_t * history_kind,
_Out_opt_ int32_t * history_depth,
_Out_opt_ int32_t * max_samples,
_Out_opt_ int32_t * max_instances,
_Out_opt_ int32_t * max_samples_per_instance
)
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 (qos) {
if (service_cleanup_delay) *service_cleanup_delay = nn_from_ddsi_duration (qos->durability_service.service_cleanup_delay);
if (history_kind) *history_kind = (dds_history_kind_t) qos->durability_service.history.kind;
if (history_depth) *history_depth = qos->durability_service.history.depth;
if (max_samples) *max_samples = qos->durability_service.resource_limits.max_samples;
if (max_instances) *max_instances = qos->durability_service.resource_limits.max_instances;
if (max_samples_per_instance) *max_samples_per_instance = qos->durability_service.resource_limits.max_samples_per_instance;
} else {
DDS_ERROR("Argument qos is NULL\n");
if (!qos || !(qos->present & QP_DURABILITY_SERVICE)) {
return false;
}
if (service_cleanup_delay) {
*service_cleanup_delay = nn_from_ddsi_duration (qos->durability_service.service_cleanup_delay);
}
if (history_kind) {
*history_kind = (dds_history_kind_t) qos->durability_service.history.kind;
}
if (history_depth) {
*history_depth = qos->durability_service.history.depth;
}
if (max_samples) {
*max_samples = qos->durability_service.resource_limits.max_samples;
}
if (max_instances) {
*max_instances = qos->durability_service.resource_limits.max_instances;
}
if (max_samples_per_instance) {
*max_samples_per_instance = qos->durability_service.resource_limits.max_samples_per_instance;
}
return true;
}

View file

@ -22,6 +22,7 @@
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "dds__builtin.h"
#include "ddsi/ddsi_sertopic.h"
#include "ddsc/ddsc_project.h"
#include "os/os.h"
@ -337,7 +338,6 @@ dds_reader_status_cb(
}
}
_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 ) ||\
@ -371,7 +371,6 @@ dds_create_reader(
}
t = topic;
} else {
/* TODO If qos is provided, we need to compare with writer qos to determine compatibility */
subscriber = dds__get_builtin_subscriber(participant_or_subscriber);
t = dds__get_builtin_topic(subscriber, topic);
}
@ -425,6 +424,14 @@ dds_create_reader(
goto err_bad_qos;
}
/* Additional checks required for built-in topics */
if (dds_entity_kind(topic) == DDS_KIND_INTERNAL && !dds__validate_builtin_reader_qos(topic, qos)) {
dds_delete_qos(rqos);
DDS_ERROR("Invalid QoS specified for built-in topic reader");
reader = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
goto err_bad_qos;
}
/* Create reader and associated read cache */
rd = dds_alloc (sizeof (*rd));
reader = dds_entity_init (&rd->m_entity, sub, DDS_KIND_READER, rqos, listener, DDS_READER_STATUS_MASK);
@ -482,6 +489,11 @@ err_tp_lock:
(void)dds_delete(subscriber);
}
err_sub_lock:
if (dds_entity_kind(topic) == DDS_KIND_INTERNAL) {
/* If topic is builtin, then the topic entity is local and should
* be deleted because the application won't. */
dds_delete(t);
}
return reader;
}

View file

@ -1401,7 +1401,15 @@ void dds_rhc_unregister_wr
time a new WR_IID will be used for the same writer, then we have
all the time in the world to scan the cache & clean up and that
we don't have to keep it locked all the time (even if we do it
that way now). */
that way now).
WR_IID was never reused while the built-in topics weren't getting
generated, but those really require the same instance id for the
same GUID if an instance still exists in some reader for that GUID.
So, if unregistration without locking the RHC is desired, entities
need to get two IIDs: the one visible to the application in the
built-in topics and in get_instance_handle, and one used internally
for tracking registrations and unregistrations. */
bool trigger_waitsets = false;
struct rhc_instance *inst;
struct ut_hhIter iter;

View file

@ -39,15 +39,9 @@ const ut_avlTreedef_t dds_topictree_def = UT_AVL_TREEDEF_INITIALIZER_INDKEY
/* builtin-topic handles */
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSPARTICIPANT = (DDS_KIND_INTERNAL + 1);
const dds_entity_t DDS_BUILTIN_TOPIC_CMPARTICIPANT = (DDS_KIND_INTERNAL + 2);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSTYPE = (DDS_KIND_INTERNAL + 3);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSTOPIC = (DDS_KIND_INTERNAL + 4);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSPUBLICATION = (DDS_KIND_INTERNAL + 5);
const dds_entity_t DDS_BUILTIN_TOPIC_CMPUBLISHER = (DDS_KIND_INTERNAL + 6);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION = (DDS_KIND_INTERNAL + 7);
const dds_entity_t DDS_BUILTIN_TOPIC_CMSUBSCRIBER = (DDS_KIND_INTERNAL + 8);
const dds_entity_t DDS_BUILTIN_TOPIC_CMDATAWRITER = (DDS_KIND_INTERNAL + 9);
const dds_entity_t DDS_BUILTIN_TOPIC_CMDATAREADER = (DDS_KIND_INTERNAL + 10);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSTOPIC = (DDS_KIND_INTERNAL + 2);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSPUBLICATION = (DDS_KIND_INTERNAL + 3);
const dds_entity_t DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION = (DDS_KIND_INTERNAL + 4);
static bool
is_valid_name(

View file

@ -14,133 +14,28 @@
#include "ddsc/dds.h"
#include "os/os.h"
#include "test-common.h"
#include "CUnit/Test.h"
#include "CUnit/Theory.h"
static dds_entity_t g_participant = 0;
static dds_entity_t g_subscriber = 0;
static dds_entity_t g_publisher = 0;
static dds_entity_t g_writer = 0;
static dds_entity_t g_reader = 0;
static dds_entity_t g_topic = 0;
#define MAX_SAMPLES 1
#define MAX_SAMPLES 2
static dds_sample_info_t g_info[MAX_SAMPLES];
static struct DDS_UserDataQosPolicy g_pol_userdata;
static struct DDS_TopicDataQosPolicy g_pol_topicdata;
static struct DDS_GroupDataQosPolicy g_pol_groupdata;
static struct DDS_DurabilityQosPolicy g_pol_durability;
static struct DDS_HistoryQosPolicy g_pol_history;
static struct DDS_ResourceLimitsQosPolicy g_pol_resource_limits;
static struct DDS_PresentationQosPolicy g_pol_presentation;
static struct DDS_LifespanQosPolicy g_pol_lifespan;
static struct DDS_DeadlineQosPolicy g_pol_deadline;
static struct DDS_LatencyBudgetQosPolicy g_pol_latency_budget;
static struct DDS_OwnershipQosPolicy g_pol_ownership;
static struct DDS_OwnershipStrengthQosPolicy g_pol_ownership_strength;
static struct DDS_LivelinessQosPolicy g_pol_liveliness;
static struct DDS_TimeBasedFilterQosPolicy g_pol_time_based_filter;
static struct DDS_PartitionQosPolicy g_pol_partition;
static struct DDS_ReliabilityQosPolicy g_pol_reliability;
static struct DDS_TransportPriorityQosPolicy g_pol_transport_priority;
static struct DDS_DestinationOrderQosPolicy g_pol_destination_order;
static struct DDS_WriterDataLifecycleQosPolicy g_pol_writer_data_lifecycle;
static struct DDS_ReaderDataLifecycleQosPolicy g_pol_reader_data_lifecycle;
static struct DDS_DurabilityServiceQosPolicy g_pol_durability_service;
static const char* c_userdata = "user_key";
static const char* c_topicdata = "topic_key";
static const char* c_groupdata = "group_key";
static const char* c_partitions[] = {"Partition1", "Partition2"};
static dds_qos_t *g_qos = NULL;
static void
qos_init(void)
{
g_qos = dds_create_qos();
CU_ASSERT_PTR_NOT_NULL_FATAL(g_qos);
g_pol_userdata.value._buffer = dds_alloc(strlen(c_userdata) + 1);
g_pol_userdata.value._length = (uint32_t)strlen(c_userdata) + 1;
g_pol_userdata.value._release = true;
g_pol_userdata.value._maximum = 0;
g_pol_topicdata.value._buffer = dds_alloc(strlen(c_topicdata) + 1);
g_pol_topicdata.value._length = (uint32_t)strlen(c_topicdata) + 1;
g_pol_topicdata.value._release = true;
g_pol_topicdata.value._maximum = 0;
g_pol_groupdata.value._buffer = dds_alloc(strlen(c_groupdata) + 1);
g_pol_groupdata.value._length = (uint32_t)strlen(c_groupdata) + 1;
g_pol_groupdata.value._release = true;
g_pol_groupdata.value._maximum = 0;
g_pol_history.kind = DDS_KEEP_LAST_HISTORY_QOS;
g_pol_history.depth = 1;
g_pol_resource_limits.max_samples = 1;
g_pol_resource_limits.max_instances = 1;
g_pol_resource_limits.max_samples_per_instance = 1;
g_pol_presentation.access_scope = DDS_INSTANCE_PRESENTATION_QOS;
g_pol_presentation.coherent_access = true;
g_pol_presentation.ordered_access = true;
g_pol_lifespan.duration.sec = 10000;
g_pol_lifespan.duration.nanosec = 11000;
g_pol_deadline.period.sec = 20000;
g_pol_deadline.period.nanosec = 220000;
g_pol_latency_budget.duration.sec = 30000;
g_pol_latency_budget.duration.nanosec = 33000;
g_pol_ownership.kind = DDS_EXCLUSIVE_OWNERSHIP_QOS;
g_pol_ownership_strength.value = 10;
g_pol_liveliness.kind = DDS_AUTOMATIC_LIVELINESS_QOS;
g_pol_liveliness.lease_duration.sec = 40000;
g_pol_liveliness.lease_duration.nanosec = 44000;
g_pol_time_based_filter.minimum_separation.sec = 12000;
g_pol_time_based_filter.minimum_separation.nanosec = 55000;
g_pol_partition.name._buffer = (char**)c_partitions;
g_pol_partition.name._length = 2;
g_pol_reliability.kind = DDS_RELIABLE_RELIABILITY_QOS;
g_pol_reliability.max_blocking_time.sec = 60000;
g_pol_reliability.max_blocking_time.nanosec = 66000;
g_pol_transport_priority.value = 42;
g_pol_destination_order.kind = DDS_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
g_pol_writer_data_lifecycle.autodispose_unregistered_instances = true;
g_pol_reader_data_lifecycle.autopurge_disposed_samples_delay.sec = 70000;
g_pol_reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec= 77000;
g_pol_reader_data_lifecycle.autopurge_nowriter_samples_delay.sec = 80000;
g_pol_reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec = 88000;
g_pol_durability_service.history_depth = 1;
g_pol_durability_service.history_kind = DDS_KEEP_LAST_HISTORY_QOS;
g_pol_durability_service.max_samples = 12;
g_pol_durability_service.max_instances = 3;
g_pol_durability_service.max_samples_per_instance = 4;
g_pol_durability_service.service_cleanup_delay.sec = 90000;
g_pol_durability_service.service_cleanup_delay.nanosec = 99000;
}
static void
qos_fini(void)
{
dds_delete_qos(g_qos);
dds_free(g_pol_userdata.value._buffer);
dds_free(g_pol_groupdata.value._buffer);
dds_free(g_pol_topicdata.value._buffer);
}
static void
@ -151,11 +46,15 @@ setup(void)
g_participant = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL);
CU_ASSERT_FATAL(g_participant > 0);
g_topic = dds_create_topic(g_participant, &RoundTripModule_DataType_desc, "RoundTrip", NULL, NULL);
CU_ASSERT_FATAL(g_topic> 0);
CU_ASSERT_FATAL(g_topic > 0);
g_subscriber = dds_create_subscriber(g_participant, NULL, NULL);
CU_ASSERT_FATAL(g_subscriber> 0);
CU_ASSERT_FATAL(g_subscriber > 0);
g_publisher = dds_create_publisher(g_participant, NULL, NULL);
CU_ASSERT_FATAL(g_publisher> 0);
CU_ASSERT_FATAL(g_publisher > 0);
g_writer = dds_create_writer(g_publisher, g_topic, NULL, NULL);
CU_ASSERT_FATAL(g_writer > 0);
g_reader = dds_create_reader(g_subscriber, g_topic, NULL, NULL);
CU_ASSERT_FATAL(g_reader > 0);
}
static void
@ -164,15 +63,6 @@ teardown(void)
qos_fini();
dds_delete(g_participant);
}
#define T_MILLISECOND 1000000ll
#define T_SECOND (1000 * T_MILLISECOND)
int64_t from_ddsi_duration (DDS_Duration_t x)
{
int64_t t;
t = (int64_t)x.sec * T_SECOND + x.nanosec;
return t;
}
static void
check_default_qos_of_builtin_entity(dds_entity_t entity)
@ -187,61 +77,64 @@ check_default_qos_of_builtin_entity(dds_entity_t entity)
dds_durability_kind_t durability_kind;
dds_presentation_access_scope_kind_t presentation_access_scope_kind;
bool presentation_coherent_access;
bool presentation_ordered_access;
dds_ownership_kind_t ownership_kind;
dds_liveliness_kind_t liveliness_kind;
dds_reliability_kind_t reliability_kind;
dds_destination_order_kind_t destination_order_kind;
dds_history_kind_t history_kind;
int32_t history_depth;
int32_t resource_limits_max_samples;
int32_t resource_limits_max_instances;
int32_t resource_limits_max_samples_per_instance;
char **partitions;
uint32_t plen;
dds_qos_t *qos = dds_create_qos();
CU_ASSERT_PTR_NOT_NULL_FATAL(qos);
CU_ASSERT_FATAL(qos != NULL);
ret = dds_get_qos(entity, qos);
CU_ASSERT_EQUAL_FATAL(ret, DDS_RETCODE_OK);
CU_ASSERT_FATAL(ret == DDS_RETCODE_OK);
dds_qget_durability(qos, &durability_kind);
dds_qget_presentation(qos, &presentation_access_scope_kind, &g_pol_presentation.coherent_access, &g_pol_presentation.ordered_access);
dds_qget_presentation(qos, &presentation_access_scope_kind, &presentation_coherent_access, &presentation_ordered_access);
dds_qget_deadline(qos, &deadline);
dds_qget_ownership(qos, &ownership_kind);
dds_qget_liveliness(qos, &liveliness_kind, &liveliness_lease_duration);
dds_qget_time_based_filter(qos, &minimum_separation);
dds_qget_reliability(qos, &reliability_kind, &max_blocking_time);
dds_qget_destination_order(qos, &destination_order_kind);
dds_qget_history(qos, &history_kind, &g_pol_history.depth);
dds_qget_resource_limits(qos, &g_pol_resource_limits.max_samples, &g_pol_resource_limits.max_instances, &g_pol_resource_limits.max_samples_per_instance);
dds_qget_history(qos, &history_kind, &history_depth);
dds_qget_resource_limits(qos, &resource_limits_max_samples, &resource_limits_max_instances, &resource_limits_max_samples_per_instance);
dds_qget_reader_data_lifecycle(qos, &autopurge_nowriter_samples_delay, &autopurge_disposed_samples_delay);
dds_qget_partition(qos, &plen, &partitions);
// no getter for ENTITY_FACTORY
CU_ASSERT_FATAL((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER || (entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER);
if ((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) {
CU_ASSERT_EQUAL(plen, 1);
if (plen > 0) {
CU_ASSERT_STRING_EQUAL(partitions[0], "__BUILT-IN PARTITION__");
}
} else if ((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER) {
CU_ASSERT_EQUAL(durability_kind, DDS_DURABILITY_TRANSIENT_LOCAL);
CU_ASSERT_EQUAL(presentation_access_scope_kind, DDS_PRESENTATION_TOPIC);
CU_ASSERT_EQUAL(g_pol_presentation.coherent_access, false);
CU_ASSERT_EQUAL(g_pol_presentation.ordered_access, false);
CU_ASSERT_EQUAL(deadline, DDS_INFINITY);
CU_ASSERT_EQUAL(ownership_kind, DDS_OWNERSHIP_SHARED);
CU_ASSERT_EQUAL(liveliness_kind, DDS_LIVELINESS_AUTOMATIC);
CU_ASSERT_EQUAL(minimum_separation, 0);
CU_ASSERT_EQUAL(reliability_kind, DDS_RELIABILITY_RELIABLE);
CU_ASSERT_EQUAL(max_blocking_time, DDS_MSECS(100));
CU_ASSERT_EQUAL(destination_order_kind, DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP);
CU_ASSERT_EQUAL(history_kind, DDS_HISTORY_KEEP_LAST);
CU_ASSERT_EQUAL(g_pol_history.depth, 1);
CU_ASSERT_EQUAL(g_pol_resource_limits.max_instances, DDS_LENGTH_UNLIMITED);
CU_ASSERT_EQUAL(g_pol_resource_limits.max_samples, DDS_LENGTH_UNLIMITED);
CU_ASSERT_EQUAL(g_pol_resource_limits.max_samples_per_instance, DDS_LENGTH_UNLIMITED);
CU_ASSERT_EQUAL(autopurge_nowriter_samples_delay, DDS_INFINITY);
CU_ASSERT_EQUAL(autopurge_disposed_samples_delay, DDS_INFINITY);
CU_ASSERT_FATAL(plen == 1);
CU_ASSERT_STRING_EQUAL_FATAL(partitions[0], "__BUILT-IN PARTITION__");
} else {
CU_FAIL_FATAL("Unsupported entity kind");
CU_ASSERT_FATAL(durability_kind == DDS_DURABILITY_TRANSIENT_LOCAL);
CU_ASSERT_FATAL(presentation_access_scope_kind == DDS_PRESENTATION_TOPIC);
CU_ASSERT_FATAL(presentation_coherent_access == false);
CU_ASSERT_FATAL(presentation_ordered_access == false);
CU_ASSERT_FATAL(deadline == DDS_INFINITY);
CU_ASSERT_FATAL(ownership_kind == DDS_OWNERSHIP_SHARED);
CU_ASSERT_FATAL(liveliness_kind == DDS_LIVELINESS_AUTOMATIC);
CU_ASSERT_FATAL(minimum_separation == 0);
CU_ASSERT_FATAL(reliability_kind == DDS_RELIABILITY_RELIABLE);
CU_ASSERT_FATAL(max_blocking_time == DDS_MSECS(100));
CU_ASSERT_FATAL(destination_order_kind == DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP);
CU_ASSERT_FATAL(history_kind == DDS_HISTORY_KEEP_LAST);
CU_ASSERT_FATAL(history_depth == 1);
CU_ASSERT_FATAL(resource_limits_max_instances == DDS_LENGTH_UNLIMITED);
CU_ASSERT_FATAL(resource_limits_max_samples == DDS_LENGTH_UNLIMITED);
CU_ASSERT_FATAL(resource_limits_max_samples_per_instance == DDS_LENGTH_UNLIMITED);
CU_ASSERT_FATAL(autopurge_nowriter_samples_delay == DDS_INFINITY);
CU_ASSERT_FATAL(autopurge_disposed_samples_delay == DDS_INFINITY);
}
if (plen > 0) {
for (uint32_t i = 0; i < plen; i++) {
@ -252,29 +145,6 @@ check_default_qos_of_builtin_entity(dds_entity_t entity)
dds_delete_qos(qos);
}
static dds_entity_t builtin_topic_handles[10];
CU_Test(ddsc_builtin_topics, types_allocation)
{
#define TEST_ALLOC(type) do { \
DDS_##type##BuiltinTopicData *data = DDS_##type##BuiltinTopicData__alloc(); \
CU_ASSERT_PTR_NOT_NULL(data); \
DDS_##type##BuiltinTopicData_free(data, DDS_FREE_ALL); \
} while(0)
TEST_ALLOC(Participant);
TEST_ALLOC(CMParticipant);
TEST_ALLOC(Type);
TEST_ALLOC(Topic);
TEST_ALLOC(Publication);
TEST_ALLOC(CMPublisher);
TEST_ALLOC(Subscription);
TEST_ALLOC(CMSubscriber);
TEST_ALLOC(CMDataWriter);
TEST_ALLOC(CMDataReader);
#undef TEST_ALLOC
}
CU_Test(ddsc_builtin_topics, availability_builtin_topics, .init = setup, .fini = teardown)
{
dds_entity_t topic;
@ -285,259 +155,101 @@ CU_Test(ddsc_builtin_topics, availability_builtin_topics, .init = setup, .fini =
topic = dds_find_topic(g_participant, "DCPSTopic");
CU_ASSERT_FATAL(topic < 0);
//TODO CHAM-347: dds_delete(topic);
topic = dds_find_topic(g_participant, "DCPSType");
CU_ASSERT_FATAL(topic < 0);
//TODO CHAM-347: dds_delete(topic);
topic = dds_find_topic(g_participant, "DCPSSubscription");
CU_ASSERT_FATAL(topic < 0);
//TODO CHAM-347: dds_delete(topic);
topic = dds_find_topic(g_participant, "DCSPPublication");
CU_ASSERT_FATAL(topic < 0);
//TODO CHAM-347: dds_delete(topic);
CU_ASSERT_FATAL(topic > 0);
dds_delete(topic);
topic = dds_find_topic(g_participant, "DCPSPublication");
CU_ASSERT_FATAL(topic > 0);
dds_delete(topic);
}
CU_Test(ddsc_builtin_topics, read_publication_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
#if 0 /* disabled pending CHAM-347 */
dds_return_t ret;
DDS_PublicationBuiltinTopicData *data;
#endif
dds_builtintopic_endpoint_t *data;
void *samples[MAX_SAMPLES];
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSPUBLICATION, NULL, NULL);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_PublicationBuiltinTopicData__alloc();
#if 0 /* disabled pending CHAM-347 */
samples[0] = NULL;
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
data = samples[0];
CU_ASSERT_FATAL(ret > 0);
data = (DDS_PublicationBuiltinTopicData *)samples;
CU_ASSERT_STRING_EQUAL_FATAL(data->topic_name, "DCPSPublication");
#endif
DDS_PublicationBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, create_reader)
{
dds_entity_t participant;
dds_entity_t t1;
/* Create a participant */
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
CU_ASSERT_FATAL(participant > 0);
/*
* The topics are created by the middleware as soon as a participant
* is created.
*/
#define TEST_FIND(p, t) do { \
t1 = dds_find_topic(p, t); \
CU_ASSERT(t1 > 0); \
dds_delete(t1); \
} while(0);
/* A builtin-topic proxy is created 'on demand' and should not exist before a reader is created for it */
TEST_FIND(participant, "DCPSParticipant");
TEST_FIND(participant, "CMParticipant");
#undef TEST_FIND
/*
* TODO CHAM-347: Not all builtin topics are created at the start.
*/
#define TEST_NOTFOUND(p, t) do { \
t1 = dds_find_topic(p, t); \
CU_ASSERT(t1 < 0); \
} while(0);
/* A builtin-topic proxy is created 'on demand' and should not exist before a reader is created for it */
TEST_NOTFOUND(participant, "DCPSType");
TEST_NOTFOUND(participant, "DCPSTopic");
TEST_NOTFOUND(participant, "DCPSPublication");
TEST_NOTFOUND(participant, "CMPublisher");
TEST_NOTFOUND(participant, "DCPSSubscription");
TEST_NOTFOUND(participant, "CMSubscriber");
TEST_NOTFOUND(participant, "CMDataWriter");
TEST_NOTFOUND(participant, "CMDataReader");
#undef TEST_NOTFOUND
/* A reader is created by providing a special builtin-topic handle */
{
dds_entity_t readers[10];
dds_entity_t builtin_subscriber, s;
builtin_topic_handles[0] = DDS_BUILTIN_TOPIC_DCPSPARTICIPANT;
builtin_topic_handles[1] = DDS_BUILTIN_TOPIC_CMPARTICIPANT;
builtin_topic_handles[2] = DDS_BUILTIN_TOPIC_DCPSTYPE;
builtin_topic_handles[3] = DDS_BUILTIN_TOPIC_DCPSTOPIC;
builtin_topic_handles[4] = DDS_BUILTIN_TOPIC_DCPSPUBLICATION;
builtin_topic_handles[5] = DDS_BUILTIN_TOPIC_CMPUBLISHER;
builtin_topic_handles[6] = DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION;
builtin_topic_handles[7] = DDS_BUILTIN_TOPIC_CMSUBSCRIBER;
builtin_topic_handles[8] = DDS_BUILTIN_TOPIC_CMDATAWRITER;
builtin_topic_handles[9] = DDS_BUILTIN_TOPIC_CMDATAREADER;
for (int i = 0; i < 10; i++) {
readers[i] = dds_create_reader(participant, builtin_topic_handles[i], NULL, NULL);
CU_ASSERT(readers[i]> 0);
if (i == 0) {
/* Check the parent of reader is a subscriber */
builtin_subscriber = dds_get_parent(readers[i]);
CU_ASSERT_FATAL(builtin_subscriber > 0);
CU_ASSERT_EQUAL_FATAL(builtin_subscriber & DDS_ENTITY_KIND_MASK, DDS_KIND_SUBSCRIBER);
} else {
/* Check the parent of reader equals parent of first reader */
s = dds_get_parent(readers[i]);
CU_ASSERT_FATAL(s > 0);
CU_ASSERT_EQUAL_FATAL(s, builtin_subscriber);
//dds_delete(s);
}
}
}
#define TEST_FOUND(p, t) do { \
t1 = dds_find_topic(p, t); \
CU_ASSERT(t1 > 0); \
if (t1 > 0) { \
dds_delete(t1); \
} \
} while(0);
/* Builtin-topics proxies should now be created */
TEST_FOUND(participant, "DCPSParticipant");
TEST_FOUND(participant, "CMParticipant");
TEST_FOUND(participant, "DCPSType");
TEST_FOUND(participant, "DCPSTopic");
TEST_FOUND(participant, "DCPSPublication");
TEST_FOUND(participant, "CMPublisher");
TEST_FOUND(participant, "DCPSSubscription");
TEST_FOUND(participant, "CMSubscriber");
TEST_FOUND(participant, "CMDataWriter");
TEST_FOUND(participant, "CMDataReader");
#undef TEST_FOUND
dds_delete(participant);
CU_ASSERT_STRING_EQUAL_FATAL(data->topic_name, "RoundTrip");
dds_return_loan(reader, samples, ret);
}
CU_Test(ddsc_builtin_topics, read_subscription_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
#if 0 /* not supported yet */
dds_return_t ret;
DDS_SubscriptionBuiltinTopicData *data;
#endif
void * samples[MAX_SAMPLES];
const char *exp[] = { "DCPSSubscription", "RoundTrip" };
unsigned seen = 0;
dds_qos_t *qos;
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION, NULL, NULL);
CU_ASSERT_FATAL(reader> 0);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_SubscriptionBuiltinTopicData__alloc();
#if 0 /* not supported yet */
samples[0] = NULL;
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret> 0);
CU_ASSERT_FATAL(ret == 2);
qos = dds_create_qos();
for (int i = 0; i < ret; i++) {
dds_builtintopic_endpoint_t *data = samples[i];
for (size_t j = 0; j < sizeof (exp) / sizeof (exp[0]); j++) {
if (strcmp (data->topic_name, exp[j]) == 0) {
seen |= 1u << j;
dds_return_t get_qos_ret = dds_get_qos(j == 0 ? reader : g_reader, qos);
CU_ASSERT_FATAL(get_qos_ret == DDS_RETCODE_OK);
const bool eq = dds_qos_equal(qos, data->qos);
CU_ASSERT_FATAL(eq);
}
}
}
CU_ASSERT_FATAL(seen == 3);
dds_delete_qos(qos);
data = (DDS_SubscriptionBuiltinTopicData *)samples;
CU_ASSERT_STRING_EQUAL_FATAL(data->topic_name, "DCPSSubscription");
#endif
DDS_SubscriptionBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
dds_return_loan(reader, samples, ret);
}
CU_Test(ddsc_builtin_topics, read_participant_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
dds_return_t ret;
//dds_builtintopic_participant_t *data;
void * samples[MAX_SAMPLES];
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSPARTICIPANT, NULL, NULL);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_ParticipantBuiltinTopicData__alloc();
samples[0] = NULL;
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret > 0);
#if 0
{
DDS_ParticipantBuiltinTopicData *data = (DDS_ParticipantBuiltinTopicData*)samples[0];
}
#endif
DDS_ParticipantBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, read_cmparticipant_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
dds_return_t ret;
void * samples[MAX_SAMPLES];
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_CMPARTICIPANT, NULL, NULL);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_CMParticipantBuiltinTopicData__alloc();
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret > 0);
#if 0
{
DDS_CMParticipantBuiltinTopicData *data = (DDS_CMParticipantBuiltinTopicData*)samples[0];
}
#endif
DDS_CMParticipantBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
dds_return_loan(reader, samples, ret);
}
CU_Test(ddsc_builtin_topics, read_topic_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
#if 0 /* disabled pending CHAM-347 */
dds_entity_t reader;
dds_return_t ret;
DDS_TopicBuiltinTopicData *data;
#endif
void * samples[MAX_SAMPLES];
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSTOPIC, NULL, NULL);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_TopicBuiltinTopicData__alloc();
#if 0 /* disabled pending CHAM-347 */
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret> 0);
data = (DDS_TopicBuiltinTopicData *)samples;
CU_ASSERT_STRING_EQUAL_FATAL(data->name, "DCPSSubscription");
#endif
DDS_ParticipantBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, read_type_data, .init = setup, .fini = teardown)
{
dds_entity_t reader;
#if 0 /* disabled pending CHAM-347 */
dds_return_t ret;
DDS_TypeBuiltinTopicData *data;
#endif
void * samples[MAX_SAMPLES];
reader = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSTYPE, NULL, NULL);
CU_ASSERT_FATAL(reader > 0);
samples[0] = DDS_TypeBuiltinTopicData__alloc();
#if 0 /* disabled pending CHAM-347 */
samples[0] = NULL;
ret = dds_read(reader, samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret > 0);
data = (DDS_TypeBuiltinTopicData *)samples;
CU_ASSERT_STRING_EQUAL_FATAL(data->name, "DCPSType");
data = (DDS_TopicBuiltinTopicData *)samples;
CU_ASSERT_STRING_EQUAL_FATAL(data->name, "DCPSSubscription");
dds_return_loan(reader, samples, ret);
#endif
DDS_TypeBuiltinTopicData_free(samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, same_subscriber, .init = setup, .fini = teardown)
@ -551,11 +263,10 @@ CU_Test(ddsc_builtin_topics, same_subscriber, .init = setup, .fini = teardown)
dds_entity_t participant_rdr;
dds_entity_t participant_subscriber;
#if 0
dds_entity_t topic_rdr;
dds_entity_t topic_subscriber;
dds_entity_t type_rdr;
dds_entity_t type_subscriber;
#endif
subscription_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION, NULL, NULL);
CU_ASSERT_FATAL(subscription_rdr > 0);
@ -567,28 +278,23 @@ CU_Test(ddsc_builtin_topics, same_subscriber, .init = setup, .fini = teardown)
publication_subscriber = dds_get_parent(publication_rdr);
CU_ASSERT_FATAL(publication_subscriber > 0);
CU_ASSERT_EQUAL_FATAL(subscription_subscriber, publication_subscriber);
CU_ASSERT_FATAL(subscription_subscriber == publication_subscriber);
participant_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSPARTICIPANT, NULL, NULL);
CU_ASSERT_FATAL(participant_rdr > 0);
participant_subscriber = dds_get_parent(participant_rdr);
CU_ASSERT_FATAL(participant_subscriber > 0);
CU_ASSERT_EQUAL_FATAL(publication_subscriber, participant_subscriber);
CU_ASSERT_FATAL(publication_subscriber == participant_subscriber);
#if 0
topic_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSTOPIC, NULL, NULL);
CU_ASSERT_FATAL(topic_rdr > 0);
topic_subscriber = dds_get_parent(topic_rdr);
CU_ASSERT_FATAL(topic_subscriber > 0);
CU_ASSERT_EQUAL_FATAL(participant_subscriber, topic_subscriber);
type_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSTYPE, NULL, NULL);
CU_ASSERT_FATAL(type_rdr > 0);
type_subscriber = dds_get_parent(type_rdr);
CU_ASSERT_FATAL(type_subscriber > 0);
CU_ASSERT_EQUAL_FATAL(topic_subscriber, type_subscriber);
CU_ASSERT_FATAL(participant_subscriber == topic_subscriber);
#endif
}
CU_Test(ddsc_builtin_topics, builtin_qos, .init = setup, .fini = teardown)
@ -604,240 +310,3 @@ CU_Test(ddsc_builtin_topics, builtin_qos, .init = setup, .fini = teardown)
CU_ASSERT_FATAL(dds_sub_subscriber > 0);
check_default_qos_of_builtin_entity(dds_sub_subscriber);
}
CU_Test(ddsc_builtin_topics, datareader_qos, .init = setup, .fini = teardown)
{
dds_entity_t rdr;
dds_entity_t subscription_rdr;
void * subscription_samples[MAX_SAMPLES];
#if 0 /* disabled pending CHAM-347 */
dds_return_t ret;
DDS_SubscriptionBuiltinTopicData *subscription_data;
#endif
// Set some qos' which differ from the default
dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
dds_qset_deadline(g_qos, from_ddsi_duration(g_pol_deadline.period));
dds_qset_latency_budget(g_qos, from_ddsi_duration(g_pol_latency_budget.duration));
dds_qset_liveliness(g_qos, (dds_liveliness_kind_t)g_pol_liveliness.kind, from_ddsi_duration(g_pol_liveliness.lease_duration));
dds_qset_reliability(g_qos, (dds_reliability_kind_t)g_pol_reliability.kind, from_ddsi_duration(g_pol_reliability.max_blocking_time));
dds_qset_ownership(g_qos, (dds_ownership_kind_t)g_pol_ownership.kind);
dds_qset_destination_order(g_qos, (dds_destination_order_kind_t)g_pol_destination_order.kind);
dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
dds_qset_time_based_filter(g_qos, from_ddsi_duration(g_pol_time_based_filter.minimum_separation));
dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
dds_qset_groupdata(g_qos, g_pol_groupdata.value._buffer, g_pol_groupdata.value._length);
rdr = dds_create_reader(g_subscriber, g_topic, g_qos, NULL);
CU_ASSERT_FATAL(rdr > 0);
subscription_samples[0] = DDS_SubscriptionBuiltinTopicData__alloc();
subscription_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION, NULL, NULL);
CU_ASSERT_FATAL(subscription_rdr > 0);
#if 0 /* disabled pending CHAM-347 */
ret = dds_read(subscription_rdr, subscription_samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret > 0);
// Check the QOS settings of the 'remote' qos'
subscription_data = (DDS_SubscriptionBuiltinTopicData *)subscription_samples[0];
CU_ASSERT_STRING_EQUAL_FATAL(subscription_data->topic_name, "RoundTrip");
CU_ASSERT_STRING_EQUAL_FATAL(subscription_data->type_name, "RoundTripModule::DataType");
CU_ASSERT_EQUAL_FATAL(subscription_data->durability.kind, g_pol_durability.kind);
CU_ASSERT_EQUAL_FATAL(subscription_data->deadline.period.sec, g_pol_deadline.period.sec);
CU_ASSERT_EQUAL_FATAL(subscription_data->deadline.period.nanosec, g_pol_deadline.period.nanosec);
CU_ASSERT_EQUAL_FATAL(subscription_data->latency_budget.duration.sec, g_pol_latency_budget.duration.sec);
CU_ASSERT_EQUAL_FATAL(subscription_data->latency_budget.duration.nanosec, g_pol_latency_budget.duration.nanosec);
CU_ASSERT_EQUAL_FATAL(subscription_data->liveliness.kind, g_pol_liveliness.kind);
CU_ASSERT_EQUAL_FATAL(subscription_data->liveliness.lease_duration.sec, g_pol_liveliness.lease_duration.sec);
CU_ASSERT_EQUAL_FATAL(subscription_data->liveliness.lease_duration.nanosec, g_pol_liveliness.lease_duration.nanosec);
CU_ASSERT_EQUAL_FATAL(subscription_data->reliability.kind, g_pol_reliability.kind);
CU_ASSERT_EQUAL_FATAL(subscription_data->reliability.max_blocking_time.sec, g_pol_reliability.max_blocking_time.sec);
CU_ASSERT_EQUAL_FATAL(subscription_data->reliability.max_blocking_time.nanosec, g_pol_reliability.max_blocking_time.nanosec);
CU_ASSERT_EQUAL_FATAL(subscription_data->ownership.kind, g_pol_ownership.kind);
CU_ASSERT_EQUAL_FATAL(subscription_data->destination_order.kind, g_pol_destination_order.kind);
CU_ASSERT_EQUAL_FATAL(subscription_data->user_data.value._buffer, g_pol_userdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(subscription_data->user_data.value._length, g_pol_userdata.value._length);
CU_ASSERT_EQUAL_FATAL(subscription_data->time_based_filter.minimum_separation.sec, g_pol_time_based_filter.minimum_separation.sec);
CU_ASSERT_EQUAL_FATAL(subscription_data->time_based_filter.minimum_separation.nanosec, g_pol_time_based_filter.minimum_separation.nanosec);
CU_ASSERT_EQUAL_FATAL(subscription_data->presentation.access_scope, g_pol_presentation.access_scope);
CU_ASSERT_EQUAL_FATAL(subscription_data->presentation.coherent_access, g_pol_presentation.coherent_access);
CU_ASSERT_EQUAL_FATAL(subscription_data->presentation.ordered_access, g_pol_presentation.ordered_access);
CU_ASSERT_EQUAL_FATAL(subscription_data->partition.name._length, g_pol_partition.name._length);
for (uint32_t i = 0; i < subscription_data->partition.name._length; ++i)
{
CU_ASSERT_STRING_EQUAL_FATAL(subscription_data->partition.name._buffer[i], c_partitions[i]);
}
CU_ASSERT_STRING_EQUAL_FATAL(subscription_data->topic_data.value._buffer, g_pol_topicdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(subscription_data->topic_data.value._length, g_pol_topicdata.value._length);
CU_ASSERT_STRING_EQUAL_FATAL(subscription_data->group_data.value._buffer, g_pol_groupdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(subscription_data->group_data.value._length, g_pol_groupdata.value._length);
#endif
DDS_SubscriptionBuiltinTopicData_free(subscription_samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, datawriter_qos, .init = setup, .fini = teardown)
{
dds_entity_t wrtr;
dds_entity_t publication_rdr;
#if 0 /* disabled pending CHAM-347 */
dds_return_t ret;
DDS_PublicationBuiltinTopicData *publication_data;
#endif
void * publication_samples[MAX_SAMPLES];
dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
dds_qset_deadline(g_qos, from_ddsi_duration(g_pol_deadline.period));
dds_qset_latency_budget(g_qos, from_ddsi_duration(g_pol_latency_budget.duration));
dds_qset_liveliness(g_qos, (dds_liveliness_kind_t)g_pol_liveliness.kind, from_ddsi_duration(g_pol_liveliness.lease_duration));
dds_qset_reliability(g_qos, (dds_reliability_kind_t)g_pol_reliability.kind, from_ddsi_duration(g_pol_reliability.max_blocking_time));
dds_qset_lifespan(g_qos, from_ddsi_duration(g_pol_lifespan.duration));
dds_qset_destination_order(g_qos, (dds_destination_order_kind_t)g_pol_destination_order.kind);
dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
dds_qset_ownership(g_qos, (dds_ownership_kind_t)g_pol_ownership.kind);
dds_qset_ownership_strength(g_qos, g_pol_ownership_strength.value);
dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
wrtr = dds_create_writer(g_publisher, g_topic, g_qos, NULL);
CU_ASSERT_FATAL(wrtr > 0);
publication_samples[0] = DDS_PublicationBuiltinTopicData__alloc();
publication_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSPUBLICATION, NULL, NULL);
CU_ASSERT_FATAL(publication_rdr > 0);
#if 0 /* disabled pending CHAM-347 */
ret = dds_read(publication_rdr, publication_samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret> 0);
// Check the QOS settings of the 'remote' qos'
publication_data = (DDS_PublicationBuiltinTopicData *)publication_samples[0];
CU_ASSERT_STRING_EQUAL_FATAL(publication_data->topic_name, "RoundTrip");
CU_ASSERT_STRING_EQUAL_FATAL(publication_data->type_name, "RoundTripModule::DataType");
CU_ASSERT_EQUAL_FATAL(publication_data->durability.kind, g_pol_durability.kind);
CU_ASSERT_EQUAL_FATAL(publication_data->deadline.period.sec, g_pol_deadline.period.sec);
CU_ASSERT_EQUAL_FATAL(publication_data->deadline.period.nanosec, g_pol_deadline.period.nanosec);
CU_ASSERT_EQUAL_FATAL(publication_data->latency_budget.duration.sec, g_pol_latency_budget.duration.sec);
CU_ASSERT_EQUAL_FATAL(publication_data->latency_budget.duration.nanosec, g_pol_latency_budget.duration.nanosec);
CU_ASSERT_EQUAL_FATAL(publication_data->liveliness.kind, g_pol_liveliness.kind);
CU_ASSERT_EQUAL_FATAL(publication_data->liveliness.lease_duration.sec, g_pol_liveliness.lease_duration.sec);
CU_ASSERT_EQUAL_FATAL(publication_data->liveliness.lease_duration.nanosec, g_pol_liveliness.lease_duration.nanosec);
CU_ASSERT_EQUAL_FATAL(publication_data->reliability.kind, g_pol_reliability.kind);
CU_ASSERT_EQUAL_FATAL(publication_data->reliability.max_blocking_time.sec, g_pol_reliability.max_blocking_time.sec);
CU_ASSERT_EQUAL_FATAL(publication_data->reliability.max_blocking_time.nanosec, g_pol_reliability.max_blocking_time.nanosec);
CU_ASSERT_EQUAL_FATAL(publication_data->lifespan.duration.sec, g_pol_lifespan.duration.sec);
CU_ASSERT_EQUAL_FATAL(publication_data->lifespan.duration.nanosec, g_pol_lifespan.duration.nanosec);
CU_ASSERT_EQUAL_FATAL(publication_data->destination_order.kind, g_pol_destination_order.kind);
CU_ASSERT_EQUAL_FATAL(publication_data->user_data.value._buffer, g_pol_userdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(publication_data->user_data.value._length, g_pol_userdata.value._length);
CU_ASSERT_EQUAL_FATAL(publication_data->ownership.kind, g_pol_ownership.kind);
CU_ASSERT_EQUAL_FATAL(publication_data->ownership_strength.value, g_pol_ownership_strength.value);
CU_ASSERT_EQUAL_FATAL(publication_data->presentation.access_scope, g_pol_presentation.access_scope);
CU_ASSERT_EQUAL_FATAL(publication_data->presentation.coherent_access, g_pol_presentation.coherent_access);
CU_ASSERT_EQUAL_FATAL(publication_data->presentation.ordered_access, g_pol_presentation.ordered_access);
CU_ASSERT_EQUAL_FATAL(publication_data->partition.name._length, g_pol_partition.name._length);
for (uint32_t i = 0; i < publication_data->partition.name._length; ++i)
{
CU_ASSERT_STRING_EQUAL_FATAL(publication_data->partition.name._buffer[i], c_partitions[i]);
}
CU_ASSERT_STRING_EQUAL_FATAL(publication_data->topic_data.value._buffer, g_pol_topicdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(publication_data->topic_data.value._length, g_pol_topicdata.value._length);
CU_ASSERT_STRING_EQUAL_FATAL(publication_data->group_data.value._buffer, g_pol_groupdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(publication_data->group_data.value._length, g_pol_groupdata.value._length);
#endif
DDS_PublicationBuiltinTopicData_free(publication_samples[0], DDS_FREE_ALL);
}
CU_Test(ddsc_builtin_topics, topic_qos, .init = setup, .fini = teardown)
{
dds_entity_t tpc;
dds_entity_t topic_rdr;
#if 0 /* disabled pending CHAM-347 */
dds_return_t ret;
DDS_TopicBuiltinTopicData *topic_data;
#endif
void * topic_samples[MAX_SAMPLES];
dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
dds_qset_durability_service(g_qos,
from_ddsi_duration(g_pol_durability_service.service_cleanup_delay),
(dds_history_kind_t)g_pol_durability_service.history_kind,
g_pol_durability_service.history_depth,
g_pol_durability_service.max_samples,
g_pol_durability_service.max_instances,
g_pol_durability_service.max_samples_per_instance);
dds_qset_deadline(g_qos, from_ddsi_duration(g_pol_deadline.period));
dds_qset_latency_budget(g_qos, from_ddsi_duration(g_pol_latency_budget.duration));
dds_qset_liveliness(g_qos, (dds_liveliness_kind_t)g_pol_liveliness.kind, from_ddsi_duration(g_pol_liveliness.lease_duration));
dds_qset_reliability(g_qos, (dds_reliability_kind_t)g_pol_reliability.kind, from_ddsi_duration(g_pol_reliability.max_blocking_time));
dds_qset_transport_priority(g_qos, g_pol_transport_priority.value);
dds_qset_lifespan(g_qos, from_ddsi_duration(g_pol_lifespan.duration));
dds_qset_destination_order(g_qos, (dds_destination_order_kind_t)g_pol_destination_order.kind);
dds_qset_history(g_qos, (dds_history_kind_t)g_pol_history.kind, g_pol_history.depth);
dds_qset_resource_limits(g_qos, g_pol_resource_limits.max_samples, g_pol_resource_limits.max_instances,
g_pol_resource_limits.max_samples_per_instance);
dds_qset_ownership(g_qos, (dds_ownership_kind_t)g_pol_ownership.kind);
dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
tpc = dds_create_topic(g_participant, &Space_Type1_desc, "SpaceType1", g_qos, NULL);
CU_ASSERT_FATAL(tpc > 0);
topic_samples[0] = DDS_PublicationBuiltinTopicData__alloc();
topic_rdr = dds_create_reader(g_participant, DDS_BUILTIN_TOPIC_DCPSTOPIC, NULL, NULL);
CU_ASSERT_FATAL(topic_rdr > 0 );
#if 0 /* disabled pending CHAM-347 */
ret = dds_read(topic_rdr, topic_samples, g_info, MAX_SAMPLES, MAX_SAMPLES);
CU_ASSERT_FATAL(ret > 0);
topic_data = (DDS_TopicBuiltinTopicData *)topic_samples[0];
CU_ASSERT_STRING_EQUAL_FATAL(topic_data->name, "SpaceType1");
CU_ASSERT_STRING_EQUAL_FATAL(topic_data->type_name, "RoundTripModule::DataType");
CU_ASSERT_EQUAL_FATAL(topic_data->durability.kind, g_pol_durability.kind);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.service_cleanup_delay.sec, g_pol_durability_service.service_cleanup_delay.sec);
CU_ASSERT_EQUAL(topic_data->durability_service.service_cleanup_delay.nanosec, g_pol_durability_service.service_cleanup_delay.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.history_kind, g_pol_durability_service.history_kind);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.history_depth, g_pol_durability_service.history_depth);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.max_samples, g_pol_durability_service.max_samples);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.max_instances, g_pol_durability_service.max_instances);
CU_ASSERT_EQUAL_FATAL(topic_data->durability_service.max_samples_per_instance, g_pol_durability_service.max_samples_per_instance);
CU_ASSERT_EQUAL_FATAL(topic_data->deadline.period.sec, g_pol_deadline.period.sec);
CU_ASSERT_EQUAL_FATAL(topic_data->deadline.period.nanosec, g_pol_deadline.period.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->latency_budget.duration.sec, g_pol_latency_budget.duration.sec);
CU_ASSERT_EQUAL_FATAL(topic_data->latency_budget.duration.nanosec, g_pol_latency_budget.duration.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->liveliness.kind, g_pol_liveliness.kind);
CU_ASSERT_EQUAL_FATAL(topic_data->liveliness.lease_duration.sec, g_pol_liveliness.lease_duration.sec);
CU_ASSERT_EQUAL_FATAL(topic_data->liveliness.lease_duration.nanosec, g_pol_liveliness.lease_duration.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->reliability.kind, g_pol_reliability.kind);
CU_ASSERT_EQUAL_FATAL(topic_data->reliability.max_blocking_time.sec, g_pol_reliability.max_blocking_time.sec);
CU_ASSERT_EQUAL_FATAL(topic_data->reliability.max_blocking_time.nanosec, g_pol_reliability.max_blocking_time.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->transport_priority.value, g_pol_transport_priority.value);
CU_ASSERT_EQUAL_FATAL(topic_data->lifespan.duration.sec, g_pol_lifespan.duration.sec);
CU_ASSERT_EQUAL_FATAL(topic_data->lifespan.duration.nanosec, g_pol_lifespan.duration.nanosec);
CU_ASSERT_EQUAL_FATAL(topic_data->destination_order.kind, g_pol_destination_order.kind);
CU_ASSERT_EQUAL_FATAL(topic_data->history.kind, g_pol_history.kind);
CU_ASSERT_EQUAL_FATAL(topic_data->history.depth, g_pol_history.depth);
CU_ASSERT_EQUAL_FATAL(topic_data->resource_limits.max_samples, g_pol_resource_limits.max_samples);
CU_ASSERT_EQUAL_FATAL(topic_data->resource_limits.max_instances, g_pol_resource_limits.max_instances);
CU_ASSERT_EQUAL_FATAL(topic_data->resource_limits.max_samples_per_instance, g_pol_resource_limits.max_samples_per_instance);
CU_ASSERT_EQUAL_FATAL(topic_data->ownership.kind, g_pol_ownership.kind);
CU_ASSERT_STRING_EQUAL_FATAL(topic_data->topic_data.value._buffer, g_pol_topicdata.value._buffer);
CU_ASSERT_EQUAL_FATAL(topic_data->topic_data.value._length, g_pol_topicdata.value._length);
#endif
DDS_TopicBuiltinTopicData_free(topic_samples[0], DDS_FREE_ALL);
}