Simplify logging and remove unwanted functions from abstraction layer

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2018-11-26 19:10:09 +01:00
parent ac020f62f7
commit 1cf03332ca
97 changed files with 2819 additions and 5361 deletions

View file

@ -28,7 +28,6 @@
66 src/dds_readcond.c
67 src/dds_subscriber.c
68 src/dds_write.c
69 src/dds_report.c
70 src/dds_builtin.c
72 src/dds_guardcond.c
73 src/dds_whc.c

View file

@ -29,13 +29,11 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
dds_key.c
dds_querycond.c
dds_topic.c
dds_report.c
dds_err.c
dds_listener.c
dds_read.c
dds_stream.c
dds_waitset.c
dds_log.c
dds_readcond.c
dds_guardcond.c
dds_subscriber.c
@ -48,7 +46,6 @@ PREPEND(hdrs_public_ddsc "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/dd
dds_public_error.h
dds_public_impl.h
dds_public_listener.h
dds_public_log.h
dds_public_qos.h
dds_public_status.h
dds_public_stream.h
@ -71,7 +68,6 @@ PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
dds__readcond.h
dds__guardcond.h
dds__reader.h
dds__report.h
dds__rhc.h
dds__stream.h
dds__subscriber.h

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 "ddsc/dds_public_log.h"
#include "dds_dcps_builtintopics.h"
#if defined (__cplusplus)

View file

@ -1,39 +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
*/
/* TODO: do we really need to expose this as an API? */
/** @file
*
* @brief DDS C Logging API
*
* This header file defines the public API for logging in the
* CycloneDDS C language binding.
*/
#ifndef DDS_LOG_H
#define DDS_LOG_H
#include "os/os_public.h"
#include "ddsc/dds_export.h"
#if defined (__cplusplus)
extern "C" {
#endif
DDS_EXPORT void dds_log_info (const char * fmt, ...);
DDS_EXPORT void dds_log_warn (const char * fmt, ...);
DDS_EXPORT void dds_log_error (const char * fmt, ...);
DDS_EXPORT void dds_log_fatal (const char * fmt, ...);
#if defined (__cplusplus)
}
#endif
#endif

View file

@ -31,9 +31,8 @@ extern "C" {
#define DDS__FILE_ID__ (((__FILE_ID__ & 0x1ff)) << 22)
#define DDS__LINE__ ((__LINE__ & 0x3fff) << 8)
#define DDS_ERR_NO(err) -(DDS__FILE_ID__ + DDS__LINE__ + (err))
#define DDS_ERRNO(e,msg,...) (assert(e > DDS_RETCODE_OK), os_report(OS_REPORT_ERROR, OS_FUNCTION, __FILE__, __LINE__, DDS_ERR_NO(e), (msg), ##__VA_ARGS__), DDS_ERR_NO(e))
#define DDS_ERRNO(err) \
(assert(err > DDS_RETCODE_OK), -(DDS__FILE_ID__ + DDS__LINE__ + (err)))
#if defined (__cplusplus)
}

View file

@ -1,78 +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 DDS_REPORT_H
#define DDS_REPORT_H
#include <stdarg.h>
#include "os/os_report.h"
#define DDS_REPORT_STACK() \
os_report_stack ()
#define DDS_CRITICAL(...) \
dds_report ( \
OS_REPORT_CRITICAL, \
__FILE__, \
__LINE__, \
OS_FUNCTION, \
DDS_RETCODE_ERROR, \
__VA_ARGS__)
#define DDS_ERROR(code,...) \
dds_report ( \
OS_REPORT_ERROR, \
__FILE__, \
__LINE__, \
OS_FUNCTION, \
(code), \
__VA_ARGS__)
#define DDS_INFO(...) \
dds_report ( \
OS_REPORT_INFO, \
__FILE__, \
__LINE__, \
OS_FUNCTION, \
DDS_RETCODE_OK, \
__VA_ARGS__)
#define DDS_WARNING(code,...) \
dds_report ( \
OS_REPORT_WARNING, \
__FILE__, \
__LINE__, \
OS_FUNCTION, \
(code), \
__VA_ARGS__)
#define DDS_REPORT(type, code,...) \
dds_report ( \
type, \
__FILE__, \
__LINE__, \
OS_FUNCTION, \
(code), \
__VA_ARGS__)
#define DDS_REPORT_FLUSH OS_REPORT_FLUSH
void
dds_report(
os_reportType reportType,
const char *file,
int32_t line,
const char *function,
dds_return_t code,
const char *format,
...);
#endif

View file

@ -103,7 +103,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
{
type = DDS_OP_TYPE (op);
#ifdef OP_DEBUG_FREE
TRACE (("F-ADR: %s offset %d\n", stream_op_type[type], ops[1]));
DDS_TRACE("F-ADR: %s offset %d\n", stream_op_type[type], ops[1]);
#endif
addr = data + ops[1];
ops += 2;
@ -119,7 +119,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
case DDS_OP_VAL_STR:
{
#ifdef OP_DEBUG_FREE
TRACE (("F-STR: @ %p %s\n", addr, *((char**) addr)));
DDS_TRACE("F-STR: @ %p %s\n", addr, *((char**) addr));
#endif
dds_free (*((char**) addr));
*((char**) addr) = NULL;
@ -132,7 +132,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
num = (seq->_maximum > seq->_length) ? seq->_maximum : seq->_length;
#ifdef OP_DEBUG_FREE
TRACE (("F-SEQ: of %s\n", stream_op_type[subtype]));
DDS_TRACE("F-SEQ: of %s\n", stream_op_type[subtype]);
#endif
if ((seq->_release && num) || (subtype > DDS_OP_VAL_STR))
{
@ -189,7 +189,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
num = *ops++;
#ifdef OP_DEBUG_FREE
TRACE (("F-ARR: of %s size %d\n", stream_op_type[subtype], num));
DDS_TRACE("F-ARR: of %s size %d\n", stream_op_type[subtype], num);
#endif
switch (subtype)
{
@ -242,7 +242,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
assert (subtype <= DDS_OP_VAL_4BY);
#ifdef OP_DEBUG_FREE
TRACE (("F-UNI: switch %s cases %d\n", stream_op_type[subtype], num));
DDS_TRACE("F-UNI: switch %s cases %d\n", stream_op_type[subtype], num);
#endif
/* Get discriminant */
@ -320,7 +320,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
case DDS_OP_JSR: /* Implies nested type */
{
#ifdef OP_DEBUG_FREE
TRACE (("F-JSR: %d\n", DDS_OP_JUMP (op)));
DDS_TRACE("F-JSR: %d\n", DDS_OP_JUMP (op));
#endif
dds_sample_free_contents (data, ops + DDS_OP_JUMP (op));
ops++;
@ -330,7 +330,7 @@ void dds_sample_free_contents (char * data, const uint32_t * ops)
}
}
#ifdef OP_DEBUG_FREE
TRACE (("F-RTS:\n"));
DDS_TRACE("F-RTS:\n");
#endif
}

View file

@ -21,7 +21,6 @@
#include "dds__participant.h"
#include "dds__err.h"
#include "dds__types.h"
#include "dds__report.h"
#include "dds__builtin.h"
#include "dds__subscriber.h"
@ -125,7 +124,8 @@ dds__create_builtin_participant(
}
if (q_rc != 0) {
participant = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal builtin error");
DDS_ERROR("Internal builtin error\n");
participant = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail;
}
@ -311,7 +311,8 @@ dds__get_builtin_topic(
desc = &DDS_CMDataReaderBuiltinTopicData_desc;
name = "CMDataReader";
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Invalid builtin-topic handle(%d)", topic);
DDS_ERROR("Invalid builtin-topic handle(%d)\n", topic);
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err_invalid_topic;
}
@ -319,10 +320,6 @@ dds__get_builtin_topic(
if (ret < 0 && dds_err_nr(ret) == DDS_RETCODE_PRECONDITION_NOT_MET) {
dds_qos_t *tqos;
/* drop the precondition-no-met error */
DDS_REPORT_FLUSH(0);
DDS_REPORT_STACK();
tqos = dds_create_qos();
dds_qset_durability(tqos, DDS_DURABILITY_TRANSIENT_LOCAL);
dds_qset_presentation(tqos, DDS_PRESENTATION_TOPIC, false, false);
@ -358,7 +355,8 @@ dds__get_builtin_writer(
}
os_mutexUnlock(&g_builtin_mutex);
} else {
wr = DDS_ERRNO(DDS_RETCODE_ERROR, "Given topic is not a builtin topic.");
DDS_ERROR("Given topic is not a builtin topic\n");
wr = DDS_ERRNO(DDS_RETCODE_ERROR);
}
return wr;
}
@ -420,10 +418,7 @@ forward_builtin_participant(
_In_ nn_wctime_t timestamp,
_In_ int alive)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds__builtin_write(DDS_BUILTIN_TOPIC_DCPSPARTICIPANT, data, timestamp.v, alive);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
dds__builtin_write(DDS_BUILTIN_TOPIC_DCPSPARTICIPANT, data, timestamp.v, alive);
}
void
@ -432,8 +427,5 @@ forward_builtin_cmparticipant(
_In_ nn_wctime_t timestamp,
_In_ int alive)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds__builtin_write(DDS_BUILTIN_TOPIC_CMPARTICIPANT, data, timestamp.v, alive);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
dds__builtin_write(DDS_BUILTIN_TOPIC_CMPARTICIPANT, data, timestamp.v, alive);
}

View file

@ -16,7 +16,6 @@
#include "dds__subscriber.h"
#include "dds__publisher.h"
#include "dds__err.h"
#include "dds__report.h"
_Pre_satisfies_(((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) || \
((entity & DDS_ENTITY_KIND_MASK) == DDS_KIND_SUBSCRIBER) || \
@ -42,7 +41,8 @@ dds_begin_coherent(
ret = dds_subscriber_begin_coherent(entity);
break;
default:
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Given entity can not control coherency");
DDS_ERROR("Given entity can not control coherency\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
break;
}
return ret;
@ -72,7 +72,8 @@ dds_end_coherent(
ret = dds_subscriber_end_coherent(entity);
break;
default:
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Given entity can not control coherency");
DDS_ERROR("Given entity can not control coherency\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
break;
}
return ret;

View file

@ -17,8 +17,6 @@
#include "dds__reader.h"
#include "dds__listener.h"
#include "dds__err.h"
#include "os/os_report.h"
#include "dds__report.h"
#include "ddsc/ddsc_project.h"
/* Sanity check. */
@ -272,11 +270,14 @@ dds_entity_init(
assert(e->m_hdllink);
} else{
if (e->m_hdl == UT_HANDLE_OUT_OF_RESOURCES) {
e->m_hdl = DDS_ERRNO(DDS_RETCODE_OUT_OF_RESOURCES, "Can not create new entity; too many where created previously.");
DDS_ERROR("Can not create new entity; too many where created previously\n");
e->m_hdl = DDS_ERRNO(DDS_RETCODE_OUT_OF_RESOURCES);
} else if (e->m_hdl == UT_HANDLE_NOT_INITALIZED) {
e->m_hdl = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, DDSC_PROJECT_NAME" is not yet initialized. Please create a participant before executing an other method.");
DDS_ERROR(DDSC_PROJECT_NAME" is not yet initialized. Please create a participant before executing an other method\n");
e->m_hdl = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
} else {
e->m_hdl = DDS_ERRNO(DDS_RETCODE_ERROR, "An internal error has occurred.");
DDS_ERROR("An internal error has occurred\n");
e->m_hdl = DDS_ERRNO(DDS_RETCODE_ERROR);
}
}
@ -291,9 +292,9 @@ dds_delete(
_In_ dds_entity_t entity)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_delete_impl(entity, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -315,7 +316,8 @@ dds_delete_impl(
rc = dds_entity_lock(entity, UT_HANDLE_DONTCARE_KIND, &e);
if (rc != DDS_RETCODE_OK) {
return DDS_ERRNO(rc, "Error on locking entity");
DDS_ERROR("Error on locking entity\n");
return DDS_ERRNO(rc);
}
if(keep_if_explicit == true && ((e->m_flags & DDS_ENTITY_IMPLICIT) == 0)){
@ -397,7 +399,8 @@ dds_delete_impl(
* is released. It is possible that this last release will be done by a thread
* that was kicked during the close(). */
if (ut_handle_delete(e->m_hdl, e->m_hdllink, timeout) != UT_HANDLE_OK) {
return DDS_ERRNO(DDS_RETCODE_TIMEOUT, "Entity deletion did not release resources.");
DDS_ERROR("Entity deletion did not release resources\n");
return DDS_ERRNO(DDS_RETCODE_TIMEOUT);
}
}
@ -454,8 +457,6 @@ dds_get_parent(
dds_entity_t hdl;
dds_entity *parent;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
if ((parent = dds__nonself_parent(e)) != NULL) {
@ -466,9 +467,10 @@ dds_get_parent(
}
dds_entity_unlock(e);
} else {
hdl = DDS_ERRNO(rc, "Error on locking handle entity");
DDS_ERROR("Error on locking handle entity\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -483,17 +485,16 @@ dds_get_participant (
dds__retcode_t rc;
dds_entity_t hdl;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
assert(e->m_participant);
hdl = e->m_participant->m_hdl;
dds_entity_unlock(e);
} else {
hdl = DDS_ERRNO(rc, "Error on locking handle entity");
DDS_ERROR("Error on locking handle entity\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH( hdl <= 0);
return hdl;
}
@ -511,21 +512,22 @@ dds_get_children(
dds_return_t ret;
dds_entity* iter;
DDS_REPORT_STACK();
if ((children != NULL) && ((size <= 0) || (size >= INT32_MAX))) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Array is given, but with invalid size");
DDS_ERROR("Array is given, but with invalid size\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
if ((children == NULL) && (size != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Size is given, but no array");
DDS_ERROR("Size is given, but no array\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
goto err;
}
/* Initialize first child to satisfy SAL. */
@ -545,7 +547,6 @@ dds_get_children(
dds_entity_unlock(e);
err:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -561,26 +562,26 @@ dds_get_qos(
dds__retcode_t rc;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
if (qos == NULL) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER,"Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
goto fail;
}
if (e->m_deriver.set_qos) {
rc = dds_copy_qos(qos, e->m_qos);
} else {
rc = DDS_RETCODE_ILLEGAL_OPERATION;
ret = DDS_ERRNO(rc, "QoS cannot be set on this entity");
DDS_ERROR("QoS cannot be set on this entity\n");
ret = DDS_ERRNO(rc);
}
dds_entity_unlock(e);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
}
@ -596,15 +597,14 @@ dds_set_qos(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (qos != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
if (e->m_deriver.set_qos) {
ret = e->m_deriver.set_qos(e, qos, e->m_flags & DDS_ENTITY_ENABLED);
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "QoS cannot be set on this entity");
DDS_ERROR("QoS cannot be set on this entity\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
if (ret == DDS_RETCODE_OK) {
/* Remember this QoS. */
@ -612,16 +612,19 @@ dds_set_qos(
e->m_qos = dds_create_qos();
}
rc = dds_copy_qos(e->m_qos, qos);
ret = DDS_ERRNO(rc, "QoS cannot be set on this entity");
DDS_ERROR("QoS cannot be set on this entity\n");
ret = DDS_ERRNO(rc);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH( ret != DDS_RETCODE_OK);
return ret;
}
@ -637,8 +640,6 @@ dds_get_listener(
dds_return_t ret = DDS_RETCODE_OK;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (listener != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
@ -646,12 +647,14 @@ dds_get_listener(
dds_copy_listener (listener, &e->m_listener);
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
}
@ -667,11 +670,10 @@ dds_set_listener(
dds__retcode_t rc;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if(rc != DDS_RETCODE_OK){
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
goto fail;
}
dds_entity_cb_wait(e);
@ -682,7 +684,6 @@ dds_set_listener(
}
dds_entity_unlock(e);
fail:
DDS_REPORT_FLUSH( ret != DDS_RETCODE_OK);
return ret;
}
@ -697,20 +698,19 @@ dds_enable(
dds__retcode_t rc;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
if ((e->m_flags & DDS_ENTITY_ENABLED) == 0) {
/* TODO: CHAM-96: Really enable. */
e->m_flags |= DDS_ENTITY_ENABLED;
DDS_ERROR(DDS_RETCODE_UNSUPPORTED, "Delayed entity enabling is not supported");
DDS_ERROR("Delayed entity enabling is not supported\n");
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -726,8 +726,6 @@ dds_get_status_changes(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (status != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
@ -735,16 +733,19 @@ dds_get_status_changes(
*status = e->m_trigger;
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "This entity does not maintain a status.");
DDS_ERROR("This entity does not maintain a status\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument status is NULL");
DDS_ERROR("Argument status is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -760,8 +761,6 @@ dds_get_enabled_status(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (status != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
@ -769,16 +768,19 @@ dds_get_enabled_status(
*status = (e->m_status_enable & ~DDS_INTERNAL_STATUS_MASK);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "This entity does not maintain a status.");
DDS_ERROR("This entity does not maintain a status\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else{
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument status is NULL");
DDS_ERROR("Argument status is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -794,8 +796,6 @@ dds_set_enabled_status(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
if (e->m_deriver.validate_status) {
@ -810,13 +810,15 @@ dds_set_enabled_status(
}
}
} else {
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION, "This entity does not maintain a status.");
DDS_ERROR("This entity does not maintain a status\n");
ret = DDS_ERRNO (DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -834,8 +836,6 @@ dds_read_status(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (status != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
@ -846,16 +846,19 @@ dds_read_status(
*status = e->m_trigger & mask;
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "This entity does not maintain a status.");
DDS_ERROR("This entity does not maintain a status\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument status is NULL");
DDS_ERROR("Argument status is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -873,7 +876,6 @@ dds_take_status(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (status != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
@ -888,16 +890,19 @@ dds_take_status(
e->m_trigger &= ~mask;
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "This entity does not maintain a status.");
DDS_ERROR("This entity does not maintain a status\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument status is NUL");
DDS_ERROR("Argument status is NUL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -927,21 +932,20 @@ dds_get_domainid(
dds__retcode_t rc;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
if (id != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
*id = e->m_domainid;
dds_entity_unlock(e);
} else{
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else{
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument domain id is NULL");
DDS_ERROR("Argument domain id is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -957,24 +961,25 @@ dds_get_instance_handle(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if (ihdl != NULL) {
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
if (e->m_deriver.get_instance_hdl) {
ret = e->m_deriver.get_instance_hdl(e, ihdl);
} else {
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION, "Instance handle is not valid");
DDS_ERROR("Instance handle is not valid\n");
ret = DDS_ERRNO(DDS_RETCODE_ILLEGAL_OPERATION);
}
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument instance handle is NULL");
DDS_ERROR("Argument instance handle is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -995,23 +1000,23 @@ dds_valid_hdl(
rc = DDS_RETCODE_OK;
} else if(utr == UT_HANDLE_UNEQUAL_KIND){
rc = DDS_RETCODE_ILLEGAL_OPERATION;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity type can not perform this operation.", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity type can not perform this operation\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_INVALID){
rc = DDS_RETCODE_BAD_PARAMETER;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity is invalid", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is invalid\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_DELETED){
rc = DDS_RETCODE_ALREADY_DELETED;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity is already deleted.", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is already deleted\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_CLOSED){
rc = DDS_RETCODE_ALREADY_DELETED;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity is already deleted.", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is already deleted\n", dds__entity_kind_str(hdl), hdl);
} else {
rc = DDS_RETCODE_ERROR;
DDS_WARNING(rc, "An internal error occurred.");
DDS_WARNING("An internal error occurred\n");
}
} else {
rc = DDS_RETCODE_BAD_PARAMETER;
DDS_WARNING(rc, "Given entity (0x%08lx) was not properly created.", hdl);
DDS_WARNING("Given entity (0x%08"PRIx32") was not properly created\n", hdl);
}
return rc;
}
@ -1042,23 +1047,23 @@ dds_entity_lock(
rc = DDS_RETCODE_OK;
} else if(utr == UT_HANDLE_UNEQUAL_KIND){
rc = DDS_RETCODE_ILLEGAL_OPERATION;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity type can not perform this operation.", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity type can not perform this operation\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_INVALID){
rc = DDS_RETCODE_BAD_PARAMETER;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity is invalid", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is invalid\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_DELETED){
rc = DDS_RETCODE_ALREADY_DELETED;
DDS_WARNING(rc , "Given (%s) [0x%08lx] entity is already deleted", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is already deleted\n", dds__entity_kind_str(hdl), hdl);
} else if(utr == UT_HANDLE_CLOSED){
rc = DDS_RETCODE_ALREADY_DELETED;
DDS_WARNING(rc, "Given (%s) [0x%08lx] entity is already deleted", dds__entity_kind_str(hdl), hdl);
DDS_WARNING("Given (%s) [0x%08"PRIx32"] entity is already deleted\n", dds__entity_kind_str(hdl), hdl);
} else {
rc = DDS_RETCODE_ERROR;
DDS_WARNING(rc, "An internal error occurred");
DDS_WARNING("An internal error occurred\n");
}
} else {
rc = DDS_RETCODE_BAD_PARAMETER;
DDS_WARNING(rc, "Given entity (0x%08lx) was not properly created.", hdl);
DDS_WARNING("Given entity (0x%08"PRIx32") was not properly created\n", hdl);
}
return rc;
}
@ -1085,16 +1090,15 @@ dds_triggered(
dds_return_t ret;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_entity_lock(entity, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
ret = (e->m_trigger != 0);
dds_entity_unlock(e);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -1151,7 +1155,7 @@ dds_entity_observer_register(
rc = dds_entity_observer_register_nl(e, observer, cb);
dds_entity_unlock(e);
} else{
DDS_ERROR(rc, "Error occurred on locking observer");
DDS_ERROR("Error occurred on locking observer\n");
}
return rc;
}
@ -1201,7 +1205,8 @@ dds_entity_observer_unregister(
rc = dds_entity_observer_unregister_nl(e, observer);
dds_entity_unlock(e);
} else{
(void)DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
(void)DDS_ERRNO(rc);
}
return rc;
}
@ -1252,8 +1257,6 @@ dds_get_topic(
dds_reader *rd;
dds_writer *wr;
DDS_REPORT_STACK();
rc = dds_reader_lock(entity, &rd);
if(rc == DDS_RETCODE_OK) {
hdl = rd->m_topic->m_entity.m_hdl;
@ -1269,9 +1272,10 @@ dds_get_topic(
}
}
if (rc != DDS_RETCODE_OK) {
hdl = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}

View file

@ -18,7 +18,6 @@
#include "ddsi/q_ephash.h"
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "dds__report.h"
_Must_inspect_result_ dds_guardcond*
dds_create_guardcond(
@ -38,7 +37,6 @@ dds_create_guardcondition(
dds_entity * pp;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &pp);
if (rc == DDS_RETCODE_OK) {
dds_guardcond *cond = dds_create_guardcond((dds_participant *)pp);
@ -46,9 +44,10 @@ dds_create_guardcondition(
hdl = cond->m_entity.m_hdl;
dds_entity_unlock(pp);
} else {
hdl = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -62,7 +61,6 @@ dds_set_guardcondition(
dds_guardcond *gcond;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_entity_lock(condition, DDS_KIND_COND_GUARD, (dds_entity**)&gcond);
if (rc == DDS_RETCODE_OK) {
if (triggered) {
@ -74,9 +72,10 @@ dds_set_guardcondition(
dds_entity_unlock(&gcond->m_entity);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD), "Argument condition is not valid");
DDS_ERROR("Argument condition is not valid\n");
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD));
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -90,7 +89,6 @@ dds_read_guardcondition(
dds_guardcond *gcond;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (triggered != NULL) {
*triggered = false;
rc = dds_entity_lock(condition, DDS_KIND_COND_GUARD, (dds_entity**)&gcond);
@ -99,12 +97,14 @@ dds_read_guardcondition(
dds_entity_unlock((dds_entity*)gcond);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD), "Argument condition is not valid");
DDS_ERROR("Argument condition is not valid\n");
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD));
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument triggered is NULL");
DDS_ERROR("Argument triggered is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -118,7 +118,6 @@ dds_take_guardcondition(
dds_guardcond *gcond;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (triggered != NULL) {
*triggered = false;
rc = dds_entity_lock(condition, DDS_KIND_COND_GUARD, (dds_entity**)&gcond);
@ -128,11 +127,13 @@ dds_take_guardcondition(
dds_entity_unlock((dds_entity*)gcond);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD), "Argument condition is not valid");
DDS_ERROR("Argument condition is not valid\n");
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_GUARD));
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument triggered is NULL");
DDS_ERROR("Argument triggered is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -12,8 +12,7 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <os/os.h>
#include <os/os_report.h>
#include "os/os.h"
#include "dds__init.h"
#include "dds__rhc.h"
#include "dds__tkmap.h"
@ -21,11 +20,10 @@
#include "dds__domain.h"
#include "dds__err.h"
#include "dds__builtin.h"
#include "dds__report.h"
#include "ddsi/ddsi_serdata.h"
#include "ddsi/q_servicelease.h"
#include "ddsi/q_entity.h"
#include <ddsi/q_config.h>
#include "ddsi/q_config.h"
#include "ddsc/ddsc_project.h"
#ifdef _WRS_KERNEL
@ -54,8 +52,6 @@ dds_init(dds_domainid_t domain)
os_osInit();
init_mutex = os_getSingletonMutex();
DDS_REPORT_STACK();
os_mutexLock(init_mutex);
dds_global.m_init_count++;
@ -66,16 +62,13 @@ dds_init(dds_domainid_t domain)
if (ut_handleserver_init() != UT_HANDLE_OK)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to initialize internal handle server");
DDS_ERROR("Failed to initialize internal handle server\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_handleserver;
}
gv.tstart = now ();
gv.exception = false;
gv.static_logbuf_lock_inited = 0;
logbuf_init (&gv.static_logbuf);
os_mutexInit (&gv.static_logbuf_lock);
gv.static_logbuf_lock_inited = 1;
os_mutexInit (&dds_global.m_mutex);
thread_states_init_static();
@ -83,7 +76,8 @@ dds_init(dds_domainid_t domain)
dds_cfgst = config_init (uri);
if (dds_cfgst == NULL)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to parse configuration XML file %s", uri);
DDS_ERROR("Failed to parse configuration XML file %s\n", uri);
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_config;
}
@ -92,7 +86,8 @@ dds_init(dds_domainid_t domain)
{
if (domain < 0 || domain > 230)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "requested domain id %d is out of range", domain);
DDS_ERROR("requested domain id %d is out of range\n", domain);
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_config;
}
else if (config.domainId.isdefault)
@ -101,7 +96,8 @@ dds_init(dds_domainid_t domain)
}
else if (domain != config.domainId.value)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "requested domain id %d is inconsistent with configured value %d", domain, config.domainId.value);
DDS_ERROR("requested domain id %d is inconsistent with configured value %d\n", domain, config.domainId.value);
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_config;
}
}
@ -114,7 +110,8 @@ dds_init(dds_domainid_t domain)
if (rtps_config_prep(dds_cfgst) != 0)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to configure RTPS.");
DDS_ERROR("Failed to configure RTPS\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_rtps_config;
}
@ -128,20 +125,23 @@ dds_init(dds_domainid_t domain)
gv.servicelease = nn_servicelease_new(0, 0);
if (gv.servicelease == NULL)
{
ret = DDS_ERRNO(DDS_RETCODE_OUT_OF_RESOURCES, "Failed to create a servicelease.");
DDS_ERROR("Failed to create a servicelease\n");
ret = DDS_ERRNO(DDS_RETCODE_OUT_OF_RESOURCES);
goto fail_servicelease_new;
}
}
if (rtps_init() < 0)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to initialize RTPS.");
DDS_ERROR("Failed to initialize RTPS\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_rtps_init;
}
if (gv.servicelease && nn_servicelease_start_renewing(gv.servicelease) < 0)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to start the servicelease.");
DDS_ERROR("Failed to start the servicelease\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_servicelease_start;
}
@ -174,7 +174,6 @@ dds_init(dds_domainid_t domain)
skip:
os_mutexUnlock(init_mutex);
DDS_REPORT_FLUSH(false);
return DDS_RETCODE_OK;
fail_servicelease_start:
@ -195,14 +194,11 @@ fail_rtps_config:
config_fini (dds_cfgst);
dds_cfgst = NULL;
fail_config:
gv.static_logbuf_lock_inited = 0;
os_mutexDestroy (&gv.static_logbuf_lock);
os_mutexDestroy (&dds_global.m_mutex);
ut_handleserver_fini();
fail_handleserver:
dds_global.m_init_count--;
os_mutexUnlock(init_mutex);
DDS_REPORT_FLUSH(true);
os_osExit();
return ret;
}
@ -229,7 +225,6 @@ extern void dds_fini (void)
config_fini (dds_cfgst);
dds_cfgst = NULL;
os_mutexDestroy (&gv.static_logbuf_lock);
os_mutexDestroy (&dds_global.m_mutex);
ut_handleserver_fini();
dds_global.m_default_domain = DDS_DOMAIN_DEFAULT;
@ -298,9 +293,9 @@ dds__check_domain(
/* Specific domain has to be the same as the configured domain. */
if (domain != dds_global.m_default_domain)
{
ret = DDS_ERRNO(DDS_RETCODE_ERROR,
"Inconsistent domain configuration detected: domain on configuration: %d, domain %d",
dds_global.m_default_domain, domain);
DDS_ERROR("Inconsistent domain configuration detected: domain on "
"configuration: %d, domain %d\n", dds_global.m_default_domain, domain);
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
}
return ret;

View file

@ -21,7 +21,6 @@
#include "ddsi/ddsi_serdata.h"
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "dds__report.h"
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
@ -30,11 +29,7 @@ dds_writedispose(
_In_ dds_entity_t writer,
_In_ const void *data)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_writedispose_ts(writer, data, dds_time());
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
return dds_writedispose_ts(writer, data, dds_time());
}
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
@ -43,11 +38,7 @@ dds_dispose(
_In_ dds_entity_t writer,
_In_ const void *data)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_dispose_ts(writer, data, dds_time());
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
return dds_dispose_ts(writer, data, dds_time());
}
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
@ -56,11 +47,7 @@ dds_dispose_ih(
_In_ dds_entity_t writer,
_In_ dds_instance_handle_t handle)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_dispose_ih_ts(writer, handle, dds_time());
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
return dds_dispose_ih_ts(writer, handle, dds_time());
}
static struct tkmap_instance*
@ -133,9 +120,8 @@ static const dds_topic * dds_instance_info_by_hdl (dds_entity_t e)
if (rc == DDS_RETCODE_OK) {
topic = dds_instance_info(w_or_r);
dds_entity_unlock(w_or_r);
}
else {
DDS_ERROR(rc, "Error occurred on locking entity");
} else {
DDS_ERROR("Error occurred on locking entity");
}
return topic;
}
@ -152,19 +138,20 @@ dds_register_instance(
dds_return_t ret;
dds__retcode_t rc;
DDS_REPORT_STACK();
if(data == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument data is NULL");
DDS_ERROR("Argument data is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
if(handle == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument handle is NULL");
DDS_ERROR("Argument handle is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
rc = dds_entity_lock(writer, DDS_KIND_WRITER, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto err;
}
inst = dds_instance_find (((dds_writer*) wr)->m_topic, data, true);
@ -172,11 +159,11 @@ dds_register_instance(
*handle = inst->m_iid;
ret = DDS_RETCODE_OK;
} else{
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Unable to create instance");
DDS_ERROR("Unable to create instance\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
dds_entity_unlock(wr);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -186,11 +173,7 @@ dds_unregister_instance(
_In_ dds_entity_t writer,
_In_opt_ const void *data)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_unregister_instance_ts (writer, data, dds_time());
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
return dds_unregister_instance_ts (writer, data, dds_time());
}
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
@ -199,11 +182,7 @@ dds_unregister_instance_ih(
_In_ dds_entity_t writer,
_In_opt_ dds_instance_handle_t handle)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_unregister_instance_ih_ts(writer, handle, dds_time());
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
return dds_unregister_instance_ih_ts(writer, handle, dds_time());
}
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
@ -220,19 +199,20 @@ dds_unregister_instance_ts(
void * sample = (void*) data;
dds_entity *wr;
DDS_REPORT_STACK();
if (data == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument data is NULL");
DDS_ERROR("Argument data is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
if(timestamp < 0){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument timestamp has negative value");
DDS_ERROR("Argument timestamp has negative value\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
rc = dds_entity_lock(writer, DDS_KIND_WRITER, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto err;
}
@ -246,7 +226,6 @@ dds_unregister_instance_ts(
ret = dds_write_impl ((dds_writer*)wr, sample, timestamp, action);
dds_entity_unlock(wr);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -266,11 +245,10 @@ dds_unregister_instance_ih_ts(
const dds_topic *topic;
void *sample;
DDS_REPORT_STACK();
rc = dds_entity_lock(writer, DDS_KIND_WRITER, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto err;
}
@ -288,13 +266,13 @@ dds_unregister_instance_ih_ts(
if (dds_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
ret = dds_write_impl ((dds_writer*)wr, sample, timestamp, action);
} else{
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "No instance related with the provided handle is found");
DDS_ERROR("No instance related with the provided handle is found\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
}
dds_sample_free (sample, topic->m_descriptor, DDS_FREE_ALL);
dds_entity_unlock(wr);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -309,8 +287,6 @@ dds_writedispose_ts(
dds__retcode_t rc;
dds_writer *wr;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc == DDS_RETCODE_OK) {
ret = dds_write_impl (wr, data, timestamp, DDS_WR_ACTION_WRITE_DISPOSE);
@ -319,9 +295,10 @@ dds_writedispose_ts(
}
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -352,16 +329,15 @@ dds_dispose_ts(
dds__retcode_t rc;
dds_writer *wr;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc == DDS_RETCODE_OK) {
ret = dds_dispose_impl(wr, data, DDS_HANDLE_NIL, timestamp);
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -376,8 +352,6 @@ dds_dispose_ih_ts(
dds__retcode_t rc;
dds_writer *wr;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc == DDS_RETCODE_OK) {
struct tkmap *map = gv.m_tkmap;
@ -386,14 +360,16 @@ dds_dispose_ih_ts(
if (dds_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
ret = dds_dispose_impl(wr, sample, handle, timestamp);
} else {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "No instance related with the provided handle is found");
DDS_ERROR("No instance related with the provided handle is found\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
}
dds_free(sample);
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -407,12 +383,9 @@ dds_instance_lookup(
const dds_topic * topic;
struct tkmap * map = gv.m_tkmap;
struct ddsi_serdata *sd;
dds_return_t ret;
DDS_REPORT_STACK();
if(data == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument data is NULL");
DDS_ERROR("Argument data is NULL\n");
goto err;
}
@ -421,12 +394,10 @@ dds_instance_lookup(
sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
ih = dds_tkmap_lookup (map, sd);
ddsi_serdata_unref (sd);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Acquired topic is NULL");
DDS_ERROR("Acquired topic is NULL\n");
}
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ih;
}
@ -441,16 +412,16 @@ dds_instance_get_key(
const dds_topic * topic;
struct tkmap * map = gv.m_tkmap;
DDS_REPORT_STACK();
if(data == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument data is NULL");
DDS_ERROR("Argument data is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
topic = dds_instance_info_by_hdl (entity);
if(topic == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Could not find topic related to the given entity");
DDS_ERROR("Could not find topic related to the given entity\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
memset (data, 0, topic->m_descriptor->m_size);
@ -458,10 +429,10 @@ dds_instance_get_key(
if (dds_tkmap_get_key (map, topic->m_stopic, inst, data)) {
ret = DDS_RETCODE_OK;
} else{
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "No instance related with the provided entity is found");
DDS_ERROR("No instance related with the provided entity is found\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -12,7 +12,6 @@
#include <assert.h>
#include "ddsc/dds.h"
#include "dds__listener.h"
#include "dds__report.h"
@ -66,7 +65,7 @@ dds_reset_listener(_Out_ dds_listener_t * __restrict listener)
l->on_sample_rejected = DDS_LUNSET;
l->on_subscription_matched = DDS_LUNSET;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -83,11 +82,11 @@ dds_copy_listener(_Out_ dds_listener_t * __restrict dst, _In_ const dds_listener
c_listener_t *dstl = dst;
if(!src){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument source(src) is NULL");
DDS_ERROR("Argument source(src) is NULL\n");
return ;
}
if(!dst){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument destination(dst) is NULL");
DDS_ERROR("Argument destination(dst) is NULL\n");
return ;
}
dstl->on_data_available = srcl->on_data_available;
@ -119,11 +118,11 @@ dds_merge_listener (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_list
c_listener_t *dstl = dst;
if(!src){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument source(src) is NULL");
DDS_ERROR("Argument source(src) is NULL\n");
return ;
}
if(!dst){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument destination(dst) is NULL");
DDS_ERROR("Argument destination(dst) is NULL\n");
return ;
}
if (dstl->on_data_available == DDS_LUNSET) {
@ -183,7 +182,7 @@ dds_lset_data_available (_Inout_ dds_listener_t * __restrict listener, _In_opt_
if (listener) {
((c_listener_t*)listener)->on_data_available = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -193,7 +192,7 @@ dds_lset_data_on_readers (_Inout_ dds_listener_t * __restrict listener, _In_opt_
if (listener) {
((c_listener_t*)listener)->on_data_on_readers = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -203,7 +202,7 @@ dds_lset_inconsistent_topic (_Inout_ dds_listener_t * __restrict listener, _In_o
if (listener) {
((c_listener_t*)listener)->on_inconsistent_topic = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -213,7 +212,7 @@ dds_lset_liveliness_changed (_Inout_ dds_listener_t * __restrict listener, _In_o
if (listener) {
((c_listener_t*)listener)->on_liveliness_changed = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -223,7 +222,7 @@ dds_lset_liveliness_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_
if (listener) {
((c_listener_t*)listener)->on_liveliness_lost = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -233,7 +232,7 @@ dds_lset_offered_deadline_missed (_Inout_ dds_listener_t * __restrict listener,
if (listener) {
((c_listener_t*)listener)->on_offered_deadline_missed = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -243,7 +242,7 @@ dds_lset_offered_incompatible_qos (_Inout_ dds_listener_t * __restrict listener,
if (listener) {
((c_listener_t*)listener)->on_offered_incompatible_qos = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -253,7 +252,7 @@ dds_lset_publication_matched (_Inout_ dds_listener_t * __restrict listener, _In_
if (listener) {
((c_listener_t*)listener)->on_publication_matched = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL");
}
}
@ -263,7 +262,7 @@ dds_lset_requested_deadline_missed (_Inout_ dds_listener_t * __restrict listener
if (listener) {
((c_listener_t*)listener)->on_requested_deadline_missed = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -273,7 +272,7 @@ dds_lset_requested_incompatible_qos (_Inout_ dds_listener_t * __restrict listene
if (listener) {
((c_listener_t*)listener)->on_requested_incompatible_qos = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -283,7 +282,7 @@ dds_lset_sample_lost (_Inout_ dds_listener_t * __restrict listener, _In_opt_ dds
if (listener) {
((c_listener_t*)listener)->on_sample_lost = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -293,7 +292,7 @@ dds_lset_sample_rejected (_Inout_ dds_listener_t * __restrict listener, _In_opt_
if (listener) {
((c_listener_t*)listener)->on_sample_rejected = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -303,7 +302,7 @@ dds_lset_subscription_matched (_Inout_ dds_listener_t * __restrict listener, _In
if (listener) {
((c_listener_t*)listener)->on_subscription_matched = callback;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
}
}
@ -315,11 +314,11 @@ void
dds_lget_data_available (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_available_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_data_available;
@ -329,11 +328,11 @@ void
dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_data_on_readers_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_data_on_readers;
@ -342,11 +341,11 @@ dds_lget_data_on_readers (_In_ const dds_listener_t * __restrict listener, _Outp
void dds_lget_inconsistent_topic (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_inconsistent_topic_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_inconsistent_topic;
@ -356,11 +355,11 @@ void
dds_lget_liveliness_changed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_changed_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_liveliness_changed;
@ -370,11 +369,11 @@ void
dds_lget_liveliness_lost (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_liveliness_lost_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_liveliness_lost;
@ -384,11 +383,11 @@ void
dds_lget_offered_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_deadline_missed_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_offered_deadline_missed;
@ -398,11 +397,11 @@ void
dds_lget_offered_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_offered_incompatible_qos_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_offered_incompatible_qos;
@ -412,11 +411,11 @@ void
dds_lget_publication_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_publication_matched_fn *callback)
{
if(!callback){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_publication_matched;
@ -426,11 +425,11 @@ void
dds_lget_requested_deadline_missed (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_deadline_missed_fn *callback)
{
if(!callback) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_requested_deadline_missed;
@ -440,11 +439,11 @@ void
dds_lget_requested_incompatible_qos (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_requested_incompatible_qos_fn *callback)
{
if(!callback) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_requested_incompatible_qos;
@ -454,11 +453,11 @@ void
dds_lget_sample_lost (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_lost_fn *callback)
{
if(!callback) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_sample_lost;
@ -468,11 +467,11 @@ void
dds_lget_sample_rejected (_In_ const dds_listener_t *__restrict listener, _Outptr_result_maybenull_ dds_on_sample_rejected_fn *callback)
{
if(!callback) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_sample_rejected;
@ -482,11 +481,11 @@ void
dds_lget_subscription_matched (_In_ const dds_listener_t * __restrict listener, _Outptr_result_maybenull_ dds_on_subscription_matched_fn *callback)
{
if(!callback) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument callback is NULL");
DDS_ERROR("Argument callback is NULL\n");
return ;
}
if (!listener) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument listener is NULL");
DDS_ERROR("Argument listener is NULL\n");
return ;
}
*callback = ((c_listener_t*)listener)->on_subscription_matched;

View file

@ -1,73 +0,0 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include <assert.h>
#include <string.h>
#include <stdarg.h>
#include "ddsc/dds.h"
#include "ddsi/q_log.h"
#define DDS_FMT_MAX 128
void dds_log_info (const char * fmt, ...)
{
va_list args;
va_start (args, fmt);
nn_vlog (LC_INFO, fmt, args);
va_end (args);
}
void dds_log_warn (const char * fmt, ...)
{
va_list args;
char fmt2 [DDS_FMT_MAX];
strcpy (fmt2, "<Warning> ");
strncat (fmt2, fmt, DDS_FMT_MAX - 11);
fmt2[DDS_FMT_MAX-1] = 0;
fmt = fmt2;
va_start (args, fmt);
nn_vlog (LC_WARNING, fmt, args);
va_end (args);
}
void dds_log_error (const char * fmt, ...)
{
va_list args;
char fmt2 [DDS_FMT_MAX];
strcpy (fmt2, "<Error> ");
strncat (fmt2, fmt, DDS_FMT_MAX - 9);
fmt2[DDS_FMT_MAX-1] = 0;
fmt = fmt2;
va_start (args, fmt);
nn_vlog (LC_ERROR, fmt, args);
va_end (args);
}
void dds_log_fatal (const char * fmt, ...)
{
va_list args;
char fmt2 [DDS_FMT_MAX];
strcpy (fmt2, "<Fatal> ");
strncat (fmt2, fmt, DDS_FMT_MAX - 9);
fmt2[DDS_FMT_MAX-1] = 0;
fmt = fmt2;
va_start (args, fmt);
nn_vlog (LC_FATAL, fmt, args);
va_end (args);
DDS_FAIL (fmt);
}

View file

@ -18,7 +18,6 @@
#include "dds__domain.h"
#include "dds__participant.h"
#include "dds__err.h"
#include "dds__report.h"
#define DDS_PARTICIPANT_STATUS_MASK 0u
@ -30,9 +29,14 @@ static dds_return_t
dds_participant_status_validate(
uint32_t mask)
{
return (mask & ~(DDS_PARTICIPANT_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument mask is invalid") :
DDS_RETCODE_OK;
dds_return_t ret = DDS_RETCODE_OK;
if (mask & ~(DDS_PARTICIPANT_STATUS_MASK)) {
DDS_ERROR("Argument mask is invalid\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
static dds_return_t
@ -104,10 +108,12 @@ dds_participant_qos_validate(
/* Check consistency. */
if ((qos->present & QP_USER_DATA) && !validate_octetseq(&qos->user_data)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "User data QoS policy is inconsistent and caused an error");
DDS_ERROR("User data QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_PRISMTECH_ENTITY_FACTORY) && !validate_entityfactory_qospolicy(&qos->entity_factory)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Prismtech entity factory QoS policy is inconsistent and caused an error");
DDS_ERROR("Prismtech entity factory QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
return ret;
}
@ -124,7 +130,8 @@ dds_participant_qos_set(
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Changing the participant QoS is not supported.");
DDS_ERROR("Changing the participant QoS is not supported\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
return ret;
@ -153,9 +160,6 @@ dds_create_participant(
goto fail_dds_init;
}
/* Report stack is only useful after dds (and thus os) init. */
DDS_REPORT_STACK();
/* Check domain id */
ret = dds__check_domain (domain);
if (ret != DDS_RETCODE_OK) {
@ -194,7 +198,8 @@ dds_create_participant(
}
nn_plist_fini (&plist);
if (q_rc != 0) {
e = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
DDS_ERROR("Internal error");
e = DDS_ERRNO(DDS_RETCODE_ERROR);
goto fail_new_participant;
}
@ -219,7 +224,6 @@ dds_create_participant(
dds_pp_head = &pp->m_entity;
os_mutexUnlock (&dds_global.m_mutex);
DDS_REPORT_FLUSH(false);
return e;
fail_entity_init:
@ -228,7 +232,6 @@ fail_new_participant:
dds_delete_qos(new_qos);
fail_qos_validation:
fail_domain_check:
DDS_REPORT_FLUSH(true);
dds_fini();
fail_dds_init:
return e;
@ -247,14 +250,14 @@ dds_lookup_participant(
os_osInit();
init_mutex = os_getSingletonMutex();
DDS_REPORT_STACK();
if ((participants != NULL) && ((size <= 0) || (size >= INT32_MAX))) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Array is given, but with invalid size");
DDS_ERROR("Array is given, but with invalid size\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
if ((participants == NULL) && (size != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Size is given, but no array");
DDS_ERROR("Size is given, but no array\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
@ -284,7 +287,6 @@ dds_lookup_participant(
os_mutexUnlock (init_mutex);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
os_osExit();
return ret;
}

View file

@ -15,7 +15,6 @@
#include "dds__qos.h"
#include "dds__err.h"
#include "ddsi/q_entity.h"
#include "dds__report.h"
#include "ddsc/ddsc_project.h"
#define DDS_PUBLISHER_STATUS_MASK 0u
@ -28,7 +27,8 @@ dds_publisher_instance_hdl(
(void)e;
(void)i;
/* TODO: Get/generate proper handle. */
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Getting publisher instance handle is not supported");
DDS_ERROR("Getting publisher instance handle is not supported\n");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
static dds_return_t
@ -41,20 +41,25 @@ dds_publisher_qos_validate(
/* Check consistency. */
if((qos->present & QP_GROUP_DATA) && !validate_octetseq(&qos->group_data)){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Group data policy is inconsistent and caused an error");
DDS_ERROR("Group data policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PRESENTATION) && (validate_presentation_qospolicy(&qos->presentation) != 0)){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Presentation policy is inconsistent and caused an error");
DDS_ERROR("Presentation policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PARTITION) && !validate_stringseq(&qos->partition)){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Partition policy is inconsistent and caused an error");
DDS_ERROR("Partition policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PRISMTECH_ENTITY_FACTORY) && !validate_entityfactory_qospolicy(&qos->entity_factory)){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Prismtech entity factory policy is inconsistent and caused an error");
DDS_ERROR("Prismtech entity factory policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if(ret == DDS_RETCODE_OK && enabled && (qos->present & QP_PRESENTATION)){
/* TODO: Improve/check immutable check. */
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Presentation policy is immutable");
DDS_ERROR("Presentation policy is immutable\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
return ret;
}
@ -70,7 +75,8 @@ dds_publisher_qos_set(
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, DDSC_PROJECT_NAME" does not support changing QoS policies yet");
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
return ret;
@ -78,9 +84,14 @@ dds_publisher_qos_set(
static dds_return_t dds_publisher_status_validate (uint32_t mask)
{
return (mask & ~(DDS_PUBLISHER_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Invalid status mask") :
DDS_RETCODE_OK;
dds_return_t ret = DDS_RETCODE_OK;
if (mask & ~(DDS_PUBLISHER_STATUS_MASK)) {
DDS_ERROR("Invalid status mask\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
_Pre_satisfies_((participant & DDS_ENTITY_KIND_MASK) == DDS_KIND_PARTICIPANT)
@ -97,11 +108,10 @@ dds_create_publisher(
dds_return_t ret;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
if (rc != DDS_RETCODE_OK) {
hdl = DDS_ERRNO(rc, "Error occurred on locking participant");
DDS_ERROR("Error occurred on locking participant\n");
hdl = DDS_ERRNO(rc);
goto lock_err;
}
@ -128,7 +138,6 @@ dds_create_publisher(
qos_err:
dds_entity_unlock(par);
lock_err:
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -140,16 +149,15 @@ dds_suspend(
{
dds_return_t ret;
DDS_REPORT_STACK();
if(dds_entity_kind(publisher) != DDS_KIND_PUBLISHER) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Provided entity is not a publisher kind");
DDS_ERROR("Provided entity is not a publisher kind\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
/* TODO: CHAM-123 Currently unsupported. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Suspend publication operation does not being supported yet");
DDS_ERROR("Suspend publication operation does not being supported yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -161,16 +169,15 @@ dds_resume(
{
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
if(dds_entity_kind(publisher) != DDS_KIND_PUBLISHER) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER,"Provided entity is not a publisher kind");
DDS_ERROR("Provided entity is not a publisher kind\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
/* TODO: CHAM-123 Currently unsupported. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Suspend publication operation does not being supported yet");
DDS_ERROR("Suspend publication operation does not being supported yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -183,23 +190,25 @@ dds_wait_for_acks(
_In_ dds_duration_t timeout)
{
dds_return_t ret;
DDS_REPORT_STACK();
/* TODO: CHAM-125 Currently unsupported. */
OS_UNUSED_ARG(timeout);
switch(dds_entity_kind(publisher_or_writer)) {
case DDS_KIND_WRITER:
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Wait for acknowledgments on a writer is not being supported yet");
DDS_ERROR("Wait for acknowledgments on a writer is not being supported yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
break;
case DDS_KIND_PUBLISHER:
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Wait for acknowledgments on a publisher is not being supported yet");
DDS_ERROR("Wait for acknowledgments on a publisher is not being supported yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
break;
default:
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Provided entity is not a publisher nor a writer");
DDS_ERROR("Provided entity is not a publisher nor a writer\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
break;
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -209,7 +218,8 @@ dds_publisher_begin_coherent(
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not being supported yet");
DDS_ERROR("Using coherency to get a coherent data set is not being supported yet\n");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
dds_return_t
@ -218,6 +228,7 @@ dds_publisher_end_coherent(
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not being supported yet");
DDS_ERROR("Using coherency to get a coherent data set is not being supported yet\n");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}

View file

@ -14,7 +14,6 @@
#include "dds__qos.h"
#include "dds__err.h"
#include "ddsi/q_config.h"
#include "dds__report.h"
/* TODO: dd_duration_t is converted to nn_ddsi_time_t declared in q_time.h
This structure contain seconds and fractions.
@ -135,25 +134,32 @@ dds_qos_validate_mutable_common (
/* TODO: Check whether immutable QoS are changed should actually incorporate change to current QoS */
if (qos->present & QP_DEADLINE) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Deadline QoS policy caused immutable error");
DDS_ERROR("Deadline QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_OWNERSHIP) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Ownership QoS policy caused immutable error");
DDS_ERROR("Ownership QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_LIVELINESS) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Liveliness QoS policy caused immutable error");
DDS_ERROR("Liveliness QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_RELIABILITY) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Reliability QoS policy caused immutable error");
DDS_ERROR("Reliability QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_DESTINATION_ORDER) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Destination order QoS policy caused immutable error");
DDS_ERROR("Destination order QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_HISTORY) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "History QoS policy caused immutable error");
DDS_ERROR("History QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
if (qos->present & QP_RESOURCE_LIMITS) {
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Resource limits QoS policy caused immutable error");
DDS_ERROR("Resource limits QoS policy caused immutable error\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
return ret;
@ -215,7 +221,7 @@ dds_reset_qos(
nn_xqos_fini (qos);
dds_qos_init_defaults (qos);
} else {
DDS_WARNING(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_WARNING("Argument QoS is NULL\n");
}
}
@ -249,10 +255,12 @@ dds_copy_qos (
_In_ const dds_qos_t * __restrict src)
{
if(!src){
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument source(src) is NULL");
DDS_ERROR("Argument source(src) is NULL\n");
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
if(!dst){
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument destination(dst) is NULL");
DDS_ERROR("Argument destination(dst) is NULL\n");
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
nn_xqos_copy (dst, src);
return DDS_RETCODE_OK;
@ -271,11 +279,11 @@ void dds_merge_qos (
_In_ const dds_qos_t * __restrict src)
{
if(!src){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument source(src) is NULL");
DDS_ERROR("Argument source(src) is NULL\n");
return;
}
if(!dst){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument destination(dst) is NULL");
DDS_ERROR("Argument destination(dst) is NULL\n");
return;
}
/* Copy qos from source to destination unless already set */
@ -309,7 +317,7 @@ void dds_qset_userdata(
_In_ size_t sz)
{
if (!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
dds_qos_data_copy_in(&qos->user_data, value, sz);
@ -322,7 +330,7 @@ void dds_qset_topicdata(
_In_ size_t sz)
{
if (!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
dds_qos_data_copy_in (&qos->topic_data, value, sz);
@ -335,7 +343,7 @@ void dds_qset_groupdata(
_In_ size_t sz)
{
if (!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
dds_qos_data_copy_in (&qos->group_data, value, sz);
@ -352,7 +360,7 @@ void dds_qset_durability
qos->durability.kind = (nn_durability_kind_t) kind;
qos->present |= QP_DURABILITY;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -368,7 +376,7 @@ void dds_qset_history
qos->history.depth = depth;
qos->present |= QP_HISTORY;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -386,7 +394,7 @@ void dds_qset_resource_limits
qos->resource_limits.max_samples_per_instance = max_samples_per_instance;
qos->present |= QP_RESOURCE_LIMITS;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -404,7 +412,7 @@ void dds_qset_presentation
qos->presentation.ordered_access = ordered_access;
qos->present |= QP_PRESENTATION;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -418,7 +426,7 @@ void dds_qset_lifespan
qos->lifespan.duration = nn_to_ddsi_duration (lifespan);
qos->present |= QP_LIFESPAN;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -432,7 +440,7 @@ void dds_qset_deadline
qos->deadline.deadline = nn_to_ddsi_duration (deadline);
qos->present |= QP_DEADLINE;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -446,7 +454,7 @@ void dds_qset_latency_budget
qos->latency_budget.duration = nn_to_ddsi_duration (duration);
qos->present |= QP_LATENCY_BUDGET;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -460,7 +468,7 @@ void dds_qset_ownership
qos->ownership.kind = (nn_ownership_kind_t) kind;
qos->present |= QP_OWNERSHIP;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -474,7 +482,7 @@ void dds_qset_ownership_strength
qos->ownership_strength.value = value;
qos->present |= QP_OWNERSHIP_STRENGTH;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -490,7 +498,7 @@ void dds_qset_liveliness
qos->liveliness.lease_duration = nn_to_ddsi_duration (lease_duration);
qos->present |= QP_LIVELINESS;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -504,7 +512,7 @@ void dds_qset_time_based_filter
qos->time_based_filter.minimum_separation = nn_to_ddsi_duration (minimum_separation);
qos->present |= QP_TIME_BASED_FILTER;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -519,11 +527,11 @@ void dds_qset_partition
size_t len;
if(!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos may not be NULL");
DDS_ERROR("Argument qos may not be NULL\n");
return ;
}
if(n && !ps) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument ps is NULL, but n (%u) > 0", n);
DDS_ERROR("Argument ps is NULL, but n (%u) > 0", n);
return ;
}
@ -560,7 +568,7 @@ void dds_qset_reliability
qos->reliability.max_blocking_time = nn_to_ddsi_duration (max_blocking_time);
qos->present |= QP_RELIABILITY;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -574,7 +582,7 @@ void dds_qset_transport_priority
qos->transport_priority.value = value;
qos->present |= QP_TRANSPORT_PRIORITY;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -589,7 +597,7 @@ void dds_qset_destination_order
qos->destination_order.kind = (nn_destination_order_kind_t) kind;
qos->present |= QP_DESTINATION_ORDER;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -603,7 +611,7 @@ void dds_qset_writer_data_lifecycle
qos->writer_data_lifecycle.autodispose_unregistered_instances = autodispose;
qos->present |= QP_PRISMTECH_WRITER_DATA_LIFECYCLE;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -621,7 +629,7 @@ void dds_qset_reader_data_lifecycle
nn_to_ddsi_duration (autopurge_disposed_samples_delay);
qos->present |= QP_PRISMTECH_READER_DATA_LIFECYCLE;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -645,7 +653,7 @@ void dds_qset_durability_service
qos->durability_service.resource_limits.max_samples_per_instance = max_samples_per_instance;
qos->present |= QP_DURABILITY_SERVICE;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
}
}
@ -657,15 +665,15 @@ void dds_qget_userdata
)
{
if(!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
return ;
}
if(!value) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument value is NULL");
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument sz is NULL");
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->user_data, value, sz);
@ -679,15 +687,15 @@ void dds_qget_topicdata
)
{
if(!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
return ;
}
if(!value) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument value is NULL");
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument sz is NULL");
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->topic_data, value, sz);
@ -701,15 +709,15 @@ void dds_qget_groupdata
)
{
if(!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
return ;
}
if(!value) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument value is NULL");
DDS_ERROR("Argument value is NULL\n");
return ;
}
if(!sz) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument sz is NULL");
DDS_ERROR("Argument sz is NULL\n");
return ;
}
dds_qos_data_copy_out (&qos->group_data, value, sz);
@ -722,11 +730,11 @@ void dds_qget_durability
)
{
if(!qos) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is NULL");
DDS_ERROR("Argument QoS is NULL\n");
return ;
}
if(!kind) {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument kind is NULL");
DDS_ERROR("Argument kind is NULL\n");
return ;
}
*kind = (dds_durability_kind_t) qos->durability.kind;
@ -743,7 +751,7 @@ void dds_qget_history
if (kind) *kind = (dds_history_kind_t) qos->history.kind;
if (depth) *depth = qos->history.depth;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -762,7 +770,7 @@ void dds_qget_resource_limits
*max_samples_per_instance = qos->resource_limits.max_samples_per_instance;
}
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -779,7 +787,7 @@ void dds_qget_presentation
if (coherent_access) *coherent_access = qos->presentation.coherent_access;
if (ordered_access) *ordered_access = qos->presentation.ordered_access;
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -790,11 +798,11 @@ void dds_qget_lifespan
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!lifespan){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument lifespan is NULL");
DDS_ERROR("Argument lifespan is NULL\n");
return ;
}
*lifespan = nn_from_ddsi_duration (qos->lifespan.duration);
@ -807,11 +815,11 @@ void dds_qget_deadline
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!deadline){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument deadline is NULL");
DDS_ERROR("Argument deadline is NULL\n");
return ;
}
*deadline = nn_from_ddsi_duration (qos->deadline.deadline);
@ -824,11 +832,11 @@ void dds_qget_latency_budget
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!duration){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument duration is NULL");
DDS_ERROR("Argument duration is NULL\n");
return ;
}
*duration = nn_from_ddsi_duration (qos->latency_budget.duration);
@ -841,11 +849,11 @@ void dds_qget_ownership
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!kind){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument kind is NULL");
DDS_ERROR("Argument kind is NULL\n");
return ;
}
*kind = (dds_ownership_kind_t) qos->ownership.kind;
@ -858,11 +866,11 @@ void dds_qget_ownership_strength
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!value){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument value is NULL");
DDS_ERROR("Argument value is NULL\n");
return ;
}
*value = qos->ownership_strength.value;
@ -879,7 +887,7 @@ void dds_qget_liveliness
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(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -890,11 +898,11 @@ void dds_qget_time_based_filter
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!minimum_separation){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument minimum_separation is NULL");
DDS_ERROR("Argument minimum_separation is NULL\n");
return ;
}
*minimum_separation = nn_from_ddsi_duration (qos->time_based_filter.minimum_separation);
@ -911,11 +919,11 @@ void dds_qget_partition
uint32_t i;
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!n){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument n is NULL");
DDS_ERROR("Argument n is NULL\n");
return ;
}
@ -945,7 +953,7 @@ void dds_qget_reliability
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(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -956,11 +964,11 @@ void dds_qget_transport_priority
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!value){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument value is NULL");
DDS_ERROR("Argument value is NULL\n");
return ;
}
*value = qos->transport_priority.value;
@ -973,11 +981,11 @@ void dds_qget_destination_order
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!kind){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument kind is NULL");
DDS_ERROR("Argument kind is NULL\n");
return ;
}
*kind = (dds_destination_order_kind_t) qos->destination_order.kind;
@ -990,11 +998,11 @@ void dds_qget_writer_data_lifecycle
)
{
if(!qos){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
return ;
}
if(!autodispose){
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument autodispose is NULL");
DDS_ERROR("Argument autodispose is NULL\n");
return ;
}
*autodispose = qos->writer_data_lifecycle.autodispose_unregistered_instances;
@ -1017,7 +1025,7 @@ void dds_qget_reader_data_lifecycle
nn_from_ddsi_duration (qos->reader_data_lifecycle.autopurge_disposed_samples_delay);
}
} else {
DDS_ERROR(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}
@ -1040,6 +1048,6 @@ void dds_qget_durability_service
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(DDS_RETCODE_BAD_PARAMETER, "Argument qos is NULL");
DDS_ERROR("Argument qos is NULL\n");
}
}

View file

@ -18,7 +18,6 @@
#include "dds__err.h"
#include "ddsi/ddsi_serdata.h"
#include "ddsi/ddsi_sertopic.h"
#include "dds__report.h"
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER)
DDS_EXPORT dds_entity_t
@ -31,8 +30,6 @@ dds_create_querycondition(
dds__retcode_t rc;
dds_reader *r;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &r);
if (rc == DDS_RETCODE_OK) {
dds_readcond *cond = dds_create_readcond(r, DDS_KIND_COND_QUERY, mask);
@ -41,8 +38,9 @@ dds_create_querycondition(
cond->m_query.m_filter = filter;
dds_reader_unlock(r);
} else {
hdl = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}

View file

@ -19,7 +19,6 @@
#include "ddsi/q_thread.h"
#include "ddsi/q_ephash.h"
#include "ddsi/q_entity.h"
#include "dds__report.h"
static _Check_return_ dds__retcode_t
@ -46,19 +45,19 @@ dds_read_lock(
rc = dds_entity_lock(parent->m_hdl, DDS_KIND_READER, (dds_entity**)reader);
if (rc != DDS_RETCODE_OK) {
dds_entity_unlock((dds_entity*)*condition);
DDS_ERROR(rc, "Failed to lock condition reader.");
DDS_ERROR("Failed to lock condition reader\n");
}
} else {
DDS_ERROR(rc, "Failed to lock condition.");
DDS_ERROR("Failed to lock condition\n");
}
} else {
DDS_ERROR(rc, "Given entity is not a reader nor a condition.");
DDS_ERROR("Given entity is not a reader nor a condition\n");
}
} else {
DDS_ERROR(rc, "Given entity is not a reader.");
DDS_ERROR("Given entity is not a reader\n");
}
} else if (rc != DDS_RETCODE_OK) {
DDS_ERROR(rc, "Failed to lock reader.");
DDS_ERROR("Failed to lock reader\n");
}
return rc;
}
@ -106,34 +105,41 @@ dds_read_impl(
thread_state_awake (thr);
}
if (buf == NULL) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "The provided buffer is NULL");
DDS_ERROR("The provided buffer is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if (si == NULL) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Provided pointer to an array of dds_sample_info_t is NULL");
DDS_ERROR("Provided pointer to an array of dds_sample_info_t is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if (maxs == 0) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "The maximum number of samples to read is zero");
DDS_ERROR("The maximum number of samples to read is zero\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if (bufsz == 0) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "The size of buffer is zero");
DDS_ERROR("The size of buffer is zero\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if (bufsz < maxs) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "The provided size of buffer is smaller than the maximum number of samples to read");
DDS_ERROR("The provided size of buffer is smaller than the maximum number of samples to read\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
rc = dds_read_lock(reader_or_condition, &rd, &cond, only_reader);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
goto fail;
}
if (hand != DDS_HANDLE_NIL) {
if (dds_tkmap_find_by_id(gv.m_tkmap, hand) == NULL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "Could not find instance");
DDS_ERROR("Could not find instance\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
dds_read_unlock(rd, cond);
goto fail;
}
@ -235,7 +241,8 @@ dds_readcdr_impl(
}
dds_read_unlock(rd, cond);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
if (asleep)
@ -258,18 +265,14 @@ dds_read(
_In_ uint32_t maxs)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
/* Use a more sensible maxs, so use bufsz instead.
* CHAM-306 will remove this ugly piece of code. */
maxs = (uint32_t)bufsz;
}
ret = dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -283,9 +286,6 @@ dds_read_wl(
_In_ uint32_t maxs)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -293,9 +293,7 @@ dds_read_wl(
* CHAM-306 will remove this ugly piece of code. */
maxs = 100;
}
ret = dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -311,9 +309,6 @@ dds_read_mask(
_In_ uint32_t mask)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -321,9 +316,7 @@ dds_read_mask(
* CHAM-306 will remove this ugly piece of code. */
maxs = (uint32_t)bufsz;
}
ret = dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -338,9 +331,6 @@ dds_read_mask_wl(
_In_ uint32_t mask)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -348,9 +338,7 @@ dds_read_mask_wl(
* CHAM-306 will remove this ugly piece of code. */
maxs = 100;
}
ret = dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0 );
return ret;
return dds_read_impl (false, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -367,10 +355,10 @@ dds_read_instance(
{
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
@ -382,7 +370,6 @@ dds_read_instance(
}
ret = dds_read_impl(false, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0 );
return ret;
}
@ -399,10 +386,10 @@ dds_read_instance_wl(
{
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
@ -414,7 +401,6 @@ dds_read_instance_wl(
}
ret = dds_read_impl(false, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -434,10 +420,10 @@ dds_read_instance_mask(
{
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
@ -449,7 +435,6 @@ dds_read_instance_mask(
}
ret = dds_read_impl(false, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -468,10 +453,10 @@ dds_read_instance_mask_wl(
{
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
if (maxs == DDS_READ_WITHOUT_LOCK) {
@ -482,7 +467,6 @@ dds_read_instance_mask_wl(
}
ret = dds_read_impl(false, rd_or_cnd, buf, maxs, maxs, si, mask, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -494,13 +478,7 @@ dds_read_next(
_Out_ dds_sample_info_t *si)
{
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
}
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
@ -511,12 +489,7 @@ dds_read_next_wl(
_Out_ dds_sample_info_t *si)
{
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
return dds_read_impl (false, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -531,9 +504,6 @@ dds_take(
_In_ uint32_t maxs)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -541,9 +511,7 @@ dds_take(
* CHAM-306 will remove this ugly piece of code. */
maxs = (uint32_t)bufsz;
}
ret = dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -557,9 +525,6 @@ dds_take_wl(
_In_ uint32_t maxs)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -567,9 +532,7 @@ dds_take_wl(
* CHAM-306 will remove this ugly piece of code. */
maxs = 100;
}
ret = dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -585,9 +548,6 @@ dds_take_mask(
_In_ uint32_t mask)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -595,9 +555,7 @@ dds_take_mask(
* CHAM-306 will remove this ugly piece of code. */
maxs = (uint32_t)bufsz;
}
ret = dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (true, rd_or_cnd, buf, bufsz, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
}
_Pre_satisfies_(((rd_or_cnd & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -612,9 +570,6 @@ dds_take_mask_wl(
_In_ uint32_t mask)
{
bool lock = true;
dds_return_t ret;
DDS_REPORT_STACK();
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
@ -622,9 +577,7 @@ dds_take_mask_wl(
* CHAM-306 will remove this ugly piece of code. */
maxs = 100;
}
ret = dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
DDS_REPORT_FLUSH(ret < 0);
return ret;
return dds_read_impl (true, rd_or_cnd, buf, maxs, maxs, si, mask, DDS_HANDLE_NIL, lock, false);
}
int
@ -636,6 +589,7 @@ dds_takecdr(
uint32_t mask)
{
bool lock = true;
if (maxs == DDS_READ_WITHOUT_LOCK) {
lock = false;
/* Use a more sensible maxs. Just an arbitrarily number.
@ -661,10 +615,9 @@ dds_take_instance(
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
@ -676,7 +629,6 @@ dds_take_instance(
}
ret = dds_read_impl(true, rd_or_cnd, buf, bufsz, maxs, si, NO_STATE_MASK_SET, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -694,10 +646,9 @@ dds_take_instance_wl(
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
if (maxs == DDS_READ_WITHOUT_LOCK) {
@ -708,7 +659,6 @@ dds_take_instance_wl(
}
ret = dds_read_impl(true, rd_or_cnd, buf, maxs, maxs, si, NO_STATE_MASK_SET, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -729,10 +679,9 @@ dds_take_instance_mask(
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
if (maxs == DDS_READ_WITHOUT_LOCK) {
@ -743,7 +692,6 @@ dds_take_instance_mask(
}
ret = dds_read_impl(true, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -763,10 +711,9 @@ dds_take_instance_mask_wl(
dds_return_t ret = DDS_RETCODE_OK;
bool lock = true;
DDS_REPORT_STACK();
if (handle == DDS_HANDLE_NIL) {
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "DDS_HANDLE_NIL was provided");
DDS_ERROR("DDS_HANDLE_NIL was provided\n");
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
goto fail;
}
if (maxs == DDS_READ_WITHOUT_LOCK) {
@ -777,7 +724,6 @@ dds_take_instance_mask_wl(
}
ret = dds_read_impl(true, rd_or_cnd, buf, maxs, maxs, si, mask, handle, lock, false);
fail:
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -789,11 +735,7 @@ dds_take_next(
_Out_ dds_sample_info_t *si)
{
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
}
_Pre_satisfies_((reader & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER )
@ -804,11 +746,7 @@ dds_take_next_wl(
_Out_ dds_sample_info_t *si)
{
uint32_t mask = DDS_NOT_READ_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
return dds_read_impl (true, reader, buf, 1u, 1u, si, mask, DDS_HANDLE_NIL, true, true);
}
_Pre_satisfies_(((reader_or_condition & DDS_ENTITY_KIND_MASK) == DDS_KIND_READER ) ||\
@ -826,20 +764,21 @@ dds_return_loan(
dds_readcond *cond;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
if (!buf ) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument buf is NULL");
DDS_ERROR("Argument buf is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if(*buf == NULL && bufsz > 0){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument buf is NULL");
DDS_ERROR("Argument buf is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
rc = dds_read_lock(reader_or_condition, &rd, &cond, false);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
goto fail;
}
desc = rd->m_topic->m_descriptor;
@ -861,6 +800,5 @@ dds_return_loan(
dds_read_unlock(rd, cond);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -18,7 +18,6 @@
#include "ddsi/q_ephash.h"
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "dds__report.h"
static dds_return_t
dds_readcond_delete(
@ -57,8 +56,6 @@ dds_create_readcondition(
dds_reader * rd;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc == DDS_RETCODE_OK) {
dds_readcond *cond = dds_create_readcond(rd, DDS_KIND_COND_READ, mask);
@ -66,9 +63,10 @@ dds_create_readcondition(
hdl = cond->m_entity.m_hdl;
dds_reader_unlock(rd);
} else {
hdl = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -80,15 +78,15 @@ dds_get_datareader(
{
dds_entity_t hdl;
DDS_REPORT_STACK();
if (dds_entity_kind(condition) == DDS_KIND_COND_READ) {
hdl = dds_get_parent(condition);
} else if (dds_entity_kind(condition) == DDS_KIND_COND_QUERY) {
hdl = dds_get_parent(condition);
} else {
hdl = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_READ), "Argument condition is not valid");
DDS_ERROR("Argument condition is not valid\n");
hdl = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_READ));
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -104,8 +102,6 @@ dds_get_mask(
dds_readcond *cond;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (mask != NULL) {
*mask = 0;
if ((dds_entity_kind(condition) == DDS_KIND_COND_READ ) ||
@ -116,14 +112,17 @@ dds_get_mask(
dds_entity_unlock((dds_entity*)cond);
ret = DDS_RETCODE_OK;
} else{
ret = DDS_ERRNO(rc, "Error occurred on locking condition");
DDS_ERROR("Error occurred on locking condition\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_READ), "Argument condition is not valid");
DDS_ERROR("Argument condition is not valid\n");
ret = DDS_ERRNO(dds_valid_hdl(condition, DDS_KIND_COND_READ));
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument mask is NULL");
DDS_ERROR("Argument mask is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -21,11 +21,9 @@
#include "dds__err.h"
#include "ddsi/q_entity.h"
#include "ddsi/q_thread.h"
#include "dds__report.h"
#include "dds__builtin.h"
#include "ddsc/ddsc_project.h"
#include <string.h>
#include "os/os.h"
@ -65,8 +63,9 @@ dds_reader_close(
thread_state_awake(thr);
}
if (delete_reader(&e->m_guid) != 0) {
DDS_ERROR("Internal error");
rc = DDS_RETCODE_ERROR;
ret = DDS_ERRNO(rc, "Internal error");
ret = DDS_ERRNO(rc);
}
if (asleep) {
thread_state_asleep(thr);
@ -103,22 +102,28 @@ dds_reader_qos_validate(
/* Check consistency. */
if(!dds_qos_validate_common(qos)) {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Argument Qos is not valid");
DDS_ERROR("Argument Qos is not valid\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
if((qos->present & QP_USER_DATA) && !(validate_octetseq (&qos->user_data))) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "User data policy is inconsistent and caused an error");
DDS_ERROR("User data policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PRISMTECH_READER_DATA_LIFECYCLE) && (validate_reader_data_lifecycle (&qos->reader_data_lifecycle) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Prismtech reader data lifecycle policy is inconsistent and caused an error");
DDS_ERROR("Prismtech reader data lifecycle policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_TIME_BASED_FILTER) && (validate_duration (&qos->time_based_filter.minimum_separation) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Time based filter policy is inconsistent and caused an error");
DDS_ERROR("Time based filter policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_HISTORY) && (qos->present & QP_RESOURCE_LIMITS) && (validate_history_and_resource_limits (&qos->history, &qos->resource_limits) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "History and resource limits policy is inconsistent and caused an error");
DDS_ERROR("History and resource limits policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_TIME_BASED_FILTER) && (qos->present & QP_DEADLINE) && !(validate_deadline_and_timebased_filter (qos->deadline.deadline, qos->time_based_filter.minimum_separation))) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Time based filter and deadline policy is inconsistent and caused an error");
DDS_ERROR("Time based filter and deadline policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if(ret == DDS_RETCODE_OK && enabled) {
ret = dds_qos_validate_mutable_common(qos);
@ -138,7 +143,8 @@ dds_reader_qos_set(
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, DDSC_PROJECT_NAME" does not support changing QoS policies");
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
return ret;
@ -149,7 +155,7 @@ dds_reader_status_validate(
uint32_t mask)
{
return (mask & ~(DDS_READER_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Invalid status mask") :
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER) :
DDS_RETCODE_OK;
}
@ -162,8 +168,6 @@ dds_reader_status_cb(
dds__retcode_t rc;
void *metrics = NULL;
DDS_REPORT_STACK();
/* When data is NULL, it means that the DDSI reader is deleted. */
if (data == NULL) {
/* Release the initial claim that was done during the create. This
@ -173,8 +177,6 @@ dds_reader_status_cb(
}
if (dds_reader_lock(((dds_entity*)entity)->m_hdl, &rd) != DDS_RETCODE_OK) {
/* There's a deletion or closing going on. */
DDS_REPORT_FLUSH(false);
return;
}
assert(rd == entity);
@ -333,8 +335,6 @@ dds_reader_status_cb(
} else {
/* Something went wrong up the hierarchy. */
}
DDS_REPORT_FLUSH(rc != DDS_RETCODE_OK);
}
@ -362,8 +362,6 @@ dds_create_reader(
const bool asleep = !vtime_awake_p (thr->vtime);
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
if (dds_entity_kind(topic) != DDS_KIND_INTERNAL) {
/* Try claiming a participant. If that's not working, then it could be a subscriber. */
if (dds_entity_kind(participant_or_subscriber) == DDS_KIND_PARTICIPANT) {
@ -380,7 +378,8 @@ dds_create_reader(
rc = dds_entity_lock(subscriber, DDS_KIND_SUBSCRIBER, &sub);
if (rc != DDS_RETCODE_OK) {
reader = DDS_ERRNO(rc, "Error occurred on locking subscriber");
DDS_ERROR("Error occurred on locking subscriber\n");
reader = DDS_ERRNO(rc);
goto err_sub_lock;
}
@ -392,7 +391,8 @@ dds_create_reader(
rc = dds_entity_lock(t, DDS_KIND_TOPIC, &tp);
if (rc != DDS_RETCODE_OK) {
reader = DDS_ERRNO(rc, "Error occurred on locking topic");
DDS_ERROR("Error occurred on locking topic\n");
reader = DDS_ERRNO(rc);
goto err_tp_lock;
}
assert (((dds_topic*)tp)->m_stopic);
@ -472,7 +472,6 @@ dds_create_reader(
dds_delete(t);
}
DDS_REPORT_FLUSH(reader <= 0);
return reader;
err_bad_qos:
@ -483,7 +482,6 @@ err_tp_lock:
(void)dds_delete(subscriber);
}
err_sub_lock:
DDS_REPORT_FLUSH(reader <= 0);
return reader;
}
@ -560,7 +558,6 @@ dds_reader_wait_for_historical_data(
int ret;
dds_reader *rd;
DDS_REPORT_STACK();
assert (reader);
ret = dds_reader_lock(reader, &rd);
@ -568,13 +565,15 @@ dds_reader_wait_for_historical_data(
if (((dds_entity*)rd)->m_qos->durability.kind > NN_TRANSIENT_LOCAL_DURABILITY_QOS) {
ret = (dds_global.m_dur_wait) (rd, max_wait);
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Can not wait for historical data on a reader with volatile durability");
DDS_ERROR("Can not wait for historical data on a reader with volatile durability\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
dds_reader_unlock(rd);
} else {
ret = DDS_ERRNO(ret, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(ret);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -587,8 +586,6 @@ dds_get_subscriber(
{
dds_entity_t hdl;
DDS_REPORT_STACK();
if (dds_entity_kind(entity) == DDS_KIND_READER) {
hdl = dds_get_parent(entity);
} else if (dds_entity_kind(entity) == DDS_KIND_COND_READ || dds_entity_kind(entity) == DDS_KIND_COND_QUERY) {
@ -596,12 +593,13 @@ dds_get_subscriber(
if(hdl > 0){
hdl = dds_get_subscriber(hdl);
} else {
DDS_ERROR(hdl, "Reader of this condition is already deleted");
DDS_ERROR("Reader of this condition is already deleted\n");
}
} else {
hdl = DDS_ERRNO(dds_valid_hdl(entity, DDS_KIND_READER), "Provided entity is not a reader nor a condition");
DDS_ERROR("Provided entity is not a reader nor a condition\n");
hdl = DDS_ERRNO(dds_valid_hdl(entity, DDS_KIND_READER));
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -615,11 +613,10 @@ dds_get_subscription_matched_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -633,7 +630,6 @@ dds_get_subscription_matched_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -647,11 +643,10 @@ dds_get_liveliness_changed_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -665,7 +660,6 @@ dds_get_liveliness_changed_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -678,11 +672,10 @@ dds_return_t dds_get_sample_rejected_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -696,7 +689,6 @@ dds_return_t dds_get_sample_rejected_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -709,11 +701,10 @@ dds_return_t dds_get_sample_lost_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -726,7 +717,6 @@ dds_return_t dds_get_sample_lost_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -739,10 +729,10 @@ dds_return_t dds_get_requested_deadline_missed_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -755,7 +745,6 @@ dds_return_t dds_get_requested_deadline_missed_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -768,11 +757,10 @@ dds_return_t dds_get_requested_incompatible_qos_status (
dds_reader *rd;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_reader_lock(reader, &rd);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking reader");
DDS_ERROR("Error occurred on locking reader\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -785,6 +773,5 @@ dds_return_t dds_get_requested_incompatible_qos_status (
}
dds_reader_unlock(rd);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -1,53 +0,0 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include "ddsc/dds.h"
#include "os/os.h"
#include "os/os_report.h"
#include <assert.h>
#include <string.h>
#include "dds__report.h"
void
dds_report(
os_reportType reportType,
const char *function,
int32_t line,
const char *file,
dds_return_t code,
const char *format,
...)
{
const char *retcode = NULL;
/* os_report truncates messages to <OS_REPORT_BUFLEN> bytes */
char buffer[OS_REPORT_BUFLEN];
size_t offset = 0;
va_list args;
assert (function != NULL);
assert (file != NULL);
assert (format != NULL);
/* probably never happens, but you can never be to sure */
assert (OS_REPORT_BUFLEN > 0);
retcode = dds_err_str(code*-1);
offset = strlen(retcode);
assert (offset < OS_REPORT_BUFLEN);
(void)memcpy(buffer, retcode, offset);
buffer[offset] = ' ';
offset++;
va_start (args, format);
(void)os_vsnprintf (buffer + offset, sizeof(buffer) - offset, format, args);
va_end (args);
os_report (reportType, function, file, line, code, "%s", buffer);
}

View file

@ -38,7 +38,6 @@
#include "ddsi/ddsi_serdata.h"
#include "ddsi/ddsi_serdata_default.h"
#include "ddsi/sysdeps.h"
#include "dds__report.h"
/* INSTANCE MANAGEMENT
===================
@ -764,7 +763,7 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
{
const uint64_t inst_wr_iid = inst->wr_iid_islive ? inst->wr_iid : 0;
TRACE ((" register:"));
DDS_TRACE(" register:");
/* Is an implicitly registering dispose semantically equivalent to
register ; dispose? If so, both no_writers_gen and disposed_gen
@ -779,7 +778,7 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
/* Same writer as last time => we know it is registered already.
This is the fast path -- we don't have to check anything
else. */
TRACE (("cached"));
DDS_TRACE("cached");
assert (inst->wrcount > 0);
return;
}
@ -797,7 +796,7 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
}
inst->wrcount++;
inst->no_writers_gen++;
TRACE (("new1"));
DDS_TRACE("new1");
if (!INST_IS_EMPTY (inst) && !inst->isdisposed)
rhc->n_not_alive_no_writers--;
@ -822,14 +821,14 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
if (lwregs_add (&rhc->registrations, inst->iid, wr_iid))
{
inst->wrcount++;
TRACE (("new2iidnull"));
DDS_TRACE("new2iidnull");
}
else
{
int x = lwregs_delete (&rhc->registrations, inst->iid, wr_iid);
assert (x);
(void) x;
TRACE (("restore"));
DDS_TRACE("restore");
}
/* to avoid wr_iid update when register is called for sample rejected */
if (iid_update)
@ -845,7 +844,7 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
if (inst->wrcount == 1)
{
/* 2nd writer => properly register the one we knew about */
TRACE (("rescue1"));
DDS_TRACE("rescue1");
int x;
x = lwregs_add (&rhc->registrations, inst->iid, inst_wr_iid);
assert (x);
@ -856,12 +855,12 @@ static void dds_rhc_register (struct rhc *rhc, struct rhc_instance *inst, uint64
/* as soon as we reach at least two writers, we have to check
the result of lwregs_add to know whether this sample
registers a previously unknown writer or not */
TRACE (("new3"));
DDS_TRACE("new3");
inst->wrcount++;
}
else
{
TRACE (("known"));
DDS_TRACE("known");
}
assert (inst->wrcount >= 2);
/* the most recent writer gets the fast path */
@ -890,7 +889,7 @@ static int rhc_unregister_isreg_w_sideeffects (struct rhc *rhc, const struct rhc
/* Returns 1 if last registration just disappeared */
if (inst->wrcount == 0)
{
TRACE (("unknown(#0)"));
DDS_TRACE("unknown(#0)");
return 0;
}
else if (inst->wrcount == 1 && inst->wr_iid_islive)
@ -898,23 +897,23 @@ static int rhc_unregister_isreg_w_sideeffects (struct rhc *rhc, const struct rhc
assert(inst->wr_iid != 0);
if (wr_iid != inst->wr_iid)
{
TRACE (("unknown(cache)"));
DDS_TRACE("unknown(cache)");
return 0;
}
else
{
TRACE (("last(cache)"));
DDS_TRACE("last(cache)");
return 1;
}
}
else if (!lwregs_delete (&rhc->registrations, inst->iid, wr_iid))
{
TRACE (("unknown(regs)"));
DDS_TRACE("unknown(regs)");
return 0;
}
else
{
TRACE (("delreg"));
DDS_TRACE("delreg");
/* If we transition from 2 to 1 writer, and we are deleting a
writer other than the one cached in the instance, that means
afterward there will be 1 writer, it will be cached, and its
@ -922,7 +921,7 @@ static int rhc_unregister_isreg_w_sideeffects (struct rhc *rhc, const struct rhc
and wr_iid != 0 the wr_iid is not in "registrations") */
if (inst->wrcount == 2 && inst->wr_iid_islive && inst->wr_iid != wr_iid)
{
TRACE ((",delreg(remain)"));
DDS_TRACE(",delreg(remain)");
lwregs_delete (&rhc->registrations, inst->iid, inst->wr_iid);
}
return 1;
@ -947,7 +946,7 @@ static int rhc_unregister_updateinst
/* Reset the ownership strength to allow samples to be read from other
writer(s) */
inst->strength = 0;
TRACE ((",clearcache"));
DDS_TRACE(",clearcache");
}
return 0;
}
@ -977,14 +976,14 @@ static int rhc_unregister_updateinst
else if (inst->isdisposed)
{
/* No content left, no registrations left, so drop */
TRACE ((",#0,empty,disposed,drop"));
DDS_TRACE(",#0,empty,disposed,drop");
drop_instance_noupdate_no_writers (rhc, inst);
return 1;
}
else
{
/* Add invalid samples for transition to no-writers */
TRACE ((",#0,empty,nowriters"));
DDS_TRACE(",#0,empty,nowriters");
assert (INST_IS_EMPTY (inst));
inst_set_invsample (rhc, inst);
update_inst (rhc, inst, pwr_info, false, tstamp);
@ -1002,7 +1001,7 @@ static void dds_rhc_unregister
)
{
/* 'post' always gets set; instance may have been freed upon return. */
TRACE ((" unregister:"));
DDS_TRACE(" unregister:");
if (!rhc_unregister_isreg_w_sideeffects (rhc, inst, pwr_info->iid))
{
/* other registrations remain */
@ -1141,13 +1140,13 @@ bool dds_rhc_store
bool notify_data_available = true;
bool delivered = true;
TRACE (("rhc_store(%"PRIx64",%"PRIx64" si %x has_data %d:", tk->m_iid, wr_iid, statusinfo, has_data));
DDS_TRACE("rhc_store(%"PRIx64",%"PRIx64" si %x has_data %d:", tk->m_iid, wr_iid, statusinfo, has_data);
if (!has_data && statusinfo == 0)
{
/* Write with nothing but a key -- I guess that would be a
register, which we do implicitly. (Currently DDSI2 won't allow
it through anyway.) */
TRACE ((" ignore explicit register)\n"));
DDS_TRACE(" ignore explicit register)\n");
return delivered;
}
@ -1166,12 +1165,12 @@ bool dds_rhc_store
*/
if (!has_data && !is_dispose)
{
TRACE ((" disp/unreg on unknown instance"));
DDS_TRACE(" disp/unreg on unknown instance");
goto error_or_nochange;
}
else
{
TRACE ((" new instance"));
DDS_TRACE(" new instance");
stored = rhc_store_new_instance (&post, rhc, pwr_info, sample, tk, has_data, &cb_data);
if (stored != RHC_STORED)
{
@ -1187,7 +1186,7 @@ bool dds_rhc_store
will raise a SAMPLE_REJECTED, and indicate that the system should
kill itself.) Not letting instances go to ALIVE or NEW based on
a rejected sample - (no one knows, it seemed) */
TRACE ((" instance rejects sample"));
DDS_TRACE(" instance rejects sample");
get_trigger_info (&pre, inst, true);
@ -1217,7 +1216,7 @@ bool dds_rhc_store
{
get_trigger_info (&pre, inst, true);
TRACE ((" wc %"PRIu32, inst->wrcount));
DDS_TRACE(" wc %"PRIu32, inst->wrcount);
if (has_data || is_dispose)
{
@ -1245,7 +1244,7 @@ bool dds_rhc_store
/* Sample arriving for a NOT_ALIVE instance => view state NEW */
if (has_data && not_alive)
{
TRACE ((" notalive->alive"));
DDS_TRACE(" notalive->alive");
inst->isnew = 1;
}
@ -1258,7 +1257,7 @@ bool dds_rhc_store
and the operation is WD. */
if (has_data && inst->isdisposed)
{
TRACE ((" disposed->notdisposed"));
DDS_TRACE(" disposed->notdisposed");
inst->isdisposed = 0;
inst->disposed_gen++;
}
@ -1266,17 +1265,17 @@ bool dds_rhc_store
{
inst->isdisposed = 1;
inst_became_disposed = !old_isdisposed;
TRACE ((" dispose(%d)", inst_became_disposed));
DDS_TRACE(" dispose(%d)", inst_became_disposed);
}
/* Only need to add a sample to the history if the input actually
is a sample. */
if (has_data)
{
TRACE ((" add_sample"));
DDS_TRACE(" add_sample");
if (! add_sample (rhc, inst, pwr_info, sample, &cb_data))
{
TRACE (("(reject)"));
DDS_TRACE("(reject)");
stored = RHC_REJECTED;
goto error_or_nochange;
}
@ -1338,7 +1337,7 @@ bool dds_rhc_store
}
}
TRACE ((")\n"));
DDS_TRACE(")\n");
/* do not send data available notification when an instance is dropped */
if ((post.qminst == ~0u) && (post.has_read == 0) && (post.has_not_read == 0) && (post.has_changed == false))
@ -1377,7 +1376,7 @@ error_or_nochange:
}
os_mutexUnlock (&rhc->lock);
TRACE ((")\n"));
DDS_TRACE(")\n");
/* Make any reader status callback */
@ -1411,7 +1410,7 @@ void dds_rhc_unregister_wr
const int auto_dispose = pwr_info->auto_dispose;
os_mutexLock (&rhc->lock);
TRACE (("rhc_unregister_wr_iid(%"PRIx64",%d:\n", wr_iid, auto_dispose));
DDS_TRACE("rhc_unregister_wr_iid(%"PRIx64",%d:\n", wr_iid, auto_dispose);
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
{
if ((inst->wr_iid_islive && inst->wr_iid == wr_iid) || lwregs_contains (&rhc->registrations, inst->iid, wr_iid))
@ -1419,7 +1418,7 @@ void dds_rhc_unregister_wr
struct trigger_info pre, post;
get_trigger_info (&pre, inst, true);
TRACE ((" %"PRIx64":", inst->iid));
DDS_TRACE(" %"PRIx64":", inst->iid);
assert (inst->wrcount > 0);
if (auto_dispose && !inst->isdisposed)
@ -1445,7 +1444,7 @@ void dds_rhc_unregister_wr
dds_rhc_unregister (&post, rhc, inst, pwr_info, inst->tstamp);
TRACE (("\n"));
DDS_TRACE("\n");
if (trigger_info_differs (&pre, &post))
{
@ -1458,7 +1457,7 @@ void dds_rhc_unregister_wr
assert (rhc_check_counts_locked (rhc, true));
}
}
TRACE ((")\n"));
DDS_TRACE(")\n");
os_mutexUnlock (&rhc->lock);
if (trigger_waitsets)
@ -1472,7 +1471,7 @@ void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t w
struct rhc_instance *inst;
struct ut_hhIter iter;
os_mutexLock (&rhc->lock);
TRACE (("rhc_relinquish_ownership(%"PRIx64":\n", wr_iid));
DDS_TRACE("rhc_relinquish_ownership(%"PRIx64":\n", wr_iid);
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
{
if (inst->wr_iid_islive && inst->wr_iid == wr_iid)
@ -1480,7 +1479,7 @@ void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t w
inst->wr_iid_islive = 0;
}
}
TRACE ((")\n"));
DDS_TRACE(")\n");
assert (rhc_check_counts_locked (rhc, true));
os_mutexUnlock (&rhc->lock);
}
@ -1636,11 +1635,11 @@ static int dds_rhc_read_w_qminv
os_mutexLock (&rhc->lock);
}
TRACE (("read_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
DDS_TRACE("read_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
(void *) rhc, (void *) values, (void *) info_seq, max_samples, qminv,
rhc->n_instances, rhc->n_nonempty_instances, rhc->n_not_alive_disposed,
rhc->n_not_alive_no_writers, rhc->n_new, rhc->n_vsamples, rhc->n_invsamples,
rhc->n_vread, rhc->n_invread));
rhc->n_vread, rhc->n_invread);
if (rhc->nonempty_instances)
{
@ -1674,7 +1673,7 @@ static int dds_rhc_read_w_qminv
{
if (!sample->isread)
{
TRACE (("s"));
DDS_TRACE("s");
sample->isread = true;
inst->nvread++;
rhc->n_vread++;
@ -1735,7 +1734,7 @@ static int dds_rhc_read_w_qminv
}
while (inst != end && n < max_samples);
}
TRACE (("read: returning %u\n", n));
DDS_TRACE("read: returning %u\n", n);
assert (rhc_check_counts_locked (rhc, true));
os_mutexUnlock (&rhc->lock);
@ -1763,11 +1762,11 @@ static int dds_rhc_take_w_qminv
os_mutexLock (&rhc->lock);
}
TRACE (("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
DDS_TRACE("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
(void*) rhc, (void*) values, (void*) info_seq, max_samples, qminv,
rhc->n_instances, rhc->n_nonempty_instances, rhc->n_not_alive_disposed,
rhc->n_not_alive_no_writers, rhc->n_new, rhc->n_vsamples,
rhc->n_invsamples, rhc->n_vread, rhc->n_invread));
rhc->n_invsamples, rhc->n_vread, rhc->n_invread);
if (rhc->nonempty_instances)
{
@ -1877,7 +1876,7 @@ static int dds_rhc_take_w_qminv
}
if (inst->wrcount == 0)
{
TRACE (("take: iid %"PRIx64" #0,empty,drop\n", iid));
DDS_TRACE("take: iid %"PRIx64" #0,empty,drop\n", iid);
if (!inst->isdisposed)
{
/* disposed has priority over no writers (why not just 2 bits?) */
@ -1899,7 +1898,7 @@ static int dds_rhc_take_w_qminv
inst = inst1;
}
}
TRACE (("take: returning %u\n", n));
DDS_TRACE("take: returning %u\n", n);
assert (rhc_check_counts_locked (rhc, true));
os_mutexUnlock (&rhc->lock);
@ -1928,11 +1927,11 @@ static int dds_rhc_takecdr_w_qminv
os_mutexLock (&rhc->lock);
}
TRACE (("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
DDS_TRACE("take_w_qminv(%p,%p,%p,%u,%x) - inst %u nonempty %u disp %u nowr %u new %u samples %u+%u read %u+%u\n",
(void*) rhc, (void*) values, (void*) info_seq, max_samples, qminv,
rhc->n_instances, rhc->n_nonempty_instances, rhc->n_not_alive_disposed,
rhc->n_not_alive_no_writers, rhc->n_new, rhc->n_vsamples,
rhc->n_invsamples, rhc->n_vread, rhc->n_invread));
rhc->n_invsamples, rhc->n_vread, rhc->n_invread);
if (rhc->nonempty_instances)
{
@ -2028,7 +2027,7 @@ static int dds_rhc_takecdr_w_qminv
}
if (inst->wrcount == 0)
{
TRACE (("take: iid %"PRIx64" #0,empty,drop\n", iid));
DDS_TRACE("take: iid %"PRIx64" #0,empty,drop\n", iid);
if (!inst->isdisposed)
{
/* disposed has priority over no writers (why not just 2 bits?) */
@ -2050,7 +2049,7 @@ static int dds_rhc_takecdr_w_qminv
inst = inst1;
}
}
TRACE (("take: returning %u\n", n));
DDS_TRACE("take: returning %u\n", n);
assert (rhc_check_counts_locked (rhc, true));
os_mutexUnlock (&rhc->lock);
@ -2084,7 +2083,7 @@ static uint32_t rhc_get_cond_trigger (struct rhc_instance * const inst, const dd
m = m && !INST_IS_EMPTY (inst);
break;
default:
NN_FATAL ("update_readconditions: sample_states invalid: %x\n", c->m_sample_states);
DDS_FATAL("update_readconditions: sample_states invalid: %x\n", c->m_sample_states);
}
return m ? 1 : 0;
}
@ -2118,9 +2117,9 @@ void dds_rhc_add_readcondition (dds_readcond * cond)
rhc->nconds++;
rhc->conds = cond;
TRACE (("add_readcondition(%p, %x, %x, %x) => %p qminv %x ; rhc %u conds\n",
DDS_TRACE("add_readcondition(%p, %x, %x, %x) => %p qminv %x ; rhc %u conds\n",
(void *) rhc, cond->m_sample_states, cond->m_view_states,
cond->m_instance_states, cond, cond->m_qminv, rhc->nconds));
cond->m_instance_states, cond, cond->m_qminv, rhc->nconds);
os_mutexUnlock (&rhc->conds_lock);
os_mutexUnlock (&rhc->lock);
@ -2172,9 +2171,9 @@ static bool update_conditions_locked
const struct dds_topic_descriptor *desc = rhc->topic->status_cb_entity->m_descriptor;
char *tmp = NULL;
TRACE (("update_conditions_locked(%p) - inst %u nonempty %u disp %u nowr %u new %u samples %u read %u\n",
DDS_TRACE("update_conditions_locked(%p) - inst %u nonempty %u disp %u nowr %u new %u samples %u read %u\n",
(void *) rhc, rhc->n_instances, rhc->n_nonempty_instances, rhc->n_not_alive_disposed,
rhc->n_not_alive_no_writers, rhc->n_new, rhc->n_vsamples, rhc->n_vread));
rhc->n_not_alive_no_writers, rhc->n_new, rhc->n_vsamples, rhc->n_vread);
assert (rhc->n_nonempty_instances >= rhc->n_not_alive_disposed + rhc->n_not_alive_no_writers);
assert (rhc->n_nonempty_instances >= rhc->n_new);
@ -2203,13 +2202,13 @@ static bool update_conditions_locked
m_post = m_post && (post->has_read + post->has_not_read);
break;
default:
NN_FATAL ("update_readconditions: sample_states invalid: %x\n", iter->m_sample_states);
DDS_FATAL("update_readconditions: sample_states invalid: %x\n", iter->m_sample_states);
}
TRACE ((" cond %p: ", (void *) iter));
DDS_TRACE(" cond %p: ", (void *) iter);
if (m_pre == m_post)
{
TRACE (("no change"));
DDS_TRACE("no change");
}
else if (m_pre < m_post)
{
@ -2226,27 +2225,27 @@ static bool update_conditions_locked
|| (iter->m_query.m_filter != NULL && iter->m_query.m_filter (tmp))
)
{
TRACE (("now matches"));
DDS_TRACE("now matches");
if (iter->m_entity.m_trigger++ == 0)
{
TRACE ((" (cond now triggers)"));
DDS_TRACE(" (cond now triggers)");
trigger = true;
}
}
}
else
{
TRACE (("no longer matches"));
DDS_TRACE("no longer matches");
if (--iter->m_entity.m_trigger == 0)
{
TRACE ((" (cond no longer triggers)"));
DDS_TRACE(" (cond no longer triggers)");
}
}
if (iter->m_entity.m_trigger) {
dds_entity_status_signal(&(iter->m_entity));
}
TRACE (("\n"));
DDS_TRACE("\n");
iter = iter->m_rhc_next;
}

View file

@ -165,7 +165,7 @@ size_t dds_stream_check_optimize (_In_ const dds_topic_descriptor_t * desc)
dds_sample_free_contents (sample, desc->m_ops);
dds_free (sample);
dds_stream_fini (&os);
dds_log_info ("Marshalling for type: %s is%s optimised\n", desc->m_typename, size ? "" : " not");
DDS_INFO("Marshalling for type: %s is%s optimised\n", desc->m_typename, size ? "" : " not");
return size;
}
@ -490,7 +490,7 @@ static void dds_stream_write
{
type = DDS_OP_TYPE (op);
#ifdef OP_DEBUG_WRITE
TRACE (("W-ADR: %s offset %d\n", stream_op_type[type], ops[1]));
DDS_TRACE("W-ADR: %s offset %d\n", stream_op_type[type], ops[1]);
#endif
addr = data + ops[1];
ops += 2;
@ -519,7 +519,7 @@ static void dds_stream_write
case DDS_OP_VAL_STR:
{
#ifdef OP_DEBUG_WRITE
TRACE (("W-STR: %s\n", *((char**) addr)));
DDS_TRACE("W-STR: %s\n", *((char**) addr));
#endif
dds_stream_write_string (os, *((char**) addr));
break;
@ -531,7 +531,7 @@ static void dds_stream_write
num = seq->_length;
#ifdef OP_DEBUG_WRITE
TRACE (("W-SEQ: %s <%d>\n", stream_op_type[subtype], num));
DDS_TRACE("W-SEQ: %s <%d>\n", stream_op_type[subtype], num);
#endif
DDS_OS_PUT4 (os, num, uint32_t);
if (num || (subtype > DDS_OP_VAL_STR))
@ -558,7 +558,7 @@ static void dds_stream_write
while (num--)
{
#ifdef OP_DEBUG_WRITE
TRACE (("W-SEQ STR: %s\n", *ptr));
DDS_TRACE("W-SEQ STR: %s\n", *ptr);
#endif
dds_stream_write_string (os, *ptr);
ptr++;
@ -572,7 +572,7 @@ static void dds_stream_write
while (num--)
{
#ifdef OP_DEBUG_WRITE
TRACE (("W-SEQ BST[%d]: %s\n", align, ptr));
DDS_TRACE("W-SEQ BST[%d]: %s\n", align, ptr);
#endif
dds_stream_write_string (os, ptr);
ptr += align;
@ -603,7 +603,7 @@ static void dds_stream_write
num = *ops++;
#ifdef OP_DEBUG_WRITE
TRACE (("W-ARR: %s [%d]\n", stream_op_type[subtype], num));
DDS_TRACE("W-ARR: %s [%d]\n", stream_op_type[subtype], num);
#endif
switch (subtype)
{
@ -693,7 +693,7 @@ static void dds_stream_write
default: assert (0);
}
#ifdef OP_DEBUG_WRITE
TRACE (("W-UNI: switch %s case %d/%d\n", stream_op_type[subtype], disc, num));
DDS_TRACE("W-UNI: switch %s case %d/%d\n", stream_op_type[subtype], disc, num);
#endif
/* Write case matching discriminant */
@ -710,7 +710,7 @@ static void dds_stream_write
addr = data + jeq_op[2];
#ifdef OP_DEBUG_WRITE
TRACE (("W-UNI: case type %s\n", stream_op_type[subtype]));
DDS_TRACE("W-UNI: case type %s\n", stream_op_type[subtype]);
#endif
switch (subtype)
{
@ -753,7 +753,7 @@ static void dds_stream_write
case DDS_OP_VAL_BST:
{
#ifdef OP_DEBUG_WRITE
TRACE (("W-BST: %s\n", (char*) addr));
DDS_TRACE("W-BST: %s\n", (char*) addr);
#endif
dds_stream_write_string (os, (char*) addr);
ops++;
@ -766,7 +766,7 @@ static void dds_stream_write
case DDS_OP_JSR: /* Implies nested type */
{
#ifdef OP_DEBUG_WRITE
TRACE (("W-JSR: %d\n", DDS_OP_JUMP (op)));
DDS_TRACE("W-JSR: %d\n", DDS_OP_JUMP (op));
#endif
dds_stream_write (os, data, ops + DDS_OP_JUMP (op));
ops++;
@ -776,7 +776,7 @@ static void dds_stream_write
}
}
#ifdef OP_DEBUG_WRITE
TRACE (("W-RTS:\n"));
DDS_TRACE("W-RTS:\n");
#endif
}
@ -797,7 +797,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
{
type = DDS_OP_TYPE (op);
#ifdef OP_DEBUG_READ
TRACE (("R-ADR: %s offset %d\n", stream_op_type[type], ops[1]));
DDS_TRACE("R-ADR: %s offset %d\n", stream_op_type[type], ops[1]);
#endif
addr = data + ops[1];
ops += 2;
@ -826,7 +826,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
case DDS_OP_VAL_STR:
{
#ifdef OP_DEBUG_READ
TRACE (("R-STR: @ %p\n", addr));
DDS_TRACE("R-STR: @ %p\n", addr);
#endif
*(char**) addr = dds_stream_reuse_string (is, *((char**) addr), 0);
break;
@ -838,7 +838,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
num = dds_stream_read_uint32 (is);
#ifdef OP_DEBUG_READ
TRACE (("R-SEQ: %s <%d>\n", stream_op_type[subtype], num));
DDS_TRACE("R-SEQ: %s <%d>\n", stream_op_type[subtype], num);
#endif
/* Maintain max sequence length (may not have been set by caller) */
@ -987,7 +987,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
num = *ops++;
#ifdef OP_DEBUG_READ
TRACE (("R-ARR: %s [%d]\n", stream_op_type[subtype], num));
DDS_TRACE("R-ARR: %s [%d]\n", stream_op_type[subtype], num);
#endif
switch (subtype)
{
@ -1080,7 +1080,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
}
#ifdef OP_DEBUG_READ
TRACE (("R-UNI: switch %s case %d/%d\n", stream_op_type[subtype], disc, num));
DDS_TRACE("R-UNI: switch %s case %d/%d\n", stream_op_type[subtype], disc, num);
#endif
/* Read case matching discriminant */
@ -1094,7 +1094,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
addr = data + jeq_op[2];
#ifdef OP_DEBUG_READ
TRACE (("R-UNI: case type %s\n", stream_op_type[subtype]));
DDS_TRACE("R-UNI: case type %s\n", stream_op_type[subtype]);
#endif
switch (subtype)
{
@ -1142,7 +1142,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
case DDS_OP_VAL_BST:
{
#ifdef OP_DEBUG_READ
TRACE (("R-BST: @ %p\n", addr));
DDS_TRACE("R-BST: @ %p\n", addr);
#endif
dds_stream_reuse_string (is, (char*) addr, *ops);
ops++;
@ -1155,7 +1155,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
case DDS_OP_JSR: /* Implies nested type */
{
#ifdef OP_DEBUG_READ
TRACE (("R-JSR: %d\n", DDS_OP_JUMP (op)));
DDS_TRACE("R-JSR: %d\n", DDS_OP_JUMP (op));
#endif
dds_stream_read (is, data, ops + DDS_OP_JUMP (op));
ops++;
@ -1165,7 +1165,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
}
}
#ifdef OP_DEBUG_READ
TRACE (("R-RTS:\n"));
DDS_TRACE("R-RTS:\n");
#endif
}
@ -1304,7 +1304,7 @@ uint32_t dds_stream_extract_key (dds_stream_t *is, dds_stream_t *os, const uint3
#ifdef OP_DEBUG_KEY
if (is_key)
{
TRACE (("K-ADR: %s\n", stream_op_type[type]));
DDS_TRACE("K-ADR: %s\n", stream_op_type[type]);
}
#endif
switch (type)
@ -1347,7 +1347,7 @@ uint32_t dds_stream_extract_key (dds_stream_t *is, dds_stream_t *os, const uint3
DDS_OS_PUT4 (os, len, uint32_t);
DDS_OS_PUT_BYTES(os, DDS_CDR_ADDRESS (is, void), len);
#ifdef OP_DEBUG_KEY
TRACE (("K-ADR: String/BString (%d)\n", len));
DDS_TRACE("K-ADR: String/BString (%d)\n", len);
#endif
}
is->m_index += len;
@ -1417,7 +1417,7 @@ uint32_t dds_stream_extract_key (dds_stream_t *is, dds_stream_t *os, const uint3
#ifdef OP_DEBUG_KEY
if (is_key)
{
TRACE (("K-ADR: %s[%d]\n", stream_op_type[subtype], num));
DDS_TRACE("K-ADR: %s[%d]\n", stream_op_type[subtype], num);
}
#endif
switch (subtype)
@ -1479,7 +1479,7 @@ uint32_t dds_stream_extract_key (dds_stream_t *is, dds_stream_t *os, const uint3
assert (! is_key);
#ifdef OP_DEBUG_KEY
TRACE (("K-UNI: switch %s cases %d\n", stream_op_type[subtype], num));
DDS_TRACE("K-UNI: switch %s cases %d\n", stream_op_type[subtype], num);
#endif
/* Read discriminant */

View file

@ -14,7 +14,6 @@
#include "dds__qos.h"
#include "dds__err.h"
#include "ddsi/q_entity.h"
#include "dds__report.h"
#include "ddsc/ddsc_project.h"
#define DDS_SUBSCRIBER_STATUS_MASK \
@ -28,7 +27,8 @@ dds_subscriber_instance_hdl(
(void)e;
(void)i;
/* TODO: Get/generate proper handle. */
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Generating subscriber instance handle is not supported");
DDS_ERROR("Generating subscriber instance handle is not supported");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
static dds_return_t
@ -41,20 +41,25 @@ dds__subscriber_qos_validate(
assert(qos);
if((qos->present & QP_GROUP_DATA) && !validate_octetseq(&qos->group_data)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Group data policy is inconsistent and caused an error");
DDS_ERROR("Group data policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PARTITION) && !validate_stringseq(&qos->partition)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Partition policy is inconsistent and caused an error");
DDS_ERROR("Partition policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PRESENTATION) && validate_presentation_qospolicy(&qos->presentation)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Presentation policy is inconsistent and caused an error");
DDS_ERROR("Presentation policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_PRISMTECH_ENTITY_FACTORY) && !validate_entityfactory_qospolicy(&qos->entity_factory)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Prismtech entity factory policy is inconsistent and caused an error");
DDS_ERROR("Prismtech entity factory policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if(ret == DDS_RETCODE_OK && enabled && (qos->present & QP_PRESENTATION)) {
/* TODO: Improve/check immutable check. */
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY, "Presentation QoS policy is immutable");
DDS_ERROR("Presentation QoS policy is immutable\n");
ret = DDS_ERRNO(DDS_RETCODE_IMMUTABLE_POLICY);
}
return ret;
@ -71,7 +76,8 @@ dds_subscriber_qos_set(
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, DDSC_PROJECT_NAME" does not support changing QoS policies yet");
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
return ret;
@ -81,9 +87,14 @@ static dds_return_t
dds_subscriber_status_validate(
uint32_t mask)
{
return (mask & ~(DDS_SUBSCRIBER_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Invalid status mask") :
DDS_RETCODE_OK;
dds_return_t ret = DDS_RETCODE_OK;
if (mask & ~(DDS_SUBSCRIBER_STATUS_MASK)) {
DDS_ERROR("Invalid status mask\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
/*
@ -159,18 +170,16 @@ dds_create_subscriber(
dds_entity_t hdl;
dds__retcode_t errnr;
DDS_REPORT_STACK();
errnr = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
if (errnr != DDS_RETCODE_OK) {
hdl = DDS_ERRNO(errnr, "Error occurred on locking participant");
DDS_ERROR("Error occurred on locking participant\n");
hdl = DDS_ERRNO(errnr);
return hdl;
}
hdl = dds__create_subscriber_l(par, qos, listener);
dds_entity_unlock(par);
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -184,12 +193,11 @@ dds_notify_readers(
dds__retcode_t errnr;
dds_return_t ret;
DDS_REPORT_STACK();
errnr = dds_entity_lock(subscriber, DDS_KIND_SUBSCRIBER, &sub);
if (errnr == DDS_RETCODE_OK) {
errnr = DDS_RETCODE_UNSUPPORTED;
ret = DDS_ERRNO(errnr, "Unsupported operation");
DDS_ERROR("Unsupported operation\n");
ret = DDS_ERRNO(errnr);
iter = sub->m_children;
while (iter) {
os_mutexLock(&iter->m_mutex);
@ -199,10 +207,10 @@ dds_notify_readers(
}
dds_entity_unlock(sub);
} else {
ret = DDS_ERRNO(errnr, "Error occurred on locking subscriber");
DDS_ERROR("Error occurred on locking subscriber\n");
ret = DDS_ERRNO(errnr);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -212,7 +220,8 @@ dds_subscriber_begin_coherent(
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not currently being supported");
DDS_ERROR("Using coherency to get a coherent data set is not currently being supported\n");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
dds_return_t
@ -221,6 +230,7 @@ dds_subscriber_end_coherent(
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not currently being supported");
DDS_ERROR("Using coherency to get a coherent data set is not currently being supported\n");
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}

View file

@ -234,7 +234,7 @@ retry:
if (tk && rd)
{
TRACE (("tk=%p iid=%"PRIx64" ", &tk, tk->m_iid));
DDS_TRACE("tk=%p iid=%"PRIx64" ", &tk, tk->m_iid);
}
return tk;
}

View file

@ -24,7 +24,6 @@
#include "ddsi/ddsi_sertopic.h"
#include "ddsi/q_ddsi_discovery.h"
#include "os/os_atomics.h"
#include "dds__report.h"
#include "dds__iid.h"
#define DDS_TOPIC_STATUS_MASK \
@ -82,9 +81,14 @@ static dds_return_t
dds_topic_status_validate(
uint32_t mask)
{
return (mask & ~(DDS_TOPIC_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument mask is invalid") :
DDS_RETCODE_OK;
dds_return_t ret = DDS_RETCODE_OK;
if (mask & ~(DDS_TOPIC_STATUS_MASK)) {
DDS_ERROR("Argument mask is invalid\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
/*
@ -99,11 +103,7 @@ dds_topic_status_cb(
dds_topic *topic;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (dds_topic_lock(((dds_entity*)cb_t)->m_hdl, &topic) != DDS_RETCODE_OK) {
/* There's a deletion or closing going on. */
DDS_REPORT_FLUSH(false);
return;
}
assert(topic == cb_t);
@ -147,8 +147,6 @@ dds_topic_status_cb(
} else {
/* Something went wrong up the hierarchy. */
}
DDS_REPORT_FLUSH(rc != DDS_RETCODE_OK);
}
struct ddsi_sertopic *
@ -225,8 +223,6 @@ dds_find_topic(
struct ddsi_sertopic *st;
dds__retcode_t rc;
DDS_REPORT_STACK();
if (name) {
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &p);
if (rc == DDS_RETCODE_OK) {
@ -236,17 +232,20 @@ dds_find_topic(
dds_entity_add_ref (&st->status_cb_entity->m_entity);
tp = st->status_cb_entity->m_entity.m_hdl;
} else {
tp = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "Topic is not being created yet");
DDS_ERROR("Topic is not being created yet\n");
tp = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
}
os_mutexUnlock (&dds_global.m_mutex);
dds_entity_unlock(p);
} else {
tp = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
tp = DDS_ERRNO(rc);
}
} else {
tp = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument name is not valid");
DDS_ERROR("Argument name is not valid\n");
tp = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(tp <= 0);
return tp;
}
@ -266,22 +265,26 @@ dds_topic_qos_validate(
dds_return_t ret = DDS_RETCODE_OK;
assert(qos);
/* Check consistency. */
if (!dds_qos_validate_common(qos)) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument QoS is not valid");
DDS_ERROR("Argument QoS is not valid\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
if ((qos->present & QP_GROUP_DATA) && !validate_octetseq (&qos->group_data)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Group data QoS policy is inconsistent and caused an error");
DDS_ERROR("Group data QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_DURABILITY_SERVICE) && (validate_durability_service_qospolicy(&qos->durability_service) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Durability service QoS policy is inconsistent and caused an error");
DDS_ERROR("Durability service QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_LIFESPAN) && (validate_duration(&qos->lifespan.duration) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Lifespan QoS policy is inconsistent and caused an error");
DDS_ERROR("Lifespan QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if (qos->present & QP_HISTORY && (qos->present & QP_RESOURCE_LIMITS) && (validate_history_and_resource_limits(&qos->history, &qos->resource_limits) != 0)) {
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Lifespan QoS policy is inconsistent and caused an error");
DDS_ERROR("Lifespan QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if(ret == DDS_RETCODE_OK && enabled){
ret = dds_qos_validate_mutable_common(qos);
@ -301,7 +304,8 @@ dds_topic_qos_set(
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Changing the topic QoS is not supported.");
DDS_ERROR("Changing the topic QoS is not supported\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
return ret;
@ -342,26 +346,28 @@ dds_create_topic(
const bool asleep = !vtime_awake_p (thr->vtime);
uint32_t index;
DDS_REPORT_STACK();
if (desc == NULL){
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Topic description is NULL");
DDS_ERROR("Topic description is NULL\n");
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto bad_param_err;
}
if (name == NULL) {
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Topic name is NULL");
DDS_ERROR("Topic name is NULL\n");
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto bad_param_err;
}
if (!is_valid_name(name)) {
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Topic name contains characters that are not allowed.");
DDS_ERROR("Topic name contains characters that are not allowed\n");
hdl = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto bad_param_err;
}
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
if (rc != DDS_RETCODE_OK) {
hdl = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
hdl = DDS_ERRNO(rc);
goto lock_err;
}
@ -381,10 +387,12 @@ dds_create_topic(
st = (struct ddsi_sertopic_default *)stgeneric;
if (st->type != desc) {
/* FIXME: should copy the type, perhaps? but then the pointers will no longer be the same */
hdl = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET, "Create topic with mismatching type.");
DDS_ERROR("Create topic with mismatching type\n");
hdl = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
} else if (!dupdef_qos_ok(qos, stgeneric)) {
/* FIXME: should copy the type, perhaps? but then the pointers will no longer be the same */
hdl = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Create topic with mismatching qos.");
DDS_ERROR("Create topic with mismatching qos\n");
hdl = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
} else {
dds_entity_add_ref (&st->c.status_cb_entity->m_entity);
hdl = st->c.status_cb_entity->m_entity.m_hdl;
@ -483,7 +491,6 @@ qos_err:
dds_entity_unlock(par);
lock_err:
bad_param_err:
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -571,14 +578,14 @@ dds_get_name(
dds_return_t ret;
dds__retcode_t rc;
DDS_REPORT_STACK();
if(size <= 0){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument size is smaller than 0");
DDS_ERROR("Argument size is smaller than 0\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if(name == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument name is NULL");
DDS_ERROR("Argument name is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
name[0] = '\0';
@ -588,11 +595,11 @@ dds_get_name(
dds_topic_unlock(t);
ret = DDS_RETCODE_OK;
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking topic");
DDS_ERROR("Error occurred on locking topic\n");
ret = DDS_ERRNO(rc);
goto fail;
}
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -607,27 +614,27 @@ dds_get_type_name(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
if(size <= 0){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument size is smaller than 0");
DDS_ERROR("Argument size is smaller than 0\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
if(name == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument name is NULL");
DDS_ERROR("Argument name is NULL\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto fail;
}
name[0] = '\0';
rc = dds_topic_lock(topic, &t);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking topic");
DDS_ERROR("Error occurred on locking topic\n");
ret = DDS_ERRNO(rc);
goto fail;
}
(void)snprintf(name, size, "%s", t->m_stopic->typename);
dds_topic_unlock(t);
ret = DDS_RETCODE_OK;
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
@ -640,11 +647,10 @@ dds_get_inconsistent_topic_status(
dds_topic *t;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_topic_lock(topic, &t);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking topic");
DDS_ERROR("Error occurred on locking topic\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -657,6 +663,5 @@ dds_get_inconsistent_topic_status(
}
dds_topic_unlock(t);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -16,7 +16,6 @@
#include "dds__readcond.h"
#include "dds__rhc.h"
#include "dds__err.h"
#include "dds__report.h"
#define dds_waitset_lock(hdl, obj) dds_entity_lock(hdl, DDS_KIND_WAITSET, (dds_entity**)obj)
@ -72,10 +71,12 @@ dds_waitset_wait_impl(
dds_attachment *prev;
if ((xs == NULL) && (nxs != 0)){
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "A size was given, but no array.");
DDS_ERROR("A size was given, but no array\n");
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
if ((xs != NULL) && (nxs == 0)){
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Array is given with an invalid size");
DDS_ERROR("Array is given with an invalid size\n");
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
/* Locking the waitset here will delay a possible deletion until it is
@ -152,12 +153,14 @@ dds_waitset_wait_impl(
} else if (rc == DDS_RETCODE_TIMEOUT) {
ret = 0;
} else {
ret = DDS_ERRNO(rc, "Internal error");
DDS_ERROR("Internal error");
ret = DDS_ERRNO(rc);
}
dds_waitset_unlock(ws);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking waitset");
DDS_ERROR("Error occurred on locking waitset\n");
ret = DDS_ERRNO(rc);
}
return ret;
@ -229,8 +232,6 @@ dds_create_waitset(
dds_entity *par;
dds__retcode_t rc;
DDS_REPORT_STACK();
rc = dds_entity_lock(participant, DDS_KIND_PARTICIPANT, &par);
if (rc == DDS_RETCODE_OK) {
dds_waitset *waitset = dds_alloc(sizeof(*waitset));
@ -240,9 +241,10 @@ dds_create_waitset(
waitset->triggered = NULL;
dds_entity_unlock(par);
} else {
hdl = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
hdl = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -258,8 +260,6 @@ dds_waitset_get_entities(
dds__retcode_t rc;
dds_waitset *ws;
DDS_REPORT_STACK();
rc = dds_waitset_lock(waitset, &ws);
if (rc == DDS_RETCODE_OK) {
dds_attachment* iter;
@ -283,9 +283,10 @@ dds_waitset_get_entities(
}
dds_waitset_unlock(ws);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking waitset");
DDS_ERROR("Error occurred on locking waitset\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret < 0);
return ret;
}
@ -359,8 +360,6 @@ dds_waitset_attach(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
rc = dds_waitset_lock(waitset, &ws);
if (rc == DDS_RETCODE_OK) {
if (waitset != entity) {
@ -390,18 +389,21 @@ dds_waitset_attach(
}
ret = DDS_RETCODE_OK;
} else if (rc != DDS_RETCODE_PRECONDITION_NOT_MET) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Entity is not valid");
DDS_ERROR("Entity is not valid\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
} else {
ret = DDS_ERRNO(rc, "Entity is already attached.");
DDS_ERROR("Entity is already attached\n");
ret = DDS_ERRNO(rc);
}
if ((e != NULL) && (waitset != entity)) {
dds_entity_unlock(e);
}
dds_waitset_unlock(ws);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking waitset");
DDS_ERROR("Error occurred on locking waitset\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK );
return ret;
}
@ -415,8 +417,6 @@ dds_waitset_detach(
dds__retcode_t rc;
dds_return_t ret;
DDS_REPORT_STACK();
rc = dds_waitset_lock(waitset, &ws);
if (rc == DDS_RETCODE_OK) {
/* Possibly fails when entity was not attached. */
@ -429,15 +429,18 @@ dds_waitset_detach(
dds_waitset_remove(ws, entity);
ret = DDS_RETCODE_OK;
} else if (rc != DDS_RETCODE_PRECONDITION_NOT_MET) {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "The given entity to detach is invalid.");
DDS_ERROR("The given entity to detach is invalid\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
} else {
ret = DDS_ERRNO(rc, "The given entity to detach was not attached previously.");
DDS_ERROR("The given entity to detach was not attached previously\n");
ret = DDS_ERRNO(rc);
}
dds_waitset_unlock(ws);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking waitset");
DDS_ERROR("Error occurred on locking waitset\n");
ret = DDS_ERRNO(rc);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -449,11 +452,7 @@ dds_waitset_wait_until(
_In_ size_t nxs,
_In_ dds_time_t abstimeout)
{
dds_return_t ret;
DDS_REPORT_STACK();
ret = dds_waitset_wait_impl(waitset, xs, nxs, abstimeout, dds_time());
DDS_REPORT_FLUSH(ret <0 );
return ret;
return dds_waitset_wait_impl(waitset, xs, nxs, abstimeout, dds_time());
}
_Pre_satisfies_((waitset & DDS_ENTITY_KIND_MASK) == DDS_KIND_WAITSET)
@ -465,16 +464,16 @@ dds_waitset_wait(
_In_ dds_duration_t reltimeout)
{
dds_entity_t ret;
DDS_REPORT_STACK();
if (reltimeout >= 0) {
dds_time_t tnow = dds_time();
dds_time_t abstimeout = (DDS_INFINITY - reltimeout <= tnow) ? DDS_NEVER : (tnow + reltimeout);
ret = dds_waitset_wait_impl(waitset, xs, nxs, abstimeout, tnow);
} else{
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Negative timeout");
DDS_ERROR("Negative timeout\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret <0 );
return ret;
}
@ -488,14 +487,13 @@ dds_waitset_set_trigger(
dds__retcode_t rc;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
/* Locking the waitset here will delay a possible deletion until it is
* unlocked. Even when the related mutex is unlocked when we want to send
* a signal. */
rc = dds_waitset_lock(waitset, &ws);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking waitset");
DDS_ERROR("Error occurred on locking waitset\n");
ret = DDS_ERRNO(rc);
goto fail;
}
if (trigger) {
@ -506,7 +504,6 @@ dds_waitset_set_trigger(
dds_waitset_signal_entity(ws);
dds_waitset_unlock(ws);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}

View file

@ -105,20 +105,6 @@ struct whc_sample_iter_sizecheck {
char fits_in_generic_type[sizeof(struct whc_sample_iter_impl) <= sizeof(struct whc_sample_iter) ? 1 : -1];
};
/* Avoiding all nn_log-related activities when LC_WHC is not set
(and it hardly ever is, as it is not even included in "trace")
saves a couple of % CPU on a high-rate publisher - that's worth
it. So we need a macro & a support function. */
static int trace_whc (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
nn_vlog (LC_WHC, fmt, ap);
va_end (ap);
return 0;
}
#define TRACE_WHC(args) ((config.enabled_logcats & LC_WHC) ? (trace_whc args) : 0)
/* Hash + interval tree adminitration of samples-by-sequence number
* - by definition contains all samples in WHC (unchanged from older versions)
* Circular array of samples per instance, inited to all 0
@ -568,7 +554,7 @@ static void free_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_s
oldn->idxnode = NULL;
if (oldn->seq <= max_drop_seq)
{
TRACE_WHC((" prune tl whcn %p\n", (void *)oldn));
DDS_LOG(DDS_LC_WHC, " prune tl whcn %p\n", (void *)oldn);
assert(oldn != whc->maxseq_node);
whc_delete_one (whc, oldn);
}
@ -882,7 +868,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
if (whc->is_transient_local && whc->tldepth == 0)
{
/* KEEP_ALL on transient local, so we can never ever delete anything */
TRACE_WHC((" KEEP_ALL transient-local: do nothing\n"));
DDS_LOG(DDS_LC_WHC, " KEEP_ALL transient-local: do nothing\n");
*deferred_free_list = NULL;
return 0;
}
@ -892,11 +878,11 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
prev_seq = whcn ? whcn->prev_seq : NULL;
while (whcn && whcn->seq <= max_drop_seq)
{
TRACE_WHC((" whcn %p %"PRId64, (void *) whcn, whcn->seq));
DDS_LOG(DDS_LC_WHC, " whcn %p %"PRId64, (void *) whcn, whcn->seq);
if (whcn_in_tlidx(whc, whcn->idxnode, whcn->idxnode_pos))
{
/* quickly skip over samples in tlidx */
TRACE_WHC((" tl:keep"));
DDS_LOG(DDS_LC_WHC, " tl:keep");
if (whcn->unacked)
{
assert (whc->unacked_bytes >= whcn->size);
@ -914,13 +900,13 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
}
else
{
TRACE_WHC((" delete"));
DDS_LOG(DDS_LC_WHC, " delete");
last_to_free->next_seq = whcn;
last_to_free = last_to_free->next_seq;
whc_delete_one_intv (whc, &intv, &whcn);
ndropped++;
}
TRACE_WHC(("\n"));
DDS_LOG(DDS_LC_WHC, "\n");
}
if (prev_seq)
prev_seq->next_seq = whcn;
@ -937,7 +923,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
if (whc->tldepth > 0 && whc->idxdepth > whc->tldepth)
{
assert(whc->hdepth == whc->idxdepth);
TRACE_WHC((" idxdepth %u > tldepth %u > 0 -- must prune\n", whc->idxdepth, whc->tldepth));
DDS_LOG(DDS_LC_WHC, " idxdepth %u > tldepth %u > 0 -- must prune\n", whc->idxdepth, whc->tldepth);
/* Do a second pass over the sequence number range we just processed: this time we only
encounter samples that were retained because of the transient-local durability setting
@ -948,14 +934,14 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
struct whc_idxnode * const idxn = whcn->idxnode;
unsigned cnt, idx;
TRACE_WHC((" whcn %p %"PRId64" idxn %p prune_seq %"PRId64":", (void *)whcn, whcn->seq, (void *)idxn, idxn->prune_seq));
DDS_LOG(DDS_LC_WHC, " whcn %p %"PRId64" idxn %p prune_seq %"PRId64":", (void *)whcn, whcn->seq, (void *)idxn, idxn->prune_seq);
assert(whcn_in_tlidx(whc, idxn, whcn->idxnode_pos));
assert (idxn->prune_seq <= max_drop_seq);
if (idxn->prune_seq == max_drop_seq)
{
TRACE_WHC((" already pruned\n"));
DDS_LOG(DDS_LC_WHC, " already pruned\n");
whcn = whcn->next_seq;
continue;
}
@ -983,7 +969,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
whcn_template.serdata = ddsi_serdata_ref(oldn->serdata);
assert(oldn->seq < whcn->seq);
#endif
TRACE_WHC((" del %p %"PRId64, (void *) oldn, oldn->seq));
DDS_LOG(DDS_LC_WHC, " del %p %"PRId64, (void *) oldn, oldn->seq);
whc_delete_one (whc, oldn);
#ifndef NDEBUG
assert(ut_hhLookup(whc->idx_hash, &template) == idxn);
@ -991,7 +977,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
#endif
}
}
TRACE_WHC(("\n"));
DDS_LOG(DDS_LC_WHC, "\n");
whcn = whcn->next_seq;
}
}
@ -1014,13 +1000,13 @@ static unsigned whc_default_remove_acked_messages (struct whc *whc_generic, seqn
assert (max_drop_seq < MAX_SEQ_NUMBER);
assert (max_drop_seq >= whc->max_drop_seq);
if (config.enabled_logcats & LC_WHC)
if (dds_get_log_mask() & DDS_LC_WHC)
{
struct whc_state tmp;
get_state_locked(whc, &tmp);
TRACE_WHC(("whc_default_remove_acked_messages(%p max_drop_seq %"PRId64")\n", (void *)whc, max_drop_seq));
TRACE_WHC((" whc: [%"PRId64",%"PRId64"] max_drop_seq %"PRId64" h %u tl %u\n",
tmp.min_seq, tmp.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
DDS_LOG(DDS_LC_WHC, "whc_default_remove_acked_messages(%p max_drop_seq %"PRId64")\n", (void *)whc, max_drop_seq);
DDS_LOG(DDS_LC_WHC, " whc: [%"PRId64",%"PRId64"] max_drop_seq %"PRId64" h %u tl %u\n",
tmp.min_seq, tmp.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth);
}
check_whc (whc);
@ -1108,13 +1094,13 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
os_mutexLock (&whc->lock);
check_whc (whc);
if (config.enabled_logcats & LC_WHC)
if (dds_get_log_mask() & DDS_LC_WHC)
{
struct whc_state whcst;
get_state_locked(whc, &whcst);
TRACE_WHC(("whc_default_insert(%p max_drop_seq %"PRId64" seq %"PRId64" plist %p serdata %p:%"PRIx32")\n", (void *)whc, max_drop_seq, seq, (void*)plist, (void*)serdata, serdata->hash));
TRACE_WHC((" whc: [%"PRId64",%"PRId64"] max_drop_seq %"PRId64" h %u tl %u\n",
whcst.min_seq, whcst.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
DDS_LOG(DDS_LC_WHC, "whc_default_insert(%p max_drop_seq %"PRId64" seq %"PRId64" plist %p serdata %p:%"PRIx32")\n", (void *)whc, max_drop_seq, seq, (void*)plist, (void*)serdata, serdata->hash);
DDS_LOG(DDS_LC_WHC, " whc: [%"PRId64",%"PRId64"] max_drop_seq %"PRId64" h %u tl %u\n",
whcst.min_seq, whcst.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth);
}
assert (max_drop_seq < MAX_SEQ_NUMBER);
@ -1128,12 +1114,12 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
/* Always insert in seq admin */
newn = whc_default_insert_seq (whc, max_drop_seq, seq, plist, serdata);
TRACE_WHC((" whcn %p:", (void*)newn));
DDS_LOG(DDS_LC_WHC, " whcn %p:", (void*)newn);
/* Special case of empty data (such as commit messages) can't go into index, and if we're not maintaining an index, we're done, too */
if (serdata->kind == SDK_EMPTY || whc->idxdepth == 0)
{
TRACE_WHC((" empty or no hist\n"));
DDS_LOG(DDS_LC_WHC, " empty or no hist\n");
os_mutexUnlock (&whc->lock);
return 0;
}
@ -1142,15 +1128,15 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
if ((idxn = ut_hhLookup (whc->idx_hash, &template)) != NULL)
{
/* Unregisters cause deleting of index entry, non-unregister of adding/overwriting in history */
TRACE_WHC((" idxn %p", (void *)idxn));
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
if (serdata->statusinfo & NN_STATUSINFO_UNREGISTER)
{
TRACE_WHC((" unreg:delete\n"));
DDS_LOG(DDS_LC_WHC, " unreg:delete\n");
delete_one_instance_from_idx (whc, max_drop_seq, idxn);
if (newn->seq <= max_drop_seq)
{
struct whc_node *prev_seq = newn->prev_seq;
TRACE_WHC((" unreg:seq <= max_drop_seq: delete newn\n"));
DDS_LOG(DDS_LC_WHC, " unreg:seq <= max_drop_seq: delete newn\n");
whc_delete_one (whc, newn);
whc->maxseq_node = prev_seq;
}
@ -1162,7 +1148,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
idxn->headidx = 0;
if ((oldn = idxn->hist[idxn->headidx]) != NULL)
{
TRACE_WHC((" overwrite whcn %p", (void *)oldn));
DDS_LOG(DDS_LC_WHC, " overwrite whcn %p", (void *)oldn);
oldn->idxnode = NULL;
}
idxn->hist[idxn->headidx] = newn;
@ -1171,7 +1157,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
if (oldn && (whc->hdepth > 0 || oldn->seq <= max_drop_seq))
{
TRACE_WHC((" prune whcn %p", (void *)oldn));
DDS_LOG(DDS_LC_WHC, " prune whcn %p", (void *)oldn);
assert(oldn != whc->maxseq_node);
whc_delete_one (whc, oldn);
}
@ -1187,23 +1173,23 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
pos -= whc->idxdepth;
if ((oldn = idxn->hist[pos]) != NULL)
{
TRACE_WHC((" prune tl whcn %p", (void *)oldn));
DDS_LOG(DDS_LC_WHC, " prune tl whcn %p", (void *)oldn);
assert(oldn != whc->maxseq_node);
whc_delete_one (whc, oldn);
}
}
TRACE_WHC(("\n"));
DDS_LOG(DDS_LC_WHC, "\n");
}
}
else
{
TRACE_WHC((" newkey"));
DDS_LOG(DDS_LC_WHC, " newkey");
/* Ignore unregisters, but insert everything else */
if (!(serdata->statusinfo & NN_STATUSINFO_UNREGISTER))
{
unsigned i;
idxn = os_malloc (sizeof (*idxn) + whc->idxdepth * sizeof (idxn->hist[0]));
TRACE_WHC((" idxn %p", (void *)idxn));
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
dds_tkmap_instance_ref(tk);
idxn->iid = tk->m_iid;
idxn->tk = tk;
@ -1219,16 +1205,16 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
}
else
{
TRACE_WHC((" unreg:skip"));
DDS_LOG(DDS_LC_WHC, " unreg:skip");
if (newn->seq <= max_drop_seq)
{
struct whc_node *prev_seq = newn->prev_seq;
TRACE_WHC((" unreg:seq <= max_drop_seq: delete newn\n"));
DDS_LOG(DDS_LC_WHC, " unreg:seq <= max_drop_seq: delete newn\n");
whc_delete_one (whc, newn);
whc->maxseq_node = prev_seq;
}
}
TRACE_WHC(("\n"));
DDS_LOG(DDS_LC_WHC, "\n");
}
os_mutexUnlock (&whc->lock);
return 0;

View file

@ -10,6 +10,7 @@
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include <assert.h>
#include <string.h>
#include "dds__writer.h"
#include "dds__write.h"
#include "dds__tkmap.h"
@ -23,9 +24,7 @@
#include "ddsi/q_ephash.h"
#include "ddsi/q_config.h"
#include "ddsi/q_entity.h"
#include "dds__report.h"
#include "ddsi/q_radmin.h"
#include <string.h>
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
dds_return_t
@ -37,20 +36,20 @@ dds_write(
dds__retcode_t rc;
dds_writer *wr;
DDS_REPORT_STACK();
if (data != NULL) {
rc = dds_writer_lock(writer, &wr);
if (rc == DDS_RETCODE_OK) {
ret = dds_write_impl(wr, data, dds_time(), 0);
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
DDS_ERROR("Error occurred on locking entity\n");
ret = DDS_ERRNO(rc);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "No data buffer provided");
DDS_ERROR("No data buffer provided\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -69,10 +68,12 @@ dds_writecdr(
ret = dds_writecdr_impl (wr, serdata, dds_time (), 0);
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
}
} else{
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Given cdr has NULL value");
DDS_ERROR("Given cdr has NULL value\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
@ -88,14 +89,14 @@ dds_write_ts(
dds__retcode_t rc;
dds_writer *wr;
DDS_REPORT_STACK();
if(data == NULL){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument data has NULL value");
DDS_ERROR("Argument data has NULL value\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
if(timestamp < 0){
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Argument timestamp has negative value");
DDS_ERROR("Argument timestamp has negative value\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
goto err;
}
rc = dds_writer_lock(writer, &wr);
@ -103,10 +104,10 @@ dds_write_ts(
ret = dds_write_impl(wr, data, timestamp, 0);
dds_writer_unlock(wr);
} else {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
}
err:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -126,13 +127,14 @@ deliver_locally(
make_proxy_writer_info(&pwr_info, &wr->e, wr->xqos);
for (i = 0; rdary[i]; i++) {
bool stored;
TRACE (("reader %x:%x:%x:%x\n", PGUID (rdary[i]->e.guid)));
DDS_TRACE("reader %x:%x:%x:%x\n", PGUID (rdary[i]->e.guid));
dds_duration_t max_block_ms = nn_from_ddsi_duration(wr->xqos->reliability.max_blocking_time) / DDS_NSECS_IN_MSEC;
do {
stored = (ddsi_plugin.rhc_plugin.rhc_store_fn) (rdary[i]->rhc, &pwr_info, payload, tk);
if (!stored) {
if (max_block_ms <= 0) {
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT, "The writer could not deliver data on time, probably due to a local reader resources being full.");
DDS_ERROR("The writer could not deliver data on time, probably due to a local reader resources being full\n");
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT);
} else {
dds_sleepfor(DDS_MSECS(DDS_HEADBANG_TIMEOUT_MS));
}
@ -163,7 +165,7 @@ deliver_locally(
for (m = ut_avlIterFirst (&wr_local_readers_treedef, &wr->local_readers, &it); m != NULL; m = ut_avlIterNext (&it)) {
struct reader *rd;
if ((rd = ephash_lookup_reader_guid (&m->rd_guid)) != NULL) {
TRACE (("reader-via-guid %x:%x:%x:%x\n", PGUID (rd->e.guid)));
DDS_TRACE("reader-via-guid %x:%x:%x:%x\n", PGUID (rd->e.guid));
/* Copied the return value ignore from DDSI deliver_user_data() function. */
(void)(ddsi_plugin.rhc_plugin.rhc_store_fn) (rd->rhc, &pwr_info, payload, tk);
}
@ -195,7 +197,8 @@ dds_write_impl(
struct ddsi_serdata *d;
if (data == NULL) {
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "No data buffer provided");
DDS_ERROR("No data buffer provided\n");
return DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
/* Check for topic filter */
@ -227,11 +230,14 @@ dds_write_impl(
}
ret = DDS_RETCODE_OK;
} else if (w_rc == ERR_TIMEOUT) {
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT, "The writer could not deliver data on time, probably due to a reader resources being full.");
DDS_ERROR("The writer could not deliver data on time, probably due to a reader resources being full\n");
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT);
} else if (w_rc == ERR_INVALID_DATA) {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Invalid data provided");
DDS_ERROR("Invalid data provided\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
DDS_ERROR("Internal error\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
if (ret == DDS_RETCODE_OK) {
ret = deliver_locally (ddsi_wr, d, tk);
@ -286,11 +292,14 @@ dds_writecdr_impl(
}
ret = DDS_RETCODE_OK;
} else if (w_rc == ERR_TIMEOUT) {
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT, "The writer could not deliver data on time, probably due to a reader resources being full.");
DDS_ERROR("The writer could not deliver data on time, probably due to a reader resources being full\n");
ret = DDS_ERRNO(DDS_RETCODE_TIMEOUT);
} else if (w_rc == ERR_INVALID_DATA) {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Invalid data provided");
DDS_ERROR("Invalid data provided\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
DDS_ERROR("Internal error\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
if (ret == DDS_RETCODE_OK) {
@ -318,9 +327,7 @@ void
dds_write_flush(
dds_entity_t writer)
{
dds_return_t ret = DDS_RETCODE_OK;
dds__retcode_t rc;
DDS_REPORT_STACK();
struct thread_state1 * const thr = lookup_thread_state ();
const bool asleep = !vtime_awake_p (thr->vtime);
@ -333,14 +340,13 @@ dds_write_flush(
if (rc == DDS_RETCODE_OK) {
nn_xpack_send (wr->m_xp, true);
dds_writer_unlock(wr);
ret = DDS_RETCODE_OK;
} else{
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
}
if (asleep) {
thread_state_asleep (thr);
}
DDS_REPORT_FLUSH(ret < 0);
return ;
}

View file

@ -22,7 +22,6 @@
#include "dds__init.h"
#include "dds__tkmap.h"
#include "dds__whc.h"
#include "dds__report.h"
#include "ddsc/ddsc_project.h"
#define DDS_WRITER_STATUS_MASK \
@ -46,9 +45,14 @@ static dds_return_t
dds_writer_status_validate(
uint32_t mask)
{
return (mask & ~(DDS_WRITER_STATUS_MASK)) ?
DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER, "Invalid status mask") :
DDS_RETCODE_OK;
dds_return_t ret = DDS_RETCODE_OK;
if (mask & ~(DDS_WRITER_STATUS_MASK)) {
DDS_ERROR("Invalid status mask\n");
ret = DDS_ERRNO(DDS_RETCODE_BAD_PARAMETER);
}
return ret;
}
/*
@ -75,11 +79,8 @@ dds_writer_status_cb(
return;
}
DDS_REPORT_STACK();
if (dds_writer_lock(((dds_entity*)entity)->m_hdl, &wr) != DDS_RETCODE_OK) {
/* There's a deletion or closing going on. */
DDS_REPORT_FLUSH(false);
return;
}
assert(wr == entity);
@ -180,8 +181,6 @@ dds_writer_status_cb(
} else {
/* Something went wrong up the hierarchy. */
}
DDS_REPORT_FLUSH(rc != DDS_RETCODE_OK);
}
static uint32_t
@ -215,7 +214,8 @@ dds_writer_close(
nn_xpack_send (wr->m_xp, false);
}
if (delete_writer (&e->m_guid) != 0) {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
DDS_ERROR("Internal error");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
if (asleep) {
thread_state_asleep(thr);
@ -268,19 +268,24 @@ dds_writer_qos_validate(
/* Check consistency. */
if(dds_qos_validate_common(qos) != true){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Provided inconsistent QoS policy");
DDS_ERROR("Provided inconsistent QoS policy\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if((qos->present & QP_USER_DATA) && validate_octetseq(&qos->user_data) != true){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "User Data QoS policy is inconsistent and caused an error");
DDS_ERROR("User Data QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_DURABILITY_SERVICE) && validate_durability_service_qospolicy(&qos->durability_service) != 0){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Durability service QoS policy is inconsistent and caused an error");
DDS_ERROR("Durability service QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_LIFESPAN) && validate_duration(&qos->lifespan.duration) != 0){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Lifespan QoS policy is inconsistent and caused an error");
DDS_ERROR("Lifespan QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if ((qos->present & QP_HISTORY) && (qos->present & QP_RESOURCE_LIMITS) && (validate_history_and_resource_limits(&qos->history, &qos->resource_limits) != 0)){
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY, "Resource limits QoS policy is inconsistent and caused an error");
DDS_ERROR("Resource limits QoS policy is inconsistent and caused an error\n");
ret = DDS_ERRNO(DDS_RETCODE_INCONSISTENT_POLICY);
}
if(ret == DDS_RETCODE_OK && enabled) {
ret = dds_qos_validate_mutable_common(qos);
@ -330,11 +335,13 @@ dds_writer_qos_set(
thread_state_asleep (thr);
}
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Setting ownership strength doesn't make sense when the ownership is shared.");
DDS_ERROR("Setting ownership strength doesn't make sense when the ownership is shared\n");
ret = DDS_ERRNO(DDS_RETCODE_ERROR);
}
} else {
if (enabled) {
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, DDSC_PROJECT_NAME" does not support changing QoS policies yet");
DDS_ERROR(DDSC_PROJECT_NAME" does not support changing QoS policies yet\n");
ret = DDS_ERRNO(DDS_RETCODE_UNSUPPORTED);
}
}
}
@ -420,8 +427,6 @@ dds_create_writer(
ddsi_tran_conn_t conn = gv.data_conn_uc;
dds_return_t ret;
DDS_REPORT_STACK();
/* Try claiming a participant. If that's not working, then it could be a subscriber. */
if(dds_entity_kind(participant_or_publisher) == DDS_KIND_PARTICIPANT){
publisher = dds_create_publisher(participant_or_publisher, qos, NULL);
@ -431,7 +436,8 @@ dds_create_writer(
rc = dds_entity_lock(publisher, DDS_KIND_PUBLISHER, &pub);
if (rc != DDS_RETCODE_OK) {
writer = DDS_ERRNO(rc, "Error occurred on locking publisher");
DDS_ERROR("Error occurred on locking publisher\n");
writer = DDS_ERRNO(rc);
goto err_pub_lock;
}
@ -441,7 +447,8 @@ dds_create_writer(
rc = dds_entity_lock(topic, DDS_KIND_TOPIC, &tp);
if (rc != DDS_RETCODE_OK) {
writer = DDS_ERRNO(rc, "Error occurred on locking topic");
DDS_ERROR("Error occurred on locking topic\n");
writer = DDS_ERRNO(rc);
goto err_tp_lock;
}
assert(((dds_topic*)tp)->m_stopic);
@ -507,7 +514,6 @@ dds_create_writer(
}
dds_entity_unlock(tp);
dds_entity_unlock(pub);
DDS_REPORT_FLUSH(writer <= 0);
return writer;
err_bad_qos:
@ -518,7 +524,6 @@ err_tp_lock:
(void)dds_delete(publisher);
}
err_pub_lock:
DDS_REPORT_FLUSH(writer <= 0);
return writer;
}
@ -531,15 +536,14 @@ dds_get_publisher(
{
dds_entity_t hdl = DDS_RETCODE_OK;
DDS_REPORT_STACK();
hdl = dds_valid_hdl(writer, DDS_KIND_WRITER);
if(hdl != DDS_RETCODE_OK){
hdl = DDS_ERRNO(hdl, "Provided handle is not writer kind, so it is not valid");
DDS_ERROR("Provided handle is not writer kind, so it is not valid\n");
hdl = DDS_ERRNO(hdl);
} else{
hdl = dds_get_parent(writer);
}
DDS_REPORT_FLUSH(hdl <= 0);
return hdl;
}
@ -553,11 +557,10 @@ dds_get_publication_matched_status (
dds_writer *wr;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -571,7 +574,6 @@ dds_get_publication_matched_status (
}
dds_writer_unlock(wr);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -585,11 +587,10 @@ dds_get_liveliness_lost_status (
dds_writer *wr;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -602,7 +603,6 @@ dds_get_liveliness_lost_status (
}
dds_writer_unlock(wr);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -616,11 +616,10 @@ dds_get_offered_deadline_missed_status(
dds_writer *wr;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -633,7 +632,6 @@ dds_get_offered_deadline_missed_status(
}
dds_writer_unlock(wr);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}
@ -647,11 +645,10 @@ dds_get_offered_incompatible_qos_status (
dds_writer *wr;
dds_return_t ret = DDS_RETCODE_OK;
DDS_REPORT_STACK();
rc = dds_writer_lock(writer, &wr);
if (rc != DDS_RETCODE_OK) {
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
DDS_ERROR("Error occurred on locking writer\n");
ret = DDS_ERRNO(rc);
goto fail;
}
/* status = NULL, application do not need the status, but reset the counter & triggered bit */
@ -664,6 +661,5 @@ dds_get_offered_incompatible_qos_status (
}
dds_writer_unlock(wr);
fail:
DDS_REPORT_FLUSH(ret != DDS_RETCODE_OK);
return ret;
}