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;
}

View file

@ -17,7 +17,6 @@
16 src/q_init.c
17 src/q_lat_estim.c
18 src/q_lease.c
19 src/q_log.c
20 src/q_md5.c
21 src/q_misc.c
22 src/q_nwif.c

View file

@ -37,7 +37,6 @@ PREPEND(srcs_ddsi "${CMAKE_CURRENT_LIST_DIR}/src"
q_init.c
q_lat_estim.c
q_lease.c
q_log.c
q_md5.c
q_misc.c
q_nwif.c

View file

@ -64,7 +64,7 @@ int addrset_any_mc (const struct addrset *as, nn_locator_t *dst);
int addrset_forone (struct addrset *as, addrset_forone_fun_t f, void *arg);
void addrset_forall (struct addrset *as, addrset_forall_fun_t f, void *arg);
size_t addrset_forall_count (struct addrset *as, addrset_forall_fun_t f, void *arg);
void nn_log_addrset (logcat_t tf, const char *prefix, const struct addrset *as);
void nn_log_addrset (uint32_t tf, const char *prefix, const struct addrset *as);
/* Tries to lock A then B for a decent check, returning false if
trylock B fails */

View file

@ -216,7 +216,7 @@ enum many_sockets_mode {
struct config
{
int valid;
logcat_t enabled_logcats;
uint32_t enabled_logcats;
char *servicename;
char *pcap_file;

View file

@ -308,13 +308,6 @@ struct q_globals {
os_timePowerEvents powerEvents;
struct nn_group_membership *mship;
/* Static log buffer, for those rare cases a thread calls nn_vlogb
without having its own log buffer (happens during config file
processing and for listeners, &c. */
int static_logbuf_lock_inited;
os_mutex static_logbuf_lock;
struct logbuf static_logbuf;
};
extern struct q_globals OSAPI_EXPORT gv;

View file

@ -35,7 +35,7 @@ void nn_lat_estim_init (struct nn_lat_estim *le);
void nn_lat_estim_fini (struct nn_lat_estim *le);
void nn_lat_estim_update (struct nn_lat_estim *le, int64_t est);
double nn_lat_estim_current (const struct nn_lat_estim *le);
int nn_lat_estim_log (logcat_t logcat, const char *tag, const struct nn_lat_estim *le);
int nn_lat_estim_log (uint32_t logcat, const char *tag, const struct nn_lat_estim *le);
#if defined (__cplusplus)
}

View file

@ -21,62 +21,21 @@
extern "C" {
#endif
#define LC_FATAL 1u
#define LC_ERROR 2u
#define LC_WARNING 4u
#define LC_CONFIG 8u
#define LC_INFO 16u
#define LC_DISCOVERY 32u
#define LC_DATA 64u
#define LC_TRACE 128u
#define LC_RADMIN 256u
#define LC_TIMING 512u
#define LC_TRAFFIC 1024u
#define LC_TOPIC 2048u
#define LC_TCP 4096u
#define LC_PLIST 8192u
#define LC_WHC 16384u
#define LC_THROTTLE 32768u
#define LC_ALLCATS (LC_FATAL | LC_ERROR | LC_WARNING | LC_CONFIG | LC_INFO | LC_DISCOVERY | LC_DATA | LC_TRACE | LC_TIMING | LC_TRAFFIC | LC_TCP | LC_THROTTLE)
typedef unsigned logcat_t;
typedef struct logbuf {
char buf[2048];
size_t bufsz;
size_t pos;
nn_wctime_t tstamp;
} *logbuf_t;
logbuf_t logbuf_new (void);
void logbuf_init (logbuf_t lb);
void logbuf_free (logbuf_t lb);
int nn_vlog (logcat_t cat, const char *fmt, va_list ap);
OSAPI_EXPORT int nn_log (_In_ logcat_t cat, _In_z_ _Printf_format_string_ const char *fmt, ...) __attribute_format__((printf,2,3));
OSAPI_EXPORT int nn_trace (_In_z_ _Printf_format_string_ const char *fmt, ...) __attribute_format__((printf,1,2));
void nn_log_set_tstamp (nn_wctime_t tnow);
#define TRACE(args) ((config.enabled_logcats & LC_TRACE) ? (nn_trace args) : 0)
#define LOG_THREAD_CPUTIME(guard) do { \
if (config.enabled_logcats & LC_TIMING) \
{ \
nn_mtime_t tnowlt = now_mt (); \
if (tnowlt.v >= (guard).v) \
{ \
int64_t ts = get_thread_cputime (); \
nn_log (LC_TIMING, "thread_cputime %d.%09d\n", \
(int) (ts / T_SECOND), (int) (ts % T_SECOND)); \
(guard).v = tnowlt.v + T_SECOND; \
} \
} \
} while (0)
#define NN_WARNING(fmt,...) nn_log (LC_WARNING, ("<Warning> " fmt),##__VA_ARGS__)
#define NN_ERROR(fmt,...) nn_log (LC_ERROR, ("<Error> " fmt),##__VA_ARGS__)
#define NN_FATAL(fmt,...) nn_log (LC_FATAL, ("<Fatal> " fmt),##__VA_ARGS__)
/* LOG_THREAD_CPUTIME must be considered private. */
#define LOG_THREAD_CPUTIME(guard) \
do { \
if (dds_get_log_mask() & DDS_LC_TIMING) { \
nn_mtime_t tnowlt = now_mt(); \
if (tnowlt.v >= (guard).v) { \
const char fmt[] = "thread_cputime %d.%09d\n"; \
int64_t ts = get_thread_cputime (); \
dds_log( \
DDS_LC_TIMING, __FILE__, __LINE__, OS_FUNCTION, \
fmt, (int)(ts / T_SECOND), (int)(ts % T_SECOND)); \
(guard).v = tnowlt.v + T_SECOND; \
} \
} \
} while (0)
#if defined (__cplusplus)
}

View file

@ -61,7 +61,6 @@ struct logbuf;
os_threadId tid; \
os_threadId extTid; \
enum thread_state state; \
struct logbuf *lb; \
char *name /* note: no semicolon! */
struct thread_state_base {

View file

@ -339,7 +339,7 @@ void nn_xqos_fini (nn_xqos_t *xqos);
void nn_xqos_mergein_missing (nn_xqos_t *a, const nn_xqos_t *b);
uint64_t nn_xqos_delta (const nn_xqos_t *a, const nn_xqos_t *b, uint64_t mask);
void nn_xqos_addtomsg (struct nn_xmsg *m, const nn_xqos_t *xqos, uint64_t wanted);
void nn_log_xqos (logcat_t cat, const nn_xqos_t *xqos);
void nn_log_xqos (uint32_t cat, const nn_xqos_t *xqos);
nn_xqos_t *nn_xqos_dup (const nn_xqos_t *src);
#if defined (__cplusplus)

View file

@ -171,7 +171,7 @@ void ddsi_ipaddr_to_loc (nn_locator_t *dst, const os_sockaddr *src, int32_t kind
}
#endif
default:
NN_FATAL ("nn_address_to_loc: family %d unsupported\n", (int) src->sa_family);
DDS_FATAL("nn_address_to_loc: family %d unsupported\n", (int) src->sa_family);
}
}

View file

@ -154,13 +154,13 @@ static int joinleave_mcgroup (ddsi_tran_conn_t conn, int join, const nn_locator_
{
char buf[256];
int err;
TRACE (("%s\n", make_joinleave_msg (buf, sizeof(buf), conn, join, srcloc, mcloc, interf, 0)));
DDS_TRACE("%s\n", make_joinleave_msg (buf, sizeof(buf), conn, join, srcloc, mcloc, interf, 0));
if (join)
err = ddsi_conn_join_mc(conn, srcloc, mcloc, interf);
else
err = ddsi_conn_leave_mc(conn, srcloc, mcloc, interf);
if (err)
NN_WARNING ("%s\n", make_joinleave_msg (buf, sizeof(buf), conn, join, srcloc, mcloc, interf, err));
DDS_WARNING("%s\n", make_joinleave_msg (buf, sizeof(buf), conn, join, srcloc, mcloc, interf, err));
return err ? -1 : 0;
}
@ -211,7 +211,7 @@ static int joinleave_mcgroups (ddsi_tran_conn_t conn, int join, const nn_locator
if (fails > 0)
{
if (oks > 0)
TRACE (("multicast join failed for some but not all interfaces, proceeding\n"));
DDS_TRACE("multicast join failed for some but not all interfaces, proceeding\n");
else
return -2;
}
@ -228,7 +228,7 @@ int ddsi_join_mc (ddsi_tran_conn_t conn, const nn_locator_t *srcloc, const nn_lo
if (!reg_group_membership (gv.mship, conn, srcloc, mcloc))
{
char buf[256];
TRACE (("%s: already joined\n", make_joinleave_msg (buf, sizeof(buf), conn, 1, srcloc, mcloc, NULL, 0)));
DDS_TRACE("%s: already joined\n", make_joinleave_msg (buf, sizeof(buf), conn, 1, srcloc, mcloc, NULL, 0));
ret = 0;
}
else
@ -246,7 +246,7 @@ int ddsi_leave_mc (ddsi_tran_conn_t conn, const nn_locator_t *srcloc, const nn_l
if (!unreg_group_membership (gv.mship, conn, srcloc, mcloc))
{
char buf[256];
TRACE (("%s: not leaving yet\n", make_joinleave_msg (buf, sizeof(buf), conn, 0, srcloc, mcloc, NULL, 0)));
DDS_TRACE("%s: not leaving yet\n", make_joinleave_msg (buf, sizeof(buf), conn, 0, srcloc, mcloc, NULL, 0));
ret = 0;
}
else

View file

@ -108,12 +108,12 @@ static ssize_t ddsi_raweth_conn_read (ddsi_tran_conn_t conn, unsigned char * buf
snprintf(addrbuf, sizeof(addrbuf), "[%02x:%02x:%02x:%02x:%02x:%02x]:%u",
src.sll_addr[0], src.sll_addr[1], src.sll_addr[2],
src.sll_addr[3], src.sll_addr[4], src.sll_addr[5], ntohs(src.sll_protocol));
NN_WARNING ("%s => %d truncated to %d\n", addrbuf, (int)ret, (int)len);
DDS_WARNING("%s => %d truncated to %d\n", addrbuf, (int)ret, (int)len);
}
}
else if (err != os_sockENOTSOCK && err != os_sockECONNRESET)
{
NN_ERROR ("UDP recvmsg sock %d: ret %d errno %d\n", (int) ((ddsi_raweth_conn_t) conn)->m_sock, (int) ret, err);
DDS_ERROR("UDP recvmsg sock %d: ret %d errno %d\n", (int) ((ddsi_raweth_conn_t) conn)->m_sock, (int) ret, err);
}
return ret;
}
@ -162,7 +162,7 @@ static ssize_t ddsi_raweth_conn_write (ddsi_tran_conn_t conn, const nn_locator_t
#endif
break;
default:
NN_ERROR("ddsi_raweth_conn_write failed with error code %d", err);
DDS_ERROR("ddsi_raweth_conn_write failed with error code %d", err);
}
}
return ret;
@ -204,14 +204,14 @@ static ddsi_tran_conn_t ddsi_raweth_create_conn (uint32_t port, ddsi_tran_qos_t
if (port == 0 || port > 65535)
{
NN_ERROR("ddsi_raweth_create_conn %s port %u - using port number as ethernet type, %u won't do\n", mcast ? "multicast" : "unicast", port, port);
DDS_ERROR("ddsi_raweth_create_conn %s port %u - using port number as ethernet type, %u won't do\n", mcast ? "multicast" : "unicast", port, port);
return NULL;
}
if ((sock = socket(PF_PACKET, SOCK_DGRAM, htons((uint16_t)port))) == -1)
{
rc = os_getErrno();
NN_ERROR("ddsi_raweth_create_conn %s port %u failed ... errno = %d\n", mcast ? "multicast" : "unicast", port, rc);
DDS_ERROR("ddsi_raweth_create_conn %s port %u failed ... errno = %d\n", mcast ? "multicast" : "unicast", port, rc);
return NULL;
}
@ -224,7 +224,7 @@ static ddsi_tran_conn_t ddsi_raweth_create_conn (uint32_t port, ddsi_tran_qos_t
{
rc = os_getErrno();
close(sock);
NN_ERROR("ddsi_raweth_create_conn %s bind port %u failed ... errno = %d\n", mcast ? "multicast" : "unicast", port, rc);
DDS_ERROR("ddsi_raweth_create_conn %s bind port %u failed ... errno = %d\n", mcast ? "multicast" : "unicast", port, rc);
return NULL;
}
@ -242,7 +242,7 @@ static ddsi_tran_conn_t ddsi_raweth_create_conn (uint32_t port, ddsi_tran_qos_t
uc->m_base.m_write_fn = ddsi_raweth_conn_write;
uc->m_base.m_disable_multiplexing_fn = 0;
nn_log(LC_INFO, "ddsi_raweth_create_conn %s socket %d port %u\n", mcast ? "multicast" : "unicast", uc->m_sock, uc->m_base.m_base.m_port);
DDS_INFO("ddsi_raweth_create_conn %s socket %d port %u\n", mcast ? "multicast" : "unicast", uc->m_sock, uc->m_base.m_base.m_port);
return uc ? &uc->m_base : NULL;
}
@ -294,9 +294,8 @@ static int ddsi_raweth_leave_mc (ddsi_tran_conn_t conn, const nn_locator_t *srcl
static void ddsi_raweth_release_conn (ddsi_tran_conn_t conn)
{
ddsi_raweth_conn_t uc = (ddsi_raweth_conn_t) conn;
nn_log
DDS_INFO
(
LC_INFO,
"ddsi_raweth_release_conn %s socket %d port %d\n",
conn->m_base.m_multicast ? "multicast" : "unicast",
uc->m_sock,
@ -344,7 +343,7 @@ static void ddsi_raweth_deinit(void)
if (os_atomic_dec32_nv(&init_g) == 0) {
if (ddsi_raweth_config_g.mship)
free_group_membership(ddsi_raweth_config_g.mship);
nn_log (LC_INFO | LC_CONFIG, "raweth de-initialized\n");
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "raweth de-initialized\n");
}
}
@ -380,7 +379,7 @@ int ddsi_raweth_init (void)
ddsi_raweth_config_g.mship = new_group_membership();
nn_log (LC_INFO | LC_CONFIG, "raweth initialized\n");
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "raweth initialized\n");
}
return 0;
}

View file

@ -60,7 +60,7 @@ static void serdata_free_wrap (void *elem)
void ddsi_serdatapool_free (struct serdatapool * pool)
{
TRACE (("ddsi_serdatapool_free(%p)\n", pool));
DDS_TRACE("ddsi_serdatapool_free(%p)\n", pool);
nn_freelist_fini (&pool->freelist, serdata_free_wrap);
os_free (pool);
}

View file

@ -31,7 +31,7 @@ static void ddsi_ssl_error (SSL * ssl, const char * str, int err)
{
char buff [128];
ERR_error_string ((unsigned) SSL_get_error (ssl, err), buff);
nn_log (LC_ERROR, "tcp/ssl %s %s %d\n", str, buff, err);
DDS_ERROR("tcp/ssl %s %s %d\n", str, buff, err);
}
static int ddsi_ssl_verify (int ok, X509_STORE_CTX * store)
@ -56,9 +56,8 @@ static int ddsi_ssl_verify (int ok, X509_STORE_CTX * store)
else
{
X509_NAME_oneline (X509_get_issuer_name (cert), issuer, sizeof (issuer));
nn_log
DDS_ERROR
(
LC_ERROR,
"tcp/ssl failed to verify certificate from %s : %s\n",
issuer,
X509_verify_cert_error_string (err)
@ -227,9 +226,9 @@ static SSL_CTX * ddsi_ssl_ctx_init (void)
if (! SSL_CTX_use_certificate_file (ctx, config.ssl_keystore, SSL_FILETYPE_PEM))
{
nn_log
DDS_LOG
(
LC_ERROR | LC_CONFIG,
DDS_LC_ERROR | DDS_LC_CONFIG,
"tcp/ssl failed to load certificate from file: %s\n",
config.ssl_keystore
);
@ -244,9 +243,9 @@ static SSL_CTX * ddsi_ssl_ctx_init (void)
if (! SSL_CTX_use_PrivateKey_file (ctx, config.ssl_keystore, SSL_FILETYPE_PEM))
{
nn_log
DDS_LOG
(
LC_ERROR | LC_CONFIG,
DDS_LC_ERROR | DDS_LC_CONFIG,
"tcp/ssl failed to load private key from file: %s\n",
config.ssl_keystore
);
@ -257,9 +256,9 @@ static SSL_CTX * ddsi_ssl_ctx_init (void)
if (! SSL_CTX_load_verify_locations (ctx, config.ssl_keystore, 0))
{
nn_log
DDS_LOG
(
LC_ERROR | LC_CONFIG,
DDS_LC_ERROR | DDS_LC_CONFIG,
"tcp/ssl failed to load CA from file: %s\n",
config.ssl_keystore
);
@ -270,9 +269,9 @@ static SSL_CTX * ddsi_ssl_ctx_init (void)
if (! SSL_CTX_set_cipher_list (ctx, config.ssl_ciphers))
{
nn_log
DDS_LOG
(
LC_ERROR | LC_CONFIG,
DDS_LC_ERROR | DDS_LC_CONFIG,
"tcp/ssl failed to set ciphers: %s\n",
config.ssl_ciphers
);
@ -285,9 +284,9 @@ static SSL_CTX * ddsi_ssl_ctx_init (void)
{
if (! RAND_load_file (config.ssl_rand_file, 4096))
{
nn_log
DDS_LOG
(
LC_ERROR | LC_CONFIG,
DDS_LC_ERROR | DDS_LC_CONFIG,
"tcp/ssl failed to load random seed from file: %s\n",
config.ssl_rand_file
);

View file

@ -73,16 +73,6 @@ typedef struct ddsi_tcp_listener
}
* ddsi_tcp_listener_t;
static void nn_trace_tcp (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
nn_vlog (LC_TCP, fmt, ap);
va_end (ap);
}
#define TRACE_TCP(args) ((config.enabled_logcats & LC_TCP) ? (nn_trace_tcp args) : (void) 0)
static int ddsi_tcp_cmp_conn (const ddsi_tcp_conn_t c1, const ddsi_tcp_conn_t c2)
{
const os_sockaddr *a1s = (os_sockaddr *)&c1->m_peer_addr;
@ -136,9 +126,9 @@ static void ddsi_tcp_cache_dump (void)
while (n)
{
os_sockaddrAddressPortToString ((const os_sockaddr *) &n->m_conn->m_peer_addr, buff, sizeof (buff));
nn_log
DDS_LOG
(
LC_INFO,
DDS_LC_INFO,
"%s cache #%d: %s sock %d port %u peer %s\n",
ddsi_name, i++, n->m_conn->m_base.m_server ? "server" : "client",
n->m_conn->m_sock, n->m_conn->m_base.m_base.m_port, buff
@ -155,7 +145,7 @@ static unsigned short get_socket_port (os_socket socket)
if (getsockname (socket, (os_sockaddr *) &addr, &addrlen) < 0)
{
int err = os_getErrno();
NN_ERROR ("ddsi_tcp_get_socket_port: getsockname errno %d\n", err);
DDS_ERROR("ddsi_tcp_get_socket_port: getsockname errno %d\n", err);
return 0;
}
return os_sockaddr_get_port((os_sockaddr *)&addr);
@ -173,7 +163,7 @@ static void ddsi_tcp_sock_free (os_socket sock, const char * msg)
{
if (msg)
{
nn_log (LC_INFO, "%s %s free socket %"PRIsock"\n", ddsi_name, msg, sock);
DDS_INFO("%s %s free socket %"PRIsock"\n", ddsi_name, msg, sock);
}
os_sockFree (sock);
}
@ -231,7 +221,7 @@ static void ddsi_tcp_conn_connect (ddsi_tcp_conn_t conn, const struct msghdr * m
#endif
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *) msg->msg_name);
nn_log (LC_INFO, "%s connect socket %"PRIsock" port %u to %s\n", ddsi_name, sock, get_socket_port (sock), buff);
DDS_INFO("%s connect socket %"PRIsock" port %u to %s\n", ddsi_name, sock, get_socket_port (sock), buff);
/* Also may need to receive on connection so add to waitset */
@ -279,7 +269,7 @@ static void ddsi_tcp_cache_add (ddsi_tcp_conn_t conn, ut_avlIPath_t * path)
}
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&conn->m_peer_addr);
nn_log (LC_INFO, "%s cache %s %s socket %"PRIsock" to %s\n", ddsi_name, action, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
DDS_INFO("%s cache %s %s socket %"PRIsock" to %s\n", ddsi_name, action, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
}
static void ddsi_tcp_cache_remove (ddsi_tcp_conn_t conn)
@ -293,7 +283,7 @@ static void ddsi_tcp_cache_remove (ddsi_tcp_conn_t conn)
if (node)
{
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&conn->m_peer_addr);
nn_log (LC_INFO, "%s cache removed socket %"PRIsock" to %s\n", ddsi_name, conn->m_sock, buff);
DDS_INFO("%s cache removed socket %"PRIsock" to %s\n", ddsi_name, conn->m_sock, buff);
ut_avlDeleteDPath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node, &path);
ddsi_tcp_node_free (node);
}
@ -372,7 +362,7 @@ static bool ddsi_tcp_select (os_socket sock, bool read, size_t pos)
timeout.tv_sec = (int) (tval / T_SECOND);
timeout.tv_nsec = (int) (tval % T_SECOND);
TRACE_TCP (("%s blocked %s: sock %d\n", ddsi_name, read ? "read" : "write", (int) sock));
DDS_LOG(DDS_LC_TCP, "%s blocked %s: sock %d\n", ddsi_name, read ? "read" : "write", (int) sock);
do
{
ret = os_sockSelect ((int32_t)sock + 1, rdset, wrset, NULL, &timeout); /* The variable "sock" with os_socket type causes the possible loss of data. So type casting done */
@ -381,9 +371,9 @@ static bool ddsi_tcp_select (os_socket sock, bool read, size_t pos)
if (ret <= 0)
{
nn_log
DDS_WARNING
(
LC_WARNING, "%s abandoning %s on blocking socket %d after %"PRIuSIZE" bytes\n",
"%s abandoning %s on blocking socket %d after %"PRIuSIZE" bytes\n",
ddsi_name, read ? "read" : "write", (int) sock, pos
);
}
@ -432,7 +422,7 @@ static ssize_t ddsi_tcp_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, s
}
else if (n == 0)
{
TRACE_TCP (("%s read: sock %"PRIsock" closed-by-peer\n", ddsi_name, tcp->m_sock));
DDS_LOG(DDS_LC_TCP, "%s read: sock %"PRIsock" closed-by-peer\n", ddsi_name, tcp->m_sock);
break;
}
else
@ -448,7 +438,7 @@ static ssize_t ddsi_tcp_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, s
}
else
{
TRACE_TCP (("%s read: sock %"PRIsock" error %d\n", ddsi_name, tcp->m_sock, err));
DDS_LOG(DDS_LC_TCP, "%s read: sock %"PRIsock" error %d\n", ddsi_name, tcp->m_sock, err);
break;
}
}
@ -516,7 +506,7 @@ static ssize_t ddsi_tcp_block_write
}
else
{
TRACE_TCP (("%s write: sock %"PRIsock" error %d\n", ddsi_name, conn->m_sock, err));
DDS_LOG(DDS_LC_TCP, "%s write: sock %"PRIsock" error %d\n", ddsi_name, conn->m_sock, err);
break;
}
}
@ -591,7 +581,7 @@ static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *d
if (!connect && ((flags & DDSI_TRAN_ON_CONNECT) != 0))
{
TRACE_TCP (("%s write: sock %"PRIsock" message filtered\n", ddsi_name, conn->m_sock));
DDS_LOG(DDS_LC_TCP, "%s write: sock %"PRIsock" message filtered\n", ddsi_name, conn->m_sock);
os_mutexUnlock (&conn->m_mutex);
return (ssize_t) len;
}
@ -651,16 +641,16 @@ static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *d
{
if (! conn->m_base.m_closed && (conn->m_sock != Q_INVALID_SOCKET))
{
nn_log
DDS_WARNING
(
LC_WARNING, "%s write failed on socket %"PRIsock" with errno %d\n",
"%s write failed on socket %"PRIsock" with errno %d\n",
ddsi_name, conn->m_sock, err
);
}
}
else
{
TRACE_TCP (("%s write: sock %"PRIsock" ECONNRESET\n", ddsi_name, conn->m_sock));
DDS_LOG(DDS_LC_TCP, "%s write: sock %"PRIsock" ECONNRESET\n", ddsi_name, conn->m_sock);
}
}
}
@ -668,7 +658,7 @@ static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *d
{
if (ret == 0)
{
TRACE_TCP (("%s write: sock %"PRIsock" eof\n", ddsi_name, conn->m_sock));
DDS_LOG(DDS_LC_TCP, "%s write: sock %"PRIsock" eof\n", ddsi_name, conn->m_sock);
}
piecewise = (ret > 0 && (size_t) ret < len);
}
@ -796,17 +786,17 @@ static ddsi_tran_conn_t ddsi_tcp_accept (ddsi_tran_listener_t listener)
{
getsockname (tl->m_sock, (struct sockaddr *) &addr, &addrlen);
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&addr);
nn_log ((err == 0) ? LC_ERROR : LC_FATAL, "%s accept failed on socket %"PRIsock" at %s errno %d\n", ddsi_name, tl->m_sock, buff, err);
DDS_LOG((err == 0) ? DDS_LC_ERROR : DDS_LC_FATAL, "%s accept failed on socket %"PRIsock" at %s errno %d\n", ddsi_name, tl->m_sock, buff, err);
}
else if (getpeername (sock, (struct sockaddr *) &addr, &addrlen) == -1)
{
nn_log (LC_WARNING, "%s accepted new socket %"PRIsock" on socket %"PRIsock" but no peer address, errno %d\n", ddsi_name, sock, tl->m_sock, os_getErrno());
DDS_WARNING("%s accepted new socket %"PRIsock" on socket %"PRIsock" but no peer address, errno %d\n", ddsi_name, sock, tl->m_sock, os_getErrno());
os_sockFree (sock);
}
else
{
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&addr);
nn_log (LC_INFO, "%s accept new socket %"PRIsock" on socket %"PRIsock" from %s\n", ddsi_name, sock, tl->m_sock, buff);
DDS_INFO("%s accept new socket %"PRIsock" on socket %"PRIsock" from %s\n", ddsi_name, sock, tl->m_sock, buff);
os_sockSetNonBlocking (sock, true);
tcp = ddsi_tcp_new_conn (sock, true, (os_sockaddr *)&addr);
@ -844,7 +834,7 @@ static void ddsi_tcp_conn_peer_locator (ddsi_tran_conn_t conn, nn_locator_t * lo
assert (tc->m_sock != Q_INVALID_SOCKET);
ddsi_ipaddr_to_loc (loc, (os_sockaddr *)&tc->m_peer_addr, tc->m_peer_addr.ss_family == AF_INET ? NN_LOCATOR_KIND_TCPv4 : NN_LOCATOR_KIND_TCPv6);
ddsi_locator_to_string(buff, sizeof(buff), loc);
TRACE (("(%s EP:%s)", ddsi_name, buff));
DDS_LOG(DDS_LC_TCP, "(%s EP:%s)", ddsi_name, buff);
}
static void ddsi_tcp_base_init (struct ddsi_tran_conn * base)
@ -907,14 +897,14 @@ static ddsi_tran_listener_t ddsi_tcp_create_listener (int port, ddsi_tran_qos_t
if (getsockname (sock, (os_sockaddr *) &addr, &addrlen) == -1)
{
int err = os_getErrno ();
NN_ERROR ("ddsi_tcp_create_listener: getsockname errno %d\n", err);
DDS_ERROR("ddsi_tcp_create_listener: getsockname errno %d\n", err);
ddsi_tcp_sock_free (sock, NULL);
os_free (tl);
return NULL;
}
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&addr);
nn_log (LC_INFO, "%s create listener socket %"PRIsock" on %s\n", ddsi_name, sock, buff);
DDS_INFO("%s create listener socket %"PRIsock" on %s\n", ddsi_name, sock, buff);
}
return tl ? &tl->m_base : NULL;
@ -924,7 +914,7 @@ static void ddsi_tcp_conn_delete (ddsi_tcp_conn_t conn)
{
char buff[DDSI_LOCSTRLEN];
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&conn->m_peer_addr);
nn_log (LC_INFO, "%s free %s connnection on socket %"PRIsock" to %s\n", ddsi_name, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
DDS_INFO("%s free %s connnection on socket %"PRIsock" to %s\n", ddsi_name, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
#ifdef DDSI_INCLUDE_SSL
if (ddsi_tcp_ssl_plugin.ssl_free)
@ -948,7 +938,7 @@ static void ddsi_tcp_close_conn (ddsi_tran_conn_t tc)
nn_locator_t loc;
ddsi_tcp_conn_t conn = (ddsi_tcp_conn_t) tc;
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&conn->m_peer_addr);
nn_log (LC_INFO, "%s close %s connnection on socket %"PRIsock" to %s\n", ddsi_name, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
DDS_INFO("%s close %s connnection on socket %"PRIsock" to %s\n", ddsi_name, conn->m_base.m_server ? "server" : "client", conn->m_sock, buff);
(void) shutdown (conn->m_sock, 2);
ddsi_ipaddr_to_loc(&loc, (os_sockaddr *)&conn->m_peer_addr, conn->m_peer_addr.ss_family == AF_INET ? NN_LOCATOR_KIND_TCPv4 : NN_LOCATOR_KIND_TCPv6);
loc.port = conn->m_peer_port;
@ -984,7 +974,7 @@ static void ddsi_tcp_unblock_listener (ddsi_tran_listener_t listener)
os_sockaddr_storage addr;
socklen_t addrlen = sizeof (addr);
if (getsockname (tl->m_sock, (os_sockaddr *) &addr, &addrlen) == -1)
nn_log (LC_WARNING, "%s failed to get listener address error %d\n", ddsi_name, os_getErrno());
DDS_WARNING("%s failed to get listener address error %d\n", ddsi_name, os_getErrno());
else
{
switch (addr.ss_family) {
@ -1016,7 +1006,7 @@ static void ddsi_tcp_unblock_listener (ddsi_tran_listener_t listener)
{
char buff[DDSI_LOCSTRLEN];
sockaddr_to_string_with_port(buff, sizeof(buff), (os_sockaddr *)&addr);
nn_log (LC_WARNING, "%s failed to connect to own listener (%s) error %d\n", ddsi_name, buff, os_getErrno());
DDS_WARNING("%s failed to connect to own listener (%s) error %d\n", ddsi_name, buff, os_getErrno());
}
}
ddsi_tcp_sock_free (sock, NULL);
@ -1091,7 +1081,7 @@ int ddsi_tcp_init (void)
ddsi_name = "tcp/ssl";
if (! (ddsi_tcp_ssl_plugin.init) ())
{
NN_ERROR ("Failed to initialize OpenSSL\n");
DDS_ERROR("Failed to initialize OpenSSL\n");
return -1;
}
}
@ -1100,7 +1090,7 @@ int ddsi_tcp_init (void)
ut_avlInit (&ddsi_tcp_treedef, &ddsi_tcp_cache_g);
os_mutexInit (&ddsi_tcp_cache_lock_g);
nn_log (LC_INFO | LC_CONFIG, "%s initialized\n", ddsi_name);
DDS_LOG(DDS_LC_CONFIG, "%s initialized\n", ddsi_name);
}
return 0;
}

View file

@ -93,12 +93,12 @@ static ssize_t ddsi_udp_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, s
nn_locator_t tmp;
ddsi_ipaddr_to_loc(&tmp, (os_sockaddr *)&src, src.ss_family == AF_INET ? NN_LOCATOR_KIND_UDPv4 : NN_LOCATOR_KIND_UDPv6);
ddsi_locator_to_string(addrbuf, sizeof(addrbuf), &tmp);
NN_WARNING ("%s => %d truncated to %d\n", addrbuf, (int)ret, (int)len);
DDS_WARNING("%s => %d truncated to %d\n", addrbuf, (int)ret, (int)len);
}
}
else if (err != os_sockENOTSOCK && err != os_sockECONNRESET)
{
NN_ERROR ("UDP recvmsg sock %d: ret %d errno %d\n", (int) ((ddsi_udp_conn_t) conn)->m_sock, (int) ret, err);
DDS_ERROR("UDP recvmsg sock %d: ret %d errno %d\n", (int) ((ddsi_udp_conn_t) conn)->m_sock, (int) ret, err);
}
return ret;
}
@ -169,7 +169,7 @@ static ssize_t ddsi_udp_conn_write (ddsi_tran_conn_t conn, const nn_locator_t *d
#endif
break;
default:
NN_ERROR("ddsi_udp_conn_write failed with error code %d", err);
DDS_ERROR("ddsi_udp_conn_write failed with error code %d", err);
}
}
return ret;
@ -220,7 +220,7 @@ static unsigned short get_socket_port (os_socket socket)
if (getsockname (socket, (os_sockaddr *) &addr, &addrlen) < 0)
{
int err = os_getErrno();
NN_ERROR ("ddsi_udp_get_socket_port: getsockname errno %d\n", err);
DDS_ERROR("ddsi_udp_get_socket_port: getsockname errno %d\n", err);
return 0;
}
@ -271,9 +271,8 @@ static ddsi_tran_conn_t ddsi_udp_create_conn
uc->m_base.m_write_fn = ddsi_udp_conn_write;
uc->m_base.m_disable_multiplexing_fn = ddsi_udp_disable_multiplexing;
nn_log
DDS_INFO
(
LC_INFO,
"ddsi_udp_create_conn %s socket %"PRIsock" port %u\n",
mcast ? "multicast" : "unicast",
uc->m_sock,
@ -285,7 +284,7 @@ static ddsi_tran_conn_t ddsi_udp_create_conn
if (os_sockSetsockopt (sock, IPPROTO_IP, IP_TOS, (char*) &uc->m_diffserv, sizeof (uc->m_diffserv)) != os_resultSuccess)
{
int err = os_getErrno();
NN_ERROR("ddsi_udp_create_conn: set diffserv error %d\n", err);
DDS_ERROR("ddsi_udp_create_conn: set diffserv error %d\n", err);
}
}
#endif
@ -294,7 +293,7 @@ static ddsi_tran_conn_t ddsi_udp_create_conn
{
if (config.participantIndex != PARTICIPANT_INDEX_AUTO)
{
NN_ERROR
DDS_ERROR
(
"UDP make_socket failed for %s port %u\n",
mcast ? "multicast" : "unicast",
@ -395,9 +394,8 @@ static int ddsi_udp_leave_mc (ddsi_tran_conn_t conn, const nn_locator_t *srcloc,
static void ddsi_udp_release_conn (ddsi_tran_conn_t conn)
{
ddsi_udp_conn_t uc = (ddsi_udp_conn_t) conn;
nn_log
DDS_INFO
(
LC_INFO,
"ddsi_udp_release_conn %s socket %"PRIsock" port %u\n",
conn->m_base.m_multicast ? "multicast" : "unicast",
uc->m_sock,
@ -415,7 +413,7 @@ void ddsi_udp_fini (void)
if(os_atomic_dec32_nv (&ddsi_udp_init_g) == 0) {
free_group_membership(ddsi_udp_config_g.mship);
memset (&ddsi_udp_factory_g, 0, sizeof (ddsi_udp_factory_g));
nn_log (LC_INFO | LC_CONFIG, "udp finalized\n");
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "udp finalized\n");
}
}
@ -505,7 +503,7 @@ static void ddsi_udp_deinit(void)
if (os_atomic_dec32_nv(&ddsi_udp_init_g) == 0) {
if (ddsi_udp_config_g.mship)
free_group_membership(ddsi_udp_config_g.mship);
nn_log (LC_INFO | LC_CONFIG, "udp de-initialized\n");
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "udp de-initialized\n");
}
}
@ -550,7 +548,7 @@ int ddsi_udp_init (void)
ddsi_factory_add (&ddsi_udp_factory_g);
nn_log (LC_INFO | LC_CONFIG, "udp initialized\n");
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "udp initialized\n");
}
return 0;
}

View file

@ -50,19 +50,19 @@ static int add_addresses_to_addrset_1 (struct addrset *as, const char *ip, int p
case AFSR_OK:
break;
case AFSR_INVALID:
NN_ERROR ("%s: %s: not a valid address\n", msgtag, ip);
DDS_ERROR("%s: %s: not a valid address\n", msgtag, ip);
return -1;
case AFSR_UNKNOWN:
NN_ERROR ("%s: %s: unknown address\n", msgtag, ip);
DDS_ERROR("%s: %s: unknown address\n", msgtag, ip);
return -1;
case AFSR_MISMATCH:
NN_ERROR ("%s: %s: address family mismatch\n", msgtag, ip);
DDS_ERROR("%s: %s: address family mismatch\n", msgtag, ip);
return -1;
}
if (req_mc && !ddsi_is_mcaddr (&loc))
{
NN_ERROR ("%s: %s: not a multicast address\n", msgtag, ip);
DDS_ERROR ("%s: %s: not a multicast address\n", msgtag, ip);
return -1;
}
@ -82,20 +82,20 @@ static int add_addresses_to_addrset_1 (struct addrset *as, const char *ip, int p
}
else
{
NN_ERROR ("%s: %s,%d,%d,%d: IPv4 multicast address generator invalid or out of place\n",
msgtag, ip, mcgen_base, mcgen_count, mcgen_idx);
DDS_ERROR("%s: %s,%d,%d,%d: IPv4 multicast address generator invalid or out of place\n",
msgtag, ip, mcgen_base, mcgen_count, mcgen_idx);
return -1;
}
if (port_mode >= 0)
{
loc.port = (unsigned) port_mode;
nn_log (LC_CONFIG, "%s: add %s", msgtag, ddsi_locator_to_string(buf, sizeof(buf), &loc));
DDS_LOG(DDS_LC_CONFIG, "%s: add %s", msgtag, ddsi_locator_to_string(buf, sizeof(buf), &loc));
add_to_addrset (as, &loc);
}
else
{
nn_log (LC_CONFIG, "%s: add ", msgtag);
DDS_LOG(DDS_LC_CONFIG, "%s: add ", msgtag);
if (!ddsi_is_mcaddr (&loc))
{
int i;
@ -104,9 +104,9 @@ static int add_addresses_to_addrset_1 (struct addrset *as, const char *ip, int p
int port = config.port_base + config.port_dg * config.domainId.value + i * config.port_pg + config.port_d1;
loc.port = (unsigned) port;
if (i == 0)
nn_log (LC_CONFIG, "%s", ddsi_locator_to_string(buf, sizeof(buf), &loc));
DDS_LOG(DDS_LC_CONFIG, "%s", ddsi_locator_to_string(buf, sizeof(buf), &loc));
else
nn_log (LC_CONFIG, ", :%d", port);
DDS_LOG(DDS_LC_CONFIG, ", :%d", port);
add_to_addrset (as, &loc);
}
}
@ -116,12 +116,12 @@ static int add_addresses_to_addrset_1 (struct addrset *as, const char *ip, int p
if (port == -1)
port = config.port_base + config.port_dg * config.domainId.value + config.port_d0;
loc.port = (unsigned) port;
nn_log (LC_CONFIG, "%s", ddsi_locator_to_string(buf, sizeof(buf), &loc));
DDS_LOG(DDS_LC_CONFIG, "%s", ddsi_locator_to_string(buf, sizeof(buf), &loc));
add_to_addrset (as, &loc);
}
}
nn_log (LC_CONFIG, "\n");
DDS_LOG(DDS_LC_CONFIG, "\n");
return 0;
}
@ -168,7 +168,7 @@ int add_addresses_to_addrset (struct addrset *as, const char *addrs, int port_mo
if (add_addresses_to_addrset_1 (as, ip, port, msgtag, req_mc, mcgen_base, mcgen_count, mcgen_idx) < 0)
goto error;
} else {
NN_ERROR ("%s: %s: port %d invalid\n", msgtag, a, port);
DDS_ERROR("%s: %s: port %d invalid\n", msgtag, a, port);
}
}
retval = 0;
@ -562,24 +562,24 @@ int addrset_forone (struct addrset *as, addrset_forone_fun_t f, void *arg)
struct log_addrset_helper_arg
{
logcat_t tf;
uint32_t tf;
};
static void log_addrset_helper (const nn_locator_t *n, void *varg)
{
const struct log_addrset_helper_arg *arg = varg;
char buf[DDSI_LOCSTRLEN];
if (config.enabled_logcats & arg->tf)
nn_log (arg->tf, " %s", ddsi_locator_to_string(buf, sizeof(buf), n));
if (dds_get_log_mask() & arg->tf)
DDS_LOG(arg->tf, " %s", ddsi_locator_to_string(buf, sizeof(buf), n));
}
void nn_log_addrset (logcat_t tf, const char *prefix, const struct addrset *as)
void nn_log_addrset (uint32_t tf, const char *prefix, const struct addrset *as)
{
if (config.enabled_logcats & tf)
if (dds_get_log_mask() & tf)
{
struct log_addrset_helper_arg arg;
arg.tf = tf;
nn_log (tf, "%s", prefix);
DDS_LOG(tf, "%s", prefix);
addrset_forall ((struct addrset *) as, log_addrset_helper, &arg); /* drop const, we know it is */
}
}

View file

@ -98,10 +98,10 @@ struct cfgst {
/* "trace" is special: it enables (nearly) everything */
static const char *logcat_names[] = {
"fatal", "error", "warning", "config", "info", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "trace", NULL
"fatal", "error", "warning", "info", "config", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "trace", NULL
};
static const logcat_t logcat_codes[] = {
LC_FATAL, LC_ERROR, LC_WARNING, LC_CONFIG, LC_INFO, LC_DISCOVERY, LC_DATA, LC_RADMIN, LC_TIMING, LC_TRAFFIC, LC_TOPIC, LC_TCP, LC_PLIST, LC_WHC, LC_THROTTLE, LC_ALLCATS
static const uint32_t logcat_codes[] = {
DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_ALL
};
/* We want the tracing/verbosity settings to be fixed while parsing
@ -785,7 +785,7 @@ static const struct cfgelem tracing_cfgelems[] = {
<li><i>finest</i>: <i>finer</i> + trace</li></ul>\n\
<p>While <i>none</i> prevents any message from being written to a DDSI2 log file.</p>\n\
<p>The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful verbosity levels are <i>config</i>, <i>fine</i> and <i>finest</i>.</p>" },
{ LEAF("OutputFile"), 1, DDSC_PROJECT_NAME_NOSPACE_SMALL"-trace.log", ABSOFF(tracingOutputFileName), 0, uf_tracingOutputFileName, ff_free, pf_string,
{ LEAF("OutputFile"), 1, DDSC_PROJECT_NAME_NOSPACE_SMALL".log", ABSOFF(tracingOutputFileName), 0, uf_tracingOutputFileName, ff_free, pf_string,
"<p>This option specifies where the logging is printed to. Note that <i>stdout</i> and <i>stderr</i> are treated as special values, representing \"standard out\" and \"standard error\" respectively. No file is created unless logging categories are enabled using the Tracing/Verbosity or Tracing/EnabledCategory settings.</p>" },
{ LEAF_W_ATTRS("Timestamps", timestamp_cfgattrs), 1, "true", ABSOFF(tracingTimestamps), 0, uf_boolean, 0, pf_boolean,
"<p>This option has no effect.</p>" },
@ -1015,7 +1015,7 @@ static size_t cfg_note_vsnprintf(struct cfg_note_buf *bb, const char *fmt, va_li
return nbufsize;
}
if ( x < 0 )
NN_FATAL("cfg_note_vsnprintf: os_vsnprintf failed\n");
DDS_FATAL("cfg_note_vsnprintf: os_vsnprintf failed\n");
else
bb->bufpos += (size_t) x;
return 0;
@ -1036,13 +1036,13 @@ static void cfg_note_snprintf(struct cfg_note_buf *bb, const char *fmt, ...)
va_start(ap, fmt);
s = os_vsnprintf(bb->buf + bb->bufpos, bb->bufsize - bb->bufpos, fmt, ap);
if ( s < 0 || (size_t) s >= bb->bufsize - bb->bufpos )
NN_FATAL("cfg_note_snprintf: os_vsnprintf failed\n");
DDS_FATAL("cfg_note_snprintf: os_vsnprintf failed\n");
va_end(ap);
bb->bufpos += (size_t) s;
}
}
static size_t cfg_note(struct cfgst *cfgst, logcat_t cat, size_t bsz, const char *fmt, va_list ap)
static size_t cfg_note(struct cfgst *cfgst, uint32_t cat, size_t bsz, const char *fmt, va_list ap)
{
/* Have to snprintf our way to a single string so we can OS_REPORT
as well as nn_log. Otherwise configuration errors will be lost
@ -1053,14 +1053,14 @@ static size_t cfg_note(struct cfgst *cfgst, logcat_t cat, size_t bsz, const char
int i, sidx;
size_t r;
if (cat & LC_ERROR) {
if (cat & DDS_LC_ERROR) {
cfgst->error = 1;
}
bb.bufpos = 0;
bb.bufsize = (bsz == 0) ? 1024 : bsz;
if ( (bb.buf = os_malloc(bb.bufsize)) == NULL )
NN_FATAL("cfg_note: out of memory\n");
DDS_FATAL("cfg_note: out of memory\n");
cfg_note_snprintf(&bb, "config: ");
@ -1093,17 +1093,17 @@ static size_t cfg_note(struct cfgst *cfgst, logcat_t cat, size_t bsz, const char
}
switch ( cat ) {
case LC_CONFIG:
nn_log(cat, "%s\n", bb.buf);
case DDS_LC_CONFIG:
DDS_LOG(cat, "%s\n", bb.buf);
break;
case LC_WARNING:
NN_WARNING("%s\n", bb.buf);
case DDS_LC_WARNING:
DDS_WARNING("%s\n", bb.buf);
break;
case LC_ERROR:
NN_ERROR("%s\n", bb.buf);
case DDS_LC_ERROR:
DDS_ERROR("%s\n", bb.buf);
break;
default:
NN_FATAL("cfg_note unhandled category %u for message %s\n", (unsigned) cat, bb.buf);
DDS_FATAL("cfg_note unhandled category %u for message %s\n", (unsigned) cat, bb.buf);
break;
}
@ -1118,7 +1118,7 @@ static void cfg_warning(struct cfgst *cfgst, const char *fmt, ...)
size_t bsz = 0;
do {
va_start(ap, fmt);
bsz = cfg_note(cfgst, LC_WARNING, bsz, fmt, ap);
bsz = cfg_note(cfgst, DDS_LC_WARNING, bsz, fmt, ap);
va_end(ap);
} while ( bsz > 0 );
}
@ -1130,7 +1130,7 @@ static int cfg_error(struct cfgst *cfgst, const char *fmt, ...)
size_t bsz = 0;
do {
va_start(ap, fmt);
bsz = cfg_note(cfgst, LC_ERROR, bsz, fmt, ap);
bsz = cfg_note(cfgst, DDS_LC_ERROR, bsz, fmt, ap);
va_end(ap);
} while ( bsz > 0 );
return 0;
@ -1142,7 +1142,7 @@ static int cfg_log(struct cfgst *cfgst, const char *fmt, ...)
size_t bsz = 0;
do {
va_start(ap, fmt);
bsz = cfg_note(cfgst, LC_CONFIG, bsz, fmt, ap);
bsz = cfg_note(cfgst, DDS_LC_CONFIG, bsz, fmt, ap);
va_end(ap);
} while ( bsz > 0 );
return 0;
@ -1345,7 +1345,7 @@ static void pf_boolean_default (struct cfgst *cfgst, void *parent, struct cfgele
static int uf_logcat(struct cfgst *cfgst, UNUSED_ARG(void *parent), UNUSED_ARG(struct cfgelem const * const cfgelem), UNUSED_ARG(int first), const char *value)
{
static const char **vs = logcat_names;
static const logcat_t *lc = logcat_codes;
static const uint32_t *lc = logcat_codes;
char *copy = os_strdup(value), *cursor = copy, *tok;
while ( (tok = os_strsep(&cursor, ",")) != NULL ) {
int idx = list_index(vs, tok);
@ -1365,8 +1365,8 @@ static int uf_verbosity(struct cfgst *cfgst, UNUSED_ARG(void *parent), UNUSED_AR
static const char *vs[] = {
"finest", "finer", "fine", "config", "info", "warning", "severe", "none", NULL
};
static const logcat_t lc[] = {
LC_ALLCATS, LC_TRAFFIC | LC_TIMING, LC_DISCOVERY | LC_THROTTLE, LC_CONFIG, LC_INFO, LC_WARNING, LC_ERROR | LC_FATAL, 0, 0
static const uint32_t lc[] = {
DDS_LC_ALL, DDS_LC_TRAFFIC | DDS_LC_TIMING, DDS_LC_DISCOVERY | DDS_LC_THROTTLE, DDS_LC_CONFIG, DDS_LC_INFO, DDS_LC_WARNING, DDS_LC_ERROR | DDS_LC_FATAL, 0, 0
};
int idx = list_index(vs, value);
assert(sizeof(vs) / sizeof(*vs) == sizeof(lc) / sizeof(*lc));
@ -2270,7 +2270,7 @@ static int uf_standards_conformance(struct cfgst *cfgst, void *parent, struct cf
static const char *vs[] = {
"pedantic", "strict", "lax", NULL
};
static const logcat_t lc[] = {
static const uint32_t lc[] = {
NN_SC_PEDANTIC, NN_SC_STRICT, NN_SC_LAX, 0
};
enum nn_standards_conformance *elem = cfg_address(cfgst, parent, cfgelem);
@ -2298,7 +2298,7 @@ static void pf_standards_conformance(struct cfgst *cfgst, void *parent, struct c
static void pf_logcat(struct cfgst *cfgst, UNUSED_ARG(void *parent), UNUSED_ARG(struct cfgelem const * const cfgelem), UNUSED_ARG(int is_default))
{
logcat_t remaining = config.enabled_logcats;
uint32_t remaining = config.enabled_logcats;
char res[256] = "", *resp = res;
const char *prefix = "";
size_t i;
@ -2313,9 +2313,9 @@ static void pf_logcat(struct cfgst *cfgst, UNUSED_ARG(void *parent), UNUSED_ARG(
}
#endif
/* TRACE enables ALLCATS, all the others just one */
if ( (remaining & LC_ALLCATS) == LC_ALLCATS ) {
if ( (remaining & DDS_LC_ALL) == DDS_LC_ALL ) {
resp += snprintf(resp, 256, "%strace", prefix);
remaining &= ~LC_ALLCATS;
remaining &= ~DDS_LC_ALL;
prefix = ",";
}
for ( i = 0; i < sizeof(logcat_codes) / sizeof(*logcat_codes); i++ ) {
@ -2692,7 +2692,7 @@ static int sort_channels_check_nodups(struct config *cfg)
result = 0;
for ( i = 0; i < n - 1; i++ ) {
if ( ary[i]->priority == ary[i + 1]->priority ) {
NN_ERROR("config: duplicate channel definition for priority %u: channels %s and %s\n",
DDS_ERROR("config: duplicate channel definition for priority %u: channels %s and %s\n",
ary[i]->priority, ary[i]->name, ary[i + 1]->name);
result = ERR_ENTITY_EXISTS;
}
@ -2722,7 +2722,7 @@ struct cfgst * config_init
memset(&config, 0, sizeof(config));
config.tracingOutputFile = stderr;
config.enabled_logcats = LC_ERROR | LC_WARNING;
config.enabled_logcats = DDS_LC_ERROR | DDS_LC_WARNING;
/* eventually, we domainId.value will be the real domain id selected, even if it was configured
to the default of "any" and has "isdefault" set; initializing it to the default-default
@ -2747,7 +2747,7 @@ struct cfgst * config_init
if ( (fp = fopen(tok, "r")) == NULL ) {
if ( strncmp(tok, "file://", 7) != 0 || (fp = fopen(tok + 7, "r")) == NULL ) {
NN_ERROR("can't open configuration file %s\n", tok);
DDS_ERROR("can't open configuration file %s\n", tok);
os_free(copy);
os_free(cfgst);
return NULL;
@ -2816,7 +2816,7 @@ struct cfgst * config_init
break;
}
if (!ok1)
NN_ERROR ("config: invalid combination of Transport, IPv6, TCP\n");
DDS_ERROR("config: invalid combination of Transport, IPv6, TCP\n");
ok = ok && ok1;
cfgst->cfg->compat_use_ipv6 = (cfgst->cfg->transport_selector == TRANS_UDP6 || cfgst->cfg->transport_selector == TRANS_TCP6) ? BOOLDEF_TRUE : BOOLDEF_FALSE;
cfgst->cfg->compat_tcp_enable = (cfgst->cfg->transport_selector == TRANS_TCP || cfgst->cfg->transport_selector == TRANS_TCP6) ? BOOLDEF_TRUE : BOOLDEF_FALSE;
@ -2844,17 +2844,17 @@ struct cfgst * config_init
case Q_CIPHER_NULL:
/* nop */
if ( s->key && strlen(s->key) > 0 ) {
NN_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: %s: cipher key not required\n", s->key);
DDS_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: %s: cipher key not required\n", s->key);
}
break;
default:
/* read the cipherkey if present */
if ( !s->key || strlen(s->key) == 0 ) {
NN_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: cipher key missing\n");
DDS_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: cipher key missing\n");
ok = 0;
} else if ( q_security_plugin.valid_uri && !(q_security_plugin.valid_uri) (s->cipher, s->key) ) {
NN_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: %s : incorrect key\n", s->key);
DDS_ERROR("config: DDSI2Service/Security/SecurityProfile[@cipherkey]: %s : incorrect key\n", s->key);
ok = 0;
}
}
@ -2883,7 +2883,7 @@ struct cfgst * config_init
if ( s )
p->securityProfile = s;
else {
NN_ERROR("config: DDSI2Service/Partitioning/NetworkPartitions/NetworkPartition[@securityprofile]: %s: unknown securityprofile\n", p->profileName);
DDS_ERROR("config: DDSI2Service/Partitioning/NetworkPartitions/NetworkPartition[@securityprofile]: %s: unknown securityprofile\n", p->profileName);
ok = 0;
}
}
@ -2911,7 +2911,7 @@ struct cfgst * config_init
if ( p ) {
m->partition = p;
} else {
NN_ERROR("config: DDSI2Service/Partitioning/PartitionMappings/PartitionMapping[@networkpartition]: %s: unknown partition\n", m->networkPartition);
DDS_ERROR("config: DDSI2Service/Partitioning/PartitionMappings/PartitionMapping[@networkpartition]: %s: unknown partition\n", m->networkPartition);
ok = 0;
}
m = m->next;
@ -2950,7 +2950,9 @@ void config_fini(_In_ struct cfgst *cfgst)
assert(config.valid);
free_all_elements(cfgst, cfgst->cfg, root_cfgelems);
if ( config.tracingOutputFile && config.tracingOutputFile != stdout && config.tracingOutputFile != stderr) {
dds_set_log_file(stderr);
dds_set_trace_file(stderr);
if (config.tracingOutputFile && config.tracingOutputFile != stdout && config.tracingOutputFile != stderr) {
fclose(config.tracingOutputFile);
}
memset(&config, 0, sizeof(config));

View file

@ -202,11 +202,11 @@ int spdp_write (struct participant *pp)
propagate_builtin_topic_participant(&(pp->e), pp->plist, now(), true);
TRACE (("spdp_write(%x:%x:%x:%x)\n", PGUID (pp->e.guid)));
DDS_TRACE("spdp_write(%x:%x:%x:%x)\n", PGUID (pp->e.guid));
if ((wr = get_builtin_writer (pp, NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER)) == NULL)
{
TRACE (("spdp_write(%x:%x:%x:%x) - builtin participant writer not found\n", PGUID (pp->e.guid)));
DDS_TRACE("spdp_write(%x:%x:%x:%x) - builtin participant writer not found\n", PGUID (pp->e.guid));
return 0;
}
@ -311,7 +311,7 @@ int spdp_write (struct participant *pp)
size = strlen(node) + strlen(OSPL_VERSION_STR) + strlen(OSPL_HOST_STR) + strlen(OSPL_TARGET_STR) + 4; /* + ///'\0' */
ps.prismtech_participant_version_info.internals = os_malloc(size);
(void) snprintf(ps.prismtech_participant_version_info.internals, size, "%s/%s/%s/%s", node, OSPL_VERSION_STR, OSPL_HOST_STR, OSPL_TARGET_STR);
TRACE (("spdp_write(%x:%x:%x:%x) - internals: %s\n", PGUID (pp->e.guid), ps.prismtech_participant_version_info.internals));
DDS_TRACE("spdp_write(%x:%x:%x:%x) - internals: %s\n", PGUID (pp->e.guid), ps.prismtech_participant_version_info.internals);
}
/* Participant QoS's insofar as they are set, different from the default, and mapped to the SPDP data, rather than to the PrismTech-specific CMParticipant endpoint. Currently, that means just USER_DATA. */
@ -339,7 +339,7 @@ int spdp_dispose_unregister (struct participant *pp)
if ((wr = get_builtin_writer (pp, NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER)) == NULL)
{
TRACE (("spdp_dispose_unregister(%x:%x:%x:%x) - builtin participant writer not found\n", PGUID (pp->e.guid)));
DDS_TRACE("spdp_dispose_unregister(%x:%x:%x:%x) - builtin participant writer not found\n", PGUID (pp->e.guid));
return 0;
}
@ -400,7 +400,7 @@ static void respond_to_spdp (const nn_guid_t *dest_proxypp_guid)
int64_t delay_max_ms = config.spdp_response_delay_max / 1000000;
int64_t delay = (int64_t) delay_norm * delay_max_ms / 1000;
nn_mtime_t tsched = add_duration_to_mtime (tnow, delay);
TRACE ((" %"PRId64, delay));
DDS_TRACE(" %"PRId64, delay);
if (!config.unicast_response_to_spdp_messages)
/* pp can't reach gc_delete_participant => can safely reschedule */
resched_xevent_if_earlier (pp->spdp_xevent, tsched);
@ -414,26 +414,26 @@ static int handle_SPDP_dead (const struct receiver_state *rst, nn_wctime_t times
{
nn_guid_t guid;
if (!(config.enabled_logcats & LC_TRACE))
nn_log (LC_DISCOVERY, "SPDP ST%x", statusinfo);
if (!(dds_get_log_mask() & DDS_LC_DISCOVERY))
DDS_LOG(DDS_LC_DISCOVERY, "SPDP ST%x", statusinfo);
if (datap->present & PP_PARTICIPANT_GUID)
{
guid = datap->participant_guid;
nn_log (LC_DISCOVERY, " %x:%x:%x:%x", PGUID (guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x", PGUID (guid));
assert (guid.entityid.u == NN_ENTITYID_PARTICIPANT);
if (delete_proxy_participant_by_guid (&guid, timestamp, 0) < 0)
{
nn_log (LC_DISCOVERY, " unknown");
DDS_LOG(DDS_LC_DISCOVERY, " unknown");
}
else
{
nn_log (LC_DISCOVERY, " delete");
DDS_LOG(DDS_LC_DISCOVERY, " delete");
}
}
else
{
NN_WARNING ("data (SPDP, vendor %u.%u): no/invalid payload\n", rst->vendor.id[0], rst->vendor.id[1]);
DDS_WARNING("data (SPDP, vendor %u.%u): no/invalid payload\n", rst->vendor.id[0], rst->vendor.id[1]);
}
return 1;
}
@ -485,12 +485,12 @@ static void make_participants_dependent_on_ddsi2 (const nn_guid_t *ddsi2guid, nn
{
if (vendor_is_opensplice (pp->vendor) && pp->e.guid.prefix.u[0] == ddsi2guid->prefix.u[0] && !pp->is_ddsi2_pp)
{
TRACE (("proxy participant %x:%x:%x:%x depends on ddsi2 %x:%x:%x:%x", PGUID (pp->e.guid), PGUID (*ddsi2guid)));
DDS_TRACE("proxy participant %x:%x:%x:%x depends on ddsi2 %x:%x:%x:%x", PGUID (pp->e.guid), PGUID (*ddsi2guid));
os_mutexLock (&pp->e.lock);
pp->privileged_pp_guid = *ddsi2guid;
os_mutexUnlock (&pp->e.lock);
proxy_participant_reassign_lease (pp, d2pp_lease);
TRACE (("\n"));
DDS_TRACE("\n");
if (ephash_lookup_proxy_participant_guid (ddsi2guid) == NULL)
{
@ -505,7 +505,7 @@ static void make_participants_dependent_on_ddsi2 (const nn_guid_t *ddsi2guid, nn
if (pp != NULL)
{
TRACE (("make_participants_dependent_on_ddsi2: ddsi2 %x:%x:%x:%x is no more, delete %x:%x:%x:%x\n", PGUID (*ddsi2guid), PGUID (pp->e.guid)));
DDS_TRACE("make_participants_dependent_on_ddsi2: ddsi2 %x:%x:%x:%x is no more, delete %x:%x:%x:%x\n", PGUID (*ddsi2guid), PGUID (pp->e.guid));
delete_proxy_participant_by_guid (&pp->e.guid, timestamp, 1);
}
}
@ -523,12 +523,12 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
nn_duration_t lease_duration;
unsigned custom_flags = 0;
if (!(config.enabled_logcats & LC_TRACE))
nn_log (LC_DISCOVERY, "SPDP ST0");
if (!(dds_get_log_mask() & DDS_LC_DISCOVERY))
DDS_LOG(DDS_LC_DISCOVERY, "SPDP ST0");
if (!(datap->present & PP_PARTICIPANT_GUID) || !(datap->present & PP_BUILTIN_ENDPOINT_SET))
{
NN_WARNING ("data (SPDP, vendor %u.%u): no/invalid payload\n", rst->vendor.id[0], rst->vendor.id[1]);
DDS_WARNING("data (SPDP, vendor %u.%u): no/invalid payload\n", rst->vendor.id[0], rst->vendor.id[1]);
return 1;
}
@ -546,7 +546,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER)) &&
config.assume_rti_has_pmd_endpoints)
{
NN_WARNING ("data (SPDP, vendor %u.%u): assuming unadvertised PMD endpoints do exist\n",
DDS_WARNING("data (SPDP, vendor %u.%u): assuming unadvertised PMD endpoints do exist\n",
rst->vendor.id[0], rst->vendor.id[1]);
builtin_endpoint_set |=
NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER |
@ -561,14 +561,14 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
but it would cause problems with cases where we would be happy with only
(say) CM participant. Have to do a backwards-compatible fix because it has
already been released with the flags all aliased to bits 0 and 1 ... */
nn_log (LC_DISCOVERY, " (ptbes_fixed_0 %x)", prismtech_builtin_endpoint_set);
DDS_LOG(DDS_LC_DISCOVERY, " (ptbes_fixed_0 %x)", prismtech_builtin_endpoint_set);
if (prismtech_builtin_endpoint_set & NN_DISC_BUILTIN_ENDPOINT_CM_PARTICIPANT_READER)
prismtech_builtin_endpoint_set |= NN_DISC_BUILTIN_ENDPOINT_CM_PUBLISHER_READER | NN_DISC_BUILTIN_ENDPOINT_CM_SUBSCRIBER_READER;
if (prismtech_builtin_endpoint_set & NN_DISC_BUILTIN_ENDPOINT_CM_PARTICIPANT_WRITER)
prismtech_builtin_endpoint_set |= NN_DISC_BUILTIN_ENDPOINT_CM_PUBLISHER_WRITER | NN_DISC_BUILTIN_ENDPOINT_CM_SUBSCRIBER_WRITER;
}
nn_log (LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->participant_guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->participant_guid));
/* Local SPDP packets may be looped back, and that may include ones
currently being deleted. The first thing that happens when
@ -578,7 +578,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
if (is_deleted_participant_guid (&datap->participant_guid, DPG_REMOTE))
{
nn_log (LC_DISCOVERY, " (recently deleted)");
DDS_LOG(DDS_LC_DISCOVERY, " (recently deleted)");
return 1;
}
@ -588,7 +588,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
islocal = 1;
if (islocal)
{
nn_log (LC_DISCOVERY, " (local %d)", islocal);
DDS_LOG(DDS_LC_DISCOVERY, " (local %d)", islocal);
return 0;
}
}
@ -599,12 +599,12 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
are even skipping the automatic lease renewal. Therefore do it
regardless of
config.arrival_of_data_asserts_pp_and_ep_liveliness. */
nn_log (LC_DISCOVERY, " (known)");
DDS_LOG(DDS_LC_DISCOVERY, " (known)");
lease_renew (os_atomic_ldvoidp (&proxypp->lease), now_et ());
os_mutexLock (&proxypp->e.lock);
if (proxypp->implicitly_created)
{
nn_log (LC_DISCOVERY, " (NEW was-implicitly-created)");
DDS_LOG(DDS_LC_DISCOVERY, " (NEW was-implicitly-created)");
proxypp->implicitly_created = 0;
update_proxy_participant_plist_locked (proxypp, datap, UPD_PROXYPP_SPDP, timestamp);
}
@ -612,7 +612,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
return 0;
}
nn_log (LC_DISCOVERY, " bes %x ptbes %x NEW", builtin_endpoint_set, prismtech_builtin_endpoint_set);
DDS_LOG(DDS_LC_DISCOVERY, " bes %x ptbes %x NEW", builtin_endpoint_set, prismtech_builtin_endpoint_set);
if (datap->present & PP_PARTICIPANT_LEASE_DURATION)
{
@ -620,7 +620,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
}
else
{
nn_log (LC_DISCOVERY, " (PARTICIPANT_LEASE_DURATION defaulting to 100s)");
DDS_LOG(DDS_LC_DISCOVERY, " (PARTICIPANT_LEASE_DURATION defaulting to 100s)");
lease_duration = nn_to_ddsi_duration (100 * T_SECOND);
}
@ -632,7 +632,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
(datap->prismtech_participant_version_info.flags & NN_PRISMTECH_FL_PARTICIPANT_IS_DDSI2))
custom_flags |= CF_PARTICIPANT_IS_DDSI2;
nn_log (LC_DISCOVERY, " (0x%08x-0x%08x-0x%08x-0x%08x-0x%08x %s)",
DDS_LOG(DDS_LC_DISCOVERY, " (0x%08x-0x%08x-0x%08x-0x%08x-0x%08x %s)",
datap->prismtech_participant_version_info.version,
datap->prismtech_participant_version_info.flags,
datap->prismtech_participant_version_info.unused[0],
@ -652,7 +652,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
if ((builtin_endpoint_set & bes_sedp_announcer_mask) != bes_sedp_announcer_mask &&
memcmp (&privileged_pp_guid, &datap->participant_guid, sizeof (nn_guid_t)) != 0)
{
nn_log (LC_DISCOVERY, " (depends on %x:%x:%x:%x)", PGUID (privileged_pp_guid));
DDS_LOG(DDS_LC_DISCOVERY, " (depends on %x:%x:%x:%x)", PGUID (privileged_pp_guid));
/* never expire lease for this proxy: it won't actually expire
until the "privileged" one expires anyway */
lease_duration = nn_to_ddsi_duration (T_NEVER);
@ -668,7 +668,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
{
privileged_pp_guid.prefix = ddsi2->e.guid.prefix;
lease_duration = nn_to_ddsi_duration (T_NEVER);
nn_log (LC_DISCOVERY, " (depends on %x:%x:%x:%x)", PGUID (privileged_pp_guid));
DDS_LOG(DDS_LC_DISCOVERY, " (depends on %x:%x:%x:%x)", PGUID (privileged_pp_guid));
}
}
else
@ -699,40 +699,40 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
else
{
uc_same_subnet = 1;
nn_log (LC_DISCOVERY, " subnet-filter");
DDS_LOG(DDS_LC_DISCOVERY, " subnet-filter");
}
/* If unicast locators not present, then try to obtain from connection */
if (!config.tcp_use_peeraddr_for_unicast && (datap->present & PP_DEFAULT_UNICAST_LOCATOR) && (get_locator (&loc, &datap->default_unicast_locators, uc_same_subnet)))
add_to_addrset (as_default, &loc);
else {
nn_log (LC_DISCOVERY, " (srclocD)");
DDS_LOG(DDS_LC_DISCOVERY, " (srclocD)");
add_to_addrset (as_default, &rst->srcloc);
}
if (!config.tcp_use_peeraddr_for_unicast && (datap->present & PP_METATRAFFIC_UNICAST_LOCATOR) && (get_locator (&loc, &datap->metatraffic_unicast_locators, uc_same_subnet)))
add_to_addrset (as_meta, &loc);
else {
nn_log (LC_DISCOVERY, " (srclocM)");
DDS_LOG(DDS_LC_DISCOVERY, " (srclocM)");
add_to_addrset (as_meta, &rst->srcloc);
}
nn_log_addrset (LC_DISCOVERY, " (data", as_default);
nn_log_addrset (LC_DISCOVERY, " meta", as_meta);
nn_log (LC_DISCOVERY, ")");
nn_log_addrset(DDS_LC_DISCOVERY, " (data", as_default);
nn_log_addrset(DDS_LC_DISCOVERY, " meta", as_meta);
DDS_LOG(DDS_LC_DISCOVERY, ")");
}
if (addrset_empty_uc (as_default) || addrset_empty_uc (as_meta))
{
nn_log (LC_DISCOVERY, " (no unicast address");
DDS_LOG(DDS_LC_DISCOVERY, " (no unicast address");
unref_addrset (as_default);
unref_addrset (as_meta);
return 1;
}
nn_log (LC_DISCOVERY, " QOS={");
nn_log_xqos (LC_DISCOVERY, &datap->qos);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, " QOS={");
nn_log_xqos(DDS_LC_DISCOVERY, &datap->qos);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
maybe_add_pp_as_meta_to_as_disc (as_meta);
@ -759,12 +759,12 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
(rst->dst_guid_prefix.u[0] != 0 || rst->dst_guid_prefix.u[1] != 0 || rst->dst_guid_prefix.u[2] != 0);
if (!have_dst)
{
nn_log (LC_DISCOVERY, "broadcasted SPDP packet -> answering");
DDS_LOG(DDS_LC_DISCOVERY, "broadcasted SPDP packet -> answering");
respond_to_spdp (&datap->participant_guid);
}
else
{
nn_log (LC_DISCOVERY, "directed SPDP packet -> not responding\n");
DDS_LOG(DDS_LC_DISCOVERY, "directed SPDP packet -> not responding\n");
}
}
@ -781,7 +781,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
of DDSI2. */
if (ephash_lookup_proxy_participant_guid (&privileged_pp_guid) == NULL)
{
nn_log (LC_DISCOVERY, "make_participants_dependent_on_ddsi2: ddsi2 %x:%x:%x:%x is no more, delete %x:%x:%x:%x\n", PGUID (privileged_pp_guid), PGUID (datap->participant_guid));
DDS_LOG(DDS_LC_DISCOVERY, "make_participants_dependent_on_ddsi2: ddsi2 %x:%x:%x:%x is no more, delete %x:%x:%x:%x\n", PGUID (privileged_pp_guid), PGUID (datap->participant_guid));
delete_proxy_participant_by_guid (&datap->participant_guid, timestamp, 1);
}
}
@ -791,10 +791,10 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
static void handle_SPDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
{
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
TRACE (("SPDP ST%x", statusinfo));
DDS_TRACE("SPDP ST%x", statusinfo);
if (data == NULL)
{
TRACE ((" no payload?\n"));
DDS_TRACE(" no payload?\n");
return;
}
else
@ -809,7 +809,7 @@ static void handle_SPDP (const struct receiver_state *rst, nn_wctime_t timestamp
src.bufsz = len - 4;
if (nn_plist_init_frommsg (&decoded_data, NULL, ~(uint64_t)0, ~(uint64_t)0, &src) < 0)
{
NN_WARNING ("SPDP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
DDS_WARNING("SPDP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
return;
}
@ -827,7 +827,7 @@ static void handle_SPDP (const struct receiver_state *rst, nn_wctime_t timestamp
}
nn_plist_fini (&decoded_data);
nn_log (interesting ? LC_DISCOVERY : LC_TRACE, "\n");
DDS_LOG(interesting ? DDS_LC_DISCOVERY : DDS_LC_TRACE, "\n");
}
}
@ -951,7 +951,7 @@ static int sedp_write_endpoint
nn_xmsg_addpar_sentinel (mpayload);
nn_plist_fini (&ps);
TRACE (("sedp: write for %x:%x:%x:%x via %x:%x:%x:%x\n", PGUID (*epguid), PGUID (wr->e.guid)));
DDS_LOG(DDS_LC_DISCOVERY, "sedp: write for %x:%x:%x:%x via %x:%x:%x:%x\n", PGUID (*epguid), PGUID (wr->e.guid));
ret = write_mpayload (wr, alive, PID_ENDPOINT_GUID, mpayload);
nn_xmsg_free (mpayload);
return ret;
@ -961,7 +961,7 @@ static struct writer *get_sedp_writer (const struct participant *pp, unsigned en
{
struct writer *sedp_wr = get_builtin_writer (pp, entityid);
if (sedp_wr == NULL)
NN_FATAL ("sedp_write_writer: no SEDP builtin writer %x for %x:%x:%x:%x\n", entityid, PGUID (pp->e.guid));
DDS_FATAL("sedp_write_writer: no SEDP builtin writer %x for %x:%x:%x:%x\n", entityid, PGUID (pp->e.guid));
return sedp_wr;
}
@ -1044,14 +1044,14 @@ static struct proxy_participant *implicitly_create_proxypp (const nn_guid_t *ppg
{
nn_vendorid_t actual_vendorid;
/* Some endpoint that we discovered through the DS, but then it must have at least some locators */
TRACE ((" from-DS %x:%x:%x:%x", PGUID (privguid)));
DDS_TRACE(" from-DS %x:%x:%x:%x", PGUID (privguid));
/* avoid "no address" case, so we never create the proxy participant for nothing (FIXME: rework some of this) */
if (!(datap->present & (PP_UNICAST_LOCATOR | PP_MULTICAST_LOCATOR)))
{
TRACE ((" data locator absent\n"));
DDS_TRACE(" data locator absent\n");
goto err;
}
nn_log (LC_DISCOVERY, " new-proxypp %x:%x:%x:%x\n", PGUID (*ppguid));
DDS_TRACE(" new-proxypp %x:%x:%x:%x\n", PGUID (*ppguid));
/* We need to handle any source of entities, but we really want to try to keep the GIDs (and
certainly the systemId component) unchanged for OSPL. The new proxy participant will take
the GID from the GUID if it is from a "modern" OSPL that advertises it includes all GIDs in
@ -1073,18 +1073,18 @@ static struct proxy_participant *implicitly_create_proxypp (const nn_guid_t *ppg
with a minimal built-in endpoint set */
struct proxy_participant *privpp;
if ((privpp = ephash_lookup_proxy_participant_guid (&privguid)) == NULL) {
TRACE ((" unknown-src-proxypp?\n"));
DDS_TRACE(" unknown-src-proxypp?\n");
goto err;
} else if (!privpp->is_ddsi2_pp) {
TRACE ((" src-proxypp-not-ddsi2?\n"));
DDS_TRACE(" src-proxypp-not-ddsi2?\n");
goto err;
} else if (!privpp->minimal_bes_mode) {
TRACE ((" src-ddsi2-not-minimal-bes-mode?\n"));
DDS_TRACE(" src-ddsi2-not-minimal-bes-mode?\n");
goto err;
} else {
struct addrset *as_default, *as_meta;
nn_plist_t tmp_plist;
TRACE ((" from-ddsi2 %x:%x:%x:%x", PGUID (privguid)));
DDS_TRACE(" from-ddsi2 %x:%x:%x:%x", PGUID (privguid));
nn_plist_init_empty (&pp_plist);
os_mutexLock (&privpp->e.lock);
@ -1109,7 +1109,7 @@ static struct proxy_participant *implicitly_create_proxypp (const nn_guid_t *ppg
static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *datap /* note: potentially modifies datap */, const nn_guid_prefix_t *src_guid_prefix, nn_vendorid_t vendorid, nn_wctime_t timestamp)
{
#define E(msg, lbl) do { nn_log (LC_DISCOVERY, (msg)); goto lbl; } while (0)
#define E(msg, lbl) do { DDS_LOG(DDS_LC_DISCOVERY, msg); goto lbl; } while (0)
struct proxy_participant *pp;
struct proxy_writer * pwr = NULL;
struct proxy_reader * prd = NULL;
@ -1126,7 +1126,7 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
if (!(datap->present & PP_ENDPOINT_GUID))
E (" no guid?\n", err);
nn_log (LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->endpoint_guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->endpoint_guid));
ppguid.prefix = datap->endpoint_guid.prefix;
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
@ -1145,11 +1145,11 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
if ((pp = ephash_lookup_proxy_participant_guid (&ppguid)) == NULL)
{
nn_log (LC_DISCOVERY, " unknown-proxypp");
DDS_LOG(DDS_LC_DISCOVERY, " unknown-proxypp");
if ((pp = implicitly_create_proxypp (&ppguid, datap, src_guid_prefix, vendorid, timestamp)) == NULL)
E ("?\n", err);
/* Repeat regular SEDP trace for convenience */
nn_log (LC_DISCOVERY, "SEDP ST0 %x:%x:%x:%x (cont)", PGUID (datap->endpoint_guid));
DDS_LOG(DDS_LC_DISCOVERY, "SEDP ST0 %x:%x:%x:%x (cont)", PGUID (datap->endpoint_guid));
}
xqos = &datap->qos;
@ -1169,7 +1169,7 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
assert (xqos->present & QP_DURABILITY);
reliable = (xqos->reliability.kind == NN_RELIABLE_RELIABILITY_QOS);
nn_log (LC_DISCOVERY, " %s %s %s: %s%s.%s/%s",
DDS_LOG(DDS_LC_DISCOVERY, " %s %s %s: %s%s.%s/%s",
reliable ? "reliable" : "best-effort",
durability_to_string (xqos->durability.kind),
is_writer ? "writer" : "reader",
@ -1197,28 +1197,28 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
if (! vendor_is_cloud (vendorid))
{
nn_log (LC_DISCOVERY, " known\n");
DDS_LOG(DDS_LC_DISCOVERY, " known\n");
goto err;
}
/* Re-bind the proxy participant to the discovery service - and do this if it is currently
bound to another DS instance, because that other DS instance may have already failed and
with a new one taking over, without our noticing it. */
nn_log (LC_DISCOVERY, " known-DS");
DDS_LOG(DDS_LC_DISCOVERY, " known-DS");
if (vendor_is_cloud (vendorid) && pp->implicitly_created && memcmp(&pp->privileged_pp_guid.prefix, src_guid_prefix, sizeof(pp->privileged_pp_guid.prefix)) != 0)
{
nn_etime_t never = { T_NEVER };
nn_log (LC_DISCOVERY, " %x:%x:%x:%x attach-to-DS %x:%x:%x:%x", PGUID(pp->e.guid), PGUIDPREFIX(*src_guid_prefix), pp->privileged_pp_guid.entityid.u);
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x attach-to-DS %x:%x:%x:%x", PGUID(pp->e.guid), PGUIDPREFIX(*src_guid_prefix), pp->privileged_pp_guid.entityid.u);
os_mutexLock (&pp->e.lock);
pp->privileged_pp_guid.prefix = *src_guid_prefix;
lease_set_expiry(os_atomic_ldvoidp(&pp->lease), never);
os_mutexUnlock (&pp->e.lock);
}
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "\n");
}
else
{
nn_log (LC_DISCOVERY, " NEW");
DDS_LOG(DDS_LC_DISCOVERY, " NEW");
}
{
@ -1228,7 +1228,7 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
add_to_addrset (as, &loc);
else if (config.tcp_use_peeraddr_for_unicast)
{
nn_log (LC_DISCOVERY, " (srcloc)");
DDS_LOG(DDS_LC_DISCOVERY, " (srcloc)");
add_to_addrset (as, &rst->srcloc);
}
else
@ -1246,22 +1246,22 @@ static void handle_SEDP_alive (const struct receiver_state *rst, nn_plist_t *dat
E (" no address", err);
}
nn_log_addrset (LC_DISCOVERY, " (as", as);
nn_log_addrset(DDS_LC_DISCOVERY, " (as", as);
#ifdef DDSI_INCLUDE_SSM
ssm = 0;
if (is_writer)
ssm = addrset_contains_ssm (as);
else if (datap->present & PP_READER_FAVOURS_SSM)
ssm = (datap->reader_favours_ssm.state != 0);
nn_log (LC_DISCOVERY, " ssm=%u", ssm);
DDS_LOG(DDS_LC_DISCOVERY, " ssm=%u", ssm);
#endif
nn_log (LC_DISCOVERY, ") QOS={");
nn_log_xqos (LC_DISCOVERY, xqos);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, ") QOS={");
nn_log_xqos(DDS_LC_DISCOVERY, xqos);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
if ((datap->endpoint_guid.entityid.u & NN_ENTITYID_SOURCE_MASK) == NN_ENTITYID_SOURCE_VENDOR && !vendor_is_prismtech (vendorid))
{
nn_log (LC_DISCOVERY, "ignoring vendor-specific endpoint %x:%x:%x:%x\n", PGUID (datap->endpoint_guid));
DDS_LOG(DDS_LC_DISCOVERY, "ignoring vendor-specific endpoint %x:%x:%x:%x\n", PGUID (datap->endpoint_guid));
}
else
{
@ -1315,10 +1315,10 @@ static void handle_SEDP_dead (nn_plist_t *datap, nn_wctime_t timestamp)
int res;
if (!(datap->present & PP_ENDPOINT_GUID))
{
nn_log (LC_DISCOVERY, " no guid?\n");
DDS_LOG(DDS_LC_DISCOVERY, " no guid?\n");
return;
}
nn_log (LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->endpoint_guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->endpoint_guid));
if (is_writer_entityid (datap->endpoint_guid.entityid))
{
res = delete_proxy_writer (&datap->endpoint_guid, timestamp, 0);
@ -1327,16 +1327,16 @@ static void handle_SEDP_dead (nn_plist_t *datap, nn_wctime_t timestamp)
{
res = delete_proxy_reader (&datap->endpoint_guid, timestamp, 0);
}
nn_log (LC_DISCOVERY, " %s\n", (res < 0) ? " unknown" : " delete");
DDS_LOG(DDS_LC_DISCOVERY, " %s\n", (res < 0) ? " unknown" : " delete");
}
static void handle_SEDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
{
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
nn_log (LC_DISCOVERY, "SEDP ST%x", statusinfo);
DDS_LOG(DDS_LC_DISCOVERY, "SEDP ST%x", statusinfo);
if (data == NULL)
{
nn_log (LC_DISCOVERY, " no payload?\n");
DDS_LOG(DDS_LC_DISCOVERY, " no payload?\n");
return;
}
else
@ -1350,7 +1350,7 @@ static void handle_SEDP (const struct receiver_state *rst, nn_wctime_t timestamp
src.bufsz = len - 4;
if (nn_plist_init_frommsg (&decoded_data, NULL, ~(uint64_t)0, ~(uint64_t)0, &src) < 0)
{
NN_WARNING ("SEDP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
DDS_WARNING("SEDP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
return;
}
@ -1400,7 +1400,7 @@ int sedp_write_topic (struct participant *pp, const struct nn_plist *datap)
nn_plist_addtomsg (mpayload, datap, ~(uint64_t)0, delta);
nn_xmsg_addpar_sentinel (mpayload);
TRACE (("sedp: write topic %s via %x:%x:%x:%x\n", datap->qos.topic_name, PGUID (sedp_wr->e.guid)));
DDS_TRACE("sedp: write topic %s via %x:%x:%x:%x\n", datap->qos.topic_name, PGUID (sedp_wr->e.guid));
ret = write_mpayload (sedp_wr, 1, PID_TOPIC_NAME, mpayload);
nn_xmsg_free (mpayload);
return ret;
@ -1449,8 +1449,8 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
}
nn_xmsg_addpar_sentinel (mpayload);
TRACE (("sedp: write CMParticipant ST%x for %x:%x:%x:%x via %x:%x:%x:%x\n",
alive ? 0 : NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, PGUID (pp->e.guid), PGUID (sedp_wr->e.guid)));
DDS_TRACE("sedp: write CMParticipant ST%x for %x:%x:%x:%x via %x:%x:%x:%x\n",
alive ? 0 : NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, PGUID (pp->e.guid), PGUID (sedp_wr->e.guid));
ret = write_mpayload (sedp_wr, alive, PID_PARTICIPANT_GUID, mpayload);
nn_xmsg_free (mpayload);
return ret;
@ -1459,12 +1459,12 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_entity_id, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
{
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
nn_log (LC_DISCOVERY, "SEDP_CM ST%x", statusinfo);
DDS_LOG(DDS_LC_DISCOVERY, "SEDP_CM ST%x", statusinfo);
assert (wr_entity_id.u == NN_ENTITYID_SEDP_BUILTIN_CM_PARTICIPANT_WRITER);
(void) wr_entity_id;
if (data == NULL)
{
nn_log (LC_DISCOVERY, " no payload?\n");
DDS_LOG(DDS_LC_DISCOVERY, " no payload?\n");
return;
}
else
@ -1478,7 +1478,7 @@ static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_e
src.bufsz = len - 4;
if (nn_plist_init_frommsg (&decoded_data, NULL, ~(uint64_t)0, ~(uint64_t)0, &src) < 0)
{
NN_WARNING ("SEDP_CM (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
DDS_WARNING("SEDP_CM (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
return;
}
@ -1487,7 +1487,7 @@ static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_e
{
struct proxy_participant *proxypp;
if (!(decoded_data.present & PP_PARTICIPANT_GUID))
NN_WARNING ("SEDP_CM (vendor %u.%u): missing participant GUID\n", src.vendorid.id[0], src.vendorid.id[1]);
DDS_WARNING("SEDP_CM (vendor %u.%u): missing participant GUID\n", src.vendorid.id[0], src.vendorid.id[1]);
else
{
if ((proxypp = ephash_lookup_proxy_participant_guid (&decoded_data.participant_guid)) == NULL)
@ -1499,7 +1499,7 @@ static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_e
nn_plist_fini (&decoded_data);
}
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "\n");
}
static struct participant *group_guid_to_participant (const nn_guid_t *group_guid)
@ -1520,8 +1520,8 @@ int sedp_write_cm_publisher (const struct nn_plist *datap, int alive)
if ((pp = group_guid_to_participant (&datap->group_guid)) == NULL)
{
TRACE (("sedp: write CMPublisher alive:%d for %x:%x:%x:%x dropped: no participant\n",
alive, PGUID (datap->group_guid)));
DDS_TRACE("sedp: write CMPublisher alive:%d for %x:%x:%x:%x dropped: no participant\n",
alive, PGUID (datap->group_guid));
return 0;
}
sedp_wr = get_sedp_writer (pp, NN_ENTITYID_SEDP_BUILTIN_CM_PUBLISHER_WRITER);
@ -1556,8 +1556,8 @@ int sedp_write_cm_subscriber (const struct nn_plist *datap, int alive)
if ((pp = group_guid_to_participant (&datap->group_guid)) == NULL)
{
TRACE (("sedp: write CMSubscriber alive:%d for %x:%x:%x:%x dropped: no participant\n",
alive, PGUID (datap->group_guid)));
DDS_LOG(DDS_LC_DISCOVERY, "sedp: write CMSubscriber alive:%d for %x:%x:%x:%x dropped: no participant\n",
alive, PGUID (datap->group_guid));
return 0;
}
sedp_wr = get_sedp_writer (pp, NN_ENTITYID_SEDP_BUILTIN_CM_SUBSCRIBER_WRITER);
@ -1584,19 +1584,19 @@ int sedp_write_cm_subscriber (const struct nn_plist *datap, int alive)
static void handle_SEDP_GROUP_alive (nn_plist_t *datap /* note: potentially modifies datap */, nn_wctime_t timestamp)
{
#define E(msg, lbl) do { nn_log (LC_DISCOVERY, (msg)); goto lbl; } while (0)
#define E(msg, lbl) do { DDS_LOG(DDS_LC_DISCOVERY, msg); goto lbl; } while (0)
nn_guid_t ppguid;
if (!(datap->present & PP_GROUP_GUID))
E (" no guid?\n", err);
nn_log (LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->group_guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x", PGUID (datap->group_guid));
ppguid.prefix = datap->group_guid.prefix;
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
if (ephash_lookup_proxy_participant_guid (&ppguid) == NULL)
E (" unknown proxy pp?\n", err);
nn_log (LC_DISCOVERY, " alive\n");
DDS_LOG(DDS_LC_DISCOVERY, " alive\n");
{
char *name = (datap->present & PP_ENTITY_NAME) ? datap->entity_name : "";
@ -1611,20 +1611,20 @@ static void handle_SEDP_GROUP_dead (nn_plist_t *datap, nn_wctime_t timestamp)
{
if (!(datap->present & PP_GROUP_GUID))
{
nn_log (LC_DISCOVERY, " no guid?\n");
DDS_LOG(DDS_LC_DISCOVERY, " no guid?\n");
return;
}
nn_log (LC_DISCOVERY, " %x:%x:%x:%x\n", PGUID (datap->group_guid));
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x\n", PGUID (datap->group_guid));
delete_proxy_group (&datap->group_guid, timestamp, 0);
}
static void handle_SEDP_GROUP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
{
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
nn_log (LC_DISCOVERY, "SEDP_GROUP ST%x", statusinfo);
DDS_LOG(DDS_LC_DISCOVERY, "SEDP_GROUP ST%x", statusinfo);
if (data == NULL)
{
nn_log (LC_DISCOVERY, " no payload?\n");
DDS_LOG(DDS_LC_DISCOVERY, " no payload?\n");
return;
}
else
@ -1638,7 +1638,7 @@ static void handle_SEDP_GROUP (const struct receiver_state *rst, nn_wctime_t tim
src.bufsz = len - 4;
if (nn_plist_init_frommsg (&decoded_data, NULL, ~(uint64_t)0, ~(uint64_t)0, &src) < 0)
{
NN_WARNING ("SEDP_GROUP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
DDS_WARNING("SEDP_GROUP (vendor %u.%u): invalid qos/parameters\n", src.vendorid.id[0], src.vendorid.id[1]);
return;
}
@ -1759,7 +1759,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
src.bufsz = NN_RDATA_PAYLOAD_OFF (fragchain) - qos_offset;
if (nn_plist_init_frommsg (&qos, NULL, PP_STATUSINFO | PP_KEYHASH, 0, &src) < 0)
{
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": invalid inline qos\n",
DDS_WARNING("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": invalid inline qos\n",
src.vendorid.id[0], src.vendorid.id[1], PGUID (srcguid), sampleinfo->seq);
goto done_upd_deliv;
}
@ -1783,7 +1783,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
{
if (datasz == 0 || !(data_smhdr_flags & DATA_FLAG_DATAFLAG))
{
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
DDS_WARNING("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
"built-in data but no payload\n",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (srcguid), sampleinfo->seq);
@ -1797,7 +1797,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
hasn't been checked fully yet. */
if (!(data_smhdr_flags & DATA_FLAG_KEYFLAG))
{
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
DDS_WARNING("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
"dispose/unregister of built-in data but payload not just key\n",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (srcguid), sampleinfo->seq);
@ -1839,7 +1839,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
pid = PID_ENDPOINT_GUID;
break;
default:
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": mapping keyhash to ENDPOINT_GUID",
DDS_WARNING("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": mapping keyhash to ENDPOINT_GUID",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (srcguid), sampleinfo->seq);
pid = PID_ENDPOINT_GUID;
@ -1856,7 +1856,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
}
else
{
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
DDS_WARNING("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": "
"dispose/unregister with no content\n",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (srcguid), sampleinfo->seq);
@ -1884,7 +1884,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
handle_SEDP_GROUP (sampleinfo->rst, timestamp, statusinfo, datap, datasz);
break;
default:
NN_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": not handled\n",
DDS_WARNING ("data(builtin, vendor %u.%u): %x:%x:%x:%x #%"PRId64": not handled\n",
sampleinfo->rst->vendor.id[0], sampleinfo->rst->vendor.id[1],
PGUID (srcguid), sampleinfo->seq);
break;

View file

@ -352,7 +352,7 @@ struct debug_monitor *new_debug_monitor (int port)
dm->servsock = ddsi_factory_create_listener (dm->tran_factory, port, NULL);
if (dm->servsock == NULL)
{
NN_WARNING ("debmon: can't create socket\n");
DDS_WARNING("debmon: can't create socket\n");
goto err_servsock;
}
@ -360,7 +360,7 @@ struct debug_monitor *new_debug_monitor (int port)
nn_locator_t loc;
char buf[DDSI_LOCSTRLEN];
(void) ddsi_listener_locator(dm->servsock, &loc);
nn_log (LC_CONFIG, "debmon at %s\n", ddsi_locator_to_string (buf, sizeof(buf), &loc));
DDS_LOG(DDS_LC_CONFIG, "debmon at %s\n", ddsi_locator_to_string (buf, sizeof(buf), &loc));
}
os_mutexInit (&dm->lock);

View file

@ -297,7 +297,7 @@ int is_deleted_participant_guid (const struct nn_guid *guid, unsigned for_what)
static void remove_deleted_participant_guid (const struct nn_guid *guid, unsigned for_what)
{
struct deleted_participant *n;
nn_log (LC_DISCOVERY, "remove_deleted_participant_guid(%x:%x:%x:%x for_what=%x)\n", PGUID (*guid), for_what);
DDS_LOG(DDS_LC_DISCOVERY, "remove_deleted_participant_guid(%x:%x:%x:%x for_what=%x)\n", PGUID (*guid), for_what);
os_mutexLock (&deleted_participants_lock);
if ((n = ut_avlLookup (&deleted_participants_treedef, &deleted_participants, guid)) != NULL)
{
@ -339,7 +339,7 @@ int pp_allocate_entityid(nn_entityid_t *id, unsigned kind, struct participant *p
}
else
{
NN_ERROR("pp_allocate_entityid(%x:%x:%x:%x): all ids in use\n", PGUID(pp->e.guid));
DDS_ERROR("pp_allocate_entityid(%x:%x:%x:%x): all ids in use\n", PGUID(pp->e.guid));
ret = ERR_OUT_OF_IDS;
}
os_mutexUnlock (&pp->e.lock);
@ -390,12 +390,12 @@ int new_participant_guid (const nn_guid_t *ppguid, unsigned flags, const nn_plis
else
{
os_mutexUnlock (&gv.participant_set_lock);
NN_ERROR ("new_participant(%x:%x:%x:%x, %x) failed: max participants reached\n", PGUID (*ppguid), flags);
DDS_ERROR("new_participant(%x:%x:%x:%x, %x) failed: max participants reached\n", PGUID (*ppguid), flags);
return ERR_OUT_OF_IDS;
}
}
nn_log (LC_DISCOVERY, "new_participant(%x:%x:%x:%x, %x)\n", PGUID (*ppguid), flags);
DDS_LOG(DDS_LC_DISCOVERY, "new_participant(%x:%x:%x:%x, %x)\n", PGUID (*ppguid), flags);
pp = os_malloc (sizeof (*pp));
@ -411,11 +411,11 @@ int new_participant_guid (const nn_guid_t *ppguid, unsigned flags, const nn_plis
nn_plist_copy (pp->plist, plist);
nn_plist_mergein_missing (pp->plist, &gv.default_plist_pp);
if (config.enabled_logcats & LC_DISCOVERY)
if (dds_get_log_mask() & DDS_LC_DISCOVERY)
{
nn_log (LC_DISCOVERY, "PARTICIPANT %x:%x:%x:%x QOS={", PGUID (pp->e.guid));
nn_log_xqos (LC_DISCOVERY, &pp->plist->qos);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, "PARTICIPANT %x:%x:%x:%x QOS={", PGUID (pp->e.guid));
nn_log_xqos(DDS_LC_DISCOVERY, &pp->plist->qos);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
}
if (config.many_sockets_mode == MSM_MANY_UNICAST)
@ -650,7 +650,7 @@ static struct participant *ref_participant (struct participant *pp, const struct
stguid = *guid_of_refing_entity;
else
memset (&stguid, 0, sizeof (stguid));
nn_log (LC_DISCOVERY, "ref_participant(%x:%x:%x:%x @ %p <- %x:%x:%x:%x @ %p) user %d builtin %d\n",
DDS_LOG(DDS_LC_DISCOVERY, "ref_participant(%x:%x:%x:%x @ %p <- %x:%x:%x:%x @ %p) user %d builtin %d\n",
PGUID (pp->e.guid), (void*)pp, PGUID (stguid), (void*)guid_of_refing_entity, pp->user_refc, pp->builtin_refc);
os_mutexUnlock (&pp->refc_lock);
return pp;
@ -691,7 +691,7 @@ static void unref_participant (struct participant *pp, const struct nn_guid *gui
stguid = *guid_of_refing_entity;
else
memset (&stguid, 0, sizeof (stguid));
nn_log (LC_DISCOVERY, "unref_participant(%x:%x:%x:%x @ %p <- %x:%x:%x:%x @ %p) user %d builtin %d\n",
DDS_LOG(DDS_LC_DISCOVERY, "unref_participant(%x:%x:%x:%x @ %p <- %x:%x:%x:%x @ %p) user %d builtin %d\n",
PGUID (pp->e.guid), (void*)pp, PGUID (stguid), (void*)guid_of_refing_entity, pp->user_refc, pp->builtin_refc);
if (pp->user_refc == 0 && (pp->bes != 0 || pp->prismtech_bes != 0) && !pp->builtins_deleted)
@ -803,7 +803,7 @@ static void unref_participant (struct participant *pp, const struct nn_guid *gui
static void gc_delete_participant (struct gcreq *gcreq)
{
struct participant *pp = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_participant(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_participant(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pp->e.guid));
gcreq_free (gcreq);
unref_participant (pp, NULL);
}
@ -863,7 +863,7 @@ struct writer *get_builtin_writer (const struct participant *pp, unsigned entity
bes_mask = NN_DISC_BUILTIN_ENDPOINT_TOPIC_ANNOUNCER;
break;
default:
NN_FATAL ("get_builtin_writer called with entityid %x\n", entityid);
DDS_FATAL ("get_builtin_writer called with entityid %x\n", entityid);
return NULL;
}
@ -983,7 +983,7 @@ static void rebuild_make_locs(int *p_nlocs, nn_locator_t **p_locs, struct addrse
j++;
}
nlocs = i+1;
nn_log(LC_DISCOVERY, "reduced nlocs=%d\n", nlocs);
DDS_LOG(DDS_LC_DISCOVERY, "reduced nlocs=%d\n", nlocs);
*p_nlocs = nlocs;
*p_locs = locs;
}
@ -1069,13 +1069,13 @@ static void rebuild_trace_covered(int nreaders, int nlocs, const nn_locator_t *l
{
char buf[INET6_ADDRSTRLEN_EXTENDED];
ddsi_locator_to_string(buf, sizeof(buf), &locs[i]);
nn_log(LC_DISCOVERY, " loc %2d = %-20s %2d {", i, buf, locs_nrds[i]);
DDS_LOG(DDS_LC_DISCOVERY, " loc %2d = %-20s %2d {", i, buf, locs_nrds[i]);
for (j = 0; j < nreaders; j++)
if (covered[j * nlocs + i] >= 0)
nn_log(LC_DISCOVERY, " %d", covered[j * nlocs + i]);
DDS_LOG(DDS_LC_DISCOVERY, " %d", covered[j * nlocs + i]);
else
nn_log(LC_DISCOVERY, " .");
nn_log(LC_DISCOVERY, " }\n");
DDS_LOG(DDS_LC_DISCOVERY, " .");
DDS_LOG(DDS_LC_DISCOVERY, " }\n");
}
}
@ -1106,7 +1106,7 @@ static void rebuild_add(struct addrset *newas, int locidx, int nreaders, int nlo
if (locs[locidx].kind != NN_LOCATOR_KIND_UDPv4MCGEN)
{
ddsi_locator_to_string(str, sizeof(str), &locs[locidx]);
nn_log(LC_DISCOVERY, " simple %s\n", str);
DDS_LOG(DDS_LC_DISCOVERY, " simple %s\n", str);
add_to_addrset(newas, &locs[locidx]);
}
else /* convert MC gen to the correct multicast address */
@ -1125,7 +1125,7 @@ static void rebuild_add(struct addrset *newas, int locidx, int nreaders, int nlo
ipn = htonl(iph);
memcpy(l.address + 12, &ipn, 4);
ddsi_locator_to_string(str, sizeof(str), &l);
nn_log(LC_DISCOVERY, " mcgen %s\n", str);
DDS_LOG(DDS_LC_DISCOVERY, " mcgen %s\n", str);
add_to_addrset(newas, &l);
}
}
@ -1158,7 +1158,8 @@ static void rebuild_writer_addrset_setcover(struct addrset *newas, struct writer
int best;
if ((all_addrs = rebuild_make_all_addrs(&nreaders, wr)) == NULL)
return;
nn_log_addrset(LC_DISCOVERY, "setcover: all_addrs", all_addrs); nn_log(LC_DISCOVERY, "\n");
nn_log_addrset(DDS_LC_DISCOVERY, "setcover: all_addrs", all_addrs);
DDS_LOG(DDS_LC_DISCOVERY, "\n");
rebuild_make_locs(&nlocs, &locs, all_addrs);
unref_addrset(all_addrs);
rebuild_make_covered(&covered, wr, &nreaders, nlocs, locs);
@ -1168,7 +1169,7 @@ static void rebuild_writer_addrset_setcover(struct addrset *newas, struct writer
while ((best = rebuild_select(nlocs, locs, locs_nrds)) >= 0)
{
rebuild_trace_covered(nreaders, nlocs, locs, locs_nrds, covered);
nn_log(LC_DISCOVERY, " best = %d\n", best);
DDS_LOG(DDS_LC_DISCOVERY, " best = %d\n", best);
rebuild_add(newas, best, nreaders, nlocs, locs, covered);
rebuild_drop(best, nreaders, nlocs, locs_nrds, covered);
assert (locs_nrds[best] == 0);
@ -1196,9 +1197,9 @@ static void rebuild_writer_addrset (struct writer *wr)
wr->as = newas;
unref_addrset (oldas);
nn_log (LC_DISCOVERY, "rebuild_writer_addrset(%x:%x:%x:%x):", PGUID (wr->e.guid));
nn_log_addrset (LC_DISCOVERY, "", wr->as);
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "rebuild_writer_addrset(%x:%x:%x:%x):", PGUID (wr->e.guid));
nn_log_addrset(DDS_LC_DISCOVERY, "", wr->as);
DDS_LOG(DDS_LC_DISCOVERY, "\n");
}
void rebuild_or_clear_writer_addrsets(int rebuild)
@ -1206,7 +1207,7 @@ void rebuild_or_clear_writer_addrsets(int rebuild)
struct ephash_enum_writer est;
struct writer *wr;
struct addrset *empty = rebuild ? NULL : new_addrset();
nn_log (LC_DISCOVERY, "rebuild_or_delete_writer_addrsets(%d)\n", rebuild);
DDS_LOG(DDS_LC_DISCOVERY, "rebuild_or_delete_writer_addrsets(%d)\n", rebuild);
ephash_enum_writer_init (&est);
os_rwlockRead (&gv.qoslock);
while ((wr = ephash_enum_writer_next (&est)) != NULL)
@ -1234,7 +1235,7 @@ void rebuild_or_clear_writer_addrsets(int rebuild)
}
os_rwlockUnlock (&gv.qoslock);
ephash_enum_writer_fini (&est);
nn_log (LC_DISCOVERY, "rebuild_or_delete_writer_addrsets(%d) done\n", rebuild);
DDS_LOG(DDS_LC_DISCOVERY, "rebuild_or_delete_writer_addrsets(%d) done\n", rebuild);
}
static void free_wr_prd_match (struct wr_prd_match *m)
@ -1256,7 +1257,7 @@ static void free_rd_pwr_match (struct rd_pwr_match *m)
assert (ddsi_is_mcaddr (&m->ssm_mc_loc));
assert (!is_unspec_locator (&m->ssm_src_loc));
if (ddsi_leave_mc (gv.data_conn_mc, &m->ssm_src_loc, &m->ssm_mc_loc) < 0)
nn_log (LC_WARNING, "failed to leave network partition ssm group\n");
DDS_WARNING("failed to leave network partition ssm group\n");
}
#endif
os_free (m);
@ -1421,19 +1422,19 @@ static void update_reader_init_acknack_count (const struct nn_guid *rd_guid, nn_
/* Update the initial acknack sequence number for the reader. See
also reader_add_connection(). */
nn_log (LC_DISCOVERY, "update_reader_init_acknack_count (%x:%x:%x:%x, %d): ", PGUID (*rd_guid), count);
DDS_LOG(DDS_LC_DISCOVERY, "update_reader_init_acknack_count (%x:%x:%x:%x, %d): ", PGUID (*rd_guid), count);
if ((rd = ephash_lookup_reader_guid (rd_guid)) != NULL)
{
os_mutexLock (&rd->e.lock);
nn_log (LC_DISCOVERY, "%d -> ", rd->init_acknack_count);
DDS_LOG(DDS_LC_DISCOVERY, "%d -> ", rd->init_acknack_count);
if (count > rd->init_acknack_count)
rd->init_acknack_count = count;
nn_log (LC_DISCOVERY, "%d\n", count);
DDS_LOG(DDS_LC_DISCOVERY, "%d\n", count);
os_mutexUnlock (&rd->e.lock);
}
else
{
nn_log (LC_DISCOVERY, "reader no longer exists\n");
DDS_LOG(DDS_LC_DISCOVERY, "reader no longer exists\n");
}
}
@ -1502,7 +1503,7 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
os_mutexLock (&prd->e.lock);
if (prd->deleting)
{
nn_log (LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - prd is being deleted\n",
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - prd is being deleted\n",
PGUID (wr->e.guid), PGUID (prd->e.guid));
pretend_everything_acked = 1;
}
@ -1530,14 +1531,14 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
m->seq = wr->seq;
if (ut_avlLookupIPath (&wr_readers_treedef, &wr->readers, &prd->e.guid, &path))
{
nn_log(LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (prd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (prd->e.guid));
os_mutexUnlock (&wr->e.lock);
nn_lat_estim_fini (&m->hb_to_ack_latency);
os_free (m);
}
else
{
nn_log(LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - ack seq %"PRId64"\n", PGUID (wr->e.guid), PGUID (prd->e.guid), m->seq);
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - ack seq %"PRId64"\n", PGUID (wr->e.guid), PGUID (prd->e.guid), m->seq);
ut_avlInsertIPath (&wr_readers_treedef, &wr->readers, m, &path);
rebuild_writer_addrset (wr);
wr->num_reliable_readers += m->is_reliable;
@ -1587,13 +1588,13 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
os_mutexLock (&wr->e.lock);
if (ut_avlLookupIPath (&wr_local_readers_treedef, &wr->local_readers, &rd->e.guid, &path))
{
nn_log(LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
os_mutexUnlock (&wr->e.lock);
os_free (m);
return;
}
nn_log(LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)", PGUID (wr->e.guid), PGUID (rd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)", PGUID (wr->e.guid), PGUID (rd->e.guid));
m->rd_guid = rd->e.guid;
ut_avlInsertIPath (&wr_local_readers_treedef, &wr->local_readers, m, &path);
local_reader_ary_insert (&wr->rdary, rd);
@ -1620,7 +1621,7 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
os_mutexUnlock (&wr->e.lock);
nn_log(LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "\n");
if (wr->status_cb)
{
@ -1647,19 +1648,19 @@ static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr,
writer will always see monotonically increasing sequence numbers
from one particular reader. This is then used for the
pwr_rd_match initialization */
nn_log (LC_DISCOVERY, " reader %x:%x:%x:%x init_acknack_count = %d\n", PGUID (rd->e.guid), rd->init_acknack_count);
DDS_LOG(DDS_LC_DISCOVERY, " reader %x:%x:%x:%x init_acknack_count = %d\n", PGUID (rd->e.guid), rd->init_acknack_count);
*init_count = rd->init_acknack_count;
if (ut_avlLookupIPath (&rd_writers_treedef, &rd->writers, &pwr->e.guid, &path))
{
nn_log (LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n",
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n",
PGUID (pwr->e.guid), PGUID (rd->e.guid));
os_mutexUnlock (&rd->e.lock);
os_free (m);
}
else
{
nn_log (LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x)\n",
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x)\n",
PGUID (pwr->e.guid), PGUID (rd->e.guid));
ut_avlInsertIPath (&rd_writers_treedef, &rd->writers, m, &path);
os_mutexUnlock (&rd->e.lock);
@ -1707,13 +1708,13 @@ static void reader_add_local_connection (struct reader *rd, struct writer *wr)
if (ut_avlLookupIPath (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid, &path))
{
nn_log(LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
os_mutexUnlock (&rd->e.lock);
os_free (m);
}
else
{
nn_log(LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
ut_avlInsertIPath (&rd_local_writers_treedef, &rd->local_writers, m, &path);
os_mutexUnlock (&rd->e.lock);
@ -1750,7 +1751,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
pwr->ddsi2direct_cbarg = rd->ddsi2direct_cbarg;
}
nn_log (LC_DISCOVERY, " proxy_writer_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x)",
DDS_LOG(DDS_LC_DISCOVERY, " proxy_writer_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x)",
PGUID (pwr->e.guid), PGUID (rd->e.guid));
m->rd_guid = rd->e.guid;
m->tcreate = now_mt ();
@ -1785,7 +1786,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
m->in_sync = PRMSS_TLCATCHUP;
m->u.not_in_sync.end_of_tl_seq = MAX_SEQ_NUMBER;
if (m->in_sync != PRMSS_SYNC)
nn_log (LC_DISCOVERY, " - tlcatchup");
DDS_LOG(DDS_LC_DISCOVERY, " - tlcatchup");
}
else if (!config.conservative_builtin_reader_startup && is_builtin_entityid (rd->e.guid.entityid, ownvendorid) && !ut_avlIsEmpty (&pwr->readers))
{
@ -1798,7 +1799,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
m->in_sync = PRMSS_OUT_OF_SYNC;
m->u.not_in_sync.end_of_tl_seq = pwr->last_seq;
m->u.not_in_sync.end_of_out_of_sync_seq = last_deliv_seq;
nn_log(LC_DISCOVERY, " - out-of-sync %"PRId64, m->u.not_in_sync.end_of_out_of_sync_seq);
DDS_LOG(DDS_LC_DISCOVERY, " - out-of-sync %"PRId64, m->u.not_in_sync.end_of_out_of_sync_seq);
}
if (m->in_sync != PRMSS_SYNC)
pwr->n_readers_out_of_sync++;
@ -1828,7 +1829,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
os_mutexUnlock (&pwr->e.lock);
qxev_pwr_entityid (pwr, &rd->e.guid.prefix);
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "\n");
if (rd->status_cb)
{
@ -1843,7 +1844,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
already_matched:
assert (is_builtin_entityid (pwr->e.guid.entityid, pwr->c.vendor) ? (pwr->c.topic == NULL) : (pwr->c.topic != NULL));
nn_log (LC_DISCOVERY, " proxy_writer_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n",
DDS_LOG(DDS_LC_DISCOVERY, " proxy_writer_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n",
PGUID (pwr->e.guid), PGUID (rd->e.guid));
os_mutexUnlock (&pwr->e.lock);
os_free (m);
@ -1861,14 +1862,14 @@ static void proxy_reader_add_connection (struct proxy_reader *prd, struct writer
prd->c.topic = wr->topic;
if (ut_avlLookupIPath (&prd_writers_treedef, &prd->writers, &wr->e.guid, &path))
{
nn_log (LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n",
DDS_LOG(DDS_LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n",
PGUID (wr->e.guid), PGUID (prd->e.guid));
os_mutexUnlock (&prd->e.lock);
os_free (m);
}
else
{
nn_log (LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x)\n",
DDS_LOG(DDS_LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x)\n",
PGUID (wr->e.guid), PGUID (prd->e.guid));
ut_avlInsertIPath (&prd_writers_treedef, &prd->writers, m, &path);
os_mutexUnlock (&prd->e.lock);
@ -2195,7 +2196,7 @@ static void generic_do_match (struct entity_common *e, nn_mtime_t tnow)
enum entity_kind mkind = generic_do_match_mkind(e->kind);
if (!is_builtin_entityid (e->guid.entityid, ownvendorid))
{
nn_log(LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning all %ss\n",
DDS_LOG(DDS_LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning all %ss\n",
generic_do_match_kindstr_us (e->kind), generic_do_match_kindstr_us (mkind),
generic_do_match_kindabbrev (e->kind), PGUID (e->guid),
generic_do_match_kindstr(mkind));
@ -2216,7 +2217,7 @@ static void generic_do_match (struct entity_common *e, nn_mtime_t tnow)
/* Built-ins have fixed QoS */
nn_entityid_t tgt_ent = builtin_entityid_match (e->guid.entityid);
enum entity_kind pkind = generic_do_match_isproxy (e) ? EK_PARTICIPANT : EK_PROXY_PARTICIPANT;
nn_log(LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning %sparticipants tgt=%x\n",
DDS_LOG(DDS_LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning %sparticipants tgt=%x\n",
generic_do_match_kindstr_us (e->kind), generic_do_match_kindstr_us (mkind),
generic_do_match_kindabbrev (e->kind), PGUID (e->guid),
generic_do_match_isproxy (e) ? "" : "proxy ",
@ -2247,7 +2248,7 @@ static void generic_do_local_match (struct entity_common *e, nn_mtime_t tnow)
/* never a need for local matches on discovery endpoints */
return;
mkind = generic_do_local_match_mkind(e->kind);
nn_log(LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning all %ss\n",
DDS_LOG(DDS_LC_DISCOVERY, "match_%s_with_%ss(%s %x:%x:%x:%x) scanning all %ss\n",
generic_do_match_kindstr_us (e->kind), generic_do_match_kindstr_us (mkind),
generic_do_match_kindabbrev (e->kind), PGUID (e->guid),
generic_do_match_kindstr(mkind));
@ -2314,7 +2315,7 @@ static void new_reader_writer_common (const struct nn_guid *guid, const struct d
if (xqos->partition.n > 1)
partition_suffix = "+";
}
nn_log (LC_DISCOVERY, "new_%s(guid %x:%x:%x:%x, %s%s.%s/%s)\n",
DDS_LOG(DDS_LC_DISCOVERY, "new_%s(guid %x:%x:%x:%x, %s%s.%s/%s)\n",
is_writer_entityid (guid->entityid) ? "writer" : "reader",
PGUID (*guid),
partition, partition_suffix,
@ -2377,7 +2378,7 @@ static uint32_t get_partitionid_from_mapping (const char *partition, const char
return 0;
else
{
nn_log (LC_DISCOVERY, "matched writer for topic \"%s\" in partition \"%s\" to networkPartition \"%s\"\n", topic, partition, pm->networkPartition);
DDS_LOG(DDS_LC_DISCOVERY, "matched writer for topic \"%s\" in partition \"%s\" to networkPartition \"%s\"\n", topic, partition, pm->networkPartition);
return pm->partition->partitionId;
}
}
@ -2549,7 +2550,7 @@ unsigned remove_acked_messages (struct writer *wr, struct whc_state *whcst, stru
writer_clear_retransmitting (wr);
if (wr->state == WRST_LINGERING && whcst->unacked_bytes == 0)
{
nn_log (LC_DISCOVERY, "remove_acked_messages: deleting lingering writer %x:%x:%x:%x\n", PGUID (wr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "remove_acked_messages: deleting lingering writer %x:%x:%x:%x\n", PGUID (wr->e.guid));
delete_writer_nolinger_locked (wr);
}
return n;
@ -2604,11 +2605,11 @@ static struct writer * new_writer_guid (const struct nn_guid *guid, const struct
assert (wr->xqos->aliased == 0);
set_topic_type_name (wr->xqos, topic);
if (config.enabled_logcats & LC_DISCOVERY)
if (dds_get_log_mask() & DDS_LC_DISCOVERY)
{
nn_log (LC_DISCOVERY, "WRITER %x:%x:%x:%x QOS={", PGUID (wr->e.guid));
nn_log_xqos (LC_DISCOVERY, wr->xqos);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, "WRITER %x:%x:%x:%x QOS={", PGUID (wr->e.guid));
nn_log_xqos (DDS_LC_DISCOVERY, wr->xqos);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
}
assert (wr->xqos->present & QP_RELIABILITY);
wr->reliable = (wr->xqos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS);
@ -2698,9 +2699,9 @@ static struct writer * new_writer_guid (const struct nn_guid *guid, const struct
wr->supports_ssm = 1;
wr->ssm_as = new_addrset ();
add_to_addrset (wr->ssm_as, &loc);
nn_log (LC_DISCOVERY, "writer %x:%x:%x:%x: ssm=%d", PGUID (wr->e.guid), wr->supports_ssm);
nn_log_addrset (LC_DISCOVERY, "", wr->ssm_as);
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "writer %x:%x:%x:%x: ssm=%d", PGUID (wr->e.guid), wr->supports_ssm);
nn_log_addrset (DDS_LC_DISCOVERY, "", wr->ssm_as);
DDS_LOG(DDS_LC_DISCOVERY, "\n");
}
}
#endif
@ -2711,7 +2712,7 @@ static struct writer * new_writer_guid (const struct nn_guid *guid, const struct
if (!is_builtin_entityid (wr->e.guid.entityid, ownvendorid))
{
struct config_channel_listelem *channel = find_channel (wr->xqos->transport_priority);
nn_log (LC_DISCOVERY, "writer %x:%x:%x:%x: transport priority %d => channel '%s' priority %d\n",
DDS_LOG(DDS_LC_DISCOVERY, "writer %x:%x:%x:%x: transport priority %d => channel '%s' priority %d\n",
PGUID (wr->e.guid), wr->xqos->transport_priority.value, channel->name, channel->priority);
wr->evq = channel->evq ? channel->evq : gv.xevents;
}
@ -2739,7 +2740,7 @@ static struct writer * new_writer_guid (const struct nn_guid *guid, const struct
if (wr->xqos->liveliness.kind != NN_AUTOMATIC_LIVELINESS_QOS ||
nn_from_ddsi_duration (wr->xqos->liveliness.lease_duration) != T_NEVER)
{
nn_log (LC_INFO | LC_DISCOVERY, "writer %x:%x:%x:%x: incorrectly treating it as of automatic liveliness kind with lease duration = inf (%d, %"PRId64")\n", PGUID (wr->e.guid), (int) wr->xqos->liveliness.kind, nn_from_ddsi_duration (wr->xqos->liveliness.lease_duration));
DDS_LOG(DDS_LC_INFO | DDS_LC_DISCOVERY, "writer %x:%x:%x:%x: incorrectly treating it as of automatic liveliness kind with lease duration = inf (%d, %"PRId64")\n", PGUID (wr->e.guid), (int) wr->xqos->liveliness.kind, nn_from_ddsi_duration (wr->xqos->liveliness.lease_duration));
}
wr->lease_duration = T_NEVER; /* FIXME */
@ -2798,7 +2799,7 @@ struct writer * new_writer (struct nn_guid *wrguid, const struct nn_guid *group_
if ((pp = ephash_lookup_participant_guid (ppguid)) == NULL)
{
nn_log (LC_DISCOVERY, "new_writer - participant %x:%x:%x:%x not found\n", PGUID (*ppguid));
DDS_LOG(DDS_LC_DISCOVERY, "new_writer - participant %x:%x:%x:%x not found\n", PGUID (*ppguid));
return NULL;
}
/* participant can't be freed while we're mucking around cos we are
@ -2814,7 +2815,7 @@ struct writer * new_writer (struct nn_guid *wrguid, const struct nn_guid *group_
static void gc_delete_writer (struct gcreq *gcreq)
{
struct writer *wr = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_writer(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (wr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_writer(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (wr->e.guid));
gcreq_free (gcreq);
/* We now allow GC while blocked on a full WHC, but we still don't allow deleting a writer while blocked on it. The writer's state must be DELETING by the time we get here, and that means the transmit path is no longer blocked. It doesn't imply that the write thread is no longer in throttle_writer(), just that if it is, it will soon return from there. Therefore, block until it isn't throttling anymore. We can safely lock the writer, as we're on the separate GC thread. */
@ -2873,7 +2874,7 @@ static void gc_delete_writer (struct gcreq *gcreq)
static void gc_delete_writer_throttlewait (struct gcreq *gcreq)
{
struct writer *wr = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_writer_throttlewait(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (wr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_writer_throttlewait(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (wr->e.guid));
/* We now allow GC while blocked on a full WHC, but we still don't allow deleting a writer while blocked on it. The writer's state must be DELETING by the time we get here, and that means the transmit path is no longer blocked. It doesn't imply that the write thread is no longer in throttle_writer(), just that if it is, it will soon return from there. Therefore, block until it isn't throttling anymore. We can safely lock the writer, as we're on the separate GC thread. */
assert (wr->state == WRST_DELETING);
os_mutexLock (&wr->e.lock);
@ -2886,7 +2887,7 @@ static void gc_delete_writer_throttlewait (struct gcreq *gcreq)
static void writer_set_state (struct writer *wr, enum writer_state newstate)
{
ASSERT_MUTEX_HELD (&wr->e.lock);
nn_log (LC_DISCOVERY, "writer_set_state(%x:%x:%x:%x) state transition %d -> %d\n", PGUID (wr->e.guid), wr->state, newstate);
DDS_LOG(DDS_LC_DISCOVERY, "writer_set_state(%x:%x:%x:%x) state transition %d -> %d\n", PGUID (wr->e.guid), wr->state, newstate);
assert (newstate > wr->state);
if (wr->state == WRST_OPERATIONAL)
{
@ -2903,7 +2904,7 @@ static void writer_set_state (struct writer *wr, enum writer_state newstate)
int delete_writer_nolinger_locked (struct writer *wr)
{
nn_log (LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) ...\n", PGUID (wr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) ...\n", PGUID (wr->e.guid));
ASSERT_MUTEX_HELD (&wr->e.lock);
local_reader_ary_setinvalid (&wr->rdary);
ephash_remove_writer_guid (wr);
@ -2924,10 +2925,10 @@ int delete_writer_nolinger (const struct nn_guid *guid)
assert (is_writer_entityid (guid->entityid));
if ((wr = ephash_lookup_writer_guid (guid)) == NULL)
{
nn_log (LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
return ERR_UNKNOWN_ENTITY;
}
nn_log (LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer_nolinger(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
os_mutexLock (&wr->e.lock);
delete_writer_nolinger_locked (wr);
os_mutexUnlock (&wr->e.lock);
@ -2940,10 +2941,10 @@ int delete_writer (const struct nn_guid *guid)
struct whc_state whcst;
if ((wr = ephash_lookup_writer_guid (guid)) == NULL)
{
nn_log (LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
return ERR_UNKNOWN_ENTITY;
}
nn_log (LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
os_mutexLock (&wr->e.lock);
/* If no unack'ed data, don't waste time or resources (expected to
@ -2953,7 +2954,7 @@ int delete_writer (const struct nn_guid *guid)
whc_get_state(wr->whc, &whcst);
if (whcst.unacked_bytes == 0)
{
nn_log (LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - no unack'ed samples\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - no unack'ed samples\n", PGUID (*guid));
delete_writer_nolinger_locked (wr);
os_mutexUnlock (&wr->e.lock);
}
@ -2965,7 +2966,7 @@ int delete_writer (const struct nn_guid *guid)
os_mutexUnlock (&wr->e.lock);
tsched = add_duration_to_mtime (now_mt (), config.writer_linger_duration);
mtime_to_sec_usec (&tsec, &tusec, tsched);
nn_log (LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - unack'ed samples, will delete when ack'd or at t = %d.%06d\n",
DDS_LOG(DDS_LC_DISCOVERY, "delete_writer(guid %x:%x:%x:%x) - unack'ed samples, will delete when ack'd or at t = %d.%06d\n",
PGUID (*guid), tsec, tusec);
qxev_delete_writer (tsched, &wr->e.guid);
}
@ -2984,7 +2985,7 @@ void writer_exit_startup_mode (struct writer *wr)
cnt += remove_acked_messages (wr, &whcst, &deferred_free_list);
cnt += whc_downgrade_to_volatile (wr->whc, &whcst);
writer_clear_retransmitting (wr);
nn_log (LC_DISCOVERY, " %x:%x:%x:%x: dropped %u samples\n", PGUID(wr->e.guid), cnt);
DDS_LOG(DDS_LC_DISCOVERY, " %x:%x:%x:%x: dropped %u samples\n", PGUID(wr->e.guid), cnt);
}
os_mutexUnlock (&wr->e.lock);
whc_free_deferred_free_list (wr->whc, deferred_free_list);
@ -3013,7 +3014,7 @@ static struct addrset * get_as_from_mapping (const char *partition, const char *
struct addrset *as = new_addrset ();
if ((pm = find_partitionmapping (partition, topic)) != NULL)
{
nn_log (LC_DISCOVERY, "matched reader for topic \"%s\" in partition \"%s\" to networkPartition \"%s\"\n", topic, partition, pm->networkPartition);
DDS_LOG(DDS_LC_DISCOVERY, "matched reader for topic \"%s\" in partition \"%s\" to networkPartition \"%s\"\n", topic, partition, pm->networkPartition);
assert (pm->partition->as);
copy_addrset_into_addrset (as, pm->partition->as);
}
@ -3029,7 +3030,7 @@ static void join_mcast_helper (const nn_locator_t *n, void * varg)
{
if (ddsi_join_mc (conn, NULL, n) < 0)
{
nn_log (LC_WARNING, "failed to join network partition multicast group\n");
DDS_LOG(DDS_LC_WARNING, "failed to join network partition multicast group\n");
}
}
else /* join all addresses that include this node */
@ -3053,7 +3054,7 @@ static void join_mcast_helper (const nn_locator_t *n, void * varg)
memcpy(l.address + 12, &ipn, 4);
if (ddsi_join_mc (conn, NULL, &l) < 0)
{
nn_log (LC_WARNING, "failed to join network partition multicast group\n");
DDS_LOG(DDS_LC_WARNING, "failed to join network partition multicast group\n");
}
}
}
@ -3071,7 +3072,7 @@ static void leave_mcast_helper (const nn_locator_t *n, void * varg)
{
if (ddsi_leave_mc (conn, NULL, n) < 0)
{
nn_log (LC_WARNING, "failed to leave network partition multicast group\n");
DDS_LOG(DDS_LC_WARNING, "failed to leave network partition multicast group\n");
}
}
else /* join all addresses that include this node */
@ -3095,7 +3096,7 @@ static void leave_mcast_helper (const nn_locator_t *n, void * varg)
memcpy(l.address + 12, &ipn, 4);
if (ddsi_leave_mc (conn, NULL, &l) < 0)
{
nn_log (LC_WARNING, "failed to leave network partition multicast group\n");
DDS_LOG(DDS_LC_WARNING, "failed to leave network partition multicast group\n");
}
}
}
@ -3138,11 +3139,11 @@ static struct reader * new_reader_guid
assert (rd->xqos->aliased == 0);
set_topic_type_name (rd->xqos, topic);
if (config.enabled_logcats & LC_DISCOVERY)
if (dds_get_log_mask() & DDS_LC_DISCOVERY)
{
nn_log (LC_DISCOVERY, "READER %x:%x:%x:%x QOS={", PGUID (rd->e.guid));
nn_log_xqos (LC_DISCOVERY, rd->xqos);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, "READER %x:%x:%x:%x QOS={", PGUID (rd->e.guid));
nn_log_xqos (DDS_LC_DISCOVERY, rd->xqos);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
}
assert (rd->xqos->present & QP_RELIABILITY);
rd->reliable = (rd->xqos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS);
@ -3171,7 +3172,7 @@ static struct reader * new_reader_guid
if (rd->xqos->liveliness.kind != NN_AUTOMATIC_LIVELINESS_QOS ||
nn_from_ddsi_duration (rd->xqos->liveliness.lease_duration) != T_NEVER)
{
nn_log (LC_INFO | LC_DISCOVERY, "reader %x:%x:%x:%x: incorrectly treating it as of automatic liveliness kind with lease duration = inf (%d, %"PRId64")\n", PGUID (rd->e.guid), (int) rd->xqos->liveliness.kind, nn_from_ddsi_duration (rd->xqos->liveliness.lease_duration));
DDS_LOG(DDS_LC_INFO | DDS_LC_DISCOVERY, "reader %x:%x:%x:%x: incorrectly treating it as of automatic liveliness kind with lease duration = inf (%d, %"PRId64")\n", PGUID (rd->e.guid), (int) rd->xqos->liveliness.kind, nn_from_ddsi_duration (rd->xqos->liveliness.lease_duration));
}
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
@ -3203,11 +3204,11 @@ static struct reader * new_reader_guid
* - Join the socket if a multicast address
*/
addrset_forall (rd->as, join_mcast_helper, gv.data_conn_mc);
if (config.enabled_logcats & LC_DISCOVERY)
if (dds_get_log_mask() & DDS_LC_DISCOVERY)
{
nn_log (LC_DISCOVERY, "READER %x:%x:%x:%x locators={", PGUID (rd->e.guid));
nn_log_addrset (LC_DISCOVERY, "", rd->as);
nn_log (LC_DISCOVERY, "}\n");
DDS_LOG(DDS_LC_DISCOVERY, "READER %x:%x:%x:%x locators={", PGUID (rd->e.guid));
nn_log_addrset(DDS_LC_DISCOVERY, "", rd->as);
DDS_LOG(DDS_LC_DISCOVERY, "}\n");
}
}
#ifdef DDSI_INCLUDE_SSM
@ -3223,7 +3224,7 @@ static struct reader * new_reader_guid
}
#ifdef DDSI_INCLUDE_SSM
if (rd->favours_ssm)
nn_log (LC_DISCOVERY, "READER %x:%x:%x:%x ssm=%d\n", PGUID (rd->e.guid), rd->favours_ssm);
DDS_LOG(DDS_LC_DISCOVERY, "READER %x:%x:%x:%x ssm=%d\n", PGUID (rd->e.guid), rd->favours_ssm);
#endif
#endif
@ -3254,7 +3255,7 @@ struct reader * new_reader
if ((pp = ephash_lookup_participant_guid (ppguid)) == NULL)
{
nn_log (LC_DISCOVERY, "new_reader - participant %x:%x:%x:%x not found\n", PGUID (*ppguid));
DDS_LOG(DDS_LC_DISCOVERY, "new_reader - participant %x:%x:%x:%x not found\n", PGUID (*ppguid));
return NULL;
}
rdguid->prefix = pp->e.guid.prefix;
@ -3268,7 +3269,7 @@ static void gc_delete_reader (struct gcreq *gcreq)
{
/* see gc_delete_writer for comments */
struct reader *rd = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (rd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (rd->e.guid));
gcreq_free (gcreq);
while (!ut_avlIsEmpty (&rd->writers))
@ -3317,14 +3318,14 @@ int delete_reader (const struct nn_guid *guid)
assert (!is_writer_entityid (guid->entityid));
if ((rd = ephash_lookup_reader_guid (guid)) == NULL)
{
nn_log (LC_DISCOVERY, "delete_reader_guid(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_reader_guid(guid %x:%x:%x:%x) - unknown guid\n", PGUID (*guid));
return ERR_UNKNOWN_ENTITY;
}
if (rd->rhc)
{
(ddsi_plugin.rhc_plugin.rhc_fini_fn) (rd->rhc);
}
nn_log (LC_DISCOVERY, "delete_reader_guid(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_reader_guid(guid %x:%x:%x:%x) ...\n", PGUID (*guid));
ephash_remove_reader_guid (rd);
gcreq_reader (rd);
return 0;
@ -3669,7 +3670,7 @@ static void unref_proxy_participant (struct proxy_participant *proxypp, struct p
{
assert (proxypp->endpoints == NULL);
os_mutexUnlock (&proxypp->e.lock);
nn_log (LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=0, freeing\n", PGUID (proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=0, freeing\n", PGUID (proxypp->e.guid));
unref_addrset (proxypp->as_default);
@ -3686,7 +3687,7 @@ static void unref_proxy_participant (struct proxy_participant *proxypp, struct p
{
assert (refc == 1);
os_mutexUnlock (&proxypp->e.lock);
nn_log (LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=%u, no endpoints, implicitly created, deleting\n", PGUID (proxypp->e.guid), (unsigned) refc);
DDS_LOG(DDS_LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=%u, no endpoints, implicitly created, deleting\n", PGUID (proxypp->e.guid), (unsigned) refc);
delete_proxy_participant_by_guid(&proxypp->e.guid, tnow, 1);
/* Deletion is still (and has to be) asynchronous. A parallel endpoint creation may or may not
succeed, and if it succeeds it will be deleted along with the proxy participant. So "your
@ -3695,14 +3696,14 @@ static void unref_proxy_participant (struct proxy_participant *proxypp, struct p
else
{
os_mutexUnlock (&proxypp->e.lock);
nn_log (LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=%u\n", PGUID (proxypp->e.guid), (unsigned) refc);
DDS_LOG(DDS_LC_DISCOVERY, "unref_proxy_participant(%x:%x:%x:%x): refc=%u\n", PGUID (proxypp->e.guid), (unsigned) refc);
}
}
static void gc_delete_proxy_participant (struct gcreq *gcreq)
{
struct proxy_participant *proxypp = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_proxy_participant(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_participant(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (proxypp->e.guid));
gcreq_free (gcreq);
unref_proxy_participant (proxypp, NULL);
}
@ -3735,7 +3736,7 @@ static void delete_or_detach_dependent_pp (struct proxy_participant *p, struct p
{
nn_etime_t texp = add_duration_to_etime (now_et(), config.ds_grace_period);
/* Clear dependency (but don't touch entity id, which must be 0x1c1) and set the lease ticking */
nn_log (LC_DISCOVERY, "%x:%x:%x:%x detach-from-DS %x:%x:%x:%x\n", PGUID(p->e.guid), PGUID(proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "%x:%x:%x:%x detach-from-DS %x:%x:%x:%x\n", PGUID(p->e.guid), PGUID(proxypp->e.guid));
memset (&p->privileged_pp_guid.prefix, 0, sizeof (p->privileged_pp_guid.prefix));
lease_set_expiry (os_atomic_ldvoidp (&p->lease), texp);
os_mutexUnlock (&p->e.lock);
@ -3748,7 +3749,7 @@ static void delete_ppt (struct proxy_participant * proxypp, nn_wctime_t timestam
int ret;
/* if any proxy participants depend on this participant, delete them */
nn_log (LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting dependent proxy participants\n", PGUID (proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting dependent proxy participants\n", PGUID (proxypp->e.guid));
{
struct ephash_enum_proxy_participant est;
struct proxy_participant *p;
@ -3765,11 +3766,11 @@ static void delete_ppt (struct proxy_participant * proxypp, nn_wctime_t timestam
if (isimplicit)
proxypp->lease_expired = 1;
nn_log (LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting groups\n", PGUID (proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting groups\n", PGUID (proxypp->e.guid));
while (!ut_avlIsEmpty (&proxypp->groups))
delete_proxy_group_locked (ut_avlRoot (&proxypp_groups_treedef, &proxypp->groups), timestamp, isimplicit);
nn_log (LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting endpoints\n", PGUID (proxypp->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting endpoints\n", PGUID (proxypp->e.guid));
c = proxypp->endpoints;
while (c)
{
@ -3834,16 +3835,16 @@ int delete_proxy_participant_by_guid (const struct nn_guid * guid, nn_wctime_t t
{
struct proxy_participant * ppt;
nn_log (LC_DISCOVERY, "delete_proxy_participant_by_guid(%x:%x:%x:%x) ", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_proxy_participant_by_guid(%x:%x:%x:%x) ", PGUID (*guid));
os_mutexLock (&gv.lock);
ppt = ephash_lookup_proxy_participant_guid (guid);
if (ppt == NULL)
{
os_mutexUnlock (&gv.lock);
nn_log (LC_DISCOVERY, "- unknown\n");
DDS_LOG(DDS_LC_DISCOVERY, "- unknown\n");
return ERR_UNKNOWN_ENTITY;
}
nn_log (LC_DISCOVERY, "- deleting\n");
DDS_LOG(DDS_LC_DISCOVERY, "- deleting\n");
propagate_builtin_topic_cmparticipant(&(ppt->e), ppt->plist, timestamp, false);
propagate_builtin_topic_participant(&(ppt->e), ppt->plist, timestamp, false);
remember_deleted_participant_guid (&ppt->e.guid);
@ -3879,7 +3880,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
if ((proxypp = ephash_lookup_proxy_participant_guid (&ppguid)) == NULL)
{
nn_log (LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x) - unknown participant\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x) - unknown participant\n", PGUID (*guid));
return 0;
}
else
@ -3896,7 +3897,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
is_sub = 1;
break;
default:
NN_WARNING ("new_proxy_group: unrecognised entityid: %x\n", guid->entityid.u);
DDS_WARNING("new_proxy_group: unrecognised entityid: %x\n", guid->entityid.u);
return ERR_INVALID_DATA;
}
os_mutexLock (&proxypp->e.lock);
@ -3911,7 +3912,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
else
{
/* Always have a guid, may not have a gid */
nn_log (LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x): new\n", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x): new\n", PGUID (*guid));
pgroup = os_malloc (sizeof (*pgroup));
pgroup->guid = *guid;
pgroup->proxypp = proxypp;
@ -3922,14 +3923,14 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
if (name)
{
assert (xqos != NULL);
nn_log (LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x): setting name (%s) and qos\n", PGUID (*guid), name);
DDS_LOG(DDS_LC_DISCOVERY, "new_proxy_group(%x:%x:%x:%x): setting name (%s) and qos\n", PGUID (*guid), name);
pgroup->name = os_strdup (name);
pgroup->xqos = nn_xqos_dup (xqos);
nn_xqos_mergein_missing (pgroup->xqos, is_sub ? &gv.default_xqos_sub : &gv.default_xqos_pub);
}
out:
os_mutexUnlock (&proxypp->e.lock);
nn_log (LC_DISCOVERY, "\n");
DDS_LOG(DDS_LC_DISCOVERY, "\n");
return 0;
}
}
@ -3940,7 +3941,7 @@ static void delete_proxy_group_locked (struct proxy_group *pgroup, nn_wctime_t t
(void)timestamp;
(void)isimplicit;
assert ((pgroup->xqos != NULL) == (pgroup->name != NULL));
nn_log (LC_DISCOVERY, "delete_proxy_group_locked %x:%x:%x:%x\n", PGUID (pgroup->guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_proxy_group_locked %x:%x:%x:%x\n", PGUID (pgroup->guid));
ut_avlDelete (&proxypp_groups_treedef, &proxypp->groups, pgroup);
/* Publish corresponding built-in topic only if it is not a place
holder: in that case we haven't announced its presence and
@ -4029,7 +4030,7 @@ int new_proxy_writer (const struct nn_guid *ppguid, const struct nn_guid *guid,
if ((proxypp = ephash_lookup_proxy_participant_guid (ppguid)) == NULL)
{
NN_WARNING ("new_proxy_writer(%x:%x:%x:%x): proxy participant unknown\n", PGUID (*guid));
DDS_WARNING("new_proxy_writer(%x:%x:%x:%x): proxy participant unknown\n", PGUID (*guid));
return ERR_UNKNOWN_ENTITY;
}
@ -4071,12 +4072,12 @@ int new_proxy_writer (const struct nn_guid *ppguid, const struct nn_guid *guid,
assert (pwr->c.xqos->present & QP_LIVELINESS);
if (pwr->c.xqos->liveliness.kind != NN_AUTOMATIC_LIVELINESS_QOS)
nn_log (LC_DISCOVERY, " FIXME: only AUTOMATIC liveliness supported");
DDS_LOG(DDS_LC_DISCOVERY, " FIXME: only AUTOMATIC liveliness supported");
#if 0
pwr->tlease_dur = nn_from_ddsi_duration (pwr->c.xqos->liveliness.lease_duration);
if (pwr->tlease_dur == 0)
{
nn_log (LC_DISCOVERY, " FIXME: treating lease_duration=0 as inf");
DDS_LOG(DDS_LC_DISCOVERY, " FIXME: treating lease_duration=0 as inf");
pwr->tlease_dur = T_NEVER;
}
pwr->tlease_end = add_duration_to_wctime (tnow, pwr->tlease_dur);
@ -4194,7 +4195,7 @@ void update_proxy_reader (struct proxy_reader * prd, struct addrset * as)
static void gc_delete_proxy_writer (struct gcreq *gcreq)
{
struct proxy_writer *pwr = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_proxy_writer(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_writer(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
gcreq_free (gcreq);
while (!ut_avlIsEmpty (&pwr->readers))
@ -4217,12 +4218,12 @@ int delete_proxy_writer (const struct nn_guid *guid, nn_wctime_t timestamp, int
struct proxy_writer *pwr;
(void)timestamp;
(void)isimplicit;
nn_log (LC_DISCOVERY, "delete_proxy_writer (%x:%x:%x:%x) ", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_proxy_writer (%x:%x:%x:%x) ", PGUID (*guid));
os_mutexLock (&gv.lock);
if ((pwr = ephash_lookup_proxy_writer_guid (guid)) == NULL)
{
os_mutexUnlock (&gv.lock);
nn_log (LC_DISCOVERY, "- unknown\n");
DDS_LOG(DDS_LC_DISCOVERY, "- unknown\n");
return ERR_UNKNOWN_ENTITY;
}
/* Set "deleting" flag in particular for Lite, to signal to the receive path it can't
@ -4230,7 +4231,7 @@ int delete_proxy_writer (const struct nn_guid *guid, nn_wctime_t timestamp, int
table will prevent the readers from looking up the proxy writer, and consequently
from removing themselves from the proxy writer's rdary[]. */
local_reader_ary_setinvalid (&pwr->rdary);
nn_log(LC_DISCOVERY, "- deleting\n");
DDS_LOG(DDS_LC_DISCOVERY, "- deleting\n");
ephash_remove_proxy_writer_guid (pwr);
os_mutexUnlock (&gv.lock);
gcreq_proxy_writer (pwr);
@ -4255,7 +4256,7 @@ int new_proxy_reader (const struct nn_guid *ppguid, const struct nn_guid *guid,
if ((proxypp = ephash_lookup_proxy_participant_guid (ppguid)) == NULL)
{
NN_WARNING ("new_proxy_reader(%x:%x:%x:%x): proxy participant unknown\n", PGUID (*guid));
DDS_WARNING("new_proxy_reader(%x:%x:%x:%x): proxy participant unknown\n", PGUID (*guid));
return ERR_UNKNOWN_ENTITY;
}
@ -4328,7 +4329,7 @@ static void proxy_reader_set_delete_and_ack_all_messages (struct proxy_reader *p
static void gc_delete_proxy_reader (struct gcreq *gcreq)
{
struct proxy_reader *prd = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_proxy_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (prd->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (prd->e.guid));
gcreq_free (gcreq);
while (!ut_avlIsEmpty (&prd->writers))
@ -4348,17 +4349,17 @@ int delete_proxy_reader (const struct nn_guid *guid, nn_wctime_t timestamp, int
struct proxy_reader *prd;
(void)timestamp;
(void)isimplicit;
nn_log (LC_DISCOVERY, "delete_proxy_reader (%x:%x:%x:%x) ", PGUID (*guid));
DDS_LOG(DDS_LC_DISCOVERY, "delete_proxy_reader (%x:%x:%x:%x) ", PGUID (*guid));
os_mutexLock (&gv.lock);
if ((prd = ephash_lookup_proxy_reader_guid (guid)) == NULL)
{
os_mutexUnlock (&gv.lock);
nn_log (LC_DISCOVERY, "- unknown\n");
DDS_LOG(DDS_LC_DISCOVERY, "- unknown\n");
return ERR_UNKNOWN_ENTITY;
}
ephash_remove_proxy_reader_guid (prd);
os_mutexUnlock (&gv.lock);
nn_log (LC_DISCOVERY, "- deleting\n");
DDS_LOG(DDS_LC_DISCOVERY, "- deleting\n");
/* If the proxy reader is reliable, pretend it has just acked all
messages: this allows a throttled writer to once again make
@ -4408,7 +4409,7 @@ static void gc_delete_proxy_writer_dqueue_bubble_cb (struct gcreq *gcreq)
{
/* delete proxy_writer, phase 3 */
struct proxy_writer *pwr = gcreq->arg;
nn_log (LC_DISCOVERY, "gc_delete_proxy_writer_dqueue_bubble(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_writer_dqueue_bubble(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
gcreq_requeue (gcreq, gc_delete_proxy_writer);
}
@ -4417,7 +4418,7 @@ static void gc_delete_proxy_writer_dqueue (struct gcreq *gcreq)
/* delete proxy_writer, phase 2 */
struct proxy_writer *pwr = gcreq->arg;
struct nn_dqueue *dqueue = pwr->dqueue;
nn_log (LC_DISCOVERY, "gc_delete_proxy_writer_dqueue(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_writer_dqueue(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
nn_dqueue_enqueue_callback (dqueue, (void (*) (void *)) gc_delete_proxy_writer_dqueue_bubble_cb, gcreq);
}

View file

@ -134,24 +134,24 @@ static uint32_t gcreq_queue_thread (struct gcreq_queue *q)
if (!threads_vtime_check (&gcreq->nvtimes, gcreq->vtimes))
{
/* Not all threads made enough progress => gcreq is not ready
yet => sleep for a bit and rety. Note that we can't even
yet => sleep for a bit and retry. Note that we can't even
terminate while this gcreq is waiting and that there is no
condition on which to wait, so a plain sleep is quite
reasonable. */
if (trace_shortsleep)
{
TRACE (("gc %p: not yet, shortsleep\n", (void*)gcreq));
DDS_TRACE("gc %p: not yet, shortsleep\n", (void*)gcreq);
trace_shortsleep = 0;
}
os_nanoSleep (shortsleep);
}
else
{
/* Sufficent progress has been made: may now continue deleting
/* Sufficient progress has been made: may now continue deleting
it; the callback is responsible for requeueing (if complex
multi-phase delete) or freeing the delete request. Reset
the current gcreq as this one obviously is no more. */
TRACE (("gc %p: deleting\n", (void*)gcreq));
DDS_TRACE("gc %p: deleting\n", (void*)gcreq);
thread_state_awake (self);
gcreq->cb (gcreq);
thread_state_asleep (self);

View file

@ -96,7 +96,7 @@ static int make_uc_sockets (uint32_t * pdisc, uint32_t * pdata, int ppid)
}
else
{
NN_FATAL ("make_uc_sockets: invalid participant index %d\n", ppid);
DDS_FATAL("make_uc_sockets: invalid participant index %d\n", ppid);
return -1;
}
@ -149,7 +149,7 @@ static int set_recvips (void)
#if OS_SOCKET_HAS_IPV6
if (gv.ipv6_link_local)
{
NN_WARNING ("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: using 'preferred' instead of 'all' because of IPv6 link-local address\n");
DDS_WARNING("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: using 'preferred' instead of 'all' because of IPv6 link-local address\n");
gv.recvips_mode = RECVIPS_MODE_PREFERRED;
}
else
@ -163,7 +163,7 @@ static int set_recvips (void)
#if OS_SOCKET_HAS_IPV6
if (gv.ipv6_link_local)
{
NN_ERROR ("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: 'any' is unsupported in combination with an IPv6 link-local address\n");
DDS_ERROR("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: 'any' is unsupported in combination with an IPv6 link-local address\n");
return -1;
}
#endif
@ -189,7 +189,7 @@ static int set_recvips (void)
nn_locator_t loc;
if (ddsi_locator_from_string(&loc, config.networkRecvAddressStrings[i]) != AFSR_OK)
{
NN_ERROR ("%s: not a valid address in DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses\n", config.networkRecvAddressStrings[i]);
DDS_ERROR("%s: not a valid address in DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses\n", config.networkRecvAddressStrings[i]);
return -1;
}
if (compare_locators(&loc, &gv.interfaces[gv.selected_interface].loc) == 0)
@ -200,7 +200,7 @@ static int set_recvips (void)
gv.recvips_mode = have_selected ? RECVIPS_MODE_PREFERRED : RECVIPS_MODE_NONE;
if (have_others)
{
NN_WARNING ("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: using 'preferred' because of IPv6 local address\n");
DDS_WARNING("DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses: using 'preferred' because of IPv6 local address\n");
}
}
#endif
@ -214,7 +214,7 @@ static int set_recvips (void)
nn_locator_t loc;
if (ddsi_locator_from_string(&loc, config.networkRecvAddressStrings[i]) != AFSR_OK)
{
NN_ERROR ("%s: not a valid address in DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses\n", config.networkRecvAddressStrings[i]);
DDS_ERROR("%s: not a valid address in DDSI2EService/General/MulticastRecvNetworkInterfaceAddresses\n", config.networkRecvAddressStrings[i]);
return -1;
}
for (j = 0; j < gv.n_interfaces; j++)
@ -224,7 +224,7 @@ static int set_recvips (void)
}
if (j == gv.n_interfaces)
{
NN_ERROR ("No interface bound to requested address '%s'\n", config.networkRecvAddressStrings[i]);
DDS_ERROR("No interface bound to requested address '%s'\n", config.networkRecvAddressStrings[i]);
return -1;
}
*recvnode = os_malloc (sizeof (struct ospl_in_addr_node));
@ -255,13 +255,13 @@ static int string_to_default_locator (nn_locator_t *loc, const char *string, uin
case AFSR_OK:
break;
case AFSR_INVALID:
NN_ERROR ("%s: not a valid address (%s)\n", string, tag);
DDS_ERROR("%s: not a valid address (%s)\n", string, tag);
return -1;
case AFSR_UNKNOWN:
NN_ERROR ("%s: address name resolution failure (%s)\n", string, tag);
DDS_ERROR("%s: address name resolution failure (%s)\n", string, tag);
return -1;
case AFSR_MISMATCH:
NN_ERROR ("%s: invalid address kind (%s)\n", string, tag);
DDS_ERROR("%s: invalid address kind (%s)\n", string, tag);
return -1;
}
if (port != 0 && !is_unspec_locator(loc))
@ -275,7 +275,7 @@ static int string_to_default_locator (nn_locator_t *loc, const char *string, uin
const int ismc = is_unspec_locator (loc) || ddsi_is_mcaddr (loc);
if (mc != ismc)
{
NN_ERROR ("%s: %s %s be the unspecified address or a multicast address\n", string, tag, rel);
DDS_ERROR("%s: %s %s be the unspecified address or a multicast address\n", string, tag, rel);
return -1;
}
}
@ -307,7 +307,7 @@ static int set_spdp_address (void)
#ifdef DDSI_INCLUDE_SSM
if (gv.loc_spdp_mc.kind != NN_LOCATOR_KIND_INVALID && ddsi_is_ssm_mcaddr (&gv.loc_spdp_mc))
{
NN_ERROR ("%s: SPDP address may not be an SSM address\n", config.spdpMulticastAddressString);
DDS_ERROR("%s: SPDP address may not be an SSM address\n", config.spdpMulticastAddressString);
return -1;
}
#endif
@ -348,7 +348,7 @@ static int set_ext_address_and_mask (void)
else if ((rc = string_to_default_locator (&loc, config.externalAddressString, 0, 0, "external address")) < 0)
return rc;
else if (rc == 0) {
NN_WARNING ("Ignoring ExternalNetworkAddress %s\n", config.externalAddressString);
DDS_WARNING("Ignoring ExternalNetworkAddress %s\n", config.externalAddressString);
gv.extloc = gv.ownloc;
} else {
gv.extloc = loc;
@ -362,7 +362,7 @@ static int set_ext_address_and_mask (void)
}
else if (config.transport_selector != TRANS_UDP)
{
NN_ERROR ("external network masks only supported in IPv4 mode\n");
DDS_ERROR("external network masks only supported in IPv4 mode\n");
return -1;
}
else
@ -412,11 +412,11 @@ static int check_thread_properties (void)
}
if (chanprefix[i] == NULL)
{
NN_ERROR ("config: DDSI2Service/Threads/Thread[@name=\"%s\"]: unknown thread\n", e->name);
DDS_ERROR("config: DDSI2Service/Threads/Thread[@name=\"%s\"]: unknown thread\n", e->name);
ok = 0;
}
#else
NN_ERROR ("config: DDSI2Service/Threads/Thread[@name=\"%s\"]: unknown thread\n", e->name);
DDS_ERROR("config: DDSI2Service/Threads/Thread[@name=\"%s\"]: unknown thread\n", e->name);
ok = 0;
#endif /* DDSI_INCLUDE_NETWORK_CHANNELS */
}
@ -446,7 +446,7 @@ int rtps_config_open (void)
}
else if ((config.tracingOutputFile = fopen (config.tracingOutputFileName, config.tracingAppendToFile ? "a" : "w")) == NULL)
{
NN_ERROR ("%s: cannot open for writing\n", config.tracingOutputFileName);
DDS_ERROR("%s: cannot open for writing\n", config.tracingOutputFileName);
status = 0;
}
else
@ -454,6 +454,10 @@ int rtps_config_open (void)
status = 1;
}
dds_set_log_mask(config.enabled_logcats);
dds_set_log_file(config.tracingOutputFile);
dds_set_trace_file(config.tracingOutputFile);
return status;
}
@ -471,7 +475,7 @@ int rtps_config_prep (struct cfgst *cfgst)
config.whc_init_highwater_mark.value < config.whc_lowwater_mark ||
config.whc_init_highwater_mark.value > config.whc_highwater_mark)
{
NN_ERROR ("Invalid watermark settings\n");
DDS_ERROR("Invalid watermark settings\n");
goto err_config_late_error;
}
@ -483,7 +487,7 @@ int rtps_config_prep (struct cfgst *cfgst)
inherited by readers/writers), but in many sockets mode each
participant has its own socket, and therefore unique address
set */
NN_ERROR ("Minimal built-in endpoint set mode and ManySocketsMode are incompatible\n");
DDS_ERROR("Minimal built-in endpoint set mode and ManySocketsMode are incompatible\n");
goto err_config_late_error;
}
@ -509,7 +513,7 @@ int rtps_config_prep (struct cfgst *cfgst)
{
double max = (double) config.auxiliary_bandwidth_limit * ((double) config.nack_delay / 1e9);
if (max < 0)
NN_FATAL ("AuxiliaryBandwidthLimit * NackDelay = %g bytes is insane\n", max);
DDS_FATAL("AuxiliaryBandwidthLimit * NackDelay = %g bytes is insane\n", max);
if (max > 2147483647.0)
config.max_queued_rexmit_bytes = 2147483647u;
else
@ -523,7 +527,7 @@ int rtps_config_prep (struct cfgst *cfgst)
/* Verify thread properties refer to defined threads */
if (!check_thread_properties ())
{
NN_ERROR ("Could not initialise configuration\n");
DDS_ERROR("Could not initialise configuration\n");
goto err_config_late_error;
}
@ -534,7 +538,7 @@ int rtps_config_prep (struct cfgst *cfgst)
have chosen the latter. */
if (config.useIpv6)
{
NN_ERROR ("IPv6 addressing requested but not supported on this platform\n");
DDS_ERROR("IPv6 addressing requested but not supported on this platform\n");
goto err_config_late_error;
}
#endif
@ -559,7 +563,7 @@ int rtps_config_prep (struct cfgst *cfgst)
if (config.transport_selector != TRANS_UDP && chptr->diffserv_field != 0)
{
NN_ERROR ("channel %s specifies IPv4 DiffServ settings which is incompatible with IPv6 use\n",
DDS_ERROR("channel %s specifies IPv4 DiffServ settings which is incompatible with IPv6 use\n",
chptr->name);
error = 1;
}
@ -583,7 +587,7 @@ int rtps_config_prep (struct cfgst *cfgst)
printed */
if (! rtps_config_open ())
{
NN_ERROR ("Could not initialise configuration\n");
DDS_ERROR("Could not initialise configuration\n");
goto err_config_late_error;
}
@ -654,7 +658,7 @@ int joinleave_spdp_defmcip (int dojoin)
unref_addrset (as);
if (arg.errcount)
{
NN_ERROR ("rtps_init: failed to join multicast groups for domain %d participant %d\n", config.domainId.value, config.participantIndex);
DDS_ERROR("rtps_init: failed to join multicast groups for domain %d participant %d\n", config.domainId.value, config.participantIndex);
return -1;
}
return 0;
@ -686,8 +690,8 @@ int create_multicast_sockets(void)
gv.disc_conn_mc = disc;
gv.data_conn_mc = data;
TRACE (("Multicast Ports: discovery %d data %d \n",
ddsi_tran_port (gv.disc_conn_mc), ddsi_tran_port (gv.data_conn_mc)));
DDS_TRACE("Multicast Ports: discovery %d data %d \n",
ddsi_tran_port (gv.disc_conn_mc), ddsi_tran_port (gv.data_conn_mc));
return 1;
err_data:
@ -735,7 +739,7 @@ static void wait_for_receive_threads (void)
/* retrying is to deal a packet geting lost because the socket buffer is full or because the
macOS firewall (and perhaps others) likes to ask if the process is allowed to receive data,
dropping the packets until the user approves. */
NN_WARNING ("wait_for_receive_threads: failed to schedule periodic triggering of the receive threads to deal with packet loss\n");
DDS_WARNING("wait_for_receive_threads: failed to schedule periodic triggering of the receive threads to deal with packet loss\n");
}
for (i = 0; i < gv.n_recv_threads; i++)
{
@ -835,20 +839,20 @@ static int setup_and_start_recv_threads (void)
it before it does anything with it. */
if ((gv.recv_threads[i].arg.rbpool = nn_rbufpool_new (config.rbuf_size, config.rmsg_chunk_size)) == NULL)
{
NN_ERROR ("rtps_init: can't allocate receive buffer pool for thread %s\n", gv.recv_threads[i].name);
DDS_ERROR("rtps_init: can't allocate receive buffer pool for thread %s\n", gv.recv_threads[i].name);
goto fail;
}
if (gv.recv_threads[i].arg.mode == RTM_MANY)
{
if ((gv.recv_threads[i].arg.u.many.ws = os_sockWaitsetNew ()) == NULL)
{
NN_ERROR ("rtps_init: can't allocate sock waitset for thread %s\n", gv.recv_threads[i].name);
DDS_ERROR("rtps_init: can't allocate sock waitset for thread %s\n", gv.recv_threads[i].name);
goto fail;
}
}
if ((gv.recv_threads[i].ts = create_thread (gv.recv_threads[i].name, recv_thread, &gv.recv_threads[i].arg)) == NULL)
{
NN_ERROR ("rtps_init: failed to start thread %s\n", gv.recv_threads[i].name);
DDS_ERROR("rtps_init: failed to start thread %s\n", gv.recv_threads[i].name);
goto fail;
}
}
@ -889,7 +893,7 @@ int rtps_init (void)
gv.debmon = NULL;
/* Print start time for referencing relative times in the remainder
of the nn_log. */
of the DDS_LOG. */
{
int sec = (int) (gv.tstart.v / 1000000000);
int usec = (int) (gv.tstart.v % 1000000000) / 1000;
@ -898,7 +902,7 @@ int rtps_init (void)
tv.tv_sec = sec;
tv.tv_nsec = usec * 1000;
os_ctime_r (&tv, str, sizeof(str));
nn_log (LC_INFO | LC_CONFIG, "started at %d.06%d -- %s\n", sec, usec, str);
DDS_LOG(DDS_LC_INFO | DDS_LC_CONFIG, "started at %d.06%d -- %s\n", sec, usec, str);
}
/* Initialize thread pool */
@ -947,14 +951,14 @@ int rtps_init (void)
if (!find_own_ip (config.networkAddressString))
{
NN_ERROR ("No network interface selected\n");
DDS_ERROR("No network interface selected\n");
goto err_find_own_ip;
}
if (config.allowMulticast)
{
if (!gv.interfaces[gv.selected_interface].mc_capable)
{
NN_WARNING ("selected interface is not multicast-capable: disabling multicast\n");
DDS_WARNING("selected interface is not multicast-capable: disabling multicast\n");
config.suppress_spdp_multicast = 1;
config.allowMulticast = AMC_FALSE;
}
@ -971,19 +975,19 @@ int rtps_init (void)
{
char buf[DDSI_LOCSTRLEN];
/* the "ownip", "extip" labels in the trace have been there for so long, that it seems worthwhile to retain them even though they need not be IP any longer */
nn_log (LC_CONFIG, "ownip: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.ownloc));
nn_log (LC_CONFIG, "extip: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.extloc));
nn_log (LC_CONFIG, "extmask: %s%s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.extmask), gv.m_factory->m_kind != NN_LOCATOR_KIND_UDPv4 ? " (not applicable)" : "");
nn_log (LC_CONFIG, "networkid: 0x%lx\n", (unsigned long) gv.myNetworkId);
nn_log (LC_CONFIG, "SPDP MC: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.loc_spdp_mc));
nn_log (LC_CONFIG, "default MC: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.loc_default_mc));
DDS_LOG(DDS_LC_CONFIG, "ownip: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.ownloc));
DDS_LOG(DDS_LC_CONFIG, "extip: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.extloc));
DDS_LOG(DDS_LC_CONFIG, "extmask: %s%s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.extmask), gv.m_factory->m_kind != NN_LOCATOR_KIND_UDPv4 ? " (not applicable)" : "");
DDS_LOG(DDS_LC_CONFIG, "networkid: 0x%lx\n", (unsigned long) gv.myNetworkId);
DDS_LOG(DDS_LC_CONFIG, "SPDP MC: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.loc_spdp_mc));
DDS_LOG(DDS_LC_CONFIG, "default MC: %s\n", ddsi_locator_to_string_no_port (buf, sizeof(buf), &gv.loc_default_mc));
#ifdef DDSI_INCLUDE_SSM
nn_log (LC_CONFIG, "SSM support included\n");
DDS_LOG(DDS_LC_CONFIG, "SSM support included\n");
#endif
}
if (gv.ownloc.kind != gv.extloc.kind)
NN_FATAL ("mismatch between network address kinds\n");
DDS_FATAL("mismatch between network address kinds\n");
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
/* Convert address sets in partition mappings from string to address sets */
@ -1007,7 +1011,7 @@ int rtps_init (void)
#endif
gv.startup_mode = (config.startup_mode_duration > 0) ? 1 : 0;
nn_log (LC_CONFIG, "startup-mode: %s\n", gv.startup_mode ? "enabled" : "disabled");
DDS_LOG(DDS_LC_CONFIG, "startup-mode: %s\n", gv.startup_mode ? "enabled" : "disabled");
(ddsi_plugin.init_fn) ();
@ -1018,7 +1022,7 @@ int rtps_init (void)
if (q_security_plugin.new_decoder)
{
gv.recvSecurityCodec = (q_security_plugin.new_decoder) ();
nn_log (LC_CONFIG, "decoderset created\n");
DDS_LOG(DDS_LC_CONFIG, "decoderset created\n");
}
#endif
@ -1064,7 +1068,7 @@ int rtps_init (void)
{
if (make_uc_sockets (&port_disc_uc, &port_data_uc, config.participantIndex) < 0)
{
NN_ERROR ("rtps_init: failed to create unicast sockets for domain %d participant %d\n", config.domainId.value, config.participantIndex);
DDS_ERROR("rtps_init: failed to create unicast sockets for domain %d participant %d\n", config.domainId.value, config.participantIndex);
goto err_unicast_sockets;
}
}
@ -1072,7 +1076,7 @@ int rtps_init (void)
{
/* try to find a free one, and update config.participantIndex */
int ppid;
nn_log (LC_CONFIG, "rtps_init: trying to find a free participant index\n");
DDS_LOG(DDS_LC_CONFIG, "rtps_init: trying to find a free participant index\n");
for (ppid = 0; ppid <= config.maxAutoParticipantIndex; ppid++)
{
int r = make_uc_sockets (&port_disc_uc, &port_data_uc, ppid);
@ -1082,13 +1086,13 @@ int rtps_init (void)
continue;
else /* Oops! */
{
NN_ERROR ("rtps_init: failed to create unicast sockets for domain %d participant %d\n", config.domainId.value, ppid);
DDS_ERROR("rtps_init: failed to create unicast sockets for domain %d participant %d\n", config.domainId.value, ppid);
goto err_unicast_sockets;
}
}
if (ppid > config.maxAutoParticipantIndex)
{
NN_ERROR ("rtps_init: failed to find a free participant index for domain %d\n", config.domainId.value);
DDS_ERROR("rtps_init: failed to find a free participant index for domain %d\n", config.domainId.value);
goto err_unicast_sockets;
}
config.participantIndex = ppid;
@ -1097,9 +1101,9 @@ int rtps_init (void)
{
assert(0);
}
nn_log (LC_CONFIG, "rtps_init: uc ports: disc %u data %u\n", port_disc_uc, port_data_uc);
DDS_LOG(DDS_LC_CONFIG, "rtps_init: uc ports: disc %u data %u\n", port_disc_uc, port_data_uc);
}
nn_log (LC_CONFIG, "rtps_init: domainid %d participantid %d\n", config.domainId.value, config.participantIndex);
DDS_LOG(DDS_LC_CONFIG, "rtps_init: domainid %d participantid %d\n", config.domainId.value, config.participantIndex);
if (config.pcap_file && *config.pcap_file)
{
@ -1119,7 +1123,7 @@ int rtps_init (void)
if (gv.m_factory->m_connless)
{
if (!(config.many_sockets_mode == MSM_NO_UNICAST && config.allowMulticast))
TRACE (("Unicast Ports: discovery %d data %d\n", ddsi_tran_port (gv.disc_conn_uc), ddsi_tran_port (gv.data_conn_uc)));
DDS_TRACE("Unicast Ports: discovery %d data %d\n", ddsi_tran_port (gv.disc_conn_uc), ddsi_tran_port (gv.data_conn_uc));
if (config.allowMulticast)
{
@ -1154,7 +1158,7 @@ int rtps_init (void)
gv.listener = ddsi_factory_create_listener (gv.m_factory, config.tcp_port, NULL);
if (gv.listener == NULL || ddsi_listener_listen (gv.listener) != 0)
{
NN_ERROR ("Failed to create %s listener\n", gv.m_factory->m_typename);
DDS_ERROR("Failed to create %s listener\n", gv.m_factory->m_typename);
if (gv.listener)
ddsi_listener_free(gv.listener);
goto err_mc_conn;
@ -1173,7 +1177,7 @@ int rtps_init (void)
/* Create shared transmit connection */
gv.tev_conn = gv.data_conn_uc;
TRACE (("Timed event transmit port: %d\n", (int) ddsi_tran_port (gv.tev_conn)));
DDS_TRACE("Timed event transmit port: %d\n", (int) ddsi_tran_port (gv.tev_conn));
#ifdef DDSI_INCLUDE_NETWORK_CHANNELS
{
@ -1194,14 +1198,14 @@ int rtps_init (void)
ddsi_tran_free_qos (qos);
if (chptr->transmit_conn == NULL)
{
NN_FATAL ("failed to create transmit connection for channel %s\n", chptr->name);
DDS_FATAL("failed to create transmit connection for channel %s\n", chptr->name);
}
}
else
{
chptr->transmit_conn = gv.data_conn_uc;
}
TRACE (("channel %s: transmit port %d\n", chptr->name, (int) ddsi_tran_port (chptr->transmit_conn)));
DDS_TRACE("channel %s: transmit port %d\n", chptr->name, (int) ddsi_tran_port (chptr->transmit_conn));
#ifdef DDSI_INCLUDE_BANDWIDTH_LIMITING
if (chptr->auxiliary_bandwidth_limit > 0 || lookup_thread_properties (tname))
@ -1270,7 +1274,7 @@ int rtps_init (void)
gv.builtins_dqueue = nn_dqueue_new ("builtins", config.delivery_queue_maxsamples, builtins_dqueue_handler, NULL);
if ((r = xeventq_start (gv.xevents, NULL)) < 0)
{
NN_FATAL ("failed to start global event processing thread (%d)\n", r);
DDS_FATAL("failed to start global event processing thread (%d)\n", r);
}
}
@ -1291,7 +1295,7 @@ int rtps_init (void)
{
int r;
if ((r = xeventq_start (chptr->evq, chptr->name)) < 0)
NN_FATAL ("failed to start event processing thread for channel '%s' (%d)\n", chptr->name, r);
DDS_FATAL("failed to start event processing thread for channel '%s' (%d)\n", chptr->name, r);
}
chptr = chptr->next;
}
@ -1302,7 +1306,7 @@ int rtps_init (void)
if (setup_and_start_recv_threads () < 0)
{
NN_FATAL ("failed to start receive threads\n");
DDS_FATAL("failed to start receive threads\n");
}
if (gv.listener)
@ -1660,5 +1664,5 @@ OS_WARNING_MSVC_ON(6001);
ddsi_serdatapool_free (gv.serpool);
nn_xmsgpool_free (gv.xmsgpool);
(ddsi_plugin.fini_fn) ();
nn_log (LC_CONFIG, "Finis.\n");
DDS_LOG(DDS_LC_CONFIG, "Finis.\n");
}

View file

@ -56,7 +56,7 @@ void nn_lat_estim_update (struct nn_lat_estim *le, int64_t est)
le->smoothed = (1.0f - alpha) * le->smoothed + alpha * med;
}
int nn_lat_estim_log (logcat_t logcat, const char *tag, const struct nn_lat_estim *le)
int nn_lat_estim_log (uint32_t logcat, const char *tag, const struct nn_lat_estim *le)
{
if (le->smoothed == 0.0f)
return 0;
@ -67,12 +67,12 @@ int nn_lat_estim_log (logcat_t logcat, const char *tag, const struct nn_lat_esti
memcpy (tmp, le->window, sizeof (tmp));
qsort (tmp, NN_LAT_ESTIM_MEDIAN_WINSZ, sizeof (tmp[0]), (int (*) (const void *, const void *)) cmpfloat);
if (tag)
nn_log (logcat, " LAT(%s: %e {", tag, le->smoothed);
DDS_LOG(logcat, " LAT(%s: %e {", tag, le->smoothed);
else
nn_log (logcat, " LAT(%e {", le->smoothed);
DDS_LOG(logcat, " LAT(%e {", le->smoothed);
for (i = 0; i < NN_LAT_ESTIM_MEDIAN_WINSZ; i++)
nn_log (logcat, "%s%e", (i > 0) ? "," : "", tmp[i]);
nn_log (logcat, "})");
DDS_LOG(logcat, "%s%e", (i > 0) ? "," : "", tmp[i]);
DDS_LOG(logcat, "})");
return 1;
}
}

View file

@ -109,7 +109,7 @@ struct lease *lease_new (nn_etime_t texpire, int64_t tdur, struct entity_common
struct lease *l;
if ((l = os_malloc (sizeof (*l))) == NULL)
return NULL;
TRACE (("lease_new(tdur %"PRId64" guid %x:%x:%x:%x) @ %p\n", tdur, PGUID (e->guid), (void *) l));
DDS_TRACE("lease_new(tdur %"PRId64" guid %x:%x:%x:%x) @ %p\n", tdur, PGUID (e->guid), (void *) l);
l->tdur = tdur;
l->tend = texpire;
l->tsched.v = TSCHED_NOT_ON_HEAP;
@ -119,7 +119,7 @@ struct lease *lease_new (nn_etime_t texpire, int64_t tdur, struct entity_common
void lease_register (struct lease *l)
{
TRACE (("lease_register(l %p guid %x:%x:%x:%x)\n", (void *) l, PGUID (l->entity->guid)));
DDS_TRACE("lease_register(l %p guid %x:%x:%x:%x)\n", (void *) l, PGUID (l->entity->guid));
os_mutexLock (&gv.leaseheap_lock);
lock_lease (l);
assert (l->tsched.v == TSCHED_NOT_ON_HEAP);
@ -137,7 +137,7 @@ void lease_register (struct lease *l)
void lease_free (struct lease *l)
{
TRACE (("lease_free(l %p guid %x:%x:%x:%x)\n", (void *) l, PGUID (l->entity->guid)));
DDS_TRACE("lease_free(l %p guid %x:%x:%x:%x)\n", (void *) l, PGUID (l->entity->guid));
os_mutexLock (&gv.leaseheap_lock);
if (l->tsched.v != TSCHED_NOT_ON_HEAP)
ut_fibheapDelete (&lease_fhdef, &gv.leaseheap, l);
@ -163,16 +163,16 @@ void lease_renew (struct lease *l, nn_etime_t tnowE)
}
unlock_lease (l);
if (did_update && (config.enabled_logcats & LC_TRACE))
if (did_update && (dds_get_log_mask() & DDS_LC_TRACE))
{
int tsec, tusec;
TRACE ((" L("));
DDS_TRACE(" L(");
if (l->entity->guid.entityid.u == NN_ENTITYID_PARTICIPANT)
TRACE ((":%x", l->entity->guid.entityid.u));
DDS_TRACE(":%x", l->entity->guid.entityid.u);
else
TRACE (("%x:%x:%x:%x", PGUID (l->entity->guid)));
DDS_TRACE("%x:%x:%x:%x", PGUID (l->entity->guid));
etime_to_sec_usec (&tsec, &tusec, tend_new);
TRACE ((" %d.%06d)", tsec, tusec));
DDS_TRACE(" %d.%06d)", tsec, tusec);
}
}
@ -234,7 +234,7 @@ int64_t check_and_handle_lease_expiration (UNUSED_ARG (struct thread_state1 *sel
continue;
}
nn_log (LC_DISCOVERY, "lease expired: l %p guid %x:%x:%x:%x tend %"PRId64" < now %"PRId64"\n", (void *) l, PGUID (g), l->tend.v, tnowE.v);
DDS_LOG(DDS_LC_DISCOVERY, "lease expired: l %p guid %x:%x:%x:%x tend %"PRId64" < now %"PRId64"\n", (void *) l, PGUID (g), l->tend.v, tnowE.v);
/* If the proxy participant is relying on another participant for
writing its discovery data (on the privileged participant,
@ -267,7 +267,7 @@ int64_t check_and_handle_lease_expiration (UNUSED_ARG (struct thread_state1 *sel
if ((proxypp = ephash_lookup_proxy_participant_guid (&g)) != NULL &&
ephash_lookup_proxy_participant_guid (&proxypp->privileged_pp_guid) != NULL)
{
nn_log (LC_DISCOVERY, "but postponing because privileged pp %x:%x:%x:%x is still live\n",
DDS_LOG(DDS_LC_DISCOVERY, "but postponing because privileged pp %x:%x:%x:%x is still live\n",
PGUID (proxypp->privileged_pp_guid));
l->tsched = l->tend = add_duration_to_etime (tnowE, 200 * T_MILLISECOND);
unlock_lease (l);
@ -317,15 +317,15 @@ static void debug_print_rawdata (const char *msg, const void *data, size_t len)
{
const unsigned char *c = data;
size_t i;
TRACE (("%s<", msg));
DDS_TRACE("%s<", msg);
for (i = 0; i < len; i++)
{
if (32 < c[i] && c[i] <= 127)
TRACE (("%s%c", (i > 0 && (i%4) == 0) ? " " : "", c[i]));
DDS_TRACE("%s%c", (i > 0 && (i%4) == 0) ? " " : "", c[i]);
else
TRACE (("%s\\x%02x", (i > 0 && (i%4) == 0) ? " " : "", c[i]));
DDS_TRACE("%s\\x%02x", (i > 0 && (i%4) == 0) ? " " : "", c[i]);
}
TRACE ((">"));
DDS_TRACE(">");
}
void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
@ -334,10 +334,10 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
const int bswap = (data->identifier == CDR_LE) ^ PLATFORM_IS_LITTLE_ENDIAN;
struct proxy_participant *pp;
nn_guid_t ppguid;
TRACE ((" PMD ST%x", statusinfo));
DDS_TRACE(" PMD ST%x", statusinfo);
if (data->identifier != CDR_LE && data->identifier != CDR_BE)
{
TRACE ((" PMD data->identifier %u !?\n", ntohs (data->identifier)));
DDS_TRACE(" PMD data->identifier %u !?\n", ntohs (data->identifier));
return;
}
switch (statusinfo & (NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER))
@ -351,7 +351,7 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
nn_guid_prefix_t p = nn_ntoh_guid_prefix (pmd->participantGuidPrefix);
unsigned kind = ntohl (pmd->kind);
unsigned length = bswap ? bswap4u (pmd->length) : pmd->length;
TRACE ((" pp %x:%x:%x kind %u data %u", p.u[0], p.u[1], p.u[2], kind, length));
DDS_TRACE(" pp %x:%x:%x kind %u data %u", p.u[0], p.u[1], p.u[2], kind, length);
if (len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value) < length)
debug_print_rawdata (" SHORT2", pmd->value, len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value));
else
@ -359,7 +359,7 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
ppguid.prefix = p;
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
if ((pp = ephash_lookup_proxy_participant_guid (&ppguid)) == NULL)
TRACE ((" PPunknown"));
DDS_TRACE(" PPunknown");
else
{
/* Renew lease if arrival of this message didn't already do so, also renew the lease
@ -382,11 +382,11 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
ppguid.prefix = nn_ntoh_guid_prefix (*((nn_guid_prefix_t *) (data + 1)));
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
if (delete_proxy_participant_by_guid (&ppguid, timestamp, 0) < 0)
TRACE ((" unknown"));
DDS_TRACE(" unknown");
else
TRACE ((" delete"));
DDS_TRACE(" delete");
}
break;
}
TRACE (("\n"));
DDS_TRACE("\n");
}

View file

@ -1,185 +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 <stdio.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "os/os.h"
#include "ddsi/q_config.h"
#include "ddsi/q_globals.h"
#include "ddsi/q_thread.h"
#include "ddsi/q_time.h"
#include "ddsi/q_log.h"
#define MAX_TIMESTAMP_LENGTH (10 + 1 + 6)
#define MAX_TID_LENGTH 10
#define MAX_HDR_LENGTH (MAX_TIMESTAMP_LENGTH + 1 + MAX_TID_LENGTH + + 2)
#define BUF_OFFSET MAX_HDR_LENGTH
static void logbuf_flush_real (struct thread_state1 *self, logbuf_t lb)
{
if (config.tracingOutputFile != NULL)
{
const char *tname = self ? self->name : "(anon)";
char hdr[MAX_HDR_LENGTH + 1];
int n, tsec, tusec;
if (lb->tstamp.v < 0)
lb->tstamp = now ();
wctime_to_sec_usec (&tsec, &tusec, lb->tstamp);
lb->tstamp.v = -1;
n = snprintf (hdr, sizeof (hdr), "%d.%06d/%*.*s: ", tsec, tusec, MAX_TID_LENGTH, MAX_TID_LENGTH, tname);
assert (0 < n && n <= BUF_OFFSET);
memcpy (lb->buf + BUF_OFFSET - n, hdr, (size_t) n);
fwrite (lb->buf + BUF_OFFSET - n, 1, lb->pos - BUF_OFFSET + (size_t) n, config.tracingOutputFile);
fflush (config.tracingOutputFile);
}
lb->pos = BUF_OFFSET;
lb->buf[lb->pos] = 0;
}
static void logbuf_flush (struct thread_state1 *self, logbuf_t lb)
{
if (lb->pos > BUF_OFFSET)
{
if (lb->pos < (int) sizeof (lb->buf))
lb->buf[lb->pos++] = '\n';
else
lb->buf[sizeof (lb->buf) - 1] = '\n';
logbuf_flush_real (self, lb);
}
}
void logbuf_init (logbuf_t lb)
{
lb->bufsz = sizeof (lb->buf);
lb->pos = BUF_OFFSET;
lb->tstamp.v = -1;
lb->buf[lb->pos] = 0;
}
logbuf_t logbuf_new (void)
{
logbuf_t lb = os_malloc (sizeof (*lb));
logbuf_init (lb);
return lb;
}
void logbuf_free (logbuf_t lb)
{
logbuf_flush (lookup_thread_state (), lb);
os_free (lb);
}
/* LOGGING ROUTINES */
static void nn_vlogb (struct thread_state1 *self, const char *fmt, va_list ap)
{
int n, trunc = 0;
size_t nrem;
logbuf_t lb;
if (*fmt == 0)
return;
if (self->lb)
lb = self->lb;
else
{
lb = &gv.static_logbuf;
if (gv.static_logbuf_lock_inited)
{
/* not supposed to be multi-threaded when mutex not
initialized */
os_mutexLock (&gv.static_logbuf_lock);
}
}
nrem = lb->bufsz - lb->pos;
if (nrem > 0)
{
n = os_vsnprintf (lb->buf + lb->pos, nrem, fmt, ap);
if (n >= 0 && (size_t) n < nrem)
lb->pos += (size_t) n;
else
{
lb->pos += nrem;
trunc = 1;
}
if (trunc)
{
static const char msg[] = "(trunc)\n";
const size_t msglen = sizeof (msg) - 1;
assert (lb->pos <= lb->bufsz);
assert (lb->pos >= msglen);
memcpy (lb->buf + lb->pos - msglen, msg, msglen);
}
}
if (fmt[strlen (fmt) - 1] == '\n')
{
logbuf_flush_real (self, lb);
}
if (lb == &gv.static_logbuf && gv.static_logbuf_lock_inited)
{
os_mutexUnlock (&gv.static_logbuf_lock);
}
}
int nn_vlog (logcat_t cat, const char *fmt, va_list ap)
{
if (config.enabled_logcats & cat)
{
struct thread_state1 *self = lookup_thread_state ();
nn_vlogb (self, fmt, ap);
}
return 0;
}
int nn_log (_In_ logcat_t cat, _In_z_ _Printf_format_string_ const char *fmt, ...)
{
if (config.enabled_logcats & cat)
{
struct thread_state1 *self = lookup_thread_state ();
va_list ap;
va_start (ap, fmt);
nn_vlogb (self, fmt, ap);
va_end (ap);
}
if (cat == LC_FATAL)
{
abort ();
}
return 0;
}
int nn_trace (_In_z_ _Printf_format_string_ const char *fmt, ...)
{
if (config.enabled_logcats & LC_TRACE)
{
struct thread_state1 *self = lookup_thread_state ();
va_list ap;
va_start (ap, fmt);
nn_vlogb (self, fmt, ap);
va_end (ap);
}
return 0;
}
void nn_log_set_tstamp (nn_wctime_t tnow)
{
struct thread_state1 *self = lookup_thread_state ();
if (self && self->lb)
self->lb->tstamp = tnow;
}

View file

@ -36,7 +36,7 @@
static void print_sockerror (const char *msg)
{
int err = os_getErrno ();
NN_ERROR ("SOCKET %s errno %d\n", msg, err);
DDS_ERROR("SOCKET %s errno %d\n", msg, err);
}
unsigned locator_to_hopefully_unique_uint32 (const nn_locator_t *src)
@ -141,15 +141,15 @@ static int set_rcvbuf (os_socket socket)
}
if (ReceiveBufferSize < socket_min_rcvbuf_size)
{
/* NN_ERROR does more than just nn_log(LC_ERROR), hence the duplication */
/* NN_ERROR does more than just DDS_ERROR(), hence the duplication */
if (config.socket_min_rcvbuf_size.isdefault)
nn_log (LC_CONFIG, "failed to increase socket receive buffer size to %u bytes, continuing with %u bytes\n", socket_min_rcvbuf_size, ReceiveBufferSize);
DDS_LOG(DDS_LC_CONFIG, "failed to increase socket receive buffer size to %u bytes, continuing with %u bytes\n", socket_min_rcvbuf_size, ReceiveBufferSize);
else
NN_ERROR ("failed to increase socket receive buffer size to %u bytes, continuing with %u bytes\n", socket_min_rcvbuf_size, ReceiveBufferSize);
DDS_ERROR("failed to increase socket receive buffer size to %u bytes, continuing with %u bytes\n", socket_min_rcvbuf_size, ReceiveBufferSize);
}
else
{
nn_log (LC_CONFIG, "socket receive buffer size set to %u bytes\n", ReceiveBufferSize);
DDS_LOG(DDS_LC_CONFIG, "socket receive buffer size set to %u bytes\n", ReceiveBufferSize);
}
}
return 0;
@ -463,13 +463,13 @@ int find_own_ip (const char *requested_address)
int selected_idx = -1;
char addrbuf[DDSI_LOCSTRLEN];
nn_log (LC_CONFIG, "interfaces:");
DDS_LOG(DDS_LC_CONFIG, "interfaces:");
{
int ret;
ret = ddsi_enumerate_interfaces(gv.m_factory, &ifa_root);
if (ret < 0) {
NN_ERROR("ddsi_enumerate_interfaces(%s): %d\n", gv.m_factory->m_typename, ret);
DDS_ERROR("ddsi_enumerate_interfaces(%s): %d\n", gv.m_factory->m_typename, ret);
return 0;
}
}
@ -485,15 +485,15 @@ int find_own_ip (const char *requested_address)
if_name[sizeof (if_name) - 1] = 0;
if (strcmp (if_name, last_if_name))
nn_log (LC_CONFIG, "%s%s", sep, if_name);
DDS_LOG(DDS_LC_CONFIG, "%s%s", sep, if_name);
strcpy (last_if_name, if_name);
/* interface must be up */
if ((ifa->flags & IFF_UP) == 0) {
nn_log (LC_CONFIG, " (interface down)");
DDS_LOG(DDS_LC_CONFIG, " (interface down)");
continue;
} else if (os_sockaddr_is_unspecified(ifa->addr)) {
nn_log (LC_CONFIG, " (address unspecified)");
DDS_LOG(DDS_LC_CONFIG, " (address unspecified)");
continue;
}
@ -513,11 +513,11 @@ int find_own_ip (const char *requested_address)
ddsi_ipaddr_to_loc(&gv.interfaces[gv.n_interfaces].loc, ifa->addr, gv.m_factory->m_kind);
}
ddsi_locator_to_string_no_port(addrbuf, sizeof(addrbuf), &gv.interfaces[gv.n_interfaces].loc);
nn_log (LC_CONFIG, " %s(", addrbuf);
DDS_LOG(DDS_LC_CONFIG, " %s(", addrbuf);
if (!(ifa->flags & IFF_MULTICAST) && multicast_override (if_name))
{
nn_log (LC_CONFIG, "assume-mc:");
DDS_LOG(DDS_LC_CONFIG, "assume-mc:");
ifa->flags |= IFF_MULTICAST;
}
@ -560,7 +560,7 @@ int find_own_ip (const char *requested_address)
q += 2;
}
nn_log (LC_CONFIG, "q%d)", q);
DDS_LOG(DDS_LC_CONFIG, "q%d)", q);
if (q == quality) {
maxq_list[maxq_count] = gv.n_interfaces;
maxq_strlen += 2 + strlen (if_name);
@ -590,7 +590,7 @@ int find_own_ip (const char *requested_address)
gv.interfaces[gv.n_interfaces].name = os_strdup (if_name);
gv.n_interfaces++;
}
nn_log (LC_CONFIG, "\n");
DDS_LOG(DDS_LC_CONFIG, "\n");
os_freeifaddrs (ifa_root);
if (requested_address == NULL)
@ -605,7 +605,7 @@ int find_own_ip (const char *requested_address)
p = 0;
for (i = 0; i < maxq_count && (size_t) p < maxq_strlen; i++)
p += snprintf (names + p, maxq_strlen - (size_t) p, ", %s", gv.interfaces[maxq_list[i]].name);
NN_WARNING ("using network interface %s (%s) selected arbitrarily from: %s\n",
DDS_WARNING("using network interface %s (%s) selected arbitrarily from: %s\n",
gv.interfaces[idx].name, addrbuf, names + 2);
os_free (names);
}
@ -613,7 +613,7 @@ int find_own_ip (const char *requested_address)
if (maxq_count > 0)
selected_idx = maxq_list[0];
else
NN_ERROR ("failed to determine default own IP address\n");
DDS_ERROR("failed to determine default own IP address\n");
}
else
{
@ -660,7 +660,7 @@ int find_own_ip (const char *requested_address)
if (i < gv.n_interfaces)
selected_idx = i;
else
NN_ERROR ("%s: does not match an available interface\n", config.networkAddressString);
DDS_ERROR("%s: does not match an available interface\n", config.networkAddressString);
}
if (selected_idx < 0)
@ -682,7 +682,7 @@ int find_own_ip (const char *requested_address)
gv.ipv6_link_local = 0;
}
#endif
nn_log (LC_CONFIG, "selected interface: %s (index %u)\n",
DDS_LOG(DDS_LC_CONFIG, "selected interface: %s (index %u)\n",
gv.interfaces[selected_idx].name, gv.interfaceNo);
return 1;

View file

@ -86,7 +86,7 @@ FILE *new_pcap_file (const char *name)
if ((fp = fopen (name, "wb")) == NULL)
{
NN_WARNING ("packet capture disabled: file %s could not be opened for writing\n", name);
DDS_WARNING ("packet capture disabled: file %s could not be opened for writing\n", name);
return NULL;
}

File diff suppressed because it is too large Load diff

View file

@ -42,20 +42,6 @@
#include "ddsi/sysdeps.h"
/* Avoiding all nn_log-related activities when LC_RADMIN 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 subscriber - that's worth
it. So we need a macro & a support function. */
static int trace_radmin (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
nn_vlog (LC_RADMIN, fmt, ap);
va_end (ap);
return 0;
}
#define TRACE_RADMIN(args) ((config.enabled_logcats & LC_RADMIN) ? (trace_radmin args) : 0)
/* OVERVIEW ------------------------------------------------------------
The receive path of DDSI2 has any number of receive threads that
@ -439,7 +425,7 @@ static struct nn_rbuf *nn_rbuf_alloc_new (struct nn_rbufpool *rbufpool)
rb->size = rbufpool->rbuf_size;
rb->max_rmsg_size = rbufpool->max_rmsg_size;
rb->freeptr = rb->u.raw;
TRACE_RADMIN (("rbuf_alloc_new(%p) = %p\n", rbufpool, rb));
DDS_LOG(DDS_LC_RADMIN, "rbuf_alloc_new(%p) = %p\n", rbufpool, rb);
return rb;
}
@ -461,10 +447,10 @@ static struct nn_rbuf *nn_rbuf_new (struct nn_rbufpool *rbufpool)
static void nn_rbuf_release (struct nn_rbuf *rbuf)
{
struct nn_rbufpool *rbp = rbuf->rbufpool;
TRACE_RADMIN (("rbuf_release(%p) pool %p current %p\n", rbuf, rbp, rbp->current));
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) pool %p current %p\n", rbuf, rbp, rbp->current);
if (os_atomic_dec32_ov (&rbuf->n_live_rmsg_chunks) == 1)
{
TRACE_RADMIN (("rbuf_release(%p) free\n", rbuf));
DDS_LOG(DDS_LC_RADMIN, "rbuf_release(%p) free\n", rbuf);
os_free (rbuf);
}
}
@ -491,7 +477,7 @@ static void *nn_rbuf_alloc (struct nn_rbufpool *rbufpool)
/* Note: only one thread calls nn_rmsg_new on a pool */
uint32_t asize = max_rmsg_size_w_hdr (rbufpool->max_rmsg_size);
struct nn_rbuf *rb;
TRACE_RADMIN (("rmsg_rbuf_alloc(%p, %u)\n", (void *) rbufpool, asize));
DDS_LOG(DDS_LC_RADMIN, "rmsg_rbuf_alloc(%p, %u)\n", (void *) rbufpool, asize);
ASSERT_RBUFPOOL_OWNER (rbufpool);
rb = rbufpool->current;
assert (rb != NULL);
@ -508,7 +494,7 @@ static void *nn_rbuf_alloc (struct nn_rbufpool *rbufpool)
assert ((uint32_t) (rb->u.raw + rb->size - rb->freeptr) >= asize);
}
TRACE_RADMIN (("rmsg_rbuf_alloc(%p, %u) = %p\n", (void *) rbufpool, asize, (void *) rb->freeptr));
DDS_LOG(DDS_LC_RADMIN, "rmsg_rbuf_alloc(%p, %u) = %p\n", (void *) rbufpool, asize, (void *) rb->freeptr);
#if USE_VALGRIND
VALGRIND_MEMPOOL_ALLOC (rbufpool, rb->freeptr, asize);
#endif
@ -527,7 +513,7 @@ struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbufpool)
{
/* Note: only one thread calls nn_rmsg_new on a pool */
struct nn_rmsg *rmsg;
TRACE_RADMIN (("rmsg_new(%p)\n", rbufpool));
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p)\n", rbufpool);
rmsg = nn_rbuf_alloc (rbufpool);
if (rmsg == NULL)
@ -540,14 +526,14 @@ struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbufpool)
rmsg->lastchunk = &rmsg->chunk;
/* Incrementing freeptr happens in commit(), so that discarding the
message is really simple. */
TRACE_RADMIN (("rmsg_new(%p) = %p\n", rbufpool, rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_new(%p) = %p\n", rbufpool, rmsg);
return rmsg;
}
void nn_rmsg_setsize (struct nn_rmsg *rmsg, uint32_t size)
{
uint32_t size8 = align8uint32 (size);
TRACE_RADMIN (("rmsg_setsize(%p, %u => %u)\n", rmsg, size, size8));
DDS_LOG(DDS_LC_RADMIN, "rmsg_setsize(%p, %u => %u)\n", rmsg, size, size8);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) == RMSG_REFCOUNT_UNCOMMITTED_BIAS);
@ -570,7 +556,7 @@ void nn_rmsg_free (struct nn_rmsg *rmsg)
free() which we don't do currently. And ideally, you'd use
compare-and-swap for this. */
struct nn_rmsg_chunk *c;
TRACE_RADMIN (("rmsg_free(%p)\n", rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_free(%p)\n", rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) == 0);
c = &rmsg->chunk;
while (c)
@ -593,7 +579,7 @@ void nn_rmsg_free (struct nn_rmsg *rmsg)
static void commit_rmsg_chunk (struct nn_rmsg_chunk *chunk)
{
struct nn_rbuf *rbuf = chunk->rbuf;
TRACE_RADMIN (("commit_rmsg_chunk(%p)\n", chunk));
DDS_LOG(DDS_LC_RADMIN, "commit_rmsg_chunk(%p)\n", chunk);
rbuf->freeptr = chunk->u.payload + chunk->size;
}
@ -608,8 +594,8 @@ void nn_rmsg_commit (struct nn_rmsg *rmsg)
happens to be such that any asynchronous activities have
completed before we got to commit. */
struct nn_rmsg_chunk *chunk = rmsg->lastchunk;
TRACE_RADMIN (("rmsg_commit(%p) refcount 0x%x last-chunk-size %u\n",
rmsg, rmsg->refcount, chunk->size));
DDS_LOG(DDS_LC_RADMIN, "rmsg_commit(%p) refcount 0x%x last-chunk-size %u\n",
rmsg, rmsg->refcount.v, chunk->size);
ASSERT_RBUFPOOL_OWNER (chunk->rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert (chunk->size <= chunk->rbuf->max_rmsg_size);
@ -624,7 +610,7 @@ void nn_rmsg_commit (struct nn_rmsg *rmsg)
{
/* Other references exist, so either stored in defrag, reorder
and/or delivery queue */
TRACE_RADMIN (("rmsg_commit(%p) => keep\n", rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_commit(%p) => keep\n", rmsg);
commit_rmsg_chunk (chunk);
}
}
@ -637,7 +623,7 @@ static void nn_rmsg_addbias (struct nn_rmsg *rmsg)
However, other threads (e.g., delivery threads) may have been
triggered already, so the increment must be done atomically. */
TRACE_RADMIN (("rmsg_addbias(%p)\n", rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_addbias(%p)\n", rmsg);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
os_atomic_add32 (&rmsg->refcount, RMSG_REFCOUNT_RDATA_BIAS);
@ -649,7 +635,7 @@ static void nn_rmsg_rmbias_and_adjust (struct nn_rmsg *rmsg, int adjust)
progressing through the pipeline, but only by the receive
thread. Can't require it to be uncommitted. */
uint32_t sub;
TRACE_RADMIN (("rmsg_rmbias_and_adjust(%p, %d)\n", rmsg, adjust));
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_and_adjust(%p, %d)\n", rmsg, adjust);
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
assert (adjust >= 0);
assert ((uint32_t) adjust < RMSG_REFCOUNT_RDATA_BIAS);
@ -663,14 +649,14 @@ static void nn_rmsg_rmbias_anythread (struct nn_rmsg *rmsg)
{
/* For removing garbage when freeing a nn_defrag. */
uint32_t sub = RMSG_REFCOUNT_RDATA_BIAS;
TRACE_RADMIN (("rmsg_rmbias_anythread(%p)\n", rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_rmbias_anythread(%p)\n", rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) >= sub);
if (os_atomic_sub32_nv (&rmsg->refcount, sub) == 0)
nn_rmsg_free (rmsg);
}
static void nn_rmsg_unref (struct nn_rmsg *rmsg)
{
TRACE_RADMIN (("rmsg_unref(%p)\n", rmsg));
DDS_LOG(DDS_LC_RADMIN, "rmsg_unref(%p)\n", rmsg);
assert (os_atomic_ld32 (&rmsg->refcount) > 0);
if (os_atomic_dec32_ov (&rmsg->refcount) == 1)
nn_rmsg_free (rmsg);
@ -682,7 +668,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
struct nn_rbuf *rbuf = chunk->rbuf;
uint32_t size8 = align8uint32 (size);
void *ptr;
TRACE_RADMIN (("rmsg_alloc(%p, %u => %u)\n", rmsg, size, size8));
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u => %u)\n", rmsg, size, size8);
ASSERT_RBUFPOOL_OWNER (rbuf->rbufpool);
ASSERT_RMSG_UNCOMMITTED (rmsg);
assert ((chunk->size % 8) == 0);
@ -692,12 +678,12 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
{
struct nn_rbufpool *rbufpool = rbuf->rbufpool;
struct nn_rmsg_chunk *newchunk;
TRACE_RADMIN (("rmsg_alloc(%p, %u) limit hit - new chunk\n", rmsg, size));
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) limit hit - new chunk\n", rmsg, size);
commit_rmsg_chunk (chunk);
newchunk = nn_rbuf_alloc (rbufpool);
if (newchunk == NULL)
{
NN_WARNING ("nn_rmsg_alloc: can't allocate more memory (%u bytes) ... giving up\n", size);
DDS_WARNING ("nn_rmsg_alloc: can't allocate more memory (%u bytes) ... giving up\n", size);
return NULL;
}
init_rmsg_chunk (newchunk, rbufpool->current);
@ -707,7 +693,7 @@ void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size)
ptr = chunk->u.payload + chunk->size;
chunk->size += size8;
TRACE_RADMIN (("rmsg_alloc(%p, %u) = %p\n", rmsg, size, ptr));
DDS_LOG(DDS_LC_RADMIN, "rmsg_alloc(%p, %u) = %p\n", rmsg, size, ptr);
#if USE_VALGRIND
if (chunk == &rmsg->chunk) {
VALGRIND_MEMPOOL_CHANGE (rbuf->rbufpool, rmsg, rmsg, offsetof (struct nn_rmsg, chunk.u.payload) + chunk->size);
@ -734,13 +720,13 @@ struct nn_rdata *nn_rdata_new (struct nn_rmsg *rmsg, uint32_t start, uint32_t en
#ifndef NDEBUG
os_atomic_st32 (&d->refcount_bias_added, 0);
#endif
TRACE_RADMIN (("rdata_new(%p, bytes [%u,%u), submsg @ %u, payload @ %u) = %p\n", rmsg, start, endp1, NN_RDATA_SUBMSG_OFF (d), NN_RDATA_PAYLOAD_OFF (d), d));
DDS_LOG(DDS_LC_RADMIN, "rdata_new(%p, bytes [%u,%u), submsg @ %u, payload @ %u) = %p\n", rmsg, start, endp1, NN_RDATA_SUBMSG_OFF (d), NN_RDATA_PAYLOAD_OFF (d), d);
return d;
}
static void nn_rdata_addbias (struct nn_rdata *rdata)
{
TRACE_RADMIN (("rdata_addbias(%p)\n", rdata));
DDS_LOG(DDS_LC_RADMIN, "rdata_addbias(%p)\n", rdata);
#ifndef NDEBUG
ASSERT_RBUFPOOL_OWNER (rdata->rmsg->chunk.rbuf->rbufpool);
if (os_atomic_inc32_nv (&rdata->refcount_bias_added) != 1)
@ -751,7 +737,7 @@ static void nn_rdata_addbias (struct nn_rdata *rdata)
static void nn_rdata_rmbias_and_adjust (struct nn_rdata *rdata, int adjust)
{
TRACE_RADMIN (("rdata_rmbias_and_adjust(%p, %d)\n", rdata, adjust));
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_and_adjust(%p, %d)\n", rdata, adjust);
#ifndef NDEBUG
if (os_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
abort ();
@ -761,7 +747,7 @@ static void nn_rdata_rmbias_and_adjust (struct nn_rdata *rdata, int adjust)
static void nn_rdata_rmbias_anythread (struct nn_rdata *rdata)
{
TRACE_RADMIN (("rdata_rmbias_anytrhead(%p, %d)\n", rdata));
DDS_LOG(DDS_LC_RADMIN, "rdata_rmbias_anythread(%p)\n", rdata);
#ifndef NDEBUG
if (os_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
abort ();
@ -771,7 +757,7 @@ static void nn_rdata_rmbias_anythread (struct nn_rdata *rdata)
static void nn_rdata_unref (struct nn_rdata *rdata)
{
TRACE_RADMIN (("rdata_rdata_unref(%p)\n", rdata));
DDS_LOG(DDS_LC_RADMIN, "rdata_rdata_unref(%p)\n", rdata);
nn_rmsg_unref (rdata->rmsg);
}
@ -908,7 +894,7 @@ struct nn_defrag *nn_defrag_new (enum nn_defrag_drop_mode drop_mode, uint32_t ma
void nn_fragchain_adjust_refcount (struct nn_rdata *frag, int adjust)
{
struct nn_rdata *frag1;
TRACE_RADMIN (("fragchain_adjust_refcount(%p, %d)\n", frag, adjust));
DDS_LOG(DDS_LC_RADMIN, "fragchain_adjust_refcount(%p, %d)\n", frag, adjust);
while (frag)
{
frag1 = frag->nextfrag;
@ -920,7 +906,7 @@ void nn_fragchain_adjust_refcount (struct nn_rdata *frag, int adjust)
static void nn_fragchain_rmbias_anythread (struct nn_rdata *frag, UNUSED_ARG (int adjust))
{
struct nn_rdata *frag1;
TRACE_RADMIN (("fragchain_rmbias_anythread(%p)\n", frag));
DDS_LOG(DDS_LC_RADMIN, "fragchain_rmbias_anythread(%p)\n", frag);
while (frag)
{
frag1 = frag->nextfrag;
@ -940,7 +926,7 @@ static void defrag_rsample_drop (struct nn_defrag *defrag, struct nn_rsample *rs
inorder treewalk does provide. */
ut_avlIter_t iter;
struct nn_defrag_iv *iv;
TRACE_RADMIN ((" defrag_rsample_drop (%p, %p)\n", (void *) defrag, (void *) rsample));
DDS_LOG(DDS_LC_RADMIN, " defrag_rsample_drop (%p, %p)\n", (void *) defrag, (void *) rsample);
ut_avlDelete (&defrag_sampletree_treedef, &defrag->sampletree, rsample);
assert (defrag->n_samples > 0);
defrag->n_samples--;
@ -954,7 +940,7 @@ void nn_defrag_free (struct nn_defrag *defrag)
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
while (s)
{
TRACE_RADMIN (("defrag_free(%p, sample %p seq %lld)\n", defrag, s, s->u.defrag.seq));
DDS_LOG(DDS_LC_RADMIN, "defrag_free(%p, sample %p seq %"PRId64")\n", defrag, s, s->u.defrag.seq);
defrag_rsample_drop (defrag, s, nn_fragchain_rmbias_anythread);
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
}
@ -966,21 +952,21 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
{
struct nn_defrag_iv *succ;
TRACE_RADMIN ((" defrag_try_merge_with_succ(%p [%u..%u)):\n",
(void *) node, node->min, node->maxp1));
DDS_LOG(DDS_LC_RADMIN, " defrag_try_merge_with_succ(%p [%u..%u)):\n",
(void *) node, node->min, node->maxp1);
if (node == sample->lastfrag)
{
/* there is no interval following node */
TRACE_RADMIN ((" node is lastfrag\n"));
DDS_LOG(DDS_LC_RADMIN, " node is lastfrag\n");
return 0;
}
succ = ut_avlFindSucc (&rsample_defrag_fragtree_treedef, &sample->fragtree, node);
assert (succ != NULL);
TRACE_RADMIN ((" succ is %p [%u..%u)\n", (void *) succ, succ->min, succ->maxp1));
DDS_LOG(DDS_LC_RADMIN, " succ is %p [%u..%u)\n", (void *) succ, succ->min, succ->maxp1);
if (succ->min > node->maxp1)
{
TRACE_RADMIN ((" gap between node and succ\n"));
DDS_LOG(DDS_LC_RADMIN, " gap between node and succ\n");
return 0;
}
else
@ -993,7 +979,7 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
ut_avlDelete (&rsample_defrag_fragtree_treedef, &sample->fragtree, succ);
if (sample->lastfrag == succ)
{
TRACE_RADMIN ((" succ is lastfrag\n"));
DDS_LOG(DDS_LC_RADMIN, " succ is lastfrag\n");
sample->lastfrag = node;
}
@ -1008,9 +994,9 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
references to rmsgs of the rdata in succ, freeing it may cause
the rsample to be freed as well. */
if (node->maxp1 < succ_maxp1)
TRACE_RADMIN ((" succ adds data to node\n"));
DDS_LOG(DDS_LC_RADMIN, " succ adds data to node\n");
else
TRACE_RADMIN ((" succ is contained in node\n"));
DDS_LOG(DDS_LC_RADMIN, " succ is contained in node\n");
node->last->nextfrag = succ->first;
node->last = succ->last;
@ -1181,9 +1167,9 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
/* relatively expensive test: lastfrag, tree must be consistent */
assert (dfsample->lastfrag == ut_avlFindMax (&rsample_defrag_fragtree_treedef, &dfsample->fragtree));
TRACE_RADMIN ((" lastfrag %p [%u..%u)\n",
DDS_LOG(DDS_LC_RADMIN, " lastfrag %p [%u..%u)\n",
(void *) dfsample->lastfrag,
dfsample->lastfrag->min, dfsample->lastfrag->maxp1));
dfsample->lastfrag->min, dfsample->lastfrag->maxp1);
/* Interval tree is sorted on min offset; each key is unique:
otherwise one would be wholly contained in another. */
@ -1191,15 +1177,15 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
{
/* Assumed normal case: fragment appends data */
predeq = dfsample->lastfrag;
TRACE_RADMIN ((" fast path: predeq = lastfrag\n"));
DDS_LOG(DDS_LC_RADMIN, " fast path: predeq = lastfrag\n");
}
else
{
/* Slow path: find preceding fragment by tree search */
predeq = ut_avlLookupPredEq (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min);
assert (predeq);
TRACE_RADMIN ((" slow path: predeq = lookup %u => %p [%u..%u)\n",
min, (void *) predeq, predeq->min, predeq->maxp1));
DDS_LOG(DDS_LC_RADMIN, " slow path: predeq = lookup %u => %p [%u..%u)\n",
min, (void *) predeq, predeq->min, predeq->maxp1);
}
/* we have a sentinel interval of [0,0) until we receive a packet
@ -1211,7 +1197,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
{
/* new is contained in predeq, discard new; rdata did not cause
completion of a sample */
TRACE_RADMIN ((" new contained in predeq\n"));
DDS_LOG(DDS_LC_RADMIN, " new contained in predeq\n");
return NULL;
}
else if (min <= predeq->maxp1)
@ -1219,7 +1205,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
/* new extends predeq, add it to the chain (necessarily at the
end); this may close the gap to the successor of predeq; predeq
need not have a fragment chain yet (it may be the sentinel) */
TRACE_RADMIN ((" grow predeq with new\n"));
DDS_LOG(DDS_LC_RADMIN, " grow predeq with new\n");
nn_rdata_addbias (rdata);
rdata->nextfrag = NULL;
if (predeq->first)
@ -1247,8 +1233,8 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
fragment in the chain adds value); but doesn't overlap with
predeq so the tree structure doesn't change even though the key
does change */
TRACE_RADMIN ((" extending succ %p [%u..%u) at head\n",
(void *) succ, succ->min, succ->maxp1));
DDS_LOG(DDS_LC_RADMIN, " extending succ %p [%u..%u) at head\n",
(void *) succ, succ->min, succ->maxp1);
nn_rdata_addbias (rdata);
rdata->nextfrag = succ->first;
succ->first = rdata;
@ -1258,7 +1244,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
succ-succ */
if (maxp1 > succ->maxp1)
{
TRACE_RADMIN ((" extending succ at end as well\n"));
DDS_LOG(DDS_LC_RADMIN, " extending succ at end as well\n");
succ->maxp1 = maxp1;
while (defrag_try_merge_with_succ (dfsample, succ))
;
@ -1271,7 +1257,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
/* doesn't extend either predeq at the end or succ at the head =>
new interval; rdata did not cause completion of sample */
ut_avlIPath_t path;
TRACE_RADMIN ((" new interval\n"));
DDS_LOG(DDS_LC_RADMIN, " new interval\n");
if (ut_avlLookupIPath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min, &path))
assert (0);
defrag_rsample_addiv (dfsample, rdata, &path);
@ -1294,25 +1280,25 @@ static int defrag_limit_samples (struct nn_defrag *defrag, seqno_t seq, seqno_t
return 1;
/* max_samples >= 1 => some sample present => max_sample != NULL */
assert (defrag->max_sample != NULL);
TRACE_RADMIN ((" max samples reached\n"));
DDS_LOG(DDS_LC_RADMIN, " max samples reached\n");
switch (defrag->drop_mode)
{
case NN_DEFRAG_DROP_LATEST:
TRACE_RADMIN ((" drop mode = DROP_LATEST\n"));
DDS_LOG(DDS_LC_RADMIN, " drop mode = DROP_LATEST\n");
if (seq > defrag->max_sample->u.defrag.seq)
{
TRACE_RADMIN ((" new sample is new latest => discarding it\n"));
DDS_LOG(DDS_LC_RADMIN, " new sample is new latest => discarding it\n");
return 0;
}
sample_to_drop = defrag->max_sample;
break;
case NN_DEFRAG_DROP_OLDEST:
TRACE_RADMIN ((" drop mode = DROP_OLDEST\n"));
DDS_LOG(DDS_LC_RADMIN, " drop mode = DROP_OLDEST\n");
sample_to_drop = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
assert (sample_to_drop);
if (seq < sample_to_drop->u.defrag.seq)
{
TRACE_RADMIN ((" new sample is new oldest => discarding it\n"));
DDS_LOG(DDS_LC_RADMIN, " new sample is new oldest => discarding it\n");
return 0;
}
break;
@ -1323,9 +1309,9 @@ static int defrag_limit_samples (struct nn_defrag *defrag, seqno_t seq, seqno_t
{
defrag->max_sample = ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree);
*max_seq = defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0;
TRACE_RADMIN ((" updating max_sample: now %p %lld\n",
DDS_LOG(DDS_LC_RADMIN, " updating max_sample: now %p %"PRId64"\n",
(void *) defrag->max_sample,
defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0));
defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0);
}
return 1;
}
@ -1370,20 +1356,20 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
consistent. Max_sample must be consistent with tree */
assert (defrag->max_sample == ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree));
max_seq = defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0;
TRACE_RADMIN (("defrag_rsample(%p, %p [%u..%u) msg %p, %p seq %lld size %u) max_seq %p %lld:\n",
(void *) defrag, (void *) rdata, rdata->min, rdata->maxp1, rdata->rmsg,
(void *) sampleinfo, sampleinfo->seq, sampleinfo->size,
(void *) defrag->max_sample, max_seq));
DDS_LOG(DDS_LC_RADMIN, "defrag_rsample(%p, %p [%u..%u) msg %p, %p seq %"PRId64" size %u) max_seq %p %"PRId64":\n",
(void *) defrag, (void *) rdata, rdata->min, rdata->maxp1, rdata->rmsg,
(void *) sampleinfo, sampleinfo->seq, sampleinfo->size,
(void *) defrag->max_sample, max_seq);
/* fast path: rdata is part of message with the highest sequence
number we're currently defragmenting, or is beyond that */
if (sampleinfo->seq == max_seq)
{
TRACE_RADMIN ((" add fragment to max_sample\n"));
DDS_LOG(DDS_LC_RADMIN, " add fragment to max_sample\n");
result = defrag_add_fragment (defrag->max_sample, rdata, sampleinfo);
}
else if (!defrag_limit_samples (defrag, sampleinfo->seq, &max_seq))
{
TRACE_RADMIN ((" discarding sample\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample\n");
result = NULL;
}
else if (sampleinfo->seq > max_seq)
@ -1391,7 +1377,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
/* a node with a key greater than the maximum always is the right
child of the old maximum node */
/* FIXME: MERGE THIS ONE WITH THE NEXT */
TRACE_RADMIN ((" new max sample\n"));
DDS_LOG(DDS_LC_RADMIN, " new max sample\n");
ut_avlLookupIPath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path);
if ((sample = defrag_rsample_new (rdata, sampleinfo)) == NULL)
return NULL;
@ -1403,7 +1389,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
else if ((sample = ut_avlLookupIPath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path)) == NULL)
{
/* a new sequence number, but smaller than the maximum */
TRACE_RADMIN ((" new sample less than max\n"));
DDS_LOG(DDS_LC_RADMIN, " new sample less than max\n");
assert (sampleinfo->seq < max_seq);
if ((sample = defrag_rsample_new (rdata, sampleinfo)) == NULL)
return NULL;
@ -1414,7 +1400,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
else
{
/* adds (or, as the case may be, doesn't add) to a known message */
TRACE_RADMIN ((" add fragment to %p\n", (void *) sample));
DDS_LOG(DDS_LC_RADMIN, " add fragment to %p\n", (void *) sample);
result = defrag_add_fragment (sample, rdata, sampleinfo);
}
@ -1423,16 +1409,16 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
/* Once completed, remove from defrag sample tree and convert to
reorder format. If it is the sample with the maximum sequence in
the tree, an update of max_sample is required. */
TRACE_RADMIN ((" complete\n"));
DDS_LOG(DDS_LC_RADMIN, " complete\n");
ut_avlDelete (&defrag_sampletree_treedef, &defrag->sampletree, result);
assert (defrag->n_samples > 0);
defrag->n_samples--;
if (result == defrag->max_sample)
{
defrag->max_sample = ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree);
TRACE_RADMIN ((" updating max_sample: now %p %lld\n",
(void *) defrag->max_sample,
defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0));
DDS_LOG(DDS_LC_RADMIN, " updating max_sample: now %p %"PRId64"\n",
(void *) defrag->max_sample,
defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0);
}
rsample_convert_defrag_to_reorder (result);
}
@ -1729,28 +1715,28 @@ static int reorder_try_append_and_discard (struct nn_reorder *reorder, struct nn
{
if (todiscard == NULL)
{
TRACE_RADMIN ((" try_append_and_discard: fail: todiscard = NULL\n"));
DDS_LOG(DDS_LC_RADMIN, " try_append_and_discard: fail: todiscard = NULL\n");
return 0;
}
else if (appendto->u.reorder.maxp1 < todiscard->u.reorder.min)
{
TRACE_RADMIN ((" try_append_and_discard: fail: appendto = [%lld,%lld) @ %p, "
"todiscard = [%lld,%lld) @ %p - gap\n",
appendto->u.reorder.min, appendto->u.reorder.maxp1, (void *) appendto,
todiscard->u.reorder.min, todiscard->u.reorder.maxp1, (void *) todiscard));
DDS_LOG(DDS_LC_RADMIN, " try_append_and_discard: fail: appendto = [%"PRId64",%"PRId64") @ %p, "
"todiscard = [%"PRId64",%"PRId64") @ %p - gap\n",
appendto->u.reorder.min, appendto->u.reorder.maxp1, (void *) appendto,
todiscard->u.reorder.min, todiscard->u.reorder.maxp1, (void *) todiscard);
return 0;
}
else
{
TRACE_RADMIN ((" try_append_and_discard: success: appendto = [%lld,%lld) @ %p, "
"todiscard = [%lld,%lld) @ %p\n",
appendto->u.reorder.min, appendto->u.reorder.maxp1, (void *) appendto,
todiscard->u.reorder.min, todiscard->u.reorder.maxp1, (void *) todiscard));
DDS_LOG(DDS_LC_RADMIN, " try_append_and_discard: success: appendto = [%"PRId64",%"PRId64") @ %p, "
"todiscard = [%"PRId64",%"PRId64") @ %p\n",
appendto->u.reorder.min, appendto->u.reorder.maxp1, (void *) appendto,
todiscard->u.reorder.min, todiscard->u.reorder.maxp1, (void *) todiscard);
assert (todiscard->u.reorder.min == appendto->u.reorder.maxp1);
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, todiscard);
append_rsample_interval (appendto, todiscard);
TRACE_RADMIN ((" try_append_and_discard: max_sampleiv needs update? %s\n",
(todiscard == reorder->max_sampleiv) ? "yes" : "no"));
DDS_LOG(DDS_LC_RADMIN, " try_append_and_discard: max_sampleiv needs update? %s\n",
(todiscard == reorder->max_sampleiv) ? "yes" : "no");
/* Inform caller whether reorder->max must be updated -- the
expected thing to do is to update it to appendto here, but that
fails if appendto isn't actually in the tree. And that happens
@ -1825,7 +1811,7 @@ static void delete_last_sample (struct nn_reorder *reorder)
{
/* Last sample is in an interval of its own - delete it, and
recalc max_sampleiv. */
TRACE_RADMIN ((" delete_last_sample: in singleton interval\n"));
DDS_LOG(DDS_LC_RADMIN, " delete_last_sample: in singleton interval\n");
fragchain = last->sc.first->fragchain;
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, reorder->max_sampleiv);
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
@ -1841,8 +1827,8 @@ static void delete_last_sample (struct nn_reorder *reorder)
large!). Can't be a singleton list, so might as well chop off
one evaluation of the loop condition. */
struct nn_rsample_chain_elem *e, *pe;
TRACE_RADMIN ((" delete_last_sample: scanning last interval [%llu..%llu)\n",
last->min, last->maxp1));
DDS_LOG(DDS_LC_RADMIN, " delete_last_sample: scanning last interval [%"PRId64"..%"PRId64")\n",
last->min, last->maxp1);
assert (last->n_samples >= 1);
assert (last->min + last->n_samples <= last->maxp1);
e = last->sc.first;
@ -1872,7 +1858,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
refcount_adjust is incremented if the sample is not discarded. */
struct nn_rsample_reorder *s = &rsampleiv->u.reorder;
TRACE_RADMIN (("reorder_sample(%p %c, %lld @ %p) expecting %lld:\n", (void *) reorder, reorder_mode_as_char (reorder), rsampleiv->u.reorder.min, (void *) rsampleiv, reorder->next_seq));
DDS_LOG(DDS_LC_RADMIN, "reorder_sample(%p %c, %"PRId64" @ %p) expecting %"PRId64":\n", (void *) reorder, reorder_mode_as_char (reorder), rsampleiv->u.reorder.min, (void *) rsampleiv, reorder->next_seq);
/* Incoming rsample must be a singleton */
assert (rsample_is_singleton (s));
@ -1883,7 +1869,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
{
struct nn_rsample *min = ut_avlFindMin (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
if (min)
TRACE_RADMIN ((" min = %lld @ %p\n", min->u.reorder.min, (void *) min));
DDS_LOG(DDS_LC_RADMIN, " min = %"PRId64" @ %p\n", min->u.reorder.min, (void *) min);
assert (min == NULL || reorder->next_seq < min->u.reorder.min);
assert ((reorder->max_sampleiv == NULL && min == NULL) ||
(reorder->max_sampleiv != NULL && min != NULL));
@ -1893,7 +1879,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
assert (reorder->max_sampleiv == NULL || reorder->max_sampleiv == ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree));
assert (reorder->n_samples <= reorder->max_samples);
if (reorder->max_sampleiv)
TRACE_RADMIN ((" max = [%lld,%lld) @ %p\n", reorder->max_sampleiv->u.reorder.min, reorder->max_sampleiv->u.reorder.maxp1, (void *) reorder->max_sampleiv));
DDS_LOG(DDS_LC_RADMIN, " max = [%"PRId64",%"PRId64") @ %p\n", reorder->max_sampleiv->u.reorder.min, reorder->max_sampleiv->u.reorder.maxp1, (void *) reorder->max_sampleiv);
if (s->min == reorder->next_seq ||
(s->min > reorder->next_seq && reorder->mode == NN_REORDER_MODE_MONOTONICALLY_INCREASING) ||
@ -1907,7 +1893,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
admin, or things go wrong very quickly.) */
if (delivery_queue_full_p)
{
TRACE_RADMIN ((" discarding deliverable sample: delivery queue is full\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding deliverable sample: delivery queue is full\n");
return NN_REORDER_REJECT;
}
@ -1918,14 +1904,14 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
if (reorder->max_sampleiv != NULL)
{
struct nn_rsample *min = ut_avlFindMin (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
TRACE_RADMIN ((" try append_and_discard\n"));
DDS_LOG(DDS_LC_RADMIN, " try append_and_discard\n");
if (reorder_try_append_and_discard (reorder, rsampleiv, min))
reorder->max_sampleiv = NULL;
}
reorder->next_seq = s->maxp1;
*sc = rsampleiv->u.reorder.sc;
(*refcount_adjust)++;
TRACE_RADMIN ((" return [%lld,%lld)\n", s->min, s->maxp1));
DDS_LOG(DDS_LC_RADMIN, " return [%"PRId64",%"PRId64")\n", s->min, s->maxp1);
/* Adjust reorder->n_samples, new sample is not counted yet */
assert (s->maxp1 - s->min >= 1);
@ -1939,7 +1925,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
{
/* we've moved beyond this one: discard it; no need to adjust
n_samples */
TRACE_RADMIN ((" discard: too old\n"));
DDS_LOG(DDS_LC_RADMIN, " discard: too old\n");
return NN_REORDER_TOO_OLD; /* don't want refcount increment */
}
else if (ut_avlIsEmpty (&reorder->sampleivtree))
@ -1948,10 +1934,10 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
is technically allowed, and potentially useful, so check for
it */
assert (reorder->n_samples == 0);
TRACE_RADMIN ((" adding to empty store\n"));
DDS_LOG(DDS_LC_RADMIN, " adding to empty store\n");
if (reorder->max_samples == 0)
{
TRACE_RADMIN ((" NOT - max_samples hit\n"));
DDS_LOG(DDS_LC_RADMIN, " NOT - max_samples hit\n");
return NN_REORDER_REJECT;
}
else
@ -1968,12 +1954,12 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
if (delivery_queue_full_p)
{
/* growing last inteval will not be accepted when this flag is set */
TRACE_RADMIN ((" discarding sample: only accepting delayed samples due to backlog in delivery queue\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample: only accepting delayed samples due to backlog in delivery queue\n");
return NN_REORDER_REJECT;
}
/* grow the last interval, if we're still accepting samples */
TRACE_RADMIN ((" growing last interval\n"));
DDS_LOG(DDS_LC_RADMIN, " growing last interval\n");
if (reorder->n_samples < reorder->max_samples)
{
append_rsample_interval (reorder->max_sampleiv, rsampleiv);
@ -1981,7 +1967,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
}
else
{
TRACE_RADMIN ((" discarding sample: max_samples reached and sample at end\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample: max_samples reached and sample at end\n");
return NN_REORDER_REJECT;
}
}
@ -1990,19 +1976,19 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
if (delivery_queue_full_p)
{
/* new interval at the end will not be accepted when this flag is set */
TRACE_RADMIN ((" discarding sample: only accepting delayed samples due to backlog in delivery queue\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample: only accepting delayed samples due to backlog in delivery queue\n");
return NN_REORDER_REJECT;
}
if (reorder->n_samples < reorder->max_samples)
{
TRACE_RADMIN ((" new interval at end\n"));
DDS_LOG(DDS_LC_RADMIN, " new interval at end\n");
reorder_add_rsampleiv (reorder, rsampleiv);
reorder->max_sampleiv = rsampleiv;
reorder->n_samples++;
}
else
{
TRACE_RADMIN ((" discarding sample: max_samples reached and sample at end\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample: max_samples reached and sample at end\n");
return NN_REORDER_REJECT;
}
}
@ -2016,37 +2002,37 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
- if immsucc exists we can prepend s to immsucc
- and possibly join predeq, s, and immsucc */
struct nn_rsample *predeq, *immsucc;
TRACE_RADMIN ((" hard case ...\n"));
DDS_LOG(DDS_LC_RADMIN, " hard case ...\n");
if (config.late_ack_mode && delivery_queue_full_p)
{
TRACE_RADMIN ((" discarding sample: delivery queue full\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding sample: delivery queue full\n");
return NN_REORDER_REJECT;
}
predeq = ut_avlLookupPredEq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->min);
if (predeq)
TRACE_RADMIN ((" predeq = [%lld,%lld) @ %p\n",
predeq->u.reorder.min, predeq->u.reorder.maxp1, (void *) predeq));
DDS_LOG(DDS_LC_RADMIN, " predeq = [%"PRId64",%"PRId64") @ %p\n",
predeq->u.reorder.min, predeq->u.reorder.maxp1, (void *) predeq);
else
TRACE_RADMIN ((" predeq = null\n"));
DDS_LOG(DDS_LC_RADMIN, " predeq = null\n");
if (predeq && s->min >= predeq->u.reorder.min && s->min < predeq->u.reorder.maxp1)
{
/* contained in predeq */
TRACE_RADMIN ((" discard: contained in predeq\n"));
DDS_LOG(DDS_LC_RADMIN, " discard: contained in predeq\n");
return NN_REORDER_REJECT;
}
immsucc = ut_avlLookup (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->maxp1);
if (immsucc)
TRACE_RADMIN ((" immsucc = [%lld,%lld) @ %p\n",
immsucc->u.reorder.min, immsucc->u.reorder.maxp1, (void *) immsucc));
DDS_LOG(DDS_LC_RADMIN, " immsucc = [%"PRId64",%"PRId64") @ %p\n",
immsucc->u.reorder.min, immsucc->u.reorder.maxp1, (void *) immsucc);
else
TRACE_RADMIN ((" immsucc = null\n"));
DDS_LOG(DDS_LC_RADMIN, " immsucc = null\n");
if (predeq && s->min == predeq->u.reorder.maxp1)
{
/* grow predeq at end, and maybe append immsucc as well */
TRACE_RADMIN ((" growing predeq at end ...\n"));
DDS_LOG(DDS_LC_RADMIN, " growing predeq at end ...\n");
append_rsample_interval (predeq, rsampleiv);
if (reorder_try_append_and_discard (reorder, predeq, immsucc))
reorder->max_sampleiv = predeq;
@ -2056,7 +2042,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
/* no predecessor, grow immsucc at head, which _does_ alter the
key of the node in the tree, but _doesn't_ change the tree's
structure. */
TRACE_RADMIN ((" growing immsucc at head\n"));
DDS_LOG(DDS_LC_RADMIN, " growing immsucc at head\n");
s->sc.last->next = immsucc->u.reorder.sc.first;
immsucc->u.reorder.sc.first = s->sc.first;
immsucc->u.reorder.min = s->min;
@ -2082,7 +2068,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
else
{
/* neither extends predeq nor immsucc */
TRACE_RADMIN ((" new interval\n"));
DDS_LOG(DDS_LC_RADMIN, " new interval\n");
reorder_add_rsampleiv (reorder, rsampleiv);
}
@ -2209,18 +2195,18 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
struct nn_rsample *coalesced;
int valuable;
TRACE_RADMIN (("reorder_gap(%p %c, [%lld,%lld) data %p) expecting %lld:\n",
DDS_LOG(DDS_LC_RADMIN, "reorder_gap(%p %c, [%"PRId64",%"PRId64") data %p) expecting %"PRId64":\n",
(void *) reorder, reorder_mode_as_char (reorder),
min, maxp1, (void *) rdata, reorder->next_seq));
min, maxp1, (void *) rdata, reorder->next_seq);
if (maxp1 <= reorder->next_seq)
{
TRACE_RADMIN ((" too old\n"));
DDS_LOG(DDS_LC_RADMIN, " too old\n");
return NN_REORDER_TOO_OLD;
}
if (reorder->mode != NN_REORDER_MODE_NORMAL)
{
TRACE_RADMIN ((" special mode => don't care\n"));
DDS_LOG(DDS_LC_RADMIN, " special mode => don't care\n");
return NN_REORDER_REJECT;
}
@ -2228,10 +2214,10 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
if ((coalesced = coalesce_intervals_touching_range (reorder, min, maxp1, &valuable)) == NULL)
{
nn_reorder_result_t res;
TRACE_RADMIN ((" coalesced = null\n"));
DDS_LOG(DDS_LC_RADMIN, " coalesced = null\n");
if (min <= reorder->next_seq)
{
TRACE_RADMIN ((" next expected: %lld\n", maxp1));
DDS_LOG(DDS_LC_RADMIN, " next expected: %"PRId64"\n", maxp1);
reorder->next_seq = maxp1;
res = NN_REORDER_ACCEPT;
}
@ -2239,17 +2225,17 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
(reorder->max_sampleiv == NULL || min > reorder->max_sampleiv->u.reorder.maxp1))
{
/* n_samples = max_samples => (max_sampleiv = NULL <=> max_samples = 0) */
TRACE_RADMIN ((" discarding gap: max_samples reached and gap at end\n"));
DDS_LOG(DDS_LC_RADMIN, " discarding gap: max_samples reached and gap at end\n");
res = NN_REORDER_REJECT;
}
else if (!reorder_insert_gap (reorder, rdata, min, maxp1))
{
TRACE_RADMIN ((" store gap failed: no memory\n"));
DDS_LOG(DDS_LC_RADMIN, " store gap failed: no memory\n");
res = NN_REORDER_REJECT;
}
else
{
TRACE_RADMIN ((" storing gap\n"));
DDS_LOG(DDS_LC_RADMIN, " storing gap\n");
res = NN_REORDER_ACCEPT;
/* do not let radmin grow beyond max_samples; there is a small
possibility that we insert it & delete it immediately
@ -2265,15 +2251,15 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
}
else if (coalesced->u.reorder.min <= reorder->next_seq)
{
TRACE_RADMIN ((" coalesced = [%lld,%lld) @ %p containing %d samples\n",
coalesced->u.reorder.min, coalesced->u.reorder.maxp1,
(void *) coalesced, coalesced->u.reorder.n_samples));
DDS_LOG(DDS_LC_RADMIN, " coalesced = [%"PRId64",%"PRId64") @ %p containing %d samples\n",
coalesced->u.reorder.min, coalesced->u.reorder.maxp1,
(void *) coalesced, coalesced->u.reorder.n_samples);
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, coalesced);
if (coalesced->u.reorder.min <= reorder->next_seq)
assert (min <= reorder->next_seq);
reorder->next_seq = coalesced->u.reorder.maxp1;
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
TRACE_RADMIN ((" next expected: %lld\n", reorder->next_seq));
DDS_LOG(DDS_LC_RADMIN, " next expected: %"PRId64"\n", reorder->next_seq);
*sc = coalesced->u.reorder.sc;
/* Adjust n_samples */
@ -2284,8 +2270,8 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
}
else
{
TRACE_RADMIN ((" coalesced = [%lld,%lld) @ %p - that is all\n",
coalesced->u.reorder.min, coalesced->u.reorder.maxp1, (void *) coalesced));
DDS_LOG(DDS_LC_RADMIN, " coalesced = [%"PRId64",%"PRId64") @ %p - that is all\n",
coalesced->u.reorder.min, coalesced->u.reorder.maxp1, (void *) coalesced);
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
return valuable ? NN_REORDER_ACCEPT : NN_REORDER_REJECT;
}
@ -2325,13 +2311,13 @@ unsigned nn_reorder_nackmap (struct nn_reorder *reorder, seqno_t base, seqno_t m
#else
if (base > reorder->next_seq)
{
NN_ERROR ("nn_reorder_nackmap: incorrect base sequence number supplied (%"PRId64" > %"PRId64")\n", base, reorder->next_seq);
DDS_ERROR("nn_reorder_nackmap: incorrect base sequence number supplied (%"PRId64" > %"PRId64")\n", base, reorder->next_seq);
base = reorder->next_seq;
}
#endif
if (maxseq + 1 < base)
{
NN_ERROR ("nn_reorder_nackmap: incorrect max sequence number supplied (maxseq %"PRId64" base %"PRId64")\n", maxseq, base);
DDS_ERROR("nn_reorder_nackmap: incorrect max sequence number supplied (maxseq %"PRId64" base %"PRId64")\n", maxseq, base);
maxseq = base - 1;
}

File diff suppressed because it is too large Load diff

View file

@ -79,7 +79,7 @@
#define Q_REPORT_OPENSSL_ERR(x) \
while ( ERR_peek_error() ) \
NN_ERROR(x "%s", ERR_error_string(ERR_get_error(), NULL));
DDS_ERROR(x "%s", ERR_error_string(ERR_get_error(), NULL));
@ -315,10 +315,10 @@ static void tdumpCounter(unsigned char* counter, int counterLength)
if (counter) {
for (i=0; i<counterLength; ++i) {
unsigned int tmpChar = (unsigned int) counter[i]; /* dont know how to tell ::printf the argument is simple char*/
TRACE(("%02x", tmpChar));
DDS_TRACE("%02x", tmpChar);
}
} else {
TRACE(( "NULL"));
DDS_TRACE("NULL");
}
}
#endif
@ -334,24 +334,24 @@ static void tdumpPayload (unsigned char* buffer, int mesgLength, int bufferLengt
int current = where;
/* line index */
TRACE((" 0x%08x", i));
DDS_TRACE(" 0x%08x", i);
/* 16 octets in hex format */
for (j=0; current<bufferLength && j<perLine; ++j, ++current) {
unsigned int tmpChar = buffer[current];
if (current != mesgLength) {
TRACE((" %02x", tmpChar));
DDS_TRACE(" %02x", tmpChar);
} else {
/* with marker */
TRACE(("#%02x", tmpChar));
DDS_TRACE("#%02x", tmpChar);
}
}
/* padding */
while(j++<perLine) {
TRACE((" "));
DDS_TRACE(" ");
}
/* seperator */
TRACE(( " "));
DDS_TRACE(" ");
current = where;
/* the same octets as before as plain text, if alpha-num,
@ -366,7 +366,7 @@ static void tdumpPayload (unsigned char* buffer, int mesgLength, int bufferLengt
}
}
TRACE(("\n"));
DDS_TRACE("\n");
where = current;
}
@ -389,10 +389,10 @@ static void tdumpBuffer
(void) partitionName;
(void) partitionId;
TRACE(("[%s] Buffer HexDump %u Counter: ", direction, (unsigned int) length));
DDS_TRACE("[%s] Buffer HexDump %u Counter: ", direction, (unsigned int) length);
tdumpCounter(counter, counterLength);
TRACE(("\n"));
DDS_TRACE("\n");
tdumpPayload(buffer, length, bufferLength);
}
@ -573,7 +573,7 @@ static c_bool q_securityResolveCipherKeyFromUri
fclose(file);
} else {
NN_ERROR("q_securityResolveCipherKeyFromUri: Could not open %s",uriStr);
DDS_ERROR("q_securityResolveCipherKeyFromUri: Could not open %s",uriStr);
}
os_free(filename);
@ -610,7 +610,7 @@ static c_bool q_securityCipherTypeFromString(const char* cipherName,
{
if (cipherName == NULL)
{
NN_ERROR("q_securityCipherTypeFromString:internal error, empty cipher string");
DDS_ERROR("q_securityCipherTypeFromString:internal error, empty cipher string");
*cipherType = Q_CIPHER_UNDEFINED;
return FALSE;
}
@ -712,7 +712,7 @@ q_securityPartitionEncoderInit(q_securityPartitionEncoder encoder,struct config_
if (!connected) {
TRACE(("Network Partition '%s' (%d) not connected, dropping outbound traffic permanently", partitionName, partitionId));
DDS_TRACE("Network Partition '%s' (%d) not connected, dropping outbound traffic permanently", partitionName, partitionId);
encoder->state = Q_CODEC_STATE_DROP_PERM;
encoder->cipherType = Q_CIPHER_UNDEFINED;
@ -804,7 +804,7 @@ q_securityPartitionEncoderInit(q_securityPartitionEncoder encoder,struct config_
/* intitialize the key-buffer */
if (cipherType != Q_CIPHER_NULL && cipherType != Q_CIPHER_NONE &&
!q_securityResolveCipherKeyFromUri(cipherKeyURL,cipherKeyLength,cipherKey)) {
NN_ERROR("DDSI Security Encoder: dropping traffic of partition '%s' (%d) due to invalid cipher key",
DDS_ERROR("DDSI Security Encoder: dropping traffic of partition '%s' (%d) due to invalid cipher key",
encoder->partitionName, partitionId);
encoder->state = Q_CODEC_STATE_DROP_TEMP;
}
@ -855,7 +855,7 @@ q_securityPartitionDecoderInit(q_securityPartitionDecoder decoder,struct config_
memset(cipherKey, 0, sizeof(cipherKey));
if (!connected) {
TRACE(("Network Partition '%s' (%d) not connected, dropping inbound traffic permanently\n", partitionName, partitionId));
DDS_TRACE("Network Partition '%s' (%d) not connected, dropping inbound traffic permanently\n", partitionName, partitionId);
decoder->state = Q_CODEC_STATE_DROP_PERM;
decoder->cipherType = Q_CIPHER_UNDEFINED;
@ -921,7 +921,7 @@ q_securityPartitionDecoderInit(q_securityPartitionDecoder decoder,struct config_
/* init key-buffer from URL */
if (cipherType != Q_CIPHER_NULL && cipherType != Q_CIPHER_NONE &&
!q_securityResolveCipherKeyFromUri(cipherKeyURL,cipherKeyLength,cipherKey)) {
NN_ERROR("DDSI Security Decoder: dropping traffic of partition '%s' (%d) due to invalid cipher key",
DDS_ERROR("DDSI Security Decoder: dropping traffic of partition '%s' (%d) due to invalid cipher key",
decoder->partitionName, partitionId);
/* can be solved by re-keying, rewriting the file */
decoder->state = Q_CODEC_STATE_DROP_TEMP;
@ -1002,15 +1002,15 @@ static q_securityEncoderSet q_securityEncoderSetNew (void)
/* the codec config is faulty, the codec has been set into
* DROP_TERMP or DROP_PERM state, depending on the kind of
* fault. Continue to intitialize remaining codecs */
NN_ERROR("q_securityEncoderSet:failed to initialize codec of partition '%s' (%d)\n",
DDS_ERROR("q_securityEncoderSet:failed to initialize codec of partition '%s' (%d)\n",
p->name,p->partitionId );
}
TRACE(("Network Partition '%s' (%d) encoder secured by %s cipher, in status '%s'\n",
p->name,
p->partitionId,
cipherTypeAsString(currentEncoder->cipherType),
stateAsString(currentEncoder->state)));
DDS_TRACE("Network Partition '%s' (%d) encoder secured by %s cipher, in status '%s'\n",
p->name,
p->partitionId,
cipherTypeAsString(currentEncoder->cipherType),
stateAsString(currentEncoder->state));
headerSizeProfile = cipherTypeToHeaderSize(currentEncoder->cipherType);
result->headerSizeMax = (headerSizeProfile > (result->headerSizeMax)) ? headerSizeProfile: (result->headerSizeMax);
@ -1021,9 +1021,9 @@ static q_securityEncoderSet q_securityEncoderSetNew (void)
currentEncoder->cipherType = Q_CIPHER_NONE;
currentEncoder->partitionName = p->name;
TRACE(("Network Partition '%s' (%d) is not secured by a cipher\n",
p->name,
p->partitionId));
DDS_TRACE("Network Partition '%s' (%d) is not secured by a cipher\n",
p->name,
p->partitionId);
}
/* count up step by step, so in case of error
* q_securityEncoderSetFree will only iterate those already
@ -1034,8 +1034,7 @@ static q_securityEncoderSet q_securityEncoderSetNew (void)
}
TRACE(("reserving %d bytes for security header\n", result->headerSizeMax));
DDS_TRACE("reserving %d bytes for security header\n", result->headerSizeMax);
}
return result;
@ -1084,24 +1083,24 @@ static q_securityDecoderSet q_securityDecoderSetNew (void)
/* the codec config is faulty, the codec has been set into
* DROP_TERMP or DROP_PERM state, depending on the kind of
* fault. Continue to intitialize remaining codecs */
NN_ERROR("q_securityDecoderSet:failed to initialize codec of partition '%s' (%d)\n",
DDS_ERROR("q_securityDecoderSet:failed to initialize codec of partition '%s' (%d)\n",
p->name,p->partitionId);
}
TRACE(("Network Partition '%s' (%d) decoder secured by %s cipher, in status '%s'\n",
DDS_TRACE("Network Partition '%s' (%d) decoder secured by %s cipher, in status '%s'\n",
p->name,
p->partitionId,
cipherTypeAsString(currentDecoder->cipherType),
stateAsString(currentDecoder->state)));
stateAsString(currentDecoder->state));
} else {
memset(currentDecoder, 0, sizeof(*currentDecoder));
currentDecoder->state = Q_CODEC_STATE_DROP_PERM;
currentDecoder->cipherType = Q_CIPHER_NONE;
currentDecoder->partitionName = p->name;
TRACE(("Network Partition '%s' (%d) is not secured by a cipher\n",
DDS_TRACE("Network Partition '%s' (%d) is not secured by a cipher\n",
p->name,
p->partitionId));
p->partitionId);
}
/* count up step by step, so in case of error
* q_securityEncoderSetFree will only iterate those already
@ -1202,7 +1201,7 @@ static c_bool counterEncryptOrDecryptInPlace
/* encrypt the current counter */
if (!EVP_EncryptUpdate(ctx, keyStream, &num, counter, bl)) { /* ECB encrypts exactly 'bl' bytes */
NN_WARNING("Incoming encrypted sub-message dropped: Decrypt failed (bufferLength %u, blockSize %u, where %u)",length, bl, where);
DDS_WARNING("Incoming encrypted sub-message dropped: Decrypt failed (bufferLength %u, blockSize %u, where %u)\n",length, bl, where);
return FALSE;
}
@ -1446,7 +1445,7 @@ static c_bool q_securityDecodeInPlace_Generic
result = verifySha1(cipherText, *dataLength, sha1HeaderStart);
TRACE((":BLF:%s", result?"OK":"ERROR")); /* debug */
if (!result) {
NN_WARNING("Incoming encrypted sub-message dropped: Decrypt (blowfish) verification failed for partition '%s' - possible Key-mismatch", decoder->partitionName);
DDS_WARNING("Incoming encrypted sub-message dropped: Decrypt (blowfish) verification failed for partition '%s' - possible Key-mismatch\n", decoder->partitionName);
}
}
@ -1479,9 +1478,9 @@ static c_bool q_securityDecodeInPlace_Generic
if ( result){
/* will zero out the sha1Header values in buffer */
result = verifySha1(cipherText, *dataLength, sha1HeaderStart);
TRACE((":AES:%s", result?"OK":"ERROR")); /* debug */
DDS_TRACE(":AES:%s", result?"OK":"ERROR"); /* debug */
if (!result) {
NN_WARNING("Incoming encrypted sub-message dropped: Decrypt (AES) verification failed for partition '%s' - possible Key-mismatch", decoder->partitionName);
DDS_WARNING("Incoming encrypted sub-message dropped: Decrypt (AES) verification failed for partition '%s' - possible Key-mismatch", decoder->partitionName);
}
}
@ -1492,7 +1491,7 @@ static c_bool q_securityDecodeInPlace_Generic
assert(0 && "do not reach");
}
TRACE((":(%d->%d)", *dataLength, *dataLength - overallHeaderSize));
DDS_TRACE(":(%d->%d)", *dataLength, *dataLength - overallHeaderSize);
*dataLength -= overallHeaderSize; /* out */
@ -1527,7 +1526,7 @@ static c_bool q_securityEncodeInPlace
if (partitionId == 0 || partitionId > codec->nofPartitions) {
/* if partitionId is larger than number of partitions, network service
* seems to be in undefined state */
NN_ERROR("q_securityEncodeInPlace:Sending message blocked, bad partitionid '%d'",
DDS_ERROR("q_securityEncodeInPlace:Sending message blocked, bad partitionid '%d'\n",
partitionId);
return FALSE;
}
@ -1536,20 +1535,20 @@ static c_bool q_securityEncodeInPlace
if (encoderIsBlocked(encoder)) {
NN_ERROR("q_securityEncodeInPlace:Sending message blocked, encoder of partitionid '%d' in bad state",
DDS_ERROR("q_securityEncodeInPlace:Sending message blocked, encoder of partitionid '%d' in bad state\n",
partitionId);
return FALSE;
}
if (*dataLength <= 0) {
NN_WARNING("q_securityEncodeInPlace:encoder called with empty buffer");
DDS_WARNING("q_securityEncodeInPlace:encoder called with empty buffer\n");
return FALSE;
}
overallHeaderSize = cipherTypeToHeaderSize(encoder->cipherType);
if (*dataLength + overallHeaderSize > fragmentLength) {
NN_ERROR("q_securityEncodeInPlace:sending message of %"PA_PRIu32" bytes overlaps with reserved space of %"PA_PRIu32" bytes",
DDS_ERROR("q_securityEncodeInPlace:sending message of %"PA_PRIu32" bytes overlaps with reserved space of %"PA_PRIu32" bytes\n",
*dataLength, overallHeaderSize);
return FALSE;
}
@ -1620,7 +1619,7 @@ static c_bool q_securityDecodeInPlace
}
if ((partitionId < 1) || (partitionId > codec->nofPartitions)) {
NN_WARNING("Incoming encrypted sub-message dropped, bad partition hash '%u'", hash);
DDS_WARNING("Incoming encrypted sub-message dropped, bad partition hash '%u'\n", hash);
return FALSE;
}
@ -1629,16 +1628,16 @@ static c_bool q_securityDecodeInPlace
overallHeaderSize = cipherTypeToHeaderSize(sendersCipherType);
if (sendersCipherType!=decoder->cipherType) {
NN_WARNING("Incoming encrypted sub-message dropped: cipherType mismatch (%d != %d) for partition '%s'", sendersCipherType,decoder->cipherType, decoder->partitionName);
DDS_WARNING("Incoming encrypted sub-message dropped: cipherType mismatch (%d != %d) for partition '%s'\n", sendersCipherType,decoder->cipherType, decoder->partitionName);
return FALSE;
}
if (decoderIsBlocked(decoder)) {
NN_WARNING("Incoming encrypted sub-message dropped: decoder is blocked for partition '%s'", decoder->partitionName);
DDS_WARNING("Incoming encrypted sub-message dropped: decoder is blocked for partition '%s'\n", decoder->partitionName);
return FALSE;
}
if (overallHeaderSize > dataLength32) {
NN_WARNING("Incoming encrypted sub-message dropped: submessage too small(%"PA_PRIu32" bytes),for partition '%s'", dataLength32, decoder->partitionName);
DDS_WARNING("Incoming encrypted sub-message dropped: submessage too small(%"PA_PRIu32" bytes),for partition '%s'\n", dataLength32, decoder->partitionName);
return FALSE;
}

View file

@ -84,7 +84,7 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
LOG_THREAD_CPUTIME (next_thread_cputime);
TRACE (("servicelease: tnow %"PRId64":", tnow.v));
DDS_TRACE("servicelease: tnow %"PRId64":", tnow.v);
/* Check progress only if enough time has passed: there is no
guarantee that os_cond_timedwait wont ever return early, and we
@ -106,7 +106,7 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
vtime_t wd = thread_states.ts[i].watchdog;
int alive = vtime_asleep_p (vt) || vtime_asleep_p (wd) || vtime_gt (wd, sl->av_ary[i].wd);
n_alive += (unsigned) alive;
TRACE ((" %u(%s):%c:%u:%u->%u:", i, thread_states.ts[i].name, alive ? 'a' : 'd', vt, sl->av_ary[i].wd, wd));
DDS_TRACE(" %u(%s):%c:%u:%u->%u:", i, thread_states.ts[i].name, alive ? 'a' : 'd', vt, sl->av_ary[i].wd, wd);
sl->av_ary[i].wd = wd;
if (sl->av_ary[i].alive != alive)
{
@ -116,7 +116,7 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
msg = "failed to make progress";
else
msg = "once again made progress";
NN_WARNING ("thread %s %s\n", name ? name : "(anon)", msg);
DDS_WARNING("thread %s %s\n", name ? name : "(anon)", msg);
sl->av_ary[i].alive = (char) alive;
}
}
@ -129,7 +129,7 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
the DDSI2 service to be marked as dead. */
if (n_alive == thread_states.nthreads)
{
TRACE ((": [%u] renewing\n", n_alive));
DDS_TRACE(": [%u] renewing\n", n_alive);
/* FIXME: perhaps it would be nice to control automatic
liveliness updates from here.
FIXME: should terminate failure of renew_cb() */
@ -138,7 +138,7 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
}
else
{
TRACE ((": [%u] NOT renewing\n", n_alive));
DDS_TRACE(": [%u] NOT renewing\n", n_alive);
if (was_alive)
log_stack_traces ();
was_alive = 0;
@ -149,16 +149,16 @@ static uint32_t lease_renewal_thread (struct nn_servicelease *sl)
statistics to the trace. Getrusage() can't fail if the
parameters are valid, and these are by the book. Still we
check. */
if (config.enabled_logcats & LC_TIMING)
if (dds_get_log_mask() & DDS_LC_TIMING)
{
struct rusage u;
if (getrusage (RUSAGE_SELF, &u) == 0)
{
nn_log (LC_TIMING,
"rusage: utime %d.%06d stime %d.%06d maxrss %ld data %ld vcsw %ld ivcsw %ld\n",
(int) u.ru_utime.tv_sec, (int) u.ru_utime.tv_usec,
(int) u.ru_stime.tv_sec, (int) u.ru_stime.tv_usec,
u.ru_maxrss, u.ru_idrss, u.ru_nvcsw, u.ru_nivcsw);
DDS_LOG(DDS_LC_TIMING,
"rusage: utime %d.%06d stime %d.%06d maxrss %ld data %ld vcsw %ld ivcsw %ld\n",
(int) u.ru_utime.tv_sec, (int) u.ru_utime.tv_usec,
(int) u.ru_stime.tv_sec, (int) u.ru_stime.tv_usec,
u.ru_maxrss, u.ru_idrss, u.ru_nvcsw, u.ru_nivcsw);
}
}
#endif

View file

@ -169,7 +169,7 @@ void os_sockWaitsetTrigger (os_sockWaitset ws)
if (n != 1)
{
err = os_getErrno ();
NN_WARNING ("os_sockWaitsetTrigger: read failed on trigger pipe, errno = %d", err);
DDS_WARNING("os_sockWaitsetTrigger: read failed on trigger pipe, errno = %d\n", err);
}
}
@ -250,7 +250,7 @@ os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws)
nevs = 0;
else
{
NN_WARNING ("os_sockWaitsetWait: kevent failed, errno = %d", os_getErrno());
DDS_WARNING("os_sockWaitsetWait: kevent failed, errno = %d\n", os_getErrno());
return NULL;
}
}
@ -330,7 +330,7 @@ void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index)
ws->ctx.conns[i] = NULL;
if (!WSACloseEvent (ws->ctx.events[i]))
{
NN_WARNING ("os_sockWaitsetPurge: WSACloseEvent (%x failed, error %d", (os_uint32) ws->ctx.events[i], os_getErrno ());
DDS_WARNING("os_sockWaitsetPurge: WSACloseEvent (%x failed, error %d\n", (os_uint32) ws->ctx.events[i], os_getErrno ());
}
}
ws->ctx.n = index + 1;
@ -363,7 +363,7 @@ void os_sockWaitsetTrigger (os_sockWaitset ws)
{
if (! WSASetEvent (ws->ctx.events[0]))
{
NN_WARNING ("os_sockWaitsetTrigger: WSASetEvent(%x) failed, error %d", (os_uint32) ws->ctx.events[0], os_getErrno ());
DDS_WARNING("os_sockWaitsetTrigger: WSASetEvent(%x) failed, error %d\n", (os_uint32) ws->ctx.events[0], os_getErrno ());
}
}
@ -392,7 +392,7 @@ int os_sockWaitsetAdd (os_sockWaitset ws, ddsi_tran_conn_t conn)
{
if (WSAEventSelect (sock, ev, FD_READ) == SOCKET_ERROR)
{
NN_WARNING ("os_sockWaitsetAdd: WSAEventSelect(%x,%x) failed, error %d", (os_uint32) sock, (os_uint32) ev, os_getErrno ());
DDS_WARNING("os_sockWaitsetAdd: WSAEventSelect(%x,%x) failed, error %d\n", (os_uint32) sock, (os_uint32) ev, os_getErrno ());
WSACloseEvent (ev);
ret = -1;
}
@ -422,7 +422,7 @@ os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws)
if ((idx = WSAWaitForMultipleEvents (ws->ctx0.n, ws->ctx0.events, FALSE, WSA_INFINITE, FALSE)) == WSA_WAIT_FAILED)
{
NN_WARNING ("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) failed, error %d", ws->ctx0.n, os_getErrno ());
DDS_WARNING("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) failed, error %d\n", ws->ctx0.n, os_getErrno ());
return NULL;
}
@ -445,11 +445,11 @@ os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws)
if (idx == WAIT_IO_COMPLETION)
{
/* Presumably can't happen with alertable = FALSE */
NN_WARNING ("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) returned unexpected WAIT_IO_COMPLETION", ws->ctx0.n);
DDS_WARNING("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) returned unexpected WAIT_IO_COMPLETION\n", ws->ctx0.n);
}
else
{
NN_WARNING ("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) returned unrecognised %d", ws->ctx0.n, idx);
DDS_WARNING("os_sockWaitsetWait: WSAWaitForMultipleEvents(%d,...,0,0,0) returned unrecognised %d\n", ws->ctx0.n, idx);
}
#ifdef TEMP_DEF_WAIT_IO_COMPLETION
#undef WAIT_IO_COMPLETION
@ -488,7 +488,7 @@ int os_sockWaitsetNextEvent (os_sockWaitsetCtx ctx, ddsi_tran_conn_t * conn)
{
/* May have a wakeup and a close in parallel, so the handle
need not exist anymore. */
NN_ERROR ("os_sockWaitsetNextEvent: WSAEnumNetworkEvents(%x,%x,...) failed, error %d", (os_uint32) handle, (os_uint32) ctx->events[idx], err);
DDS_ERROR("os_sockWaitsetNextEvent: WSAEnumNetworkEvents(%x,%x,...) failed, error %d", (os_uint32) handle, (os_uint32) ctx->events[idx], err);
}
return -1;
}
@ -753,7 +753,7 @@ void os_sockWaitsetTrigger (os_sockWaitset ws)
if (n != 1)
{
err = os_getErrno ();
NN_WARNING ("os_sockWaitsetTrigger: read failed on trigger pipe, errno = %d", err);
DDS_WARNING("os_sockWaitsetTrigger: read failed on trigger pipe, errno = %d", err);
}
}
@ -882,7 +882,7 @@ os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws)
err = os_getErrno ();
if ((err != os_sockEINTR) && (err != os_sockEAGAIN))
{
NN_WARNING ("os_sockWaitsetWait: select failed, errno = %d", err);
DDS_WARNING("os_sockWaitsetWait: select failed, errno = %d", err);
break;
}
}
@ -905,7 +905,7 @@ os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws)
if (n1 != 1)
{
err = os_getErrno ();
NN_WARNING ("os_sockWaitsetWait: read failed on trigger pipe, errno = %d", err);
DDS_WARNING("os_sockWaitsetWait: read failed on trigger pipe, errno = %d", err);
assert (0);
}
}

View file

@ -59,7 +59,7 @@ static void os_free_aligned ( _Pre_maybenull_ _Post_invalid_ void *ptr)
void thread_states_init_static (void)
{
static struct thread_state1 ts =
{ .state = THREAD_STATE_ALIVE, .vtime = 1, .watchdog = 1, .lb = NULL, .name = "(anon)" };
{ .state = THREAD_STATE_ALIVE, .vtime = 1, .watchdog = 1, .name = "(anon)" };
tsd_thread_state = &ts;
}
@ -79,7 +79,6 @@ OS_WARNING_MSVC_OFF(6386);
thread_states.ts[i].state = THREAD_STATE_ZERO;
thread_states.ts[i].vtime = 1;
thread_states.ts[i].watchdog = 1;
thread_states.ts[i].lb = NULL;
thread_states.ts[i].name = NULL;
}
OS_WARNING_MSVC_ON(6386);
@ -134,10 +133,9 @@ lookup_thread_state(
ts1 = init_thread_state(tname);
if (ts1 != NULL) {
os_osInit();
ts1->lb = 0;
ts1->extTid = tid;
ts1->tid = tid;
nn_log (LC_INFO, "started application thread %s\n", tname);
DDS_LOG(DDS_LC_INFO, "started application thread %s\n", tname);
os_threadCleanupPush(&cleanup_thread_state, NULL);
}
os_mutexUnlock(&thread_states.lock);
@ -177,7 +175,6 @@ static uint32_t create_thread_wrapper (_In_ _Post_invalid_ struct thread_context
uint32_t ret;
ctxt->self->tid = os_threadIdSelf ();
ret = ctxt->f (ctxt->arg);
logbuf_free (ctxt->self->lb);
os_free (ctxt);
return ret;
}
@ -194,7 +191,7 @@ static int find_free_slot (_In_z_ const char *name)
break;
}
if (cand == -1)
NN_FATAL ("create_thread: %s: no free slot\n", name ? name : "(anon)");
DDS_FATAL("create_thread: %s: no free slot\n", name ? name : "(anon)");
return cand;
}
@ -210,7 +207,6 @@ void upgrade_main_thread (void)
assert (vtime_asleep_p (ts1->vtime));
ts1->state = THREAD_STATE_ALIVE;
ts1->tid = os_threadIdSelf ();
ts1->lb = logbuf_new ();
ts1->name = main_thread_name;
os_mutexUnlock (&thread_states.lock);
tsd_thread_state = ts1;
@ -259,7 +255,6 @@ struct thread_state1 *create_thread (_In_z_ const char *name, _In_ uint32_t (*f)
if (ts1 == NULL)
goto fatal;
ts1->lb = logbuf_new ();
ctxt->self = ts1;
ctxt->f = f;
ctxt->arg = arg;
@ -272,15 +267,15 @@ struct thread_state1 *create_thread (_In_z_ const char *name, _In_ uint32_t (*f)
if (!tprops->stack_size.isdefault)
tattr.stackSize = tprops->stack_size.value;
}
TRACE (("create_thread: %s: class %d priority %d stack %u\n", name, (int) tattr.schedClass, tattr.schedPriority, tattr.stackSize));
DDS_TRACE("create_thread: %s: class %d priority %d stack %u\n", name, (int) tattr.schedClass, tattr.schedPriority, tattr.stackSize);
if (os_threadCreate (&tid, name, &tattr, (os_threadRoutine)&create_thread_wrapper, ctxt) != os_resultSuccess)
{
ts1->state = THREAD_STATE_ZERO;
NN_FATAL ("create_thread: %s: os_threadCreate failed\n", name);
DDS_FATAL("create_thread: %s: os_threadCreate failed\n", name);
goto fatal;
}
nn_log (LC_INFO, "started new thread 0x%"PRIxMAX" : %s\n", os_threadIdToInteger (tid), name);
DDS_LOG(DDS_LC_INFO, "started new thread 0x%"PRIxMAX" : %s\n", os_threadIdToInteger (tid), name);
ts1->extTid = tid; /* overwrite the temporary value with the correct external one */
os_mutexUnlock (&thread_states.lock);
return ts1;
@ -329,7 +324,6 @@ void downgrade_main_thread (void)
{
struct thread_state1 *ts1 = lookup_thread_state ();
thread_state_asleep (ts1);
logbuf_free (ts1->lb);
/* no need to sync with service lease: already stopped */
reap_thread_state (ts1, 0);
thread_states_init_static ();

View file

@ -184,16 +184,16 @@ struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct writer *wr, const stru
}
}
TRACE (("writer_hbcontrol: wr %x:%x:%x:%x ", PGUID (wr->e.guid)));
DDS_TRACE("writer_hbcontrol: wr %x:%x:%x:%x ", PGUID (wr->e.guid));
if (prd_guid == NULL)
TRACE (("multicasting "));
DDS_TRACE("multicasting ");
else
TRACE (("unicasting to prd %x:%x:%x:%x ", PGUID (*prd_guid)));
TRACE (("(rel-prd %d seq-eq-max %d seq %"PRId64" maxseq %"PRId64")\n",
DDS_TRACE("unicasting to prd %x:%x:%x:%x ", PGUID (*prd_guid));
DDS_TRACE("(rel-prd %d seq-eq-max %d seq %"PRId64" maxseq %"PRId64")\n",
wr->num_reliable_readers,
ut_avlIsEmpty (&wr->readers) ? -1 : root_rdmatch (wr)->num_reliable_readers_where_seq_equals_max,
wr->seq,
ut_avlIsEmpty (&wr->readers) ? (seqno_t) -1 : root_rdmatch (wr)->max_seq));
ut_avlIsEmpty (&wr->readers) ? (seqno_t) -1 : root_rdmatch (wr)->max_seq);
if (prd_guid == NULL)
{
@ -208,7 +208,7 @@ struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct writer *wr, const stru
struct proxy_reader *prd;
if ((prd = ephash_lookup_proxy_reader_guid (prd_guid)) == NULL)
{
TRACE (("writer_hbcontrol: wr %x:%x:%x:%x unknown prd %x:%x:%x:%x\n", PGUID (wr->e.guid), PGUID (*prd_guid)));
DDS_TRACE("writer_hbcontrol: wr %x:%x:%x:%x unknown prd %x:%x:%x:%x\n", PGUID (wr->e.guid), PGUID (*prd_guid));
nn_xmsg_free (msg);
return NULL;
}
@ -306,13 +306,13 @@ struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_
if (msg)
{
TRACE (("heartbeat(wr %x:%x:%x:%x%s) piggybacked, resched in %g s (min-ack %"PRId64"%s, avail-seq %"PRId64", xmit %"PRId64")\n",
DDS_TRACE("heartbeat(wr %x:%x:%x:%x%s) piggybacked, resched in %g s (min-ack %"PRId64"%s, avail-seq %"PRId64", xmit %"PRId64")\n",
PGUID (wr->e.guid),
*hbansreq ? "" : " final",
(hbc->tsched.v == T_NEVER) ? POS_INFINITY_DOUBLE : (double) (hbc->tsched.v - tnow.v) / 1e9,
ut_avlIsEmpty (&wr->readers) ? -1 : root_rdmatch (wr)->min_seq,
ut_avlIsEmpty (&wr->readers) || root_rdmatch (wr)->all_have_replied_to_hb ? "" : "!",
whcst->max_seq, READ_SEQ_XMIT(wr)));
whcst->max_seq, READ_SEQ_XMIT(wr));
}
return msg;
@ -400,13 +400,12 @@ static int create_fragment_message_simple (struct writer *wr, seqno_t seq, struc
#define TEST_KEYHASH 0
const size_t expected_inline_qos_size = 4+8+20+4 + 32;
struct nn_xmsg_marker sm_marker;
unsigned char contentflag;
unsigned char contentflag = 0;
Data_t *data;
switch (serdata->kind)
{
case SDK_EMPTY:
contentflag = 0;
break;
case SDK_KEY:
#if TEST_KEYHASH
@ -634,9 +633,9 @@ int create_fragment_message (struct writer *wr, seqno_t seq, const struct nn_pli
nn_xmsg_serdata (*pmsg, serdata, fragstart, fraglen);
nn_xmsg_submsg_setnext (*pmsg, sm_marker);
#if 0
TRACE (("queue data%s %x:%x:%x:%x #%lld/%u[%u..%u)\n",
DDS_TRACE("queue data%s %x:%x:%x:%x #%lld/%u[%u..%u)\n",
fragging ? "frag" : "", PGUID (wr->e.guid),
seq, fragnum+1, fragstart, fragstart + fraglen));
seq, fragnum+1, fragstart, fragstart + fraglen);
#endif
return ret;
@ -859,7 +858,7 @@ static int insert_sample_in_whc (struct writer *wr, seqno_t seq, struct nn_plist
ASSERT_MUTEX_HELD (&wr->e.lock);
if (config.enabled_logcats & LC_TRACE)
if (dds_get_log_mask() & DDS_LC_TRACE)
{
char ppbuf[1024];
int tmp;
@ -867,10 +866,10 @@ static int insert_sample_in_whc (struct writer *wr, seqno_t seq, struct nn_plist
const char *ttname = wr->topic ? wr->topic->typename : "(null)";
ppbuf[0] = '\0';
tmp = sizeof (ppbuf) - 1;
nn_log (LC_TRACE, "write_sample %x:%x:%x:%x #%"PRId64"", PGUID (wr->e.guid), seq);
DDS_TRACE("write_sample %x:%x:%x:%x #%"PRId64"", PGUID (wr->e.guid), seq);
if (plist != 0 && (plist->present & PP_COHERENT_SET))
nn_log (LC_TRACE, " C#%"PRId64"", fromSN (plist->coherent_set_seqno));
nn_log (LC_TRACE, ": ST%u %s/%s:%s%s\n", serdata->statusinfo, tname, ttname, ppbuf, tmp < (int) sizeof (ppbuf) ? "" : " (trunc)");
DDS_TRACE(" C#%"PRId64"", fromSN (plist->coherent_set_seqno));
DDS_TRACE(": ST%u %s/%s:%s%s\n", serdata->statusinfo, tname, ttname, ppbuf, tmp < (int) sizeof (ppbuf) ? "" : " (trunc)");
}
assert (wr->reliable || have_reliable_subs (wr) == 0);
@ -959,7 +958,7 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
assert (!is_builtin_entityid(wr->e.guid.entityid, ownvendorid));
}
nn_log (LC_THROTTLE, "writer %x:%x:%x:%x waiting for whc to shrink below low-water mark (whc %"PRIuSIZE" low=%u high=%u)\n", PGUID (wr->e.guid), whcst.unacked_bytes, wr->whc_low, wr->whc_high);
DDS_LOG(DDS_LC_THROTTLE, "writer %x:%x:%x:%x waiting for whc to shrink below low-water mark (whc %"PRIuSIZE" low=%u high=%u)\n", PGUID (wr->e.guid), whcst.unacked_bytes, wr->whc_low, wr->whc_high);
wr->throttling = 1;
wr->throttle_count++;
@ -1007,7 +1006,7 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
os_condBroadcast (&wr->throttle_cond);
}
nn_log (LC_THROTTLE, "writer %x:%x:%x:%x done waiting for whc to shrink below low-water mark (whc %"PRIuSIZE" low=%u high=%u)\n", PGUID (wr->e.guid), whcst.unacked_bytes, wr->whc_low, wr->whc_high);
DDS_LOG(DDS_LC_THROTTLE, "writer %x:%x:%x:%x done waiting for whc to shrink below low-water mark (whc %"PRIuSIZE" low=%u high=%u)\n", PGUID (wr->e.guid), whcst.unacked_bytes, wr->whc_low, wr->whc_high);
return result;
}
@ -1046,7 +1045,7 @@ static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_p
const char *ttname = wr->topic ? wr->topic->typename : "(null)";
ppbuf[0] = '\0';
tmp = sizeof (ppbuf) - 1;
NN_WARNING ("dropping oversize (%u > %u) sample from local writer %x:%x:%x:%x %s/%s:%s%s\n",
DDS_WARNING ("dropping oversize (%u > %u) sample from local writer %x:%x:%x:%x %s/%s:%s%s\n",
ddsi_serdata_size (serdata), config.max_sample_size,
PGUID (wr->e.guid), tname, ttname, ppbuf,
tmp < (int) sizeof (ppbuf) ? "" : " (trunc)");

View file

@ -175,7 +175,7 @@ static int compare_xevent_tsched (const void *va, const void *vb)
static void update_rexmit_counts (struct xeventq *evq, struct xevent_nt *ev)
{
#if 0
TRACE (("ZZZ(%p,%"PA_PRIuSIZE")", (void *) ev, ev->u.msg_rexmit.queued_rexmit_bytes));
DDS_TRACE(("ZZZ(%p,%"PA_PRIuSIZE")", (void *) ev, ev->u.msg_rexmit.queued_rexmit_bytes);
#endif
assert (ev->kind == XEVK_MSG_REXMIT);
assert (ev->u.msg_rexmit.queued_rexmit_bytes <= evq->queued_rexmit_bytes);
@ -187,13 +187,13 @@ static void update_rexmit_counts (struct xeventq *evq, struct xevent_nt *ev)
#if 0
static void trace_msg (const char *func, const struct nn_xmsg *m)
{
if (config.enabled_logcats & LC_TRACE)
if (dds_get_log_mask() & DDS_LC_TRACE)
{
nn_guid_t wrguid;
seqno_t wrseq;
nn_fragment_number_t wrfragid;
nn_xmsg_guid_seq_fragid (m, &wrguid, &wrseq, &wrfragid);
TRACE ((" %s(%x:%x:%x:%x/%"PRId64"/%u)", func, PGUID (wrguid), wrseq, wrfragid));
DDS_TRACE(" %s(%x:%x:%x:%x/%"PRId64"/%u)", func, PGUID (wrguid), wrseq, wrfragid);
}
}
#else
@ -409,7 +409,7 @@ static struct xevent * qxev_common (struct xeventq *evq, nn_mtime_t tsched, enum
if (tsched.v != T_NEVER && config.schedule_time_rounding != 0)
{
nn_mtime_t tsched_rounded = mtime_round_up (tsched, config.schedule_time_rounding);
TRACE (("rounded event scheduled for %"PRId64" to %"PRId64"\n", tsched.v, tsched_rounded.v));
DDS_TRACE("rounded event scheduled for %"PRId64" to %"PRId64"\n", tsched.v, tsched_rounded.v);
tsched = tsched_rounded;
}
@ -462,7 +462,7 @@ static void qxev_insert_nt (struct xevent_nt *ev)
struct xeventq *evq = ev->evq;
ASSERT_MUTEX_HELD (&evq->lock);
add_to_non_timed_xmit_list (evq, ev);
TRACE (("non-timed queue now has %d items\n", compute_non_timed_xmit_list_size (evq)));
DDS_TRACE("non-timed queue now has %d items\n", compute_non_timed_xmit_list_size (evq));
}
static int msg_xevents_cmp (const void *a, const void *b)
@ -548,7 +548,7 @@ void xeventq_free (struct xeventq *evq)
{
union { void *v; void (*f) (struct xevent *ev, void *arg, nn_mtime_t tnow); } fp;
fp.f = ev->u.callback.cb;
NN_WARNING("xeventq_free: callback %p did not schedule deletion as required, deleting event anyway\n", fp.v);
DDS_WARNING("xeventq_free: callback %p did not schedule deletion as required, deleting event anyway\n", fp.v);
delete_xevent (ev);
}
}
@ -600,8 +600,8 @@ static void handle_xevk_heartbeat (struct nn_xpack *xp, struct xevent *ev, nn_mt
if ((wr = ephash_lookup_writer_guid (&ev->u.heartbeat.wr_guid)) == NULL)
{
TRACE (("heartbeat(wr %x:%x:%x:%x) writer gone\n",
PGUID (ev->u.heartbeat.wr_guid)));
DDS_TRACE("heartbeat(wr %x:%x:%x:%x) writer gone\n",
PGUID (ev->u.heartbeat.wr_guid));
return;
}
@ -627,14 +627,14 @@ static void handle_xevk_heartbeat (struct nn_xpack *xp, struct xevent *ev, nn_mt
t_next.v = tnow.v + writer_hbcontrol_intv (wr, &whcst, tnow);
}
TRACE (("heartbeat(wr %x:%x:%x:%x%s) %s, resched in %g s (min-ack %"PRId64"%s, avail-seq %"PRId64", xmit %"PRId64")\n",
DDS_TRACE("heartbeat(wr %x:%x:%x:%x%s) %s, resched in %g s (min-ack %"PRId64"%s, avail-seq %"PRId64", xmit %"PRId64")\n",
PGUID (wr->e.guid),
hbansreq ? "" : " final",
msg ? "sent" : "suppressed",
(t_next.v == T_NEVER) ? POS_INFINITY_DOUBLE : (double)(t_next.v - tnow.v) / 1e9,
ut_avlIsEmpty (&wr->readers) ? (seqno_t) -1 : ((struct wr_prd_match *) ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers))->min_seq,
ut_avlIsEmpty (&wr->readers) || ((struct wr_prd_match *) ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb ? "" : "!",
whcst.max_seq, READ_SEQ_XMIT(wr)));
whcst.max_seq, READ_SEQ_XMIT(wr));
resched_xevent_if_earlier (ev, t_next);
wr->hbcontrol.tsched = t_next;
os_mutexUnlock (&wr->e.lock);
@ -822,11 +822,11 @@ static void add_AckNack (struct nn_xmsg *msg, struct proxy_writer *pwr, struct p
nn_xmsg_shrink (msg, sm_marker, ACKNACK_SIZE (an->readerSNState.numbits));
nn_xmsg_submsg_setnext (msg, sm_marker);
TRACE (("acknack %x:%x:%x:%x -> %x:%x:%x:%x: #%d:%"PRId64"/%u:",
DDS_TRACE("acknack %x:%x:%x:%x -> %x:%x:%x:%x: #%d:%"PRId64"/%u:",
PGUID (rwn->rd_guid), PGUID (pwr->e.guid), rwn->count,
base, an->readerSNState.numbits));
base, an->readerSNState.numbits);
for (ui = 0; ui != an->readerSNState.numbits; ui++)
TRACE (("%c", nn_bitset_isset (numbits, an->readerSNState.bits, ui) ? '1' : '0'));
DDS_TRACE("%c", nn_bitset_isset (numbits, an->readerSNState.bits, ui) ? '1' : '0');
}
if (nackfrag_numbits > 0)
@ -853,13 +853,13 @@ static void add_AckNack (struct nn_xmsg *msg, struct proxy_writer *pwr, struct p
*countp = ++pwr->nackfragcount;
nn_xmsg_submsg_setnext (msg, sm_marker);
TRACE ((" + nackfrag #%d:%"PRId64"/%u/%u:", *countp, fromSN (nf->writerSN), nf->fragmentNumberState.bitmap_base, nf->fragmentNumberState.numbits));
DDS_TRACE(" + nackfrag #%d:%"PRId64"/%u/%u:", *countp, fromSN (nf->writerSN), nf->fragmentNumberState.bitmap_base, nf->fragmentNumberState.numbits);
for (ui = 0; ui != nf->fragmentNumberState.numbits; ui++)
TRACE (("%c", nn_bitset_isset (nf->fragmentNumberState.numbits, nf->fragmentNumberState.bits, ui) ? '1' : '0'));
DDS_TRACE("%c", nn_bitset_isset (nf->fragmentNumberState.numbits, nf->fragmentNumberState.bits, ui) ? '1' : '0');
}
}
TRACE (("\n"));
DDS_TRACE("\n");
}
static void handle_xevk_acknack (UNUSED_ARG (struct nn_xpack *xp), struct xevent *ev, nn_mtime_t tnow)
@ -918,13 +918,13 @@ static void handle_xevk_acknack (UNUSED_ARG (struct nn_xpack *xp), struct xevent
eventually. */
resched_xevent_if_earlier (ev, add_duration_to_mtime (tnow, config.auto_resched_nack_delay));
}
TRACE (("send acknack(rd %x:%x:%x:%x -> pwr %x:%x:%x:%x)\n",
PGUID (ev->u.acknack.rd_guid), PGUID (ev->u.acknack.pwr_guid)));
DDS_TRACE("send acknack(rd %x:%x:%x:%x -> pwr %x:%x:%x:%x)\n",
PGUID (ev->u.acknack.rd_guid), PGUID (ev->u.acknack.pwr_guid));
}
else
{
TRACE (("skip acknack(rd %x:%x:%x:%x -> pwr %x:%x:%x:%x): no address\n",
PGUID (ev->u.acknack.rd_guid), PGUID (ev->u.acknack.pwr_guid)));
DDS_TRACE("skip acknack(rd %x:%x:%x:%x -> pwr %x:%x:%x:%x): no address\n",
PGUID (ev->u.acknack.rd_guid), PGUID (ev->u.acknack.pwr_guid));
msg = NULL;
}
@ -972,8 +972,8 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
if ((pp = ephash_lookup_participant_guid (&ev->u.spdp.pp_guid)) == NULL)
{
TRACE (("handle_xevk_spdp %x:%x:%x:%x - unknown guid\n",
PGUID (ev->u.spdp.pp_guid)));
DDS_TRACE("handle_xevk_spdp %x:%x:%x:%x - unknown guid\n",
PGUID (ev->u.spdp.pp_guid));
if (ev->u.spdp.directed)
delete_xevent (ev);
return;
@ -981,8 +981,8 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
if ((spdp_wr = get_builtin_writer (pp, NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER)) == NULL)
{
TRACE (("handle_xevk_spdp %x:%x:%x:%x - spdp writer of participant not found\n",
PGUID (ev->u.spdp.pp_guid)));
DDS_TRACE("handle_xevk_spdp %x:%x:%x:%x - spdp writer of participant not found\n",
PGUID (ev->u.spdp.pp_guid));
if (ev->u.spdp.directed)
delete_xevent (ev);
return;
@ -1001,7 +1001,7 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
guid.entityid.u = NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER;
if ((prd = ephash_lookup_proxy_reader_guid (&guid)) == NULL)
{
TRACE (("xmit spdp: no proxy reader %x:%x:%x:%x\n", PGUID (guid)));
DDS_TRACE("xmit spdp: no proxy reader %x:%x:%x:%x\n", PGUID (guid));
goto skip;
}
}
@ -1068,8 +1068,8 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
}
else
{
TRACE (("xmit spdp: suppressing early spdp response from %x:%x:%x:%x to %x:%x:%x:%x\n",
PGUID (pp->e.guid), PGUIDPREFIX (ev->u.spdp.dest_proxypp_guid_prefix), NN_ENTITYID_PARTICIPANT));
DDS_TRACE("xmit spdp: suppressing early spdp response from %x:%x:%x:%x to %x:%x:%x:%x\n",
PGUID (pp->e.guid), PGUIDPREFIX (ev->u.spdp.dest_proxypp_guid_prefix), NN_ENTITYID_PARTICIPANT);
}
}
#endif
@ -1084,10 +1084,10 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
else
{
nn_mtime_t tnext = add_duration_to_mtime (tnow, T_SECOND);
TRACE (("xmit spdp %x:%x:%x:%x to %x:%x:%x:%x (resched %gs)\n",
PGUID (pp->e.guid),
PGUIDPREFIX (ev->u.spdp.dest_proxypp_guid_prefix), NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER,
(double)(tnext.v - tnow.v) / 1e9));
DDS_TRACE("xmit spdp %x:%x:%x:%x to %x:%x:%x:%x (resched %gs)\n",
PGUID (pp->e.guid),
PGUIDPREFIX (ev->u.spdp.dest_proxypp_guid_prefix), NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER,
(double)(tnext.v - tnow.v) / 1e9);
resched_xevent_if_earlier (ev, tnext);
}
}
@ -1111,10 +1111,10 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
intv = config.spdp_interval;
tnext = add_duration_to_mtime (tnow, intv);
TRACE (("xmit spdp %x:%x:%x:%x to %x:%x:%x:%x (resched %gs)\n",
DDS_TRACE("xmit spdp %x:%x:%x:%x to %x:%x:%x:%x (resched %gs)\n",
PGUID (pp->e.guid),
PGUIDPREFIX (ev->u.spdp.dest_proxypp_guid_prefix), NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER,
(double)(tnext.v - tnow.v) / 1e9));
(double)(tnext.v - tnow.v) / 1e9);
resched_xevent_if_earlier (ev, tnext);
}
}
@ -1132,7 +1132,7 @@ static void write_pmd_message (struct nn_xpack *xp, struct participant *pp, unsi
if ((wr = get_builtin_writer (pp, NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER)) == NULL)
{
TRACE (("write_pmd_message(%x:%x:%x:%x) - builtin pmd writer not found\n", PGUID (pp->e.guid)));
DDS_TRACE("write_pmd_message(%x:%x:%x:%x) - builtin pmd writer not found\n", PGUID (pp->e.guid));
return;
}
@ -1182,7 +1182,7 @@ static void handle_xevk_pmd_update (struct nn_xpack *xp, struct xevent *ev, nn_m
if (intv == T_NEVER)
{
tnext.v = T_NEVER;
TRACE (("resched pmd(%x:%x:%x:%x): never\n", PGUID (pp->e.guid)));
DDS_TRACE("resched pmd(%x:%x:%x:%x): never\n", PGUID (pp->e.guid));
}
else
{
@ -1192,7 +1192,7 @@ static void handle_xevk_pmd_update (struct nn_xpack *xp, struct xevent *ev, nn_m
tnext.v = tnow.v + intv - 2 * T_SECOND;
else
tnext.v = tnow.v + 4 * intv / 5;
TRACE (("resched pmd(%x:%x:%x:%x): %gs\n", PGUID (pp->e.guid), (double)(tnext.v - tnow.v) / 1e9));
DDS_TRACE("resched pmd(%x:%x:%x:%x): %gs\n", PGUID (pp->e.guid), (double)(tnext.v - tnow.v) / 1e9);
}
resched_xevent_if_earlier (ev, tnext);
@ -1204,7 +1204,7 @@ static void handle_xevk_end_startup_mode (UNUSED_ARG (struct nn_xpack *xp), stru
struct ephash_enum_writer est;
struct writer *wr;
assert (gv.startup_mode);
nn_log (LC_DISCOVERY, "end startup mode\n");
DDS_LOG(DDS_LC_DISCOVERY, "end startup mode\n");
gv.startup_mode = 0;
/* FIXME: MEMBAR needed for startup mode (or use a lock) */
ephash_enum_writer_init (&est);
@ -1217,7 +1217,7 @@ static void handle_xevk_end_startup_mode (UNUSED_ARG (struct nn_xpack *xp), stru
static void handle_xevk_delete_writer (UNUSED_ARG (struct nn_xpack *xp), struct xevent *ev, UNUSED_ARG (nn_mtime_t tnow))
{
/* don't worry if the writer is already gone by the time we get here. */
TRACE (("handle_xevk_delete_writer: %x:%x:%x:%x\n", PGUID (ev->u.delete_writer.guid)));
DDS_TRACE("handle_xevk_delete_writer: %x:%x:%x:%x\n", PGUID (ev->u.delete_writer.guid));
delete_writer_nolinger (&ev->u.delete_writer.guid);
delete_xevent (ev);
}
@ -1447,7 +1447,7 @@ void qxev_prd_entityid (struct proxy_reader * prd, nn_guid_prefix_t * id)
msg = nn_xmsg_new (gv.xmsgpool, id, sizeof (EntityId_t), NN_XMSG_KIND_CONTROL);
if (nn_xmsg_setdstPRD (msg, prd) == 0)
{
TRACE ((" qxev_prd_entityid (%x:%x:%x)\n", PGUIDPREFIX (*id)));
DDS_TRACE(" qxev_prd_entityid (%x:%x:%x)\n", PGUIDPREFIX (*id));
nn_xmsg_add_entityid (msg);
os_mutexLock (&gv.xevents->lock);
ev = qxev_common_nt (gv.xevents, XEVK_ENTITYID);
@ -1474,7 +1474,7 @@ void qxev_pwr_entityid (struct proxy_writer * pwr, nn_guid_prefix_t * id)
msg = nn_xmsg_new (gv.xmsgpool, id, sizeof (EntityId_t), NN_XMSG_KIND_CONTROL);
if (nn_xmsg_setdstPWR (msg, pwr) == 0)
{
TRACE ((" qxev_pwr_entityid (%x:%x:%x)\n", PGUIDPREFIX (*id)));
DDS_TRACE(" qxev_pwr_entityid (%x:%x:%x)\n", PGUIDPREFIX (*id));
nn_xmsg_add_entityid (msg);
os_mutexLock (&pwr->evq->lock);
ev = qxev_common_nt (pwr->evq, XEVK_ENTITYID);
@ -1512,8 +1512,8 @@ int qxev_msg_rexmit_wrlock_held (struct xeventq *evq, struct nn_xmsg *msg, int f
os_mutexUnlock (&evq->lock);
nn_xmsg_free (msg);
#if 0
TRACE ((" qxev_msg_rexmit%s drop (sz %"PA_PRIuSIZE" qb %"PA_PRIuSIZE" qm %"PA_PRIuSIZE")", force ? "!" : "",
msg_size, evq->queued_rexmit_bytes, evq->queued_rexmit_msgs));
DDS_TRACE(" qxev_msg_rexmit%s drop (sz %"PA_PRIuSIZE" qb %"PA_PRIuSIZE" qm %"PA_PRIuSIZE")", force ? "!" : "",
msg_size, evq->queued_rexmit_bytes, evq->queued_rexmit_msgs);
#endif
return 0;
}
@ -1526,7 +1526,7 @@ int qxev_msg_rexmit_wrlock_held (struct xeventq *evq, struct nn_xmsg *msg, int f
evq->queued_rexmit_msgs++;
qxev_insert_nt (ev);
#if 0
TRACE (("AAA(%p,%"PA_PRIuSIZE")", (void *) ev, msg_size));
DDS_TRACE("AAA(%p,%"PA_PRIuSIZE")", (void *) ev, msg_size);
#endif
os_mutexUnlock (&evq->lock);
return 2;

View file

@ -256,7 +256,7 @@ static void nn_xmsg_realfree_wrap (void *elem)
void nn_xmsgpool_free (struct nn_xmsgpool *pool)
{
nn_freelist_fini (&pool->freelist, nn_xmsg_realfree_wrap);
TRACE (("xmsgpool_free(%p)\n", pool));
DDS_TRACE("xmsgpool_free(%p)\n", pool);
os_free (pool);
}
@ -588,7 +588,7 @@ int nn_xmsg_setdstPRD (struct nn_xmsg *m, const struct proxy_reader *prd)
}
else
{
NN_WARNING("nn_xmsg_setdstPRD: no address for %x:%x:%x:%x", PGUID (prd->e.guid));
DDS_WARNING("nn_xmsg_setdstPRD: no address for %x:%x:%x:%x", PGUID (prd->e.guid));
return ERR_NO_ADDRESS;
}
}
@ -601,7 +601,7 @@ int nn_xmsg_setdstPWR (struct nn_xmsg *m, const struct proxy_writer *pwr)
nn_xmsg_setdst1 (m, &pwr->e.guid.prefix, &loc);
return 0;
}
NN_WARNING ("nn_xmsg_setdstPRD: no address for %x:%x:%x:%x", PGUID (pwr->e.guid));
DDS_WARNING("nn_xmsg_setdstPRD: no address for %x:%x:%x:%x", PGUID (pwr->e.guid));
return ERR_NO_ADDRESS;
}
@ -657,8 +657,8 @@ int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct nn_xmsg *m, const stru
assert (m->kindspecific.data.readerId_off != 0);
assert (madd->kindspecific.data.readerId_off != 0);
TRACE ((" (%x:%x:%x:%x#%"PRId64"/%u:",
PGUID (m->kindspecific.data.wrguid), m->kindspecific.data.wrseq, m->kindspecific.data.wrfragid + 1));
DDS_TRACE(" (%x:%x:%x:%x#%"PRId64"/%u:",
PGUID (m->kindspecific.data.wrguid), m->kindspecific.data.wrseq, m->kindspecific.data.wrfragid + 1);
switch (m->dstmode)
{
@ -667,7 +667,7 @@ int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct nn_xmsg *m, const stru
return 0;
case NN_XMSG_DST_ALL:
TRACE (("*->*)"));
DDS_TRACE("*->*)");
return 1;
case NN_XMSG_DST_ONE:
@ -678,7 +678,7 @@ int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct nn_xmsg *m, const stru
return 0;
case NN_XMSG_DST_ALL:
TRACE (("1+*->*)"));
DDS_TRACE("1+*->*)");
clear_readerId (m);
m->dstmode = NN_XMSG_DST_ALL;
m->dstaddr.all.as = ref_addrset (madd->dstaddr.all.as);
@ -697,12 +697,12 @@ int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct nn_xmsg *m, const stru
can go and everyone's life will become easier! */
if ((wr = ephash_lookup_writer_guid (&m->kindspecific.data.wrguid)) == NULL)
{
TRACE (("writer-dead)"));
DDS_TRACE("writer-dead)");
return 0;
}
else
{
TRACE (("1+1->*)"));
DDS_TRACE("1+1->*)");
clear_readerId (m);
m->dstmode = NN_XMSG_DST_ALL;
m->dstaddr.all.as = ref_addrset (wr->as);
@ -712,12 +712,12 @@ int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct nn_xmsg *m, const stru
}
else if (readerId_compatible (m, madd))
{
TRACE (("1+1->1)"));
DDS_TRACE("1+1->1)");
return 1;
}
else
{
TRACE (("1+1->2)"));
DDS_TRACE("1+1->2)");
clear_readerId (m);
return 1;
}
@ -1181,19 +1181,19 @@ static void nn_bw_limit_sleep_if_needed(struct nn_bw_limiter* this, ssize_t size
this->balance += (target_interval - actual_interval);
TRACE ((" <limiter(us):%"PRId64"",(target_interval - actual_interval)/1000));
DDS_TRACE(" <limiter(us):%"PRId64"",(target_interval - actual_interval)/1000);
if ( this->balance < NN_BW_LIMIT_MAX_BUFFER )
{
/* We're below the bandwidth limit, do not further accumulate */
this->balance = NN_BW_LIMIT_MAX_BUFFER;
TRACE ((":%"PRId64":max",this->balance/1000));
DDS_TRACE(":%"PRId64":max",this->balance/1000);
}
else if ( this->balance > NN_BW_LIMIT_MIN_SLEEP )
{
/* We're over the bandwidth limit far enough, to warrent a sleep. */
os_time delay;
TRACE ((":%"PRId64":sleep",this->balance/1000));
DDS_TRACE(":%"PRId64":sleep",this->balance/1000);
delay.tv_sec = (int32_t) (this->balance / T_SECOND);
delay.tv_nsec = (int32_t) (this->balance % T_SECOND);
thread_state_blocked (lookup_thread_state ());
@ -1202,9 +1202,9 @@ static void nn_bw_limit_sleep_if_needed(struct nn_bw_limiter* this, ssize_t size
}
else
{
TRACE ((":%"PRId64"",this->balance/1000));
DDS_TRACE(":%"PRId64"",this->balance/1000);
}
TRACE ((">"));
DDS_TRACE(">");
}
}
@ -1312,10 +1312,10 @@ static ssize_t nn_xpack_send1 (const nn_locator_t *loc, void * varg)
struct nn_xpack * xp = varg;
ssize_t nbytes = 0;
if (config.enabled_logcats & LC_TRACE)
if (dds_get_log_mask() & DDS_LC_TRACE)
{
char buf[DDSI_LOCSTRLEN];
TRACE ((" %s", ddsi_locator_to_string (buf, sizeof(buf), loc)));
DDS_TRACE(" %s", ddsi_locator_to_string (buf, sizeof(buf), loc));
}
if (config.xmit_lossiness > 0)
@ -1324,7 +1324,7 @@ static ssize_t nn_xpack_send1 (const nn_locator_t *loc, void * varg)
of all packets to be sent */
if ((random () % 1000) < config.xmit_lossiness)
{
TRACE (("(dropped)"));
DDS_TRACE("(dropped)");
xp->call_flags = 0;
return 0;
}
@ -1344,7 +1344,7 @@ static ssize_t nn_xpack_send1 (const nn_locator_t *loc, void * varg)
nbytes = ddsi_conn_write (xp->conn, loc, xp->niov, xp->iov, xp->call_flags);
else
{
TRACE (("(dropped)"));
DDS_TRACE("(dropped)");
nbytes = (ssize_t) xp->msg_len.length;
}
}
@ -1406,17 +1406,17 @@ static void nn_xpack_send_real (struct nn_xpack * xp)
assert (xp->dstmode != NN_XMSG_DST_UNSET);
if (config.enabled_logcats & LC_TRACE)
if (dds_get_log_mask() & DDS_LC_TRACE)
{
int i;
TRACE (("nn_xpack_send %u:", xp->msg_len.length));
DDS_TRACE("nn_xpack_send %u:", xp->msg_len.length);
for (i = 0; i < (int) xp->niov; i++)
{
TRACE ((" %p:%lu", (void *) xp->iov[i].iov_base, (unsigned long) xp->iov[i].iov_len));
DDS_TRACE(" %p:%lu", (void *) xp->iov[i].iov_base, (unsigned long) xp->iov[i].iov_len);
}
}
TRACE ((" ["));
DDS_TRACE(" [");
if (xp->dstmode == NN_XMSG_DST_ONE)
{
calls = 1;
@ -1459,10 +1459,10 @@ static void nn_xpack_send_real (struct nn_xpack * xp)
unref_addrset (xp->dstaddr.all.as_group);
}
}
TRACE ((" ]\n"));
DDS_TRACE(" ]\n");
if (calls)
{
nn_log (LC_TRAFFIC, "traffic-xmit (%lu) %u\n", (unsigned long) calls, xp->msg_len.length);
DDS_LOG(DDS_LC_TRAFFIC, "traffic-xmit (%lu) %u\n", (unsigned long) calls, xp->msg_len.length);
}
nn_xmsg_chain_release (&xp->included_msgs);
nn_xpack_reinit (xp);
@ -1692,22 +1692,22 @@ int nn_xpack_addmsg (struct nn_xpack *xp, struct nn_xmsg *m, const uint32_t flag
But do make sure we can't run out of iovecs. */
assert (niov + NN_XMSG_MAX_SUBMESSAGE_IOVECS <= NN_XMSG_MAX_MESSAGE_IOVECS);
TRACE (("xpack_addmsg %p %p %u(", (void *) xp, (void *) m, flags));
DDS_TRACE("xpack_addmsg %p %p %u(", (void *) xp, (void *) m, flags);
switch (m->kind)
{
case NN_XMSG_KIND_CONTROL:
TRACE (("control"));
DDS_TRACE("control");
break;
case NN_XMSG_KIND_DATA:
case NN_XMSG_KIND_DATA_REXMIT:
TRACE (("%s(%x:%x:%x:%x:#%"PRId64"/%u)",
DDS_TRACE("%s(%x:%x:%x:%x:#%"PRId64"/%u)",
(m->kind == NN_XMSG_KIND_DATA) ? "data" : "rexmit",
PGUID (m->kindspecific.data.wrguid),
m->kindspecific.data.wrseq,
m->kindspecific.data.wrfragid + 1));
m->kindspecific.data.wrfragid + 1);
break;
}
TRACE (("): niov %d sz %"PRIuSIZE, (int) niov, sz));
DDS_TRACE("): niov %d sz %"PRIuSIZE, (int) niov, sz);
/* If a fresh xp has been provided, add an RTPS header */
@ -1835,7 +1835,7 @@ int nn_xpack_addmsg (struct nn_xpack *xp, struct nn_xmsg *m, const uint32_t flag
if (xpo_niov > 0 && sz > config.max_msg_size)
{
TRACE ((" => now niov %d sz %"PRIuSIZE" > max_msg_size %u, nn_xpack_send niov %d sz %u now\n", (int) niov, sz, config.max_msg_size, (int) xpo_niov, xpo_sz));
DDS_TRACE(" => now niov %d sz %"PRIuSIZE" > max_msg_size %u, nn_xpack_send niov %d sz %u now\n", (int) niov, sz, config.max_msg_size, (int) xpo_niov, xpo_sz);
xp->msg_len.length = xpo_sz;
xp->niov = xpo_niov;
nn_xpack_send (xp, false);
@ -1845,7 +1845,7 @@ int nn_xpack_addmsg (struct nn_xpack *xp, struct nn_xmsg *m, const uint32_t flag
{
xp->call_flags = flags;
nn_xmsg_chain_add (&xp->included_msgs, m);
TRACE ((" => now niov %d sz %"PRIuSIZE"\n", (int) niov, sz));
DDS_TRACE(" => now niov %d sz %"PRIuSIZE"\n", (int) niov, sz);
}
return result;

View file

@ -267,17 +267,17 @@ static void log_stacktrace_sigh (int sig __attribute__ ((unused)))
void log_stacktrace (const char *name, os_threadId tid)
{
if (config.enabled_logcats == 0)
if (dds_get_log_mask() == 0)
; /* no op if nothing logged */
else if (!config.noprogress_log_stacktraces)
nn_log (~0u, "-- stack trace of %s requested, but traces disabled --\n", name);
DDS_LOG(~0u, "-- stack trace of %s requested, but traces disabled --\n", name);
else
{
const os_time d = { 0, 1000000 };
struct sigaction act, oact;
char **strs;
int i;
nn_log (~0u, "-- stack trace of %s requested --\n", name);
DDS_LOG(~0u, "-- stack trace of %s requested --\n", name);
act.sa_handler = log_stacktrace_sigh;
act.sa_flags = 0;
sigfillset (&act.sa_mask);
@ -289,15 +289,15 @@ void log_stacktrace (const char *name, os_threadId tid)
os_nanoSleep (d);
sigaction (SIGXCPU, &oact, NULL);
if (pthread_kill (tid.v, 0) != 0)
nn_log (~0u, "-- thread exited --\n");
DDS_LOG(~0u, "-- thread exited --\n");
else
{
nn_log (~0u, "-- stack trace follows --\n");
DDS_LOG(~0u, "-- stack trace follows --\n");
strs = backtrace_symbols (log_stacktrace_stk.stk, log_stacktrace_stk.depth);
for (i = 0; i < log_stacktrace_stk.depth; i++)
nn_log (~0u, "%s\n", strs[i]);
DDS_LOG(~0u, "%s\n", strs[i]);
free (strs);
nn_log (~0u, "-- end of stack trace --\n");
DDS_LOG(~0u, "-- end of stack trace --\n");
}
os_atomic_st32 (&log_stacktrace_flag, 0);
}