stricter warning checks and the corresponding fixes
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
							parent
							
								
									87e4780446
								
							
						
					
					
						commit
						b7487b18a6
					
				
					 101 changed files with 1756 additions and 1615 deletions
				
			
		| 
						 | 
				
			
			@ -3043,7 +3043,7 @@ DDS_EXPORT _Must_inspect_result_ dds_return_t
 | 
			
		|||
dds_return_loan(
 | 
			
		||||
        _In_ dds_entity_t reader_or_condition,
 | 
			
		||||
        _Inout_updates_(bufsz) void **buf,
 | 
			
		||||
        _In_ size_t bufsz);
 | 
			
		||||
        _In_ int32_t bufsz);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Instance handle <=> key value mapping.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,10 +43,10 @@ struct rhc;
 | 
			
		|||
 | 
			
		||||
/* Internal entity status flags */
 | 
			
		||||
 | 
			
		||||
#define DDS_INTERNAL_STATUS_MASK     (0xFF000000)
 | 
			
		||||
#define DDS_INTERNAL_STATUS_MASK     (0xFF000000u)
 | 
			
		||||
 | 
			
		||||
#define DDS_WAITSET_TRIGGER_STATUS   (0x01000000)
 | 
			
		||||
#define DDS_DELETING_STATUS          (0x02000000)
 | 
			
		||||
#define DDS_WAITSET_TRIGGER_STATUS   (0x01000000u)
 | 
			
		||||
#define DDS_DELETING_STATUS          (0x02000000u)
 | 
			
		||||
 | 
			
		||||
/* This can be used when polling for various states.
 | 
			
		||||
 * Obviously, it is encouraged to use condition variables and such. But
 | 
			
		||||
| 
						 | 
				
			
			@ -78,8 +78,8 @@ typedef struct c_listener {
 | 
			
		|||
 | 
			
		||||
/* Entity flag values */
 | 
			
		||||
 | 
			
		||||
#define DDS_ENTITY_ENABLED      0x0001
 | 
			
		||||
#define DDS_ENTITY_IMPLICIT     0x0002
 | 
			
		||||
#define DDS_ENTITY_ENABLED      0x0001u
 | 
			
		||||
#define DDS_ENTITY_IMPLICIT     0x0002u
 | 
			
		||||
 | 
			
		||||
typedef struct dds_domain
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ This file was the one orginally in ./src/api/dcps/saj/code/.
 | 
			
		|||
(and therefore by implication ./src/api/dcps/cj/java/code).
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE   long
 | 
			
		||||
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE   unsigned long
 | 
			
		||||
 | 
			
		||||
module DDS {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -990,7 +990,7 @@ dds_valid_hdl(
 | 
			
		|||
    /* When the given handle already contains an error, then return that
 | 
			
		||||
     * same error to retain the original information. */
 | 
			
		||||
    if (hdl >= 0) {
 | 
			
		||||
        utr = ut_handle_status(hdl, NULL, kind);
 | 
			
		||||
        utr = ut_handle_status(hdl, NULL, (int32_t)kind);
 | 
			
		||||
        if(utr == UT_HANDLE_OK){
 | 
			
		||||
            rc = DDS_RETCODE_OK;
 | 
			
		||||
        } else if(utr == UT_HANDLE_UNEQUAL_KIND){
 | 
			
		||||
| 
						 | 
				
			
			@ -1029,7 +1029,7 @@ dds_entity_lock(
 | 
			
		|||
    /* When the given handle already contains an error, then return that
 | 
			
		||||
     * same error to retain the original information. */
 | 
			
		||||
    if (hdl >= 0) {
 | 
			
		||||
        utr = ut_handle_claim(hdl, NULL, kind, (void**)e);
 | 
			
		||||
        utr = ut_handle_claim(hdl, NULL, (int32_t)kind, (void**)e);
 | 
			
		||||
        if (utr == UT_HANDLE_OK) {
 | 
			
		||||
            os_mutexLock(&((*e)->m_mutex));
 | 
			
		||||
            /* The handle could have been closed while we were waiting for the mutex. */
 | 
			
		||||
| 
						 | 
				
			
			@ -1195,14 +1195,13 @@ dds_entity_observer_unregister(
 | 
			
		|||
        _In_ dds_entity_t observer)
 | 
			
		||||
{
 | 
			
		||||
    dds__retcode_t rc;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    dds_entity *e;
 | 
			
		||||
    rc = dds_entity_lock(observed, DDS_KIND_DONTCARE, &e);
 | 
			
		||||
    if (rc == DDS_RETCODE_OK) {
 | 
			
		||||
        rc = dds_entity_observer_unregister_nl(e, observer);
 | 
			
		||||
        dds_entity_unlock(e);
 | 
			
		||||
    } else{
 | 
			
		||||
        ret = DDS_ERRNO(rc, "Error occurred on locking entity");
 | 
			
		||||
        rc = DDS_ERRNO(rc, "Error occurred on locking entity");
 | 
			
		||||
    }
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ static const char * dds_err_code_array[DDS_ERR_CODE_NUM] =
 | 
			
		|||
 | 
			
		||||
const char * dds_err_str (dds_return_t err)
 | 
			
		||||
{
 | 
			
		||||
  unsigned index = DDS_ERR_NR_INDEX (err);
 | 
			
		||||
  unsigned index = (unsigned)DDS_ERR_NR_INDEX (err);
 | 
			
		||||
  if (err >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    return "Success";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,12 +37,7 @@ char *os_environ[] = { NULL };
 | 
			
		|||
 | 
			
		||||
struct q_globals gv;
 | 
			
		||||
 | 
			
		||||
dds_globals dds_global =
 | 
			
		||||
{
 | 
			
		||||
  DDS_DOMAIN_DEFAULT, 0,
 | 
			
		||||
  NULL, NULL, NULL, NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
dds_globals dds_global = { .m_default_domain = DDS_DOMAIN_DEFAULT };
 | 
			
		||||
static struct cfgst * dds_cfgst = NULL;
 | 
			
		||||
 | 
			
		||||
dds_return_t
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
#ifndef NDEBUG
 | 
			
		||||
static bool keyhash_is_reset(const dds_key_hash_t *kh)
 | 
			
		||||
{
 | 
			
		||||
  static const char nullhash[sizeof(kh->m_hash)];
 | 
			
		||||
  static const char nullhash[sizeof(kh->m_hash)] = { 0 };
 | 
			
		||||
  return kh->m_flags == 0 && memcmp(kh->m_hash, nullhash, sizeof(nullhash)) == 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ void dds_key_md5 (dds_key_hash_t * kh)
 | 
			
		|||
  md5_finish (&md5st, (unsigned char *) kh->m_hash);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
/*
 | 
			
		||||
  dds_key_gen: Generates key and keyhash for a sample.
 | 
			
		||||
  See section 9.6.3.3 of DDSI spec.
 | 
			
		||||
*/
 | 
			
		||||
| 
						 | 
				
			
			@ -85,9 +85,13 @@ void dds_key_gen
 | 
			
		|||
        case DDS_OP_VAL_2BY: len += 2; break;
 | 
			
		||||
        case DDS_OP_VAL_4BY: len += 4; break;
 | 
			
		||||
        case DDS_OP_VAL_8BY: len += 8; break;
 | 
			
		||||
        case DDS_OP_VAL_STR: src = *((char**) src); /* Fall-through intentional */
 | 
			
		||||
        case DDS_OP_VAL_BST: len += (uint32_t) (5 + strlen (src)); break;
 | 
			
		||||
        case DDS_OP_VAL_ARR: 
 | 
			
		||||
        case DDS_OP_VAL_STR:
 | 
			
		||||
          src = *((char**) src);
 | 
			
		||||
          /* FALLS THROUGH */
 | 
			
		||||
        case DDS_OP_VAL_BST:
 | 
			
		||||
          len += (uint32_t) (5 + strlen (src));
 | 
			
		||||
          break;
 | 
			
		||||
        case DDS_OP_VAL_ARR:
 | 
			
		||||
          len += op[2] * dds_op_size[DDS_OP_SUBTYPE (*op)];
 | 
			
		||||
          break;
 | 
			
		||||
        default: assert (0);
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +147,8 @@ void dds_key_gen
 | 
			
		|||
      case DDS_OP_VAL_STR:
 | 
			
		||||
      {
 | 
			
		||||
        src = *((char**) src);
 | 
			
		||||
      } /* Fall-through intentional */
 | 
			
		||||
      }
 | 
			
		||||
        /* FALLS THROUGH */
 | 
			
		||||
      case DDS_OP_VAL_BST:
 | 
			
		||||
      {
 | 
			
		||||
        uint32_t u32;
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +178,7 @@ void dds_key_gen
 | 
			
		|||
 | 
			
		||||
  /* Hash is md5 of key */
 | 
			
		||||
 | 
			
		||||
  if ((kh->m_flags & DDS_KEY_IS_HASH) == 0) 
 | 
			
		||||
  if ((kh->m_flags & DDS_KEY_IS_HASH) == 0)
 | 
			
		||||
  {
 | 
			
		||||
    dds_key_md5 (kh);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
#include "dds__err.h"
 | 
			
		||||
#include "dds__report.h"
 | 
			
		||||
 | 
			
		||||
#define DDS_PARTICIPANT_STATUS_MASK    0
 | 
			
		||||
#define DDS_PARTICIPANT_STATUS_MASK    0u
 | 
			
		||||
 | 
			
		||||
/* List of created participants */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +101,7 @@ dds_participant_qos_validate(
 | 
			
		|||
{
 | 
			
		||||
    dds_return_t ret = DDS_RETCODE_OK;
 | 
			
		||||
    assert(qos);
 | 
			
		||||
    (void)enabled;
 | 
			
		||||
 | 
			
		||||
    /* Check consistency. */
 | 
			
		||||
    if ((qos->present & QP_USER_DATA) && !validate_octetseq(&qos->user_data)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +121,7 @@ dds_participant_qos_set(
 | 
			
		|||
        bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t ret = dds_participant_qos_validate(qos, enabled);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
        if (enabled) {
 | 
			
		||||
            /* TODO: CHAM-95: DDSI does not support changing QoS policies. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,15 +18,15 @@
 | 
			
		|||
#include "dds__report.h"
 | 
			
		||||
#include "ddsc/ddsc_project.h"
 | 
			
		||||
 | 
			
		||||
#define DDS_PUBLISHER_STATUS_MASK   0
 | 
			
		||||
#define DDS_PUBLISHER_STATUS_MASK   0u
 | 
			
		||||
 | 
			
		||||
static dds_return_t
 | 
			
		||||
dds_publisher_instance_hdl(
 | 
			
		||||
        dds_entity *e,
 | 
			
		||||
        dds_instance_handle_t *i)
 | 
			
		||||
{
 | 
			
		||||
    assert(e);
 | 
			
		||||
    assert(i);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    (void)i;
 | 
			
		||||
    /* TODO: Get/generate proper handle. */
 | 
			
		||||
    return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Getting publisher instance handle is not supported");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +66,7 @@ dds_publisher_qos_set(
 | 
			
		|||
        bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t ret = dds_publisher_qos_validate(qos, enabled);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
        if (enabled) {
 | 
			
		||||
            /* TODO: CHAM-95: DDSI does not support changing QoS policies. */
 | 
			
		||||
| 
						 | 
				
			
			@ -207,6 +208,7 @@ dds_publisher_begin_coherent(
 | 
			
		|||
        _In_ dds_entity_t e)
 | 
			
		||||
{
 | 
			
		||||
    /* 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");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -215,6 +217,7 @@ dds_publisher_end_coherent(
 | 
			
		|||
        _In_ dds_entity_t e)
 | 
			
		||||
{
 | 
			
		||||
    /* 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");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -207,6 +207,7 @@ dds_readcdr_impl(
 | 
			
		|||
  assert (si);
 | 
			
		||||
  assert (hand == DDS_HANDLE_NIL);
 | 
			
		||||
  assert (maxs > 0);
 | 
			
		||||
  (void)take;
 | 
			
		||||
 | 
			
		||||
  if (asleep)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -817,7 +818,7 @@ _Must_inspect_result_ dds_return_t
 | 
			
		|||
dds_return_loan(
 | 
			
		||||
        _In_ dds_entity_t reader_or_condition,
 | 
			
		||||
        _Inout_updates_(bufsz) void **buf,
 | 
			
		||||
        _In_ size_t bufsz)
 | 
			
		||||
        _In_ int32_t bufsz)
 | 
			
		||||
{
 | 
			
		||||
    dds__retcode_t rc;
 | 
			
		||||
    const dds_topic_descriptor_t * desc;
 | 
			
		||||
| 
						 | 
				
			
			@ -845,7 +846,7 @@ dds_return_loan(
 | 
			
		|||
 | 
			
		||||
    /* Only free sample contents if they have been allocated */
 | 
			
		||||
    if (desc->m_flagset & DDS_TOPIC_NO_OPTIMIZE) {
 | 
			
		||||
        size_t i = 0;
 | 
			
		||||
        int32_t i = 0;
 | 
			
		||||
        for (i = 0; i < bufsz; i++) {
 | 
			
		||||
            dds_sample_free(buf[i], desc, DDS_FREE_CONTENTS);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,6 +134,7 @@ dds_reader_qos_set(
 | 
			
		|||
        bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t ret = dds_reader_qos_validate(qos, enabled);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
        if (enabled) {
 | 
			
		||||
            /* TODO: CHAM-95: DDSI does not support changing QoS policies. */
 | 
			
		||||
| 
						 | 
				
			
			@ -517,7 +518,7 @@ dds_reader_ddsi2direct(
 | 
			
		|||
      else
 | 
			
		||||
      {
 | 
			
		||||
        memset (&pwrguid_next, 0xff, sizeof (pwrguid_next));
 | 
			
		||||
        pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
 | 
			
		||||
        pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~(uint32_t)0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
 | 
			
		||||
      }
 | 
			
		||||
      os_mutexUnlock (&rd->e.lock);
 | 
			
		||||
      if ((pwr = ephash_lookup_proxy_writer_guid (&pwrguid)) != NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -541,9 +542,7 @@ dds_reader_lock_samples(
 | 
			
		|||
{
 | 
			
		||||
    uint32_t ret = 0;
 | 
			
		||||
    dds_reader *rd;
 | 
			
		||||
 | 
			
		||||
    ret = dds_reader_lock(reader, &rd);
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
    if (dds_reader_lock(reader, &rd) == DDS_RETCODE_OK) {
 | 
			
		||||
        ret = dds_rhc_lock_samples(rd->m_rd->rhc);
 | 
			
		||||
        dds_reader_unlock(rd);
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -248,7 +248,7 @@ struct rhc_instance
 | 
			
		|||
  unsigned inv_isread : 1;     /* whether or not that state change has been read before */
 | 
			
		||||
  unsigned disposed_gen;       /* bloody generation counters - worst invention of mankind */
 | 
			
		||||
  unsigned no_writers_gen;     /* __/ */
 | 
			
		||||
  uint32_t strength;           /* "current" ownership strength */
 | 
			
		||||
  int32_t strength;            /* "current" ownership strength */
 | 
			
		||||
  nn_guid_t wr_guid;           /* guid of last writer (if wr_iid != 0 then wr_guid is the corresponding guid, else undef) */
 | 
			
		||||
  nn_wctime_t tstamp;          /* source time stamp of last update */
 | 
			
		||||
  struct rhc_instance *next;   /* next non-empty instance in arbitrary ordering */
 | 
			
		||||
| 
						 | 
				
			
			@ -313,7 +313,7 @@ struct trigger_info
 | 
			
		|||
#define QMASK_OF_SAMPLE(s) ((s)->isread ? DDS_READ_SAMPLE_STATE : DDS_NOT_READ_SAMPLE_STATE)
 | 
			
		||||
#define QMASK_OF_INVSAMPLE(i) ((i)->inv_isread ? DDS_READ_SAMPLE_STATE : DDS_NOT_READ_SAMPLE_STATE)
 | 
			
		||||
#define INST_NSAMPLES(i) ((i)->nvsamples + (i)->inv_exists)
 | 
			
		||||
#define INST_NREAD(i) ((i)->nvread + ((i)->inv_exists & (i)->inv_isread))
 | 
			
		||||
#define INST_NREAD(i) ((i)->nvread + (unsigned)((i)->inv_exists & (i)->inv_isread))
 | 
			
		||||
#define INST_IS_EMPTY(i) (INST_NSAMPLES (i) == 0)
 | 
			
		||||
#define INST_HAS_READ(i) (INST_NREAD (i) > 0)
 | 
			
		||||
#define INST_HAS_UNREAD(i) (INST_NREAD (i) < INST_NSAMPLES (i))
 | 
			
		||||
| 
						 | 
				
			
			@ -413,7 +413,8 @@ void dds_rhc_set_qos (struct rhc * rhc, const nn_xqos_t * qos)
 | 
			
		|||
  rhc->by_source_ordering = (qos->destination_order.kind == NN_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS);
 | 
			
		||||
  rhc->exclusive_ownership = (qos->ownership.kind == NN_EXCLUSIVE_OWNERSHIP_QOS);
 | 
			
		||||
  rhc->reliable = (qos->reliability.kind == NN_RELIABLE_RELIABILITY_QOS);
 | 
			
		||||
  rhc->history_depth = (qos->history.kind == NN_KEEP_LAST_HISTORY_QOS) ? qos->history.depth : ~0u;
 | 
			
		||||
  assert(qos->history.kind != NN_KEEP_LAST_HISTORY_QOS || qos->history.depth > 0);
 | 
			
		||||
  rhc->history_depth = (qos->history.kind == NN_KEEP_LAST_HISTORY_QOS) ? (uint32_t)qos->history.depth : ~0u;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct rhc_sample * alloc_sample (struct rhc_instance *inst)
 | 
			
		||||
| 
						 | 
				
			
			@ -706,7 +707,7 @@ static int inst_accepts_sample
 | 
			
		|||
  }
 | 
			
		||||
  if (rhc->exclusive_ownership && inst->wr_iid_islive && inst->wr_iid != pwr_info->iid)
 | 
			
		||||
  {
 | 
			
		||||
    uint32_t strength = pwr_info->ownership_strength;
 | 
			
		||||
    int32_t strength = pwr_info->ownership_strength;
 | 
			
		||||
    if (strength > inst->strength) {
 | 
			
		||||
      /* ok */
 | 
			
		||||
    } else if (strength < inst->strength) {
 | 
			
		||||
| 
						 | 
				
			
			@ -729,6 +730,7 @@ static void update_inst
 | 
			
		|||
  const struct rhc *rhc, struct rhc_instance *inst,
 | 
			
		||||
  const struct proxy_writer_info * __restrict pwr_info, bool wr_iid_valid, nn_wctime_t tstamp)
 | 
			
		||||
{
 | 
			
		||||
  (void)rhc;
 | 
			
		||||
  inst->tstamp = tstamp;
 | 
			
		||||
  inst->wr_iid_islive = wr_iid_valid;
 | 
			
		||||
  if (wr_iid_valid)
 | 
			
		||||
| 
						 | 
				
			
			@ -1016,7 +1018,6 @@ static void dds_rhc_unregister
 | 
			
		|||
 | 
			
		||||
static struct rhc_instance * alloc_new_instance
 | 
			
		||||
(
 | 
			
		||||
  const struct rhc *rhc,
 | 
			
		||||
  const struct proxy_writer_info *pwr_info,
 | 
			
		||||
  struct serdata *serdata,
 | 
			
		||||
  struct tkmap_instance *tk
 | 
			
		||||
| 
						 | 
				
			
			@ -1086,7 +1087,7 @@ static rhc_store_result_t rhc_store_new_instance
 | 
			
		|||
    return RHC_REJECTED;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  inst = alloc_new_instance (rhc, pwr_info, sample, tk);
 | 
			
		||||
  inst = alloc_new_instance (pwr_info, sample, tk);
 | 
			
		||||
  if (has_data)
 | 
			
		||||
  {
 | 
			
		||||
    if (!add_sample (rhc, inst, pwr_info, sample, cb_data))
 | 
			
		||||
| 
						 | 
				
			
			@ -1298,8 +1299,8 @@ bool dds_rhc_store
 | 
			
		|||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
          rhc->n_not_alive_disposed += inst->isdisposed - old_isdisposed;
 | 
			
		||||
          rhc->n_new += inst->isnew - old_isnew;
 | 
			
		||||
          rhc->n_not_alive_disposed += (uint32_t)(inst->isdisposed - old_isdisposed);
 | 
			
		||||
          rhc->n_new += (uint32_t)(inst->isnew - old_isnew);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
| 
						 | 
				
			
			@ -1740,7 +1741,8 @@ static int dds_rhc_read_w_qminv
 | 
			
		|||
      dds_entity_status_signal((dds_entity*)(rhc->reader));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return n;
 | 
			
		||||
  assert (n <= INT_MAX);
 | 
			
		||||
  return (int)n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int dds_rhc_take_w_qminv
 | 
			
		||||
| 
						 | 
				
			
			@ -1904,7 +1906,8 @@ static int dds_rhc_take_w_qminv
 | 
			
		|||
      dds_entity_status_signal((dds_entity*)(rhc->reader));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return n;
 | 
			
		||||
  assert (n <= INT_MAX);
 | 
			
		||||
  return (int)n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int dds_rhc_takecdr_w_qminv
 | 
			
		||||
| 
						 | 
				
			
			@ -1916,6 +1919,7 @@ static int dds_rhc_takecdr_w_qminv
 | 
			
		|||
  bool trigger_waitsets = false;
 | 
			
		||||
  uint64_t iid;
 | 
			
		||||
  uint32_t n = 0;
 | 
			
		||||
  (void)cond;
 | 
			
		||||
 | 
			
		||||
  if (lock)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -2053,7 +2057,8 @@ static int dds_rhc_takecdr_w_qminv
 | 
			
		|||
      dds_entity_status_signal((dds_entity*)(rhc->reader));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return n;
 | 
			
		||||
  assert (n <= INT_MAX);
 | 
			
		||||
  return (int)n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*************************
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ static void dds_stream_read
 | 
			
		|||
  (dds_stream_t * is, char * data, const uint32_t * ops);
 | 
			
		||||
 | 
			
		||||
#define DDS_SWAP16(v) \
 | 
			
		||||
  (((v) >> 8) | ((v) << 8))
 | 
			
		||||
  ((uint16_t)(((v) >> 8) | ((v) << 8)))
 | 
			
		||||
#define DDS_SWAP32(v) \
 | 
			
		||||
  (((v) >> 24) | \
 | 
			
		||||
  (((v) & 0x00ff0000) >> 8) | \
 | 
			
		||||
| 
						 | 
				
			
			@ -207,12 +207,12 @@ void dds_stream_grow (dds_stream_t * st, size_t size)
 | 
			
		|||
 | 
			
		||||
  /* Reallocate on 4k boundry */
 | 
			
		||||
 | 
			
		||||
  size_t newSize = (needed & ~0xfff) + 0x1000;
 | 
			
		||||
  size_t newSize = (needed & ~(size_t)0xfff) + 0x1000;
 | 
			
		||||
  uint8_t * old = st->m_buffer.p8;
 | 
			
		||||
 | 
			
		||||
  st->m_buffer.p8 = dds_realloc (old, newSize);
 | 
			
		||||
  memset (st->m_buffer.p8 + st->m_size, 0, newSize - st->m_size);
 | 
			
		||||
  st->m_size = (int32_t) newSize;
 | 
			
		||||
  st->m_size = newSize;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool dds_stream_read_bool (dds_stream_t * is)
 | 
			
		||||
| 
						 | 
				
			
			@ -280,12 +280,12 @@ double dds_stream_read_double (dds_stream_t * is)
 | 
			
		|||
  return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char * dds_stream_reuse_string 
 | 
			
		||||
char * dds_stream_reuse_string
 | 
			
		||||
  (dds_stream_t * is, char * str, const uint32_t bound)
 | 
			
		||||
{
 | 
			
		||||
  uint32_t length;
 | 
			
		||||
  void * src;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  DDS_CDR_ALIGN4 (is);
 | 
			
		||||
  if (DDS_IS_OK (is, 4))
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -356,7 +356,7 @@ void dds_stream_swap (void * buff, uint32_t size, uint32_t num)
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void dds_stream_read_fixed_buffer 
 | 
			
		||||
static void dds_stream_read_fixed_buffer
 | 
			
		||||
  (dds_stream_t * is, void * buff, uint32_t len, const uint32_t size, const bool swap)
 | 
			
		||||
{
 | 
			
		||||
  if (size && len)
 | 
			
		||||
| 
						 | 
				
			
			@ -423,12 +423,16 @@ void dds_stream_write_uint64 (dds_stream_t * os, uint64_t val)
 | 
			
		|||
 | 
			
		||||
void dds_stream_write_float (dds_stream_t * os, float val)
 | 
			
		||||
{
 | 
			
		||||
  DDS_OS_PUT4 (os, val, float);
 | 
			
		||||
  union { float f; uint32_t u; } u;
 | 
			
		||||
  u.f = val;
 | 
			
		||||
  dds_stream_write_uint32 (os, u.u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void dds_stream_write_double (dds_stream_t * os, double val)
 | 
			
		||||
{
 | 
			
		||||
  DDS_OS_PUT8 (os, val, double);
 | 
			
		||||
  union { double f; uint64_t u; } u;
 | 
			
		||||
  u.f = val;
 | 
			
		||||
  dds_stream_write_uint64 (os, u.u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void dds_stream_write_string (dds_stream_t * os, const char * val)
 | 
			
		||||
| 
						 | 
				
			
			@ -457,7 +461,7 @@ void dds_stream_write_buffer (dds_stream_t * os, uint32_t len, uint8_t * buffer)
 | 
			
		|||
  DDS_OS_PUT_BYTES (os, buffer, len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void dds_stream_write 
 | 
			
		||||
static void dds_stream_write
 | 
			
		||||
(
 | 
			
		||||
  dds_stream_t * os,
 | 
			
		||||
  const char * data,
 | 
			
		||||
| 
						 | 
				
			
			@ -633,7 +637,7 @@ static void dds_stream_write
 | 
			
		|||
                const uint32_t * jsr_ops = ops + DDS_OP_ADR_JSR (*ops) - 3;
 | 
			
		||||
                const uint32_t jmp = DDS_OP_ADR_JMP (*ops);
 | 
			
		||||
                const uint32_t elem_size = ops[1];
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                while (num--)
 | 
			
		||||
                {
 | 
			
		||||
                  dds_stream_write (os, addr, jsr_ops);
 | 
			
		||||
| 
						 | 
				
			
			@ -1225,7 +1229,8 @@ void dds_stream_write_key
 | 
			
		|||
        DDS_OS_PUT8 (os, *((uint64_t*) src), uint64_t);
 | 
			
		||||
        break;
 | 
			
		||||
      case DDS_OP_VAL_STR:
 | 
			
		||||
        src = *(char**) src; /* drop through */
 | 
			
		||||
        src = *(char**) src;
 | 
			
		||||
        /* FALLS THROUGH */
 | 
			
		||||
      case DDS_OP_VAL_BST:
 | 
			
		||||
        dds_stream_write_string (os, src);
 | 
			
		||||
        break;
 | 
			
		||||
| 
						 | 
				
			
			@ -1243,14 +1248,14 @@ void dds_stream_write_key
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
/*
 | 
			
		||||
  dds_stream_get_keyhash: Extract key values from a stream and generate
 | 
			
		||||
  keyhash used for instance identification. Non key fields are skipped.
 | 
			
		||||
  Key hash data is big endian CDR encoded with no padding. Returns length
 | 
			
		||||
  of key hash. Input stream may contain full sample of just key data.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static uint32_t dds_stream_get_keyhash 
 | 
			
		||||
static uint32_t dds_stream_get_keyhash
 | 
			
		||||
(
 | 
			
		||||
  dds_stream_t * is,
 | 
			
		||||
  char * dst,
 | 
			
		||||
| 
						 | 
				
			
			@ -1308,7 +1313,7 @@ static uint32_t dds_stream_get_keyhash
 | 
			
		|||
        {
 | 
			
		||||
          case DDS_OP_VAL_1BY:
 | 
			
		||||
          {
 | 
			
		||||
            *dst++ = DDS_IS_GET1 (is);
 | 
			
		||||
            *dst++ = (char) DDS_IS_GET1 (is);
 | 
			
		||||
            break;
 | 
			
		||||
          }
 | 
			
		||||
          case DDS_OP_VAL_2BY:
 | 
			
		||||
| 
						 | 
				
			
			@ -1523,7 +1528,7 @@ static uint32_t dds_stream_get_keyhash
 | 
			
		|||
                if ((jeq_op[1] == disc) || (has_default && (num == 0)))
 | 
			
		||||
                {
 | 
			
		||||
                  subtype = DDS_JEQ_TYPE (jeq_op[0]);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
                  switch (subtype)
 | 
			
		||||
                  {
 | 
			
		||||
                    case DDS_OP_VAL_1BY:
 | 
			
		||||
| 
						 | 
				
			
			@ -1579,7 +1584,7 @@ static uint32_t dds_stream_get_keyhash
 | 
			
		|||
#ifndef NDEBUG
 | 
			
		||||
static bool keyhash_is_reset(const dds_key_hash_t *kh)
 | 
			
		||||
{
 | 
			
		||||
  static const char nullhash[sizeof(kh->m_hash)];
 | 
			
		||||
  static const char nullhash[sizeof(kh->m_hash)] = { 0 };
 | 
			
		||||
  return kh->m_flags == 0 && memcmp(kh->m_hash, nullhash, sizeof(nullhash)) == 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,8 +25,8 @@ dds_subscriber_instance_hdl(
 | 
			
		|||
        dds_entity *e,
 | 
			
		||||
        dds_instance_handle_t *i)
 | 
			
		||||
{
 | 
			
		||||
    assert(e);
 | 
			
		||||
    assert(i);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    (void)i;
 | 
			
		||||
    /* TODO: Get/generate proper handle. */
 | 
			
		||||
    return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Generating subscriber instance handle is not supported");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -67,6 +67,7 @@ dds_subscriber_qos_set(
 | 
			
		|||
        bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t ret = dds__subscriber_qos_validate(qos, enabled);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
        if (enabled) {
 | 
			
		||||
            /* TODO: CHAM-95: DDSI does not support changing QoS policies. */
 | 
			
		||||
| 
						 | 
				
			
			@ -210,6 +211,7 @@ dds_subscriber_begin_coherent(
 | 
			
		|||
        _In_ dds_entity_t e)
 | 
			
		||||
{
 | 
			
		||||
    /* 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");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -218,6 +220,7 @@ dds_subscriber_end_coherent(
 | 
			
		|||
        _In_ dds_entity_t e)
 | 
			
		||||
{
 | 
			
		||||
    /* 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");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ dds_time_t dds_time (void)
 | 
			
		|||
 
 | 
			
		||||
void dds_sleepfor (dds_duration_t n)
 | 
			
		||||
{
 | 
			
		||||
  os_time interval = { (os_timeSec) (n / DDS_NSECS_IN_SEC), (uint32_t) (n % DDS_NSECS_IN_SEC) };
 | 
			
		||||
  os_time interval = { (os_timeSec) (n / DDS_NSECS_IN_SEC), (int32_t) (n % DDS_NSECS_IN_SEC) };
 | 
			
		||||
  os_nanoSleep (interval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -297,6 +297,7 @@ dds_topic_qos_set(
 | 
			
		|||
        bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t ret = dds_topic_qos_validate(qos, enabled);
 | 
			
		||||
    (void)e;
 | 
			
		||||
    if (ret == DDS_RETCODE_OK) {
 | 
			
		||||
        if (enabled) {
 | 
			
		||||
            /* TODO: CHAM-95: DDSI does not support changing QoS policies. */
 | 
			
		||||
| 
						 | 
				
			
			@ -426,9 +427,9 @@ dds_create_topic(
 | 
			
		|||
        st->id = next_topicid++;
 | 
			
		||||
 | 
			
		||||
#ifdef VXWORKS_RTP
 | 
			
		||||
        st->hash = (st->id * UINT64_C (12844332200329132887UL)) >> 32;
 | 
			
		||||
        st->hash = (uint32_t)((st->id * UINT64_C (12844332200329132887UL)) >> 32);
 | 
			
		||||
#else
 | 
			
		||||
        st->hash = (st->id * UINT64_C (12844332200329132887)) >> 32;
 | 
			
		||||
        st->hash = (uint32_t)((st->id * UINT64_C (12844332200329132887)) >> 32);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
        /* Check if topic cannot be optimised (memcpy marshal) */
 | 
			
		||||
| 
						 | 
				
			
			@ -518,6 +519,9 @@ dds_topic_mod_filter(
 | 
			
		|||
            *ctx = t->m_stopic->filter_ctx;
 | 
			
		||||
        }
 | 
			
		||||
        dds_topic_unlock(t);
 | 
			
		||||
    } else {
 | 
			
		||||
        *filter = 0;
 | 
			
		||||
        *ctx = NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -541,7 +545,7 @@ dds_topic_get_filter(
 | 
			
		|||
    void *ctx;
 | 
			
		||||
    dds_topic_mod_filter (topic, &filter, &ctx, false);
 | 
			
		||||
    return
 | 
			
		||||
      (filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : NULL;
 | 
			
		||||
      (filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			@ -560,7 +564,7 @@ dds_topic_get_filter_with_ctx(
 | 
			
		|||
  dds_topic_intern_filter_fn filter;
 | 
			
		||||
  void *ctx;
 | 
			
		||||
  dds_topic_mod_filter (topic, &filter, &ctx, false);
 | 
			
		||||
  return (filter == dds_topic_chaining_filter) ? NULL : filter;
 | 
			
		||||
  return (filter == dds_topic_chaining_filter) ? 0 : filter;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ dds_waitset_wait_impl(
 | 
			
		|||
                    to.tv_nsec = DDS_NSECS_IN_SEC - 1;
 | 
			
		||||
                } else {
 | 
			
		||||
                    to.tv_sec = (os_timeSec) (dt / DDS_NSECS_IN_SEC);
 | 
			
		||||
                    to.tv_nsec = (uint32_t) (dt % DDS_NSECS_IN_SEC);
 | 
			
		||||
                    to.tv_nsec = (int32_t) (dt % DDS_NSECS_IN_SEC);
 | 
			
		||||
                }
 | 
			
		||||
                (void)os_condTimedWait(&ws->m_entity.m_cond, &ws->m_entity.m_mutex, &to);
 | 
			
		||||
                tnow = dds_time();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ struct whc_intvnode {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
struct whc_idxnode {
 | 
			
		||||
  int64_t iid;
 | 
			
		||||
  uint64_t iid;
 | 
			
		||||
  seqno_t prune_seq;
 | 
			
		||||
  struct tkmap_instance *tk;
 | 
			
		||||
  unsigned headidx;
 | 
			
		||||
| 
						 | 
				
			
			@ -1017,11 +1017,11 @@ static unsigned whc_remove_acked_messages (struct whc *whc_generic, seqno_t max_
 | 
			
		|||
 | 
			
		||||
  if (config.enabled_logcats & LC_WHC)
 | 
			
		||||
  {
 | 
			
		||||
    struct whc_state whcst;
 | 
			
		||||
    get_state_locked(whc, &whcst);
 | 
			
		||||
    struct whc_state tmp;
 | 
			
		||||
    get_state_locked(whc, &tmp);
 | 
			
		||||
    TRACE_WHC(("whc_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",
 | 
			
		||||
               whcst.min_seq, whcst.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
 | 
			
		||||
               tmp.min_seq, tmp.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  check_whc (whc);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,6 +192,7 @@ get_bandwidth_limit(
 | 
			
		|||
  struct config_channel_listelem *channel = find_channel (transport_priority);
 | 
			
		||||
  return channel->data_bandwidth_limit;
 | 
			
		||||
#else
 | 
			
		||||
  (void)transport_priority;
 | 
			
		||||
  return 0;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -360,25 +361,25 @@ static struct whc *make_whc(const dds_qos_t *qos)
 | 
			
		|||
   an index at all (e.g., volatile KEEP_ALL) */
 | 
			
		||||
  if (config.startup_mode_full) {
 | 
			
		||||
    startup_mode = gv.startup_mode &&
 | 
			
		||||
      (qos->durability.kind >= DDS_DURABILITY_TRANSIENT ||
 | 
			
		||||
       (qos->durability.kind == DDS_DURABILITY_VOLATILE &&
 | 
			
		||||
        qos->reliability.kind != DDS_RELIABILITY_BEST_EFFORT));
 | 
			
		||||
      (qos->durability.kind >= NN_TRANSIENT_DURABILITY_QOS ||
 | 
			
		||||
       (qos->durability.kind == NN_VOLATILE_DURABILITY_QOS &&
 | 
			
		||||
        qos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS));
 | 
			
		||||
  } else {
 | 
			
		||||
    startup_mode = gv.startup_mode &&
 | 
			
		||||
      (qos->durability.kind == DDS_DURABILITY_VOLATILE &&
 | 
			
		||||
       qos->reliability.kind != DDS_RELIABILITY_BEST_EFFORT);
 | 
			
		||||
      (qos->durability.kind == NN_VOLATILE_DURABILITY_QOS &&
 | 
			
		||||
       qos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* Construct WHC -- if aggressive_keep_last1 is set, the WHC will
 | 
			
		||||
    drop all samples for which a later update is available.  This
 | 
			
		||||
    forces it to maintain a tlidx.  */
 | 
			
		||||
  handle_as_transient_local = (qos->durability.kind == DDS_DURABILITY_TRANSIENT_LOCAL);
 | 
			
		||||
  if (!config.aggressive_keep_last_whc || qos->history.kind == DDS_HISTORY_KEEP_ALL)
 | 
			
		||||
  handle_as_transient_local = (qos->durability.kind == NN_TRANSIENT_LOCAL_DURABILITY_QOS);
 | 
			
		||||
  if (!config.aggressive_keep_last_whc || qos->history.kind == NN_KEEP_ALL_HISTORY_QOS)
 | 
			
		||||
    hdepth = 0;
 | 
			
		||||
  else
 | 
			
		||||
    hdepth = (unsigned)qos->history.depth;
 | 
			
		||||
  if (handle_as_transient_local) {
 | 
			
		||||
    if (qos->durability_service.history.kind == DDS_HISTORY_KEEP_ALL)
 | 
			
		||||
    if (qos->durability_service.history.kind == NN_KEEP_ALL_HISTORY_QOS)
 | 
			
		||||
      tldepth = 0;
 | 
			
		||||
    else
 | 
			
		||||
      tldepth = (unsigned)qos->durability_service.history.depth;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ qos_init(void)
 | 
			
		|||
    g_pol_liveliness.lease_duration.sec = 40000;
 | 
			
		||||
    g_pol_liveliness.lease_duration.nanosec = 44000;
 | 
			
		||||
 | 
			
		||||
    g_pol_time_based_filter.minimum_separation.sec = 50000;
 | 
			
		||||
    g_pol_time_based_filter.minimum_separation.sec = 12000;
 | 
			
		||||
    g_pol_time_based_filter.minimum_separation.nanosec = 55000;
 | 
			
		||||
 | 
			
		||||
    g_pol_partition.name._buffer = (char**)c_partitions;
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ qos_init(void)
 | 
			
		|||
 | 
			
		||||
    g_pol_durability_service.history_depth = 1;
 | 
			
		||||
    g_pol_durability_service.history_kind = DDS_KEEP_LAST_HISTORY_QOS;
 | 
			
		||||
    g_pol_durability_service.max_samples = 2;
 | 
			
		||||
    g_pol_durability_service.max_samples = 12;
 | 
			
		||||
    g_pol_durability_service.max_instances = 3;
 | 
			
		||||
    g_pol_durability_service.max_samples_per_instance = 4;
 | 
			
		||||
    g_pol_durability_service.service_cleanup_delay.sec = 90000;
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ teardown(void)
 | 
			
		|||
int64_t from_ddsi_duration (DDS_Duration_t x)
 | 
			
		||||
{
 | 
			
		||||
  int64_t t;
 | 
			
		||||
  t = x.sec * 10^9 + x.nanosec;
 | 
			
		||||
  t = (int64_t)x.sec * T_SECOND + x.nanosec;
 | 
			
		||||
  return t;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -627,12 +627,13 @@ Test(ddsc_builtin_topics, datareader_qos, .init = setup, .fini = teardown)
 | 
			
		|||
  dds_qset_destination_order(g_qos, (dds_destination_order_kind_t)g_pol_destination_order.kind);
 | 
			
		||||
  dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
 | 
			
		||||
  dds_qset_time_based_filter(g_qos, from_ddsi_duration(g_pol_time_based_filter.minimum_separation));
 | 
			
		||||
  dds_qset_presentation(g_qos, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
 | 
			
		||||
  dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
 | 
			
		||||
  dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
 | 
			
		||||
  dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
 | 
			
		||||
  dds_qset_groupdata(g_qos, g_pol_groupdata.value._buffer, g_pol_groupdata.value._length);
 | 
			
		||||
 | 
			
		||||
  rdr = dds_create_reader(g_subscriber, g_topic, g_qos, NULL);
 | 
			
		||||
  cr_assert_gt(rdr, 0, "Failed to create a data reader.");
 | 
			
		||||
 | 
			
		||||
  subscription_samples[0] = DDS_SubscriptionBuiltinTopicData__alloc();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -693,7 +694,7 @@ Test(ddsc_builtin_topics, datawriter_qos, .init = setup, .fini = teardown)
 | 
			
		|||
  void * publication_samples[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  dds_qset_durability(g_qos, g_pol_durability.kind);
 | 
			
		||||
  dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
 | 
			
		||||
  dds_qset_deadline(g_qos, from_ddsi_duration(g_pol_deadline.period));
 | 
			
		||||
  dds_qset_latency_budget(g_qos, from_ddsi_duration(g_pol_latency_budget.duration));
 | 
			
		||||
  dds_qset_liveliness(g_qos, (dds_liveliness_kind_t)g_pol_liveliness.kind, from_ddsi_duration(g_pol_liveliness.lease_duration));
 | 
			
		||||
| 
						 | 
				
			
			@ -703,11 +704,12 @@ Test(ddsc_builtin_topics, datawriter_qos, .init = setup, .fini = teardown)
 | 
			
		|||
  dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
 | 
			
		||||
  dds_qset_ownership(g_qos, (dds_ownership_kind_t)g_pol_ownership.kind);
 | 
			
		||||
  dds_qset_ownership_strength(g_qos, g_pol_ownership_strength.value);
 | 
			
		||||
  dds_qset_presentation(g_qos, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
 | 
			
		||||
  dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
 | 
			
		||||
  dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
 | 
			
		||||
  dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
 | 
			
		||||
 | 
			
		||||
  wrtr = dds_create_writer(g_publisher, g_topic, g_qos, NULL);
 | 
			
		||||
  cr_assert_gt(wrtr, 0, "Failed to create a data writer.");
 | 
			
		||||
 | 
			
		||||
  publication_samples[0] = DDS_PublicationBuiltinTopicData__alloc();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -771,7 +773,7 @@ Test(ddsc_builtin_topics, topic_qos, .init = setup, .fini = teardown)
 | 
			
		|||
 | 
			
		||||
  void * topic_samples[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
  dds_qset_durability(g_qos, g_pol_durability.kind);
 | 
			
		||||
  dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
 | 
			
		||||
  dds_qset_durability_service(g_qos,
 | 
			
		||||
                              from_ddsi_duration(g_pol_durability_service.service_cleanup_delay),
 | 
			
		||||
                              (dds_history_kind_t)g_pol_durability_service.history_kind,
 | 
			
		||||
| 
						 | 
				
			
			@ -794,6 +796,7 @@ Test(ddsc_builtin_topics, topic_qos, .init = setup, .fini = teardown)
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
  tpc = dds_create_topic(g_participant, &Space_Type1_desc, "SpaceType1", g_qos, NULL);
 | 
			
		||||
  cr_assert_gt(tpc, 0, "Failed to create a topic.");
 | 
			
		||||
 | 
			
		||||
  topic_samples[0] = DDS_PublicationBuiltinTopicData__alloc();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
disposing_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_qos_t *qos = dds_qos_create ();
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,8 +15,10 @@
 | 
			
		|||
 | 
			
		||||
/* We are deliberately testing some bad arguments that SAL will complain about.
 | 
			
		||||
 * So, silence SAL regarding these issues. */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 6387 28020)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Add --verbose command line argument to get the cr_log_info traces (if there are any). */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -320,13 +322,13 @@ Test(ddsc_entity, get_entities, .init = create_entity, .fini = delete_entity)
 | 
			
		|||
    /* Get Children, of which there are currently none. */
 | 
			
		||||
    status = dds_get_children (entity, NULL, 0);
 | 
			
		||||
    if (status > 0) {
 | 
			
		||||
        cr_assert("dds_get_children(entity, NULL, 0) un-expectantly found children");
 | 
			
		||||
        cr_assert(false, "dds_get_children(entity, NULL, 0) un-expectantly found children");
 | 
			
		||||
    } else {
 | 
			
		||||
        cr_assert_eq(status, 0, "dds_get_children(entity, NULL, 0) failed");
 | 
			
		||||
    }
 | 
			
		||||
    status = dds_get_children (entity, &child, 1);
 | 
			
		||||
    if (status > 0) {
 | 
			
		||||
        cr_assert("dds_get_children(entity, child, 1) un-expectantly returned children");
 | 
			
		||||
        cr_assert(false, "dds_get_children(entity, child, 1) un-expectantly returned children");
 | 
			
		||||
    } else {
 | 
			
		||||
        cr_assert_eq(status, 0, "dds_get_children(entity, child, 1) failed");
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -362,4 +364,6 @@ Test(ddsc_entity, delete, .init = create_entity)
 | 
			
		|||
    entity = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@ static dds_entity_t g_querycond   = 0;
 | 
			
		|||
static bool
 | 
			
		||||
accept_all(const void * sample)
 | 
			
		||||
{
 | 
			
		||||
    (void)sample;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -840,7 +841,7 @@ Test(ddsc_entity_explicit_subscriber, invalid_topic)
 | 
			
		|||
Test(ddsc_entity_get_children, implicit_publisher)
 | 
			
		||||
{
 | 
			
		||||
    dds_entity_t participant;
 | 
			
		||||
    dds_entity_t publisher;
 | 
			
		||||
    dds_entity_t publisher = 0;
 | 
			
		||||
    dds_entity_t writer;
 | 
			
		||||
    dds_entity_t topic;
 | 
			
		||||
    dds_entity_t child[2], child2[2];
 | 
			
		||||
| 
						 | 
				
			
			@ -885,7 +886,7 @@ Test(ddsc_entity_get_children, implicit_publisher)
 | 
			
		|||
Test(ddsc_entity_get_children, implicit_subscriber)
 | 
			
		||||
{
 | 
			
		||||
    dds_entity_t participant;
 | 
			
		||||
    dds_entity_t subscriber;
 | 
			
		||||
    dds_entity_t subscriber = 0;
 | 
			
		||||
    dds_entity_t reader;
 | 
			
		||||
    dds_entity_t topic;
 | 
			
		||||
    dds_entity_t child[2], child2[2];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -130,7 +130,7 @@ Test(ddsc_entity_status, publication_matched, .init=init_entity_status, .fini=fi
 | 
			
		|||
 | 
			
		||||
    /* Wait for publication matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_publication_matched_status(wri, &publication_matched);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(publication_matched.current_count,        1);
 | 
			
		||||
| 
						 | 
				
			
			@ -149,7 +149,7 @@ Test(ddsc_entity_status, publication_matched, .init=init_entity_status, .fini=fi
 | 
			
		|||
 | 
			
		||||
    /* Wait for publication matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_publication_matched_status(wri, &publication_matched);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(publication_matched.current_count,         0);
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
 | 
			
		|||
 | 
			
		||||
    /* Wait for subscription  matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_subscription_matched_status(rea, &subscription_matched);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(subscription_matched.current_count,        1);
 | 
			
		||||
| 
						 | 
				
			
			@ -186,7 +186,7 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
 | 
			
		|||
 | 
			
		||||
    /* Wait for subscription  matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_subscription_matched_status(rea, &subscription_matched);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(subscription_matched.current_count,         0);
 | 
			
		||||
| 
						 | 
				
			
			@ -199,8 +199,10 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
 | 
			
		|||
Test(ddsc_entity, incompatible_qos, .init=init_entity_status, .fini=fini_entity_status)
 | 
			
		||||
{
 | 
			
		||||
    dds_entity_t reader2;
 | 
			
		||||
    dds_requested_incompatible_qos_status_t req_incompatible_qos = {0};
 | 
			
		||||
    dds_offered_incompatible_qos_status_t off_incompatible_qos = {0};
 | 
			
		||||
    dds_requested_incompatible_qos_status_t req_incompatible_qos;
 | 
			
		||||
    dds_offered_incompatible_qos_status_t off_incompatible_qos;
 | 
			
		||||
    memset (&req_incompatible_qos, 0, sizeof (req_incompatible_qos));
 | 
			
		||||
    memset (&off_incompatible_qos, 0, sizeof (off_incompatible_qos));
 | 
			
		||||
    dds_qset_durability (qos, DDS_DURABILITY_PERSISTENT);
 | 
			
		||||
 | 
			
		||||
    /* Create a reader with persistent durability */
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +238,7 @@ Test(ddsc_entity, incompatible_qos, .init=init_entity_status, .fini=fini_entity_
 | 
			
		|||
 | 
			
		||||
    /* Wait for offered incompatible QoS status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_offered_incompatible_qos_status (wri, &off_incompatible_qos);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(off_incompatible_qos.total_count,           1);
 | 
			
		||||
| 
						 | 
				
			
			@ -267,7 +269,7 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
 | 
			
		|||
 | 
			
		||||
    /* wait for LIVELINESS_CHANGED status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_get_liveliness_changed_status (rea, &liveliness_changed);
 | 
			
		||||
    cr_assert_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +290,7 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
 | 
			
		|||
 | 
			
		||||
    /* wait for LIVELINESS_CHANGED when a writer is deleted */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_get_liveliness_changed_status (rea, &liveliness_changed);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -301,10 +303,12 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
 | 
			
		|||
 | 
			
		||||
Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_status)
 | 
			
		||||
{
 | 
			
		||||
    dds_sample_rejected_status_t sample_rejected = {0};
 | 
			
		||||
    dds_sample_rejected_status_t sample_rejected;
 | 
			
		||||
 | 
			
		||||
    /* Topic instance */
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample_rejected, 0, sizeof (sample_rejected));
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -313,9 +317,9 @@ Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_s
 | 
			
		|||
 | 
			
		||||
    /* Wait for subscription matched and publication matched */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_set_enabled_status(rea, DDS_SAMPLE_REJECTED_STATUS);
 | 
			
		||||
    cr_assert_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -329,7 +333,7 @@ Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_s
 | 
			
		|||
 | 
			
		||||
    /* wait for sample rejected status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_sample_rejected_status (rea, &sample_rejected);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(sample_rejected.total_count,        4);
 | 
			
		||||
| 
						 | 
				
			
			@ -360,7 +364,7 @@ Test(ddsc_entity, inconsistent_topic)
 | 
			
		|||
 | 
			
		||||
    /* Wait for pub inconsistent topic status callback */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_inconsistent_topic_status (top, &topic_status);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_gt(topic_status.total_count, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -387,10 +391,12 @@ Test(ddsc_entity, inconsistent_topic)
 | 
			
		|||
Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_status)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    dds_sample_lost_status_t sample_lost = {0};
 | 
			
		||||
    dds_sample_lost_status_t sample_lost;
 | 
			
		||||
    dds_time_t time1;
 | 
			
		||||
    /* Topic instance */
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample_lost, 0, sizeof (sample_lost));
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -399,9 +405,9 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
 | 
			
		|||
 | 
			
		||||
    /* Wait for subscription matched and publication matched */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_set_enabled_status(rea, DDS_SAMPLE_LOST_STATUS);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +424,7 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
 | 
			
		|||
 | 
			
		||||
    /* wait for sample lost status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_get_sample_lost_status (rea, &sample_lost);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
    cr_assert_eq(sample_lost.total_count,          1);
 | 
			
		||||
| 
						 | 
				
			
			@ -432,7 +438,8 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
 | 
			
		|||
 | 
			
		||||
Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_status)
 | 
			
		||||
{
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -441,9 +448,9 @@ Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_st
 | 
			
		|||
 | 
			
		||||
    /* Wait for subscription and publication matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    /* Write the sample */
 | 
			
		||||
    ret = dds_write (wri, &sample);
 | 
			
		||||
| 
						 | 
				
			
			@ -455,7 +462,7 @@ Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_st
 | 
			
		|||
    cr_assert_eq(sta, DDS_SUBSCRIPTION_MATCHED_STATUS);
 | 
			
		||||
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_get_status_changes (rea, &sta);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -477,10 +484,11 @@ Test(ddsc_entity, all_data_available, .init=init_entity_status, .fini=fini_entit
 | 
			
		|||
    dds_sample_info_t info;
 | 
			
		||||
 | 
			
		||||
    /* Topic instance */
 | 
			
		||||
    RoundTripModule_DataType p_sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType p_sample;
 | 
			
		||||
    void * s_samples[1];
 | 
			
		||||
    RoundTripModule_DataType s_sample;
 | 
			
		||||
 | 
			
		||||
    memset (&p_sample, 0, sizeof (p_sample));
 | 
			
		||||
    memset (&s_sample, 0, sizeof (s_sample));
 | 
			
		||||
    s_samples[0] = &s_sample;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -500,13 +508,13 @@ Test(ddsc_entity, all_data_available, .init=init_entity_status, .fini=fini_entit
 | 
			
		|||
 | 
			
		||||
    /* Wait for publication matched status */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    /* Wait for subscription matched status on both readers */
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
    ret = dds_waitset_wait(waitSetrd2, wsresults2, wsresultsize2, waitTimeout);
 | 
			
		||||
    cr_assert_eq(ret, wsresultsize);
 | 
			
		||||
    cr_assert_eq(ret, (dds_return_t)wsresultsize);
 | 
			
		||||
 | 
			
		||||
    ret = dds_write (wri, &p_sample);
 | 
			
		||||
    cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,17 +83,17 @@ static dds_entity_t    cb_writer     = 0;
 | 
			
		|||
static dds_entity_t    cb_reader     = 0;
 | 
			
		||||
static dds_entity_t    cb_subscriber = 0;
 | 
			
		||||
 | 
			
		||||
static dds_inconsistent_topic_status_t          cb_inconsistent_topic_status        = { 0 };
 | 
			
		||||
static dds_liveliness_lost_status_t             cb_liveliness_lost_status           = { 0 };
 | 
			
		||||
static dds_offered_deadline_missed_status_t     cb_offered_deadline_missed_status   = { 0 };
 | 
			
		||||
static dds_offered_incompatible_qos_status_t    cb_offered_incompatible_qos_status  = { 0 };
 | 
			
		||||
static dds_sample_lost_status_t                 cb_sample_lost_status               = { 0 };
 | 
			
		||||
static dds_sample_rejected_status_t             cb_sample_rejected_status           = { 0 };
 | 
			
		||||
static dds_liveliness_changed_status_t          cb_liveliness_changed_status        = { 0 };
 | 
			
		||||
static dds_requested_deadline_missed_status_t   cb_requested_deadline_missed_status = { 0 };
 | 
			
		||||
static dds_requested_incompatible_qos_status_t  cb_requested_incompatible_qos_status= { 0 };
 | 
			
		||||
static dds_publication_matched_status_t         cb_publication_matched_status       = { 0 };
 | 
			
		||||
static dds_subscription_matched_status_t        cb_subscription_matched_status      = { 0 };
 | 
			
		||||
static dds_inconsistent_topic_status_t          cb_inconsistent_topic_status;
 | 
			
		||||
static dds_liveliness_lost_status_t             cb_liveliness_lost_status;
 | 
			
		||||
static dds_offered_deadline_missed_status_t     cb_offered_deadline_missed_status;
 | 
			
		||||
static dds_offered_incompatible_qos_status_t    cb_offered_incompatible_qos_status;
 | 
			
		||||
static dds_sample_lost_status_t                 cb_sample_lost_status;
 | 
			
		||||
static dds_sample_rejected_status_t             cb_sample_rejected_status;
 | 
			
		||||
static dds_liveliness_changed_status_t          cb_liveliness_changed_status;
 | 
			
		||||
static dds_requested_deadline_missed_status_t   cb_requested_deadline_missed_status;
 | 
			
		||||
static dds_requested_incompatible_qos_status_t  cb_requested_incompatible_qos_status;
 | 
			
		||||
static dds_publication_matched_status_t         cb_publication_matched_status;
 | 
			
		||||
static dds_subscription_matched_status_t        cb_subscription_matched_status;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +101,7 @@ inconsistent_topic_cb(
 | 
			
		|||
        dds_entity_t topic,
 | 
			
		||||
        const dds_inconsistent_topic_status_t status, void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_topic = topic;
 | 
			
		||||
    cb_inconsistent_topic_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -115,6 +116,7 @@ liveliness_lost_cb(
 | 
			
		|||
        const dds_liveliness_lost_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_writer = writer;
 | 
			
		||||
    cb_liveliness_lost_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -129,6 +131,7 @@ offered_deadline_missed_cb(
 | 
			
		|||
        const dds_offered_deadline_missed_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_writer = writer;
 | 
			
		||||
    cb_offered_deadline_missed_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -143,6 +146,7 @@ offered_incompatible_qos_cb(
 | 
			
		|||
        const dds_offered_incompatible_qos_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_writer = writer;
 | 
			
		||||
    cb_offered_incompatible_qos_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -156,6 +160,7 @@ data_on_readers_cb(
 | 
			
		|||
        dds_entity_t subscriber,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_subscriber = subscriber;
 | 
			
		||||
    cb_called |= DDS_DATA_ON_READERS_STATUS;
 | 
			
		||||
| 
						 | 
				
			
			@ -169,6 +174,7 @@ sample_lost_cb(
 | 
			
		|||
        const dds_sample_lost_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_sample_lost_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -182,6 +188,7 @@ data_available_cb(
 | 
			
		|||
        dds_entity_t reader,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_called |= DDS_DATA_AVAILABLE_STATUS;
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +202,7 @@ sample_rejected_cb(
 | 
			
		|||
        const dds_sample_rejected_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_sample_rejected_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -209,6 +217,7 @@ liveliness_changed_cb(
 | 
			
		|||
        const dds_liveliness_changed_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_liveliness_changed_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -223,6 +232,7 @@ requested_deadline_missed_cb(
 | 
			
		|||
        const dds_requested_deadline_missed_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_requested_deadline_missed_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -237,6 +247,7 @@ requested_incompatible_qos_cb(
 | 
			
		|||
        const dds_requested_incompatible_qos_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_requested_incompatible_qos_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -251,6 +262,7 @@ publication_matched_cb(
 | 
			
		|||
        const dds_publication_matched_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_writer = writer;
 | 
			
		||||
    cb_publication_matched_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -265,6 +277,7 @@ subscription_matched_cb(
 | 
			
		|||
        const dds_subscription_matched_status_t status,
 | 
			
		||||
        void* arg)
 | 
			
		||||
{
 | 
			
		||||
    (void)arg;
 | 
			
		||||
    os_mutexLock(&g_mutex);
 | 
			
		||||
    cb_reader = reader;
 | 
			
		||||
    cb_subscription_matched_status = status;
 | 
			
		||||
| 
						 | 
				
			
			@ -584,12 +597,13 @@ Test(ddsc_listener, getters_setters)
 | 
			
		|||
 ****************************************************************************/
 | 
			
		||||
Test(ddsc_listener, propagation, .init=init_triggering_base, .fini=fini_triggering_base)
 | 
			
		||||
{
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    dds_listener_t *listener_par = NULL;
 | 
			
		||||
    dds_listener_t *listener_pub = NULL;
 | 
			
		||||
    dds_listener_t *listener_sub = NULL;
 | 
			
		||||
    uint32_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    /* Let participant be interested in data. */
 | 
			
		||||
    listener_par = dds_listener_create(NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -807,7 +821,8 @@ Test(ddsc_listener, data_available, .init=init_triggering_test, .fini=fini_trigg
 | 
			
		|||
    dds_return_t ret;
 | 
			
		||||
    uint32_t triggered;
 | 
			
		||||
    uint32_t status;
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    /* We are interested in data available notifications. */
 | 
			
		||||
    dds_lset_data_available(g_listener, data_available_cb);
 | 
			
		||||
| 
						 | 
				
			
			@ -837,7 +852,8 @@ Test(ddsc_listener, data_on_readers, .init=init_triggering_test, .fini=fini_trig
 | 
			
		|||
    dds_return_t ret;
 | 
			
		||||
    uint32_t triggered;
 | 
			
		||||
    uint32_t status;
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    /* We are interested in data available notifications. */
 | 
			
		||||
    dds_lset_data_on_readers(g_listener, data_on_readers_cb);
 | 
			
		||||
| 
						 | 
				
			
			@ -875,7 +891,8 @@ Test(ddsc_listener, sample_lost, .init=init_triggering_test, .fini=fini_triggeri
 | 
			
		|||
    uint32_t triggered;
 | 
			
		||||
    dds_time_t the_past;
 | 
			
		||||
    uint32_t status;
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    /* Get a time that should be historic on all platforms.*/
 | 
			
		||||
    the_past = dds_time() - 1000000;
 | 
			
		||||
| 
						 | 
				
			
			@ -911,7 +928,8 @@ Test(ddsc_listener, sample_rejected, .init=init_triggering_test, .fini=fini_trig
 | 
			
		|||
    dds_return_t ret;
 | 
			
		||||
    uint32_t triggered;
 | 
			
		||||
    uint32_t status;
 | 
			
		||||
    RoundTripModule_DataType sample = { 0 };
 | 
			
		||||
    RoundTripModule_DataType sample;
 | 
			
		||||
    memset (&sample, 0, sizeof (sample));
 | 
			
		||||
 | 
			
		||||
    /* We are interested in sample rejected notifications. */
 | 
			
		||||
    dds_lset_sample_rejected(g_listener, sample_rejected_cb);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,14 +15,19 @@
 | 
			
		|||
 | 
			
		||||
/* We are deliberately testing some bad arguments that SAL will complain about.
 | 
			
		||||
 * So, silence SAL regarding these issues. */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 28020)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define cr_assert_status_eq(s1, s2, ...) cr_assert_eq(dds_err_nr(s1), s2, __VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
/* Dummy callback */
 | 
			
		||||
static void data_available_cb(dds_entity_t reader, void* arg) {}
 | 
			
		||||
static void data_available_cb(dds_entity_t reader, void* arg)
 | 
			
		||||
{
 | 
			
		||||
  (void)reader;
 | 
			
		||||
  (void)arg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Test(ddsc_publisher, create)
 | 
			
		||||
| 
						 | 
				
			
			@ -62,8 +67,10 @@ Test(ddsc_publisher, create)
 | 
			
		|||
  dds_delete(publisher);
 | 
			
		||||
 | 
			
		||||
/* Somehow, the compiler thinks the char arrays might not be zero-terminated... */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 6054)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  /* Use qos with single partition */
 | 
			
		||||
  dds_qset_partition (qos, 1, singlePartitions);
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +90,9 @@ Test(ddsc_publisher, create)
 | 
			
		|||
  cr_assert_gt(publisher, 0, "dds_create_publisher(participant,qos,NULL) where qos with duplicate partitions");
 | 
			
		||||
  dds_delete(publisher);
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  /* Use listener(NULL) */
 | 
			
		||||
  listener = dds_listener_create(NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -265,4 +274,6 @@ Test(ddsc_publisher, coherency)
 | 
			
		|||
  return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,13 +15,12 @@
 | 
			
		|||
#include <criterion/logging.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
#else
 | 
			
		||||
/* We are deliberately testing some bad arguments that SAL will complain about.
 | 
			
		||||
 * So, silence SAL regarding these issues. */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 6387 28020)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +242,7 @@ qos_fini(void)
 | 
			
		|||
 ****************************************************************************/
 | 
			
		||||
Test(ddsc_qos, userdata, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_userdata p = { 0 };
 | 
			
		||||
    struct pol_userdata p = { NULL, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_userdata(NULL, g_pol_userdata.value, g_pol_userdata.sz);
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +260,7 @@ Test(ddsc_qos, userdata, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, topicdata, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_topicdata p = { 0 };
 | 
			
		||||
    struct pol_topicdata p = { NULL, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_topicdata(NULL, g_pol_topicdata.value, g_pol_topicdata.sz);
 | 
			
		||||
| 
						 | 
				
			
			@ -279,7 +278,7 @@ Test(ddsc_qos, topicdata, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, groupdata, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_groupdata p = { 0 };
 | 
			
		||||
    struct pol_groupdata p = { NULL, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_groupdata(NULL, g_pol_groupdata.value, g_pol_groupdata.sz);
 | 
			
		||||
| 
						 | 
				
			
			@ -297,7 +296,7 @@ Test(ddsc_qos, groupdata, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, durability, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_durability p = { 0 };
 | 
			
		||||
    struct pol_durability p = { DDS_DURABILITY_VOLATILE };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_durability(NULL, g_pol_durability.kind);
 | 
			
		||||
| 
						 | 
				
			
			@ -312,7 +311,7 @@ Test(ddsc_qos, durability, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, history, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_history p = { 0 };
 | 
			
		||||
    struct pol_history p = { DDS_HISTORY_KEEP_ALL, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_history(NULL, g_pol_history.kind, g_pol_history.depth);
 | 
			
		||||
| 
						 | 
				
			
			@ -328,7 +327,7 @@ Test(ddsc_qos, history, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, resource_limits, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_resource_limits p = { 0 };
 | 
			
		||||
    struct pol_resource_limits p = { 0, 0, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_resource_limits(NULL, g_pol_resource_limits.max_samples, g_pol_resource_limits.max_instances, g_pol_resource_limits.max_samples_per_instance);
 | 
			
		||||
| 
						 | 
				
			
			@ -345,7 +344,7 @@ Test(ddsc_qos, resource_limits, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, presentation, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_presentation p = { 0 };
 | 
			
		||||
    struct pol_presentation p = { DDS_PRESENTATION_INSTANCE, false, false };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_presentation(NULL, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
 | 
			
		||||
| 
						 | 
				
			
			@ -407,7 +406,7 @@ Test(ddsc_qos, latency_budget, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, ownership, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_ownership p = { 0 };
 | 
			
		||||
    struct pol_ownership p = { DDS_OWNERSHIP_SHARED };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_ownership(NULL, g_pol_ownership.kind);
 | 
			
		||||
| 
						 | 
				
			
			@ -437,7 +436,7 @@ Test(ddsc_qos, ownership_strength, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, liveliness, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_liveliness p = { 0 };
 | 
			
		||||
    struct pol_liveliness p = { DDS_LIVELINESS_AUTOMATIC, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_liveliness(NULL, g_pol_liveliness.kind, g_pol_liveliness.lease_duration);
 | 
			
		||||
| 
						 | 
				
			
			@ -468,7 +467,7 @@ Test(ddsc_qos, time_base_filter, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, partition, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_partition p = { 0 };
 | 
			
		||||
    struct pol_partition p = { 0, NULL };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_partition(NULL, g_pol_partition.n, c_partitions);
 | 
			
		||||
| 
						 | 
				
			
			@ -490,7 +489,7 @@ Test(ddsc_qos, partition, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, reliability, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_reliability p = { 0 };
 | 
			
		||||
    struct pol_reliability p = { DDS_RELIABILITY_BEST_EFFORT, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_reliability(NULL, g_pol_reliability.kind, g_pol_reliability.max_blocking_time);
 | 
			
		||||
| 
						 | 
				
			
			@ -521,7 +520,7 @@ Test(ddsc_qos, transport_priority, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, destination_order, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_destination_order p = { 0 };
 | 
			
		||||
    struct pol_destination_order p = { DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_destination_order(NULL, g_pol_destination_order.kind);
 | 
			
		||||
| 
						 | 
				
			
			@ -536,7 +535,7 @@ Test(ddsc_qos, destination_order, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, writer_data_lifecycle, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_writer_data_lifecycle p = { 0 };
 | 
			
		||||
    struct pol_writer_data_lifecycle p = { false };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_writer_data_lifecycle(NULL, g_pol_writer_data_lifecycle.autodispose);
 | 
			
		||||
| 
						 | 
				
			
			@ -551,7 +550,7 @@ Test(ddsc_qos, writer_data_lifecycle, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, reader_data_lifecycle, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_reader_data_lifecycle p = { 0 };
 | 
			
		||||
    struct pol_reader_data_lifecycle p = { 0, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_reader_data_lifecycle(NULL, g_pol_reader_data_lifecycle.autopurge_nowriter_samples_delay, g_pol_reader_data_lifecycle.autopurge_disposed_samples_delay);
 | 
			
		||||
| 
						 | 
				
			
			@ -567,7 +566,7 @@ Test(ddsc_qos, reader_data_lifecycle, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
 | 
			
		||||
Test(ddsc_qos, durability_service, .init=qos_init, .fini=qos_fini)
 | 
			
		||||
{
 | 
			
		||||
    struct pol_durability_service p = { 0 };
 | 
			
		||||
    struct pol_durability_service p = { 0, DDS_HISTORY_KEEP_LAST, 0, 0, 0, 0 };
 | 
			
		||||
 | 
			
		||||
    /* NULLs shouldn't crash and be a noops. */
 | 
			
		||||
    dds_qset_durability_service(NULL,
 | 
			
		||||
| 
						 | 
				
			
			@ -615,7 +614,6 @@ Test(ddsc_qos, durability_service, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
    cr_assert_eq(p.max_samples_per_instance, g_pol_durability_service.max_samples_per_instance);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
querycondition_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_qos_t *qos = dds_qos_create ();
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,6 @@ static Space_Type1        g_data[MAX_SAMPLES];
 | 
			
		|||
static dds_sample_info_t  g_info[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
static dds_instance_handle_t   g_hdl_valid;
 | 
			
		||||
static dds_instance_handle_t   g_hdl_nil = DDS_HANDLE_NIL;
 | 
			
		||||
 | 
			
		||||
static bool
 | 
			
		||||
filter_mod2(const void * sample)
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +88,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
read_instance_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    char name[100];
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +179,7 @@ read_instance_init(void)
 | 
			
		|||
    for(int i = 0; i < ret; i++) {
 | 
			
		||||
        Space_Type1 *s = (Space_Type1*)g_samples[i];
 | 
			
		||||
        PRINT_SAMPLE("INIT: Read      ", (*s));
 | 
			
		||||
        (void)s;
 | 
			
		||||
    }
 | 
			
		||||
    /*  | long_1 | long_2 | long_3 |    sst   | vst |    ist     |
 | 
			
		||||
     *  ----------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
readcondition_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_qos_t *qos = dds_qos_create ();
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
reader_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    char name[100];
 | 
			
		||||
| 
						 | 
				
			
			@ -174,6 +174,7 @@ reader_init(void)
 | 
			
		|||
    for(int i = 0; i < ret; i++) {
 | 
			
		||||
        Space_Type1 *s = (Space_Type1*)g_samples[i];
 | 
			
		||||
        PRINT_SAMPLE("INIT: Read      ", (*s));
 | 
			
		||||
        (void)s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Re-write the samples that should be not_read&old_view. */
 | 
			
		||||
| 
						 | 
				
			
			@ -2499,7 +2500,7 @@ Test(ddsc_take_mask, take_instance_last_sample)
 | 
			
		|||
    int expected_long_3 = 2;
 | 
			
		||||
#endif
 | 
			
		||||
    dds_return_t expected_cnt = 1;
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    char name[100];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,9 +89,6 @@ static void*              g_samples[MAX_SAMPLES];
 | 
			
		|||
static Space_Type1        g_data[MAX_SAMPLES];
 | 
			
		||||
static dds_sample_info_t  g_info[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
static dds_instance_handle_t   g_hdl_valid;
 | 
			
		||||
static dds_instance_handle_t   g_hdl_nil = DDS_HANDLE_NIL;
 | 
			
		||||
 | 
			
		||||
static char*
 | 
			
		||||
create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +125,7 @@ filter_mod2(const void * sample)
 | 
			
		|||
static void
 | 
			
		||||
reader_iterator_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    char name[100];
 | 
			
		||||
| 
						 | 
				
			
			@ -364,9 +361,9 @@ Test(ddsc_read_next, reader, .init=reader_iterator_init, .fini=reader_iterator_f
 | 
			
		|||
        dds_instance_state_t expected_ist    = SAMPLE_IST(expected_long_1);
 | 
			
		||||
 | 
			
		||||
        /* Check data. */
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1 );
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2   );
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_2 *2);
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1);
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2);
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_3);
 | 
			
		||||
 | 
			
		||||
        /* Check states. */
 | 
			
		||||
        cr_assert_eq(g_info[0].valid_data,     true);
 | 
			
		||||
| 
						 | 
				
			
			@ -399,7 +396,7 @@ Theory((dds_entity_t rdr), ddsc_read_next, invalid_readers, .init=reader_iterato
 | 
			
		|||
    dds_return_t ret;
 | 
			
		||||
 | 
			
		||||
    ret = dds_read_next(rdr, g_samples, g_info);
 | 
			
		||||
    cr_assert_eq(dds_err_nr(ret), dds_err_nr(exp), "returned %d != expected %d", dds_err_str(ret), dds_err_nr(exp));
 | 
			
		||||
    cr_assert_eq(dds_err_nr(ret), dds_err_nr(exp), "returned %d != expected %d", dds_err_nr(ret), dds_err_nr(exp));
 | 
			
		||||
}
 | 
			
		||||
/*************************************************************************************************/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -476,9 +473,9 @@ Test(ddsc_read_next_wl, reader, .init=reader_iterator_init, .fini=reader_iterato
 | 
			
		|||
        dds_instance_state_t expected_ist    = SAMPLE_IST(expected_long_1);
 | 
			
		||||
 | 
			
		||||
        /* Check data. */
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_2/3 );
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2   );
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_2 *2);
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1);
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2);
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_3);
 | 
			
		||||
 | 
			
		||||
        /* Check states. */
 | 
			
		||||
        cr_assert_eq(g_info[0].valid_data,     true);
 | 
			
		||||
| 
						 | 
				
			
			@ -590,9 +587,9 @@ Test(ddsc_take_next, reader, .init=reader_iterator_init, .fini=reader_iterator_f
 | 
			
		|||
        dds_instance_state_t expected_ist    = SAMPLE_IST(expected_long_1);
 | 
			
		||||
 | 
			
		||||
        /* Check data. */
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1 );
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2   );
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_2 *2);
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1);
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2);
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_3);
 | 
			
		||||
 | 
			
		||||
        /* Check states. */
 | 
			
		||||
        cr_assert_eq(g_info[0].valid_data,     true);
 | 
			
		||||
| 
						 | 
				
			
			@ -700,9 +697,9 @@ Test(ddsc_take_next_wl, reader, .init=reader_iterator_init, .fini=reader_iterato
 | 
			
		|||
        dds_instance_state_t expected_ist    = SAMPLE_IST(expected_long_1);
 | 
			
		||||
 | 
			
		||||
        /* Check data. */
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_2/3 );
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2   );
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_2 *2);
 | 
			
		||||
        cr_assert_eq(sample->long_1, expected_long_1);
 | 
			
		||||
        cr_assert_eq(sample->long_2, expected_long_2);
 | 
			
		||||
        cr_assert_eq(sample->long_3, expected_long_3);
 | 
			
		||||
 | 
			
		||||
        /* Check states. */
 | 
			
		||||
        cr_assert_eq(g_info[0].valid_data,     true);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,6 @@ static dds_time_t   g_present     = 0;
 | 
			
		|||
 | 
			
		||||
static void*             g_samples[MAX_SAMPLES];
 | 
			
		||||
static Space_Type1       g_data[MAX_SAMPLES];
 | 
			
		||||
static dds_sample_info_t g_info[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
static char*
 | 
			
		||||
create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +53,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
registering_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_qos_t *qos = dds_qos_create ();
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +162,6 @@ TheoryDataPoints(ddsc_register_instance, invalid_params) = {
 | 
			
		|||
};
 | 
			
		||||
Theory((dds_instance_handle_t *hndl2, void *datap), ddsc_register_instance, invalid_params/*, .init=registering_init, .fini=registering_fini*/)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
 | 
			
		||||
    /* Only test when the combination of parameters is actually invalid.*/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,19 +92,27 @@ Test(ddsc_reader, return_loan_bad_params, .init = create_entities, .fini = delet
 | 
			
		|||
        DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
 | 
			
		||||
        dds_err_str(result));
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 6387)
 | 
			
		||||
#endif
 | 
			
		||||
    result = dds_return_loan(reader, buf, 10);
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
    cr_expect_eq(dds_err_nr(result), DDS_RETCODE_BAD_PARAMETER, "Invalid buffer size, Expected(%s) Returned(%s)",
 | 
			
		||||
        DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
 | 
			
		||||
        dds_err_str(result));
 | 
			
		||||
 | 
			
		||||
    buf = create_loan_buf(10, false);
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 28020)
 | 
			
		||||
#endif
 | 
			
		||||
    result = dds_return_loan(0, buf, 10);
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
    cr_expect_eq(dds_err_nr(result), DDS_RETCODE_BAD_PARAMETER, "Invalid entity, Expected(%s) Returned(%s)",
 | 
			
		||||
        DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
 | 
			
		||||
        dds_err_str(result));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,11 +17,23 @@
 | 
			
		|||
 | 
			
		||||
/* We are deliberately testing some bad arguments that SAL will complain about.
 | 
			
		||||
 * So, silence SAL regarding these issues. */
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(push)
 | 
			
		||||
#pragma warning(disable: 6387 28020)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void on_data_available(dds_entity_t reader, void* arg) {}
 | 
			
		||||
static void on_publication_matched(dds_entity_t writer, const dds_publication_matched_status_t status, void* arg) {}
 | 
			
		||||
static void on_data_available(dds_entity_t reader, void* arg)
 | 
			
		||||
{
 | 
			
		||||
  (void)reader;
 | 
			
		||||
  (void)arg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void on_publication_matched(dds_entity_t writer, const dds_publication_matched_status_t status, void* arg)
 | 
			
		||||
{
 | 
			
		||||
  (void)writer;
 | 
			
		||||
  (void)status;
 | 
			
		||||
  (void)arg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Test(ddsc_subscriber, notify_readers) {
 | 
			
		||||
  dds_entity_t participant;
 | 
			
		||||
| 
						 | 
				
			
			@ -108,4 +120,6 @@ Test(ddsc_subscriber, create) {
 | 
			
		|||
  dds_delete(participant);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#pragma warning(pop)
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,6 @@ static Space_Type1        g_data[MAX_SAMPLES];
 | 
			
		|||
static dds_sample_info_t  g_info[MAX_SAMPLES];
 | 
			
		||||
 | 
			
		||||
static dds_instance_handle_t   g_hdl_valid;
 | 
			
		||||
static dds_instance_handle_t   g_hdl_nil = DDS_HANDLE_NIL;
 | 
			
		||||
 | 
			
		||||
static bool
 | 
			
		||||
filter_mod2(const void * sample)
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +88,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
take_instance_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    char name[100];
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +179,7 @@ take_instance_init(void)
 | 
			
		|||
    for(int i = 0; i < ret; i++) {
 | 
			
		||||
        Space_Type1 *s = (Space_Type1*)g_samples[i];
 | 
			
		||||
        PRINT_SAMPLE("INIT: Read      ", (*s));
 | 
			
		||||
        (void)s;
 | 
			
		||||
    }
 | 
			
		||||
    /*  | long_1 | long_2 | long_3 |    sst   | vst |    ist     |
 | 
			
		||||
     *  ----------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@
 | 
			
		|||
#define MAX_SAMPLES  (7)
 | 
			
		||||
Test(ddsc_transient_local, late_joiner)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    dds_entity_t par;
 | 
			
		||||
    dds_entity_t pub;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,7 +53,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
 | 
			
		|||
static void
 | 
			
		||||
unregistering_init(void)
 | 
			
		||||
{
 | 
			
		||||
    Space_Type1 sample = { 0 };
 | 
			
		||||
    Space_Type1 sample = { 0, 0, 0 };
 | 
			
		||||
    dds_qos_t *qos = dds_qos_create ();
 | 
			
		||||
    dds_attach_t triggered;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -664,11 +664,10 @@ TheoryDataPoints(ddsc_waitset_wait, invalid_params) = {
 | 
			
		|||
};
 | 
			
		||||
Theory((dds_attach_t *a, size_t size, int msec), ddsc_waitset_wait, invalid_params, .init=ddsc_waitset_basic_init, .fini=ddsc_waitset_basic_fini)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
 | 
			
		||||
    /* Only test when the combination of parameters is actually invalid. */
 | 
			
		||||
    cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (size < 0) || (msec < 0));
 | 
			
		||||
    cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (msec < 0));
 | 
			
		||||
 | 
			
		||||
    ret = dds_waitset_wait(waitset, a, size, DDS_MSECS(msec));
 | 
			
		||||
    cr_assert_eq(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER, "returned %d != expected %d", dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
 | 
			
		||||
| 
						 | 
				
			
			@ -722,11 +721,10 @@ TheoryDataPoints(ddsc_waitset_wait_until, invalid_params) = {
 | 
			
		|||
};
 | 
			
		||||
Theory((dds_attach_t *a, size_t size), ddsc_waitset_wait_until, invalid_params, .init=ddsc_waitset_basic_init, .fini=ddsc_waitset_basic_fini)
 | 
			
		||||
{
 | 
			
		||||
    dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
 | 
			
		||||
    /* Only test when the combination of parameters is actually invalid. */
 | 
			
		||||
    cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (size < 0));
 | 
			
		||||
    cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)));
 | 
			
		||||
 | 
			
		||||
    ret = dds_waitset_wait_until(waitset, a, size, dds_time());
 | 
			
		||||
    cr_assert_eq(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER, "returned %d != expected %d", dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
 | 
			
		||||
| 
						 | 
				
			
			@ -820,7 +818,7 @@ Theory((size_t size), ddsc_waitset_get_entities, array_sizes, .init=ddsc_waitset
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /* Every found entity should be a known one. */
 | 
			
		||||
    cr_assert_eq(NumberOfSetBits(found), ret, "Not all found entities are known");
 | 
			
		||||
    cr_assert_eq((dds_return_t)NumberOfSetBits(found), ret, "Not all found entities are known");
 | 
			
		||||
}
 | 
			
		||||
/*************************************************************************************************/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -839,7 +837,6 @@ Test(ddsc_waitset_get_entities, no_array, .init=ddsc_waitset_attached_init, .fin
 | 
			
		|||
/*************************************************************************************************/
 | 
			
		||||
Test(ddsc_waitset_get_entities, deleted_waitset, .init=ddsc_waitset_attached_init, .fini=ddsc_waitset_attached_fini)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t found = 0;
 | 
			
		||||
    dds_return_t ret;
 | 
			
		||||
    dds_entity_t entities[MAX_ENTITIES_CNT];
 | 
			
		||||
    dds_delete(waitset);
 | 
			
		||||
| 
						 | 
				
			
			@ -1078,7 +1075,6 @@ static os_result
 | 
			
		|||
thread_reached_state(thread_state_t *actual, thread_state_t expected, int32_t msec)
 | 
			
		||||
{
 | 
			
		||||
    /* Convenience function. */
 | 
			
		||||
    bool stopped = false;
 | 
			
		||||
    os_time msec10 = { 0, 10000000 };
 | 
			
		||||
    while ((msec > 0) && (*actual != expected)) {
 | 
			
		||||
        os_nanoSleep(msec10);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,8 +20,8 @@
 | 
			
		|||
/* Tests in this file only concern themselves with very basic api tests of
 | 
			
		||||
   dds_write and dds_write_ts */
 | 
			
		||||
 | 
			
		||||
static const int payloadSize = 32;
 | 
			
		||||
static RoundTripModule_DataType data = { 0 };
 | 
			
		||||
static const uint32_t payloadSize = 32;
 | 
			
		||||
static RoundTripModule_DataType data;
 | 
			
		||||
 | 
			
		||||
static dds_entity_t participant = 0;
 | 
			
		||||
static dds_entity_t topic = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -175,11 +175,7 @@ int ddsi_serdata_is_key (const struct serdata * serdata);
 | 
			
		|||
int ddsi_serdata_is_empty (const struct serdata * serdata);
 | 
			
		||||
 | 
			
		||||
OSAPI_EXPORT void ddsi_serstate_append_blob (serstate_t st, size_t align, size_t sz, const void *data);
 | 
			
		||||
OSAPI_EXPORT void ddsi_serstate_set_msginfo
 | 
			
		||||
(
 | 
			
		||||
  serstate_t st, unsigned statusinfo, nn_wctime_t timestamp,
 | 
			
		||||
  void * dummy
 | 
			
		||||
);
 | 
			
		||||
OSAPI_EXPORT void ddsi_serstate_set_msginfo (serstate_t st, unsigned statusinfo, nn_wctime_t timestamp);
 | 
			
		||||
OSAPI_EXPORT serstate_t ddsi_serstate_new (const struct sertopic * topic);
 | 
			
		||||
OSAPI_EXPORT serdata_t ddsi_serstate_fix (serstate_t st);
 | 
			
		||||
nn_mtime_t ddsi_serstate_twrite (const struct serstate *serstate);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,9 +18,9 @@
 | 
			
		|||
#include "ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */
 | 
			
		||||
#include "ddsi/q_protocol.h" /* for nn_sequence_number_t */
 | 
			
		||||
 | 
			
		||||
#define bswap2(x) ((short) bswap2u ((unsigned short) (x)))
 | 
			
		||||
#define bswap4(x) ((int) bswap4u ((unsigned) (x)))
 | 
			
		||||
#define bswap8(x) ((long long) bswap8u ((unsigned long long) (x)))
 | 
			
		||||
#define bswap2(x) ((int16_t) bswap2u ((uint16_t) (x)))
 | 
			
		||||
#define bswap4(x) ((int32_t) bswap4u ((uint32_t) (x)))
 | 
			
		||||
#define bswap8(x) ((int64_t) bswap8u ((uint64_t) (x)))
 | 
			
		||||
 | 
			
		||||
#if NN_HAVE_C99_INLINE && !defined SUPPRESS_BSWAP_INLINES
 | 
			
		||||
#include "q_bswap_template.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -28,9 +28,9 @@
 | 
			
		|||
#if defined (__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
unsigned short bswap2u (unsigned short x);
 | 
			
		||||
unsigned bswap4u (unsigned x);
 | 
			
		||||
unsigned long long bswap8u (unsigned long long x);
 | 
			
		||||
uint16_t bswap2u (uint16_t x);
 | 
			
		||||
uint32_t bswap4u (uint32_t x);
 | 
			
		||||
uint64_t bswap8u (uint64_t x);
 | 
			
		||||
void bswapSN (nn_sequence_number_t *sn);
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,21 +16,21 @@
 | 
			
		|||
#define VDDS_INLINE
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
VDDS_INLINE unsigned short bswap2u (unsigned short x)
 | 
			
		||||
VDDS_INLINE uint16_t bswap2u (uint16_t x)
 | 
			
		||||
{
 | 
			
		||||
  return (unsigned short) ((x >> 8) | (x << 8));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VDDS_INLINE unsigned bswap4u (unsigned x)
 | 
			
		||||
VDDS_INLINE uint32_t bswap4u (uint32_t x)
 | 
			
		||||
{
 | 
			
		||||
  return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VDDS_INLINE unsigned long long bswap8u (unsigned long long x)
 | 
			
		||||
VDDS_INLINE uint64_t bswap8u (uint64_t x)
 | 
			
		||||
{
 | 
			
		||||
  const unsigned newhi = bswap4u ((unsigned) x);
 | 
			
		||||
  const unsigned newlo = bswap4u ((unsigned) (x >> 32));
 | 
			
		||||
  return ((unsigned long long) newhi << 32) | (unsigned long long) newlo;
 | 
			
		||||
  const uint32_t newhi = bswap4u ((uint32_t) x);
 | 
			
		||||
  const uint32_t newlo = bswap4u ((uint32_t) (x >> 32));
 | 
			
		||||
  return ((uint64_t) newhi << 32) | (uint64_t) newlo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VDDS_INLINE void bswapSN (nn_sequence_number_t *sn)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,6 @@ struct sertopic;
 | 
			
		|||
struct whc;
 | 
			
		||||
struct nn_xqos;
 | 
			
		||||
struct nn_plist;
 | 
			
		||||
struct v_gid_s;
 | 
			
		||||
 | 
			
		||||
struct proxy_group;
 | 
			
		||||
struct proxy_endpoint_common;
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +141,7 @@ struct local_reader_ary {
 | 
			
		|||
  os_mutex rdary_lock;
 | 
			
		||||
  unsigned valid: 1; /* always true until (proxy-)writer is being deleted; !valid => !fastpath_ok */
 | 
			
		||||
  unsigned fastpath_ok: 1; /* if not ok, fall back to using GUIDs (gives access to the reader-writer match data for handling readers that bumped into resource limits, hence can flip-flop, unlike "valid") */
 | 
			
		||||
  int n_readers;
 | 
			
		||||
  unsigned n_readers;
 | 
			
		||||
  struct reader **rdary; /* for efficient delivery, null-pointer terminated */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -552,7 +551,7 @@ int delete_proxy_reader (const struct nn_guid *guid, nn_wctime_t timestamp, int
 | 
			
		|||
void update_proxy_reader (struct proxy_reader * prd, struct addrset *as);
 | 
			
		||||
void update_proxy_writer (struct proxy_writer * pwr, struct addrset *as);
 | 
			
		||||
 | 
			
		||||
int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp);
 | 
			
		||||
int new_proxy_group (const struct nn_guid *guid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp);
 | 
			
		||||
void delete_proxy_group (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit);
 | 
			
		||||
 | 
			
		||||
void writer_exit_startup_mode (struct writer *wr);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ struct hbcontrol {
 | 
			
		|||
 | 
			
		||||
void writer_hbcontrol_init (struct hbcontrol *hbc);
 | 
			
		||||
int64_t writer_hbcontrol_intv (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
 | 
			
		||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
 | 
			
		||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, nn_mtime_t tnow);
 | 
			
		||||
int writer_hbcontrol_ack_required (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
 | 
			
		||||
struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, unsigned packetid, int *hbansreq);
 | 
			
		||||
int writer_hbcontrol_must_send (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@
 | 
			
		|||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
struct v_gid_s;
 | 
			
		||||
struct nn_guid;
 | 
			
		||||
 | 
			
		||||
int vendor_is_lite (nn_vendorid_t vendor);
 | 
			
		||||
| 
						 | 
				
			
			@ -40,7 +39,7 @@ int WildcardOverlap(char * p1, char * p2);
 | 
			
		|||
int ddsi2_patmatch (const char *pat, const char *str);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint32_t crc32_calc (const void *buf, uint32_t length);
 | 
			
		||||
uint32_t crc32_calc (const void *buf, size_t length);
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ typedef struct nn_udpv4mcgen_address {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
struct cdrstring {
 | 
			
		||||
  unsigned length;
 | 
			
		||||
  uint32_t length;
 | 
			
		||||
  unsigned char contents[1]; /* C90 does not support flex. array members */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,10 +26,10 @@ typedef struct {
 | 
			
		|||
} nn_protocol_version_t;
 | 
			
		||||
typedef union nn_guid_prefix {
 | 
			
		||||
  unsigned char s[12];
 | 
			
		||||
  unsigned u[3];
 | 
			
		||||
  uint32_t u[3];
 | 
			
		||||
} nn_guid_prefix_t;
 | 
			
		||||
typedef union nn_entityid {
 | 
			
		||||
  unsigned u;
 | 
			
		||||
  uint32_t u;
 | 
			
		||||
} nn_entityid_t;
 | 
			
		||||
typedef struct nn_guid {
 | 
			
		||||
  nn_guid_prefix_t prefix;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ void nn_xmsg_guid_seq_fragid (const struct nn_xmsg *m, nn_guid_t *wrguid, seqno_
 | 
			
		|||
void *nn_xmsg_submsg_from_marker (struct nn_xmsg *msg, struct nn_xmsg_marker marker);
 | 
			
		||||
void *nn_xmsg_append (struct nn_xmsg *m, struct nn_xmsg_marker *marker, size_t sz);
 | 
			
		||||
void nn_xmsg_shrink (struct nn_xmsg *m, struct nn_xmsg_marker marker, size_t sz);
 | 
			
		||||
void nn_xmsg_serdata (struct nn_xmsg *m, struct serdata *serdata, unsigned off, unsigned len);
 | 
			
		||||
void nn_xmsg_serdata (struct nn_xmsg *m, struct serdata *serdata, size_t off, size_t len);
 | 
			
		||||
void nn_xmsg_submsg_setnext (struct nn_xmsg *msg, struct nn_xmsg_marker marker);
 | 
			
		||||
void nn_xmsg_submsg_init (struct nn_xmsg *msg, struct nn_xmsg_marker marker, SubmessageKind_t smkind);
 | 
			
		||||
void nn_xmsg_add_timestamp (struct nn_xmsg *m, nn_wctime_t t);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ extern "C" {
 | 
			
		|||
#define NN_DDS_LENGTH_UNLIMITED -1
 | 
			
		||||
 | 
			
		||||
typedef struct nn_octetseq {
 | 
			
		||||
  unsigned length;
 | 
			
		||||
  uint32_t length;
 | 
			
		||||
  unsigned char *value;
 | 
			
		||||
} nn_octetseq_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ typedef struct nn_property {
 | 
			
		|||
} nn_property_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_propertyseq {
 | 
			
		||||
  unsigned n;
 | 
			
		||||
  uint32_t n;
 | 
			
		||||
  nn_property_t *props;
 | 
			
		||||
} nn_propertyseq_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ typedef struct nn_binaryproperty {
 | 
			
		|||
} nn_binaryproperty_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_binarypropertyseq {
 | 
			
		||||
  unsigned n;
 | 
			
		||||
  uint32_t n;
 | 
			
		||||
  nn_binaryproperty_t *props;
 | 
			
		||||
} nn_binarypropertyseq_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -78,13 +78,13 @@ typedef enum nn_history_kind {
 | 
			
		|||
 | 
			
		||||
typedef struct nn_history_qospolicy {
 | 
			
		||||
  nn_history_kind_t kind;
 | 
			
		||||
  int depth;
 | 
			
		||||
  int32_t depth;
 | 
			
		||||
} nn_history_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_resource_limits_qospolicy {
 | 
			
		||||
  int max_samples;
 | 
			
		||||
  int max_instances;
 | 
			
		||||
  int max_samples_per_instance;
 | 
			
		||||
  int32_t max_samples;
 | 
			
		||||
  int32_t max_instances;
 | 
			
		||||
  int32_t max_samples_per_instance;
 | 
			
		||||
} nn_resource_limits_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_durability_service_qospolicy {
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +123,7 @@ typedef struct nn_ownership_qospolicy {
 | 
			
		|||
} nn_ownership_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_ownership_strength_qospolicy {
 | 
			
		||||
  int value;
 | 
			
		||||
  int32_t value;
 | 
			
		||||
} nn_ownership_strength_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef enum nn_liveliness_kind {
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ typedef struct nn_time_based_filter_qospolicy {
 | 
			
		|||
} nn_time_based_filter_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_stringseq {
 | 
			
		||||
  unsigned n;
 | 
			
		||||
  uint32_t n;
 | 
			
		||||
  char **strs;
 | 
			
		||||
} nn_stringseq_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +159,7 @@ typedef struct nn_reliability_qospolicy {
 | 
			
		|||
} nn_reliability_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_external_reliability_qospolicy {
 | 
			
		||||
  int kind;
 | 
			
		||||
  uint32_t kind;
 | 
			
		||||
  nn_duration_t max_blocking_time;
 | 
			
		||||
} nn_external_reliability_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ typedef struct nn_external_reliability_qospolicy {
 | 
			
		|||
#define NN_INTEROP_RELIABLE_RELIABILITY_QOS     2
 | 
			
		||||
 | 
			
		||||
typedef struct nn_transport_priority_qospolicy {
 | 
			
		||||
  int value;
 | 
			
		||||
  int32_t value;
 | 
			
		||||
} nn_transport_priority_qospolicy_t;
 | 
			
		||||
 | 
			
		||||
typedef struct nn_lifespan_qospolicy {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,16 +158,25 @@ typedef struct ddsi_iovec {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#if ! SYSDEPS_HAVE_MSGHDR
 | 
			
		||||
#if defined _WIN32
 | 
			
		||||
typedef DWORD ddsi_msg_iovlen_t;
 | 
			
		||||
#else
 | 
			
		||||
typedef int ddsi_msg_iovlen_t;
 | 
			
		||||
#endif
 | 
			
		||||
struct msghdr
 | 
			
		||||
{
 | 
			
		||||
  void *msg_name;
 | 
			
		||||
  socklen_t msg_namelen;
 | 
			
		||||
  ddsi_iovec_t *msg_iov;
 | 
			
		||||
  size_t msg_iovlen;
 | 
			
		||||
  ddsi_msg_iovlen_t msg_iovlen;
 | 
			
		||||
  void *msg_control;
 | 
			
		||||
  size_t msg_controllen;
 | 
			
		||||
  int msg_flags;
 | 
			
		||||
};
 | 
			
		||||
#elif defined __linux
 | 
			
		||||
typedef size_t ddsi_msg_iovlen_t;
 | 
			
		||||
#else /* POSIX says int (which macOS, FreeBSD, Solaris do) */
 | 
			
		||||
typedef int ddsi_msg_iovlen_t;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef MSG_TRUNC
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,11 +120,7 @@ void ddsi_serstate_append_blob (serstate_t st, size_t align, size_t sz, const vo
 | 
			
		|||
  memcpy (p, data, sz);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ddsi_serstate_set_msginfo
 | 
			
		||||
(
 | 
			
		||||
  serstate_t st, unsigned statusinfo, nn_wctime_t timestamp,
 | 
			
		||||
  void * dummy
 | 
			
		||||
)
 | 
			
		||||
void ddsi_serstate_set_msginfo (serstate_t st, unsigned statusinfo, nn_wctime_t timestamp)
 | 
			
		||||
{
 | 
			
		||||
  serdata_t d = st->data;
 | 
			
		||||
  d->v.msginfo.statusinfo = statusinfo;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,7 @@ static const ut_avlTreedef_t ddsi_tcp_treedef = UT_AVL_TREEDEF_INITIALIZER_INDKE
 | 
			
		|||
(
 | 
			
		||||
  offsetof (struct ddsi_tcp_node, m_avlnode),
 | 
			
		||||
  offsetof (struct ddsi_tcp_node, m_conn),
 | 
			
		||||
  (ut_avlCompare_t) ddsi_tcp_cmp_conn,
 | 
			
		||||
  ddsi_tcp_cmp_conn,
 | 
			
		||||
  0
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -559,15 +559,11 @@ static size_t iovlen_sum (size_t niov, const ddsi_iovec_t *iov)
 | 
			
		|||
  return tot;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Turns out Darwin uses "int" for msg_iovlen, but glibc uses "size_t". The simplest
 | 
			
		||||
 way out is to do the assignment with the conversion warnings disabled */
 | 
			
		||||
//OSPL_DIAG_OFF(conversion)
 | 
			
		||||
static void set_msghdr_iov (struct msghdr *mhdr, ddsi_iovec_t *iov, size_t iovlen)
 | 
			
		||||
{
 | 
			
		||||
  mhdr->msg_iov = iov;
 | 
			
		||||
  mhdr->msg_iovlen = iovlen;
 | 
			
		||||
  mhdr->msg_iovlen = (ddsi_msg_iovlen_t)iovlen;
 | 
			
		||||
}
 | 
			
		||||
//OSPL_DIAG_ON(conversion)
 | 
			
		||||
 | 
			
		||||
static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *dst, size_t niov, const ddsi_iovec_t *iov, uint32_t flags)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,15 +97,11 @@ static ssize_t ddsi_udp_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, s
 | 
			
		|||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Turns out Darwin uses "int" for msg_iovlen, but glibc uses "size_t". The simplest
 | 
			
		||||
 way out is to do the assignment with the conversion warnings disabled */
 | 
			
		||||
//OSPL_DIAG_OFF(conversion)
 | 
			
		||||
static void set_msghdr_iov (struct msghdr *mhdr, ddsi_iovec_t *iov, size_t iovlen)
 | 
			
		||||
{
 | 
			
		||||
  mhdr->msg_iov = iov;
 | 
			
		||||
  mhdr->msg_iovlen = iovlen;
 | 
			
		||||
  mhdr->msg_iovlen = (ddsi_msg_iovlen_t)iovlen;
 | 
			
		||||
}
 | 
			
		||||
//OSPL_DIAG_ON(conversion)
 | 
			
		||||
 | 
			
		||||
static ssize_t ddsi_udp_conn_write (ddsi_tran_conn_t conn, const nn_locator_t *dst, size_t niov, const ddsi_iovec_t *iov, uint32_t flags)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -296,7 +292,7 @@ static ddsi_tran_conn_t ddsi_udp_create_conn
 | 
			
		|||
 | 
			
		||||
static int joinleave_asm_mcgroup (os_socket socket, int join, const nn_locator_t *mcloc, const struct nn_interface *interf)
 | 
			
		||||
{
 | 
			
		||||
  int rc;
 | 
			
		||||
  os_result rc;
 | 
			
		||||
  os_sockaddr_storage mcip;
 | 
			
		||||
  ddsi_ipaddr_from_loc(&mcip, mcloc);
 | 
			
		||||
#if OS_SOCKET_HAS_IPV6
 | 
			
		||||
| 
						 | 
				
			
			@ -319,13 +315,13 @@ static int joinleave_asm_mcgroup (os_socket socket, int join, const nn_locator_t
 | 
			
		|||
      mreq.imr_interface.s_addr = htonl (INADDR_ANY);
 | 
			
		||||
    rc = os_sockSetsockopt (socket, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, (char *) &mreq, sizeof (mreq));
 | 
			
		||||
  }
 | 
			
		||||
  return (rc == -1) ? os_getErrno() : 0;
 | 
			
		||||
  return (rc != os_resultSuccess) ? os_getErrno() : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef DDSI_INCLUDE_SSM
 | 
			
		||||
static int joinleave_ssm_mcgroup (os_socket socket, int join, const nn_locator_t *srcloc, const nn_locator_t *mcloc, const struct nn_interface *interf)
 | 
			
		||||
{
 | 
			
		||||
  int rc;
 | 
			
		||||
  os_result rc;
 | 
			
		||||
  os_sockaddr_storage mcip, srcip;
 | 
			
		||||
  ddsi_ipaddr_from_loc(&mcip, mcloc);
 | 
			
		||||
  ddsi_ipaddr_from_loc(&srcip, srcloc);
 | 
			
		||||
| 
						 | 
				
			
			@ -352,7 +348,7 @@ static int joinleave_ssm_mcgroup (os_socket socket, int join, const nn_locator_t
 | 
			
		|||
      mreq.imr_interface.s_addr = INADDR_ANY;
 | 
			
		||||
    rc = os_sockSetsockopt (socket, IPPROTO_IP, join ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof (mreq));
 | 
			
		||||
  }
 | 
			
		||||
  return (rc == -1) ? os_getErrno() : 0;
 | 
			
		||||
  return (rc != os_resultSuccess) ? os_getErrno() : 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -233,7 +233,7 @@ void set_unspec_locator (nn_locator_t *loc)
 | 
			
		|||
 | 
			
		||||
int is_unspec_locator (const nn_locator_t *loc)
 | 
			
		||||
{
 | 
			
		||||
  static const nn_locator_t zloc;
 | 
			
		||||
  static const nn_locator_t zloc = { .kind = 0 };
 | 
			
		||||
  return (loc->kind == NN_LOCATOR_KIND_INVALID &&
 | 
			
		||||
          loc->port == NN_LOCATOR_PORT_INVALID &&
 | 
			
		||||
          memcmp (&zloc.address, loc->address, sizeof (zloc.address)) == 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -204,6 +204,7 @@ DI(if_thread_properties);
 | 
			
		|||
#define GROUP_W_ATTRS(name, children, attrs) name, children, attrs, 1, NULL, 0, 0, 0, 0, 0, 0
 | 
			
		||||
#define MGROUP(name, children, attrs) name, children, attrs
 | 
			
		||||
#define ATTR(name) name, NULL, NULL
 | 
			
		||||
#define DEPRECATED_ATTR(name) "|" name, NULL, NULL
 | 
			
		||||
/* MOVED: whereto must be a path relative to DDSI2Service, may not be used in/for lists and only for elements, may not be chained */
 | 
			
		||||
#define MOVED(name, whereto) ">" name, NULL, NULL, 0, whereto, 0, 0, 0, 0, 0, 0, NULL
 | 
			
		||||
static const struct cfgelem timestamp_cfgattrs[] = {
 | 
			
		||||
| 
						 | 
				
			
			@ -465,15 +466,19 @@ static const struct cfgelem unsupp_watermarks_cfgelems[] = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
static const struct cfgelem control_topic_cfgattrs[] = {
 | 
			
		||||
    { ATTR("Enable"), 1, "false", ABSOFF(enable_control_topic), 0, uf_boolean, 0, pf_boolean },
 | 
			
		||||
    { ATTR("InitialReset"), 1, "inf", ABSOFF(initial_deaf_mute_reset), 0, uf_duration_inf, 0, pf_duration },
 | 
			
		||||
    { DEPRECATED_ATTR("Enable"), 1, "false", ABSOFF(enable_control_topic), 0, uf_boolean, 0, pf_boolean,
 | 
			
		||||
      "<p>This element controls whether DDSI2E should create a topic to control DDSI2E's behaviour dynamically.<p>"
 | 
			
		||||
    },
 | 
			
		||||
    { DEPRECATED_ATTR("InitialReset"), 1, "inf", ABSOFF(initial_deaf_mute_reset), 0, uf_duration_inf, 0, pf_duration,
 | 
			
		||||
      "<p>This element controls after how much time an initial deaf/mute state will automatically reset.<p>"
 | 
			
		||||
    },
 | 
			
		||||
    END_MARKER
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct cfgelem control_topic_cfgelems[] = {
 | 
			
		||||
    { LEAF ("Deaf"), 1, "false", ABSOFF (initial_deaf), 0, uf_deaf_mute, 0, pf_boolean,
 | 
			
		||||
    { DEPRECATED_LEAF ("Deaf"), 1, "false", ABSOFF (initial_deaf), 0, uf_deaf_mute, 0, pf_boolean,
 | 
			
		||||
    "<p>This element controls whether DDSI2E defaults to deaf mode or to normal mode. This controls both the initial behaviour and what behaviour it auto-reverts to.</p>" },
 | 
			
		||||
    { LEAF ("Mute"), 1, "false", ABSOFF (initial_mute), 0, uf_deaf_mute, 0, pf_boolean,
 | 
			
		||||
    { DEPRECATED_LEAF ("Mute"), 1, "false", ABSOFF (initial_mute), 0, uf_deaf_mute, 0, pf_boolean,
 | 
			
		||||
    "<p>This element controls whether DDSI2E defaults to mute mode or to normal mode. This controls both the initial behaviour and what behaviour it auto-reverts to.</p>" },
 | 
			
		||||
    END_MARKER
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -548,7 +553,8 @@ static const struct cfgelem unsupp_cfgelems[] = {
 | 
			
		|||
{ LEAF("RetransmitMergingPeriod"), 1, "5 ms", ABSOFF(retransmit_merging_period), 0, uf_duration_us_1s, 0, pf_duration,
 | 
			
		||||
"<p>This setting determines the size of the time window in which a NACK of some sample is ignored because a retransmit of that sample has been multicasted too recently. This setting has no effect on unicasted retransmits.</p>\n\
 | 
			
		||||
<p>See also Internal/RetransmitMerging.</p>" },
 | 
			
		||||
{ LEAF_W_ATTRS("HeartbeatInterval", heartbeat_interval_attrs), 1, "100 ms", ABSOFF(const_hb_intv_sched), 0, uf_duration_inf, 0, pf_duration },
 | 
			
		||||
{ LEAF_W_ATTRS("HeartbeatInterval", heartbeat_interval_attrs), 1, "100 ms", ABSOFF(const_hb_intv_sched), 0, uf_duration_inf, 0, pf_duration,
 | 
			
		||||
  "<p>This elemnents allows configuring the base interval for sending writer heartbeats and the bounds within it can vary.</p>" },
 | 
			
		||||
{ LEAF("MaxQueuedRexmitBytes"), 1, "50 kB", ABSOFF(max_queued_rexmit_bytes), 0, uf_memsize, 0, pf_memsize,
 | 
			
		||||
"<p>This setting limits the maximum number of bytes queued for retransmission. The default value of 0 is unlimited unless an AuxiliaryBandwidthLimit has been set, in which case it becomes NackDelay * AuxiliaryBandwidthLimit. It must be large enough to contain the largest sample that may need to be retransmitted.</p>" },
 | 
			
		||||
{ LEAF("MaxQueuedRexmitMessages"), 1, "200", ABSOFF(max_queued_rexmit_msgs), 0, uf_uint, 0, pf_uint,
 | 
			
		||||
| 
						 | 
				
			
			@ -1306,7 +1312,7 @@ static int uf_boolean_default (struct cfgst *cfgst, void *parent, struct cfgelem
 | 
			
		|||
  static const enum boolean_default ms[] = {
 | 
			
		||||
    BOOLDEF_DEFAULT, BOOLDEF_FALSE, BOOLDEF_TRUE, 0,
 | 
			
		||||
  };
 | 
			
		||||
  int *elem = cfg_address (cfgst, parent, cfgelem);
 | 
			
		||||
  enum boolean_default *elem = cfg_address (cfgst, parent, cfgelem);
 | 
			
		||||
  int idx = list_index (vs, value);
 | 
			
		||||
  assert (sizeof (vs) / sizeof (*vs) == sizeof (ms) / sizeof (*ms));
 | 
			
		||||
  if (idx < 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -2857,7 +2863,7 @@ struct cfgst * config_init
 | 
			
		|||
            forces us to include a crc32 routine when we have md5
 | 
			
		||||
            available anyway */
 | 
			
		||||
            p->partitionId = config.nof_networkPartitions; /* starting at 1 */
 | 
			
		||||
            p->partitionHash = crc32_calc(p->name, (int) strlen(p->name));
 | 
			
		||||
            p->partitionHash = crc32_calc(p->name, strlen(p->name));
 | 
			
		||||
            p = p->next;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -325,7 +325,7 @@ int spdp_write (struct participant *pp)
 | 
			
		|||
  ddsi_serstate_append_blob (serstate, 4, payload_sz, payload_blob);
 | 
			
		||||
  kh = nn_hton_guid (pp->e.guid);
 | 
			
		||||
  serstate_set_key (serstate, 0, &kh);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_plist_fini(&ps);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
| 
						 | 
				
			
			@ -362,7 +362,7 @@ int spdp_dispose_unregister (struct participant *pp)
 | 
			
		|||
  ddsi_serstate_append_blob (serstate, 4, payload_sz, payload_blob);
 | 
			
		||||
  kh = nn_hton_guid (pp->e.guid);
 | 
			
		||||
  serstate_set_key (serstate, 1, &kh);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -977,7 +977,7 @@ static int sedp_write_endpoint
 | 
			
		|||
    statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
 | 
			
		||||
  else
 | 
			
		||||
    statusinfo = 0;
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1443,7 +1443,7 @@ int sedp_write_topic (struct participant *pp, const struct nn_plist *datap)
 | 
			
		|||
  md5_finish (&md5st, digest);
 | 
			
		||||
 | 
			
		||||
  serstate_set_key (serstate, 0, digest);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1509,7 +1509,7 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
 | 
			
		|||
    statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
 | 
			
		||||
  else
 | 
			
		||||
    statusinfo = 0;
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1619,7 +1619,7 @@ int sedp_write_cm_publisher (const struct nn_plist *datap, int alive)
 | 
			
		|||
    statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
 | 
			
		||||
  else
 | 
			
		||||
    statusinfo = 0;
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1674,7 +1674,7 @@ int sedp_write_cm_subscriber (const struct nn_plist *datap, int alive)
 | 
			
		|||
    statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
 | 
			
		||||
  else
 | 
			
		||||
    statusinfo = 0;
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
  nn_xmsg_free (mpayload);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1698,10 +1698,8 @@ static void handle_SEDP_GROUP_alive (nn_plist_t *datap /* note: potentially modi
 | 
			
		|||
  nn_log (LC_DISCOVERY, " alive\n");
 | 
			
		||||
 | 
			
		||||
  {
 | 
			
		||||
    struct v_gid_s *gid = NULL;
 | 
			
		||||
    char *name;
 | 
			
		||||
    name = (datap->present & PP_ENTITY_NAME) ? datap->entity_name : "";
 | 
			
		||||
    new_proxy_group (&datap->group_guid, gid, name, &datap->qos, timestamp);
 | 
			
		||||
    char *name = (datap->present & PP_ENTITY_NAME) ? datap->entity_name : "";
 | 
			
		||||
    new_proxy_group (&datap->group_guid, name, &datap->qos, timestamp);
 | 
			
		||||
  }
 | 
			
		||||
err:
 | 
			
		||||
  return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -197,7 +197,7 @@ void local_reader_ary_insert (struct local_reader_ary *x, struct reader *rd)
 | 
			
		|||
 | 
			
		||||
void local_reader_ary_remove (struct local_reader_ary *x, struct reader *rd)
 | 
			
		||||
{
 | 
			
		||||
  int i;
 | 
			
		||||
  unsigned i;
 | 
			
		||||
  os_mutexLock (&x->rdary_lock);
 | 
			
		||||
  for (i = 0; i < x->n_readers; i++)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1943,7 +1943,7 @@ static nn_entityid_t builtin_entityid_match (nn_entityid_t x)
 | 
			
		|||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writer_qos_mismatch (struct writer * wr, int32_t reason)
 | 
			
		||||
static void writer_qos_mismatch (struct writer * wr, uint32_t reason)
 | 
			
		||||
{
 | 
			
		||||
  /* When the reason is DDS_INVALID_QOS_POLICY_ID, it means that we compared
 | 
			
		||||
   * readers/writers from different topics: ignore that. */
 | 
			
		||||
| 
						 | 
				
			
			@ -1963,7 +1963,7 @@ static void writer_qos_mismatch (struct writer * wr, int32_t reason)
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void reader_qos_mismatch (struct reader * rd, int32_t reason)
 | 
			
		||||
static void reader_qos_mismatch (struct reader * rd, uint32_t reason)
 | 
			
		||||
{
 | 
			
		||||
  /* When the reason is DDS_INVALID_QOS_POLICY_ID, it means that we compared
 | 
			
		||||
   * readers/writers from different topics: ignore that. */
 | 
			
		||||
| 
						 | 
				
			
			@ -1996,7 +1996,7 @@ static void connect_writer_with_proxy_reader (struct writer *wr, struct proxy_re
 | 
			
		|||
    return;
 | 
			
		||||
  if (!isb0 && (reason = qos_match_p (prd->c.xqos, wr->xqos)) >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    writer_qos_mismatch (wr, reason);
 | 
			
		||||
    writer_qos_mismatch (wr, (uint32_t)reason);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  proxy_reader_add_connection (prd, wr);
 | 
			
		||||
| 
						 | 
				
			
			@ -2015,7 +2015,7 @@ static void connect_proxy_writer_with_reader (struct proxy_writer *pwr, struct r
 | 
			
		|||
    return;
 | 
			
		||||
  if (!isb0 && (reason = qos_match_p (rd->xqos, pwr->c.xqos)) >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    reader_qos_mismatch (rd, reason);
 | 
			
		||||
    reader_qos_mismatch (rd, (uint32_t)reason);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  reader_add_connection (rd, pwr, &init_count);
 | 
			
		||||
| 
						 | 
				
			
			@ -2025,12 +2025,13 @@ static void connect_proxy_writer_with_reader (struct proxy_writer *pwr, struct r
 | 
			
		|||
static void connect_writer_with_reader (struct writer *wr, struct reader *rd, nn_mtime_t tnow)
 | 
			
		||||
{
 | 
			
		||||
  int32_t reason;
 | 
			
		||||
  (void)tnow;
 | 
			
		||||
  if (is_builtin_entityid (wr->e.guid.entityid, ownvendorid) || is_builtin_entityid (rd->e.guid.entityid, ownvendorid))
 | 
			
		||||
    return;
 | 
			
		||||
  if ((reason = qos_match_p (rd->xqos, wr->xqos)) >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    writer_qos_mismatch (wr, reason);
 | 
			
		||||
    reader_qos_mismatch (rd, reason);
 | 
			
		||||
    writer_qos_mismatch (wr, (uint32_t)reason);
 | 
			
		||||
    reader_qos_mismatch (rd, (uint32_t)reason);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  reader_add_local_connection (rd, wr);
 | 
			
		||||
| 
						 | 
				
			
			@ -3882,10 +3883,11 @@ uint64_t participant_instance_id (const struct nn_guid *guid)
 | 
			
		|||
 | 
			
		||||
/* PROXY-GROUP --------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp)
 | 
			
		||||
int new_proxy_group (const struct nn_guid *guid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp)
 | 
			
		||||
{
 | 
			
		||||
  struct proxy_participant *proxypp;
 | 
			
		||||
  nn_guid_t ppguid;
 | 
			
		||||
  (void)timestamp;
 | 
			
		||||
  ppguid.prefix = guid->prefix;
 | 
			
		||||
  ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
 | 
			
		||||
  if ((proxypp = ephash_lookup_proxy_participant_guid (&ppguid)) == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -3948,6 +3950,8 @@ int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, cons
 | 
			
		|||
static void delete_proxy_group_locked (struct proxy_group *pgroup, nn_wctime_t timestamp, int isimplicit)
 | 
			
		||||
{
 | 
			
		||||
  struct proxy_participant *proxypp = pgroup->proxypp;
 | 
			
		||||
  (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));
 | 
			
		||||
  ut_avlDelete (&proxypp_groups_treedef, &proxypp->groups, pgroup);
 | 
			
		||||
| 
						 | 
				
			
			@ -4032,7 +4036,7 @@ int new_proxy_writer (const struct nn_guid *ppguid, const struct nn_guid *guid,
 | 
			
		|||
  struct proxy_writer *pwr;
 | 
			
		||||
  int isreliable;
 | 
			
		||||
  nn_mtime_t tnow = now_mt ();
 | 
			
		||||
 | 
			
		||||
  (void)timestamp;
 | 
			
		||||
  assert (is_writer_entityid (guid->entityid));
 | 
			
		||||
  assert (ephash_lookup_proxy_writer_guid (guid) == NULL);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4224,6 +4228,8 @@ static void gc_delete_proxy_writer (struct gcreq *gcreq)
 | 
			
		|||
int delete_proxy_writer (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit)
 | 
			
		||||
{
 | 
			
		||||
  struct proxy_writer *pwr;
 | 
			
		||||
  (void)timestamp;
 | 
			
		||||
  (void)isimplicit;
 | 
			
		||||
  nn_log (LC_DISCOVERY, "delete_proxy_writer (%x:%x:%x:%x) ", PGUID (*guid));
 | 
			
		||||
  os_mutexLock (&gv.lock);
 | 
			
		||||
  if ((pwr = ephash_lookup_proxy_writer_guid (guid)) == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -4255,6 +4261,7 @@ int new_proxy_reader (const struct nn_guid *ppguid, const struct nn_guid *guid,
 | 
			
		|||
  struct proxy_participant *proxypp;
 | 
			
		||||
  struct proxy_reader *prd;
 | 
			
		||||
  nn_mtime_t tnow = now_mt ();
 | 
			
		||||
  (void)timestamp;
 | 
			
		||||
 | 
			
		||||
  assert (!is_writer_entityid (guid->entityid));
 | 
			
		||||
  assert (ephash_lookup_proxy_reader_guid (guid) == NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -4352,6 +4359,8 @@ static void gc_delete_proxy_reader (struct gcreq *gcreq)
 | 
			
		|||
int delete_proxy_reader (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit)
 | 
			
		||||
{
 | 
			
		||||
  struct proxy_reader *prd;
 | 
			
		||||
  (void)timestamp;
 | 
			
		||||
  (void)isimplicit;
 | 
			
		||||
  nn_log (LC_DISCOVERY, "delete_proxy_reader (%x:%x:%x:%x) ", PGUID (*guid));
 | 
			
		||||
  os_mutexLock (&gv.lock);
 | 
			
		||||
  if ((prd = ephash_lookup_proxy_reader_guid (guid)) == NULL)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,11 +38,11 @@ static const uint64_t unihashconsts[] = {
 | 
			
		|||
static uint32_t hash_entity_guid (const struct entity_common *c)
 | 
			
		||||
{
 | 
			
		||||
  return
 | 
			
		||||
    (int) (((((uint32_t) c->guid.prefix.u[0] + unihashconsts[0]) *
 | 
			
		||||
             ((uint32_t) c->guid.prefix.u[1] + unihashconsts[1])) +
 | 
			
		||||
            (((uint32_t) c->guid.prefix.u[2] + unihashconsts[2]) *
 | 
			
		||||
             ((uint32_t) c->guid.entityid.u  + unihashconsts[3])))
 | 
			
		||||
           >> 32);
 | 
			
		||||
    (uint32_t) (((((uint32_t) c->guid.prefix.u[0] + unihashconsts[0]) *
 | 
			
		||||
                  ((uint32_t) c->guid.prefix.u[1] + unihashconsts[1])) +
 | 
			
		||||
                 (((uint32_t) c->guid.prefix.u[2] + unihashconsts[2]) *
 | 
			
		||||
                  ((uint32_t) c->guid.entityid.u  + unihashconsts[3])))
 | 
			
		||||
                >> 32);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32_t hash_entity_guid_wrapper (const void *c)
 | 
			
		||||
| 
						 | 
				
			
			@ -121,6 +121,7 @@ static void *ephash_lookup_guid_int (const struct ephash *ephash, const struct n
 | 
			
		|||
  /* FIXME: could (now) require guid to be first in entity_common; entity_common already is first in entity */
 | 
			
		||||
  struct entity_common e;
 | 
			
		||||
  struct entity_common *res;
 | 
			
		||||
  (void)ephash;
 | 
			
		||||
  e.guid = *guid;
 | 
			
		||||
  res = ut_chhLookup (gv.guid_hash->hash, &e);
 | 
			
		||||
  if (res && res->kind == kind)
 | 
			
		||||
| 
						 | 
				
			
			@ -287,7 +288,7 @@ void *ephash_enum_next (struct ephash_enum *st)
 | 
			
		|||
  if (st->cur)
 | 
			
		||||
  {
 | 
			
		||||
    st->cur = ut_chhIterNext (&st->it);
 | 
			
		||||
    while (st->cur && (int)st->cur->kind != st->kind)
 | 
			
		||||
    while (st->cur && st->cur->kind != st->kind)
 | 
			
		||||
      st->cur = ut_chhIterNext (&st->it);
 | 
			
		||||
  }
 | 
			
		||||
  return res;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -199,6 +199,8 @@ _Check_return_ bool nn_freelist_push (_Inout_ struct nn_freelist *fl, _Inout_ _W
 | 
			
		|||
_Check_return_ _Ret_maybenull_ void *nn_freelist_pushmany (_Inout_ struct nn_freelist *fl, _Inout_opt_ _When_ (return != 0, _Post_invalid_) void *first, _Inout_opt_ _When_ (return != 0, _Post_invalid_) void *last, uint32_t n)
 | 
			
		||||
{
 | 
			
		||||
  void *m = first;
 | 
			
		||||
  (void)last;
 | 
			
		||||
  (void)n;
 | 
			
		||||
  while (m)
 | 
			
		||||
  {
 | 
			
		||||
    void *mnext = get_next (fl, m);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,8 @@ static void check(const struct inverse_uint32_set *set)
 | 
			
		|||
    assert(n->max <= set->max);
 | 
			
		||||
    assert(pn == NULL || n->min > pn->max+1);
 | 
			
		||||
  }
 | 
			
		||||
#else
 | 
			
		||||
  (void)set;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -199,11 +199,12 @@ static const uint32_t crc32_table[] = {
 | 
			
		|||
  0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
uint32_t crc32_calc (const void *buf, uint32_t length)
 | 
			
		||||
uint32_t crc32_calc (const void *buf, size_t length)
 | 
			
		||||
{
 | 
			
		||||
  const uint8_t *vptr = buf;
 | 
			
		||||
  uint32_t i, reg = 0;
 | 
			
		||||
  uint32_t reg = 0;
 | 
			
		||||
  uint8_t top;
 | 
			
		||||
  size_t i;
 | 
			
		||||
  for (i = 0; i < length; i++)
 | 
			
		||||
  {
 | 
			
		||||
    top = (uint8_t) (reg >> 24);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -222,7 +222,7 @@ static int set_reuse_options (os_socket socket)
 | 
			
		|||
 | 
			
		||||
static int bind_socket (os_socket socket, unsigned short port)
 | 
			
		||||
{
 | 
			
		||||
  int rc;
 | 
			
		||||
  os_result rc;
 | 
			
		||||
 | 
			
		||||
#if OS_SOCKET_HAS_IPV6
 | 
			
		||||
  if (config.transport_selector == TRANS_TCP6 || config.transport_selector == TRANS_UDP6)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ typedef struct nn_ipaddress_params_tmp {
 | 
			
		|||
 | 
			
		||||
struct dd {
 | 
			
		||||
  const unsigned char *buf;
 | 
			
		||||
  unsigned bufsz;
 | 
			
		||||
  size_t bufsz;
 | 
			
		||||
  unsigned bswap: 1;
 | 
			
		||||
  nn_protocol_version_t protocol_version;
 | 
			
		||||
  nn_vendorid_t vendorid;
 | 
			
		||||
| 
						 | 
				
			
			@ -90,9 +90,9 @@ static int trace_plist (const char *fmt, ...)
 | 
			
		|||
 | 
			
		||||
static void log_octetseq (logcat_t cat, unsigned n, const unsigned char *xs);
 | 
			
		||||
 | 
			
		||||
static unsigned align4u (unsigned x)
 | 
			
		||||
static size_t align4u (size_t x)
 | 
			
		||||
{
 | 
			
		||||
  return (x + 3u) & (unsigned)-4;
 | 
			
		||||
  return (x + 3u) & ~(size_t)3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int protocol_version_is_newer (nn_protocol_version_t pv)
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +101,7 @@ static int protocol_version_is_newer (nn_protocol_version_t pv)
 | 
			
		|||
  return (pv.major < mv.major) ? 0 : (pv.major > mv.major) ? 1 : (pv.minor > mv.minor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int validate_string (const struct dd *dd, unsigned *len)
 | 
			
		||||
static int validate_string (const struct dd *dd, size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  const struct cdrstring *x = (const struct cdrstring *) dd->buf;
 | 
			
		||||
  if (dd->bufsz < sizeof (struct cdrstring))
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +112,7 @@ static int validate_string (const struct dd *dd, unsigned *len)
 | 
			
		|||
  *len = dd->bswap ? bswap4u (x->length) : x->length;
 | 
			
		||||
  if (*len < 1 || *len > dd->bufsz - offsetof (struct cdrstring, contents))
 | 
			
		||||
  {
 | 
			
		||||
    TRACE (("plist/validate_string: length %u out of range\n", *len));
 | 
			
		||||
    TRACE (("plist/validate_string: length %" PRIuSIZE " out of range\n", *len));
 | 
			
		||||
    return ERR_INVALID;
 | 
			
		||||
  }
 | 
			
		||||
  if (x->contents[*len-1] != 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +123,7 @@ static int validate_string (const struct dd *dd, unsigned *len)
 | 
			
		|||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int alias_string (const unsigned char **ptr, const struct dd *dd, unsigned *len)
 | 
			
		||||
static int alias_string (const unsigned char **ptr, const struct dd *dd, size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  int rc;
 | 
			
		||||
  if ((rc = validate_string (dd, len)) < 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -153,7 +153,7 @@ static void unalias_string (char **str, int bswap)
 | 
			
		|||
  memcpy (*str, alias, len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int validate_octetseq (const struct dd *dd, unsigned *len)
 | 
			
		||||
static int validate_octetseq (const struct dd *dd, size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  const struct cdroctetseq *x = (const struct cdroctetseq *) dd->buf;
 | 
			
		||||
  if (dd->bufsz < offsetof (struct cdroctetseq, value))
 | 
			
		||||
| 
						 | 
				
			
			@ -166,14 +166,15 @@ static int validate_octetseq (const struct dd *dd, unsigned *len)
 | 
			
		|||
 | 
			
		||||
static int alias_octetseq (nn_octetseq_t *oseq, const struct dd *dd)
 | 
			
		||||
{
 | 
			
		||||
  unsigned len;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  int rc;
 | 
			
		||||
  if ((rc = validate_octetseq (dd, &len)) < 0)
 | 
			
		||||
    return rc;
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    const struct cdroctetseq *x = (const struct cdroctetseq *) dd->buf;
 | 
			
		||||
    oseq->length = len;
 | 
			
		||||
    assert(len <= UINT32_MAX); /* it really is an uint32_t on the wire */
 | 
			
		||||
    oseq->length = (uint32_t)len;
 | 
			
		||||
    oseq->value = (len == 0) ? NULL : (unsigned char *) x->value;
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +182,8 @@ static int alias_octetseq (nn_octetseq_t *oseq, const struct dd *dd)
 | 
			
		|||
 | 
			
		||||
static int alias_blob (nn_octetseq_t *oseq, const struct dd *dd)
 | 
			
		||||
{
 | 
			
		||||
  oseq->length = dd->bufsz;
 | 
			
		||||
  assert (dd->bufsz <= UINT32_MAX);
 | 
			
		||||
  oseq->length = (uint32_t)dd->bufsz;
 | 
			
		||||
  oseq->value = (oseq->length == 0) ? NULL : (unsigned char *) dd->buf;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -225,16 +227,16 @@ static int validate_stringseq (const struct dd *dd)
 | 
			
		|||
  {
 | 
			
		||||
    for (i = 0; i < n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      int rc;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t) (seqend - seq);
 | 
			
		||||
      if ((rc = validate_string (&dd1, &len1)) < 0)
 | 
			
		||||
      {
 | 
			
		||||
        TRACE (("plist/validate_stringseq: invalid string\n"));
 | 
			
		||||
        return rc;
 | 
			
		||||
      }
 | 
			
		||||
      seq += sizeof (unsigned) + align4u (len1);
 | 
			
		||||
      seq += sizeof (uint32_t) + align4u (len1);
 | 
			
		||||
    }
 | 
			
		||||
    if (i < n)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -266,7 +268,7 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
 | 
			
		|||
  memcpy (&strseq->n, seq, sizeof (strseq->n));
 | 
			
		||||
  if (dd->bswap)
 | 
			
		||||
    strseq->n = bswap4u (strseq->n);
 | 
			
		||||
  seq += sizeof (unsigned);
 | 
			
		||||
  seq += sizeof (uint32_t);
 | 
			
		||||
  if (strseq->n >= UINT_MAX / sizeof(*strs))
 | 
			
		||||
  {
 | 
			
		||||
    TRACE (("plist/alias_stringseq: length %u out of range\n", strseq->n));
 | 
			
		||||
| 
						 | 
				
			
			@ -281,9 +283,9 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
 | 
			
		|||
    strs = os_malloc (strseq->n * sizeof (*strs));
 | 
			
		||||
    for (i = 0; i < strseq->n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t)(seqend - seq);
 | 
			
		||||
      /* (const char **) to silence the compiler, unfortunately strseq
 | 
			
		||||
         can't have a const char **strs, that would require a const
 | 
			
		||||
         and a non-const version of it. */
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +294,7 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
 | 
			
		|||
        TRACE (("plist/alias_stringseq: invalid string\n"));
 | 
			
		||||
        goto fail;
 | 
			
		||||
      }
 | 
			
		||||
      seq += sizeof (unsigned) + align4u (len1);
 | 
			
		||||
      seq += sizeof (uint32_t) + align4u (len1);
 | 
			
		||||
    }
 | 
			
		||||
    if (i != strseq->n)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -358,11 +360,11 @@ assert (dest->strs == NULL);
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int validate_property (_In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  struct dd ddV = *dd;
 | 
			
		||||
  unsigned lenN;
 | 
			
		||||
  unsigned lenV;
 | 
			
		||||
  size_t lenN;
 | 
			
		||||
  size_t lenV;
 | 
			
		||||
  int rc;
 | 
			
		||||
 | 
			
		||||
  /* Check name. */
 | 
			
		||||
| 
						 | 
				
			
			@ -372,7 +374,7 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		|||
    TRACE (("plist/validate_property: name validation failed\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenN = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenN = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u(lenN);     /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -385,7 +387,7 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		|||
    TRACE (("plist/validate_property: value validation failed\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenV = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenV = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u(lenV);     /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  *len = lenN + lenV;
 | 
			
		||||
| 
						 | 
				
			
			@ -394,11 +396,11 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  struct dd ddV = *dd;
 | 
			
		||||
  unsigned lenN;
 | 
			
		||||
  unsigned lenV;
 | 
			
		||||
  size_t lenN;
 | 
			
		||||
  size_t lenV;
 | 
			
		||||
  int rc;
 | 
			
		||||
 | 
			
		||||
  /* Get name */
 | 
			
		||||
| 
						 | 
				
			
			@ -408,7 +410,7 @@ static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd,
 | 
			
		|||
    TRACE (("plist/alias_property: invalid name buffer\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenN = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenN = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u(lenN);     /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* Get value */
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +422,7 @@ static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd,
 | 
			
		|||
    TRACE (("plist/validate_property: invalid value buffer\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenV = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenV = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u (lenV);    /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* We got this from the wire; so it has been propagated. */
 | 
			
		||||
| 
						 | 
				
			
			@ -453,7 +455,7 @@ static void duplicate_property (_Out_ nn_property_t *dest, _In_ const nn_propert
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int validate_propertyseq (_In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  const unsigned char *seq = dd->buf;
 | 
			
		||||
  const unsigned char *seqend = seq + dd->bufsz;
 | 
			
		||||
| 
						 | 
				
			
			@ -481,10 +483,10 @@ static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		|||
  {
 | 
			
		||||
    for (i = 0; i < n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      int rc;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t) (seqend - seq);
 | 
			
		||||
      if ((rc = validate_property (&dd1, &len1)) != 0)
 | 
			
		||||
      {
 | 
			
		||||
        TRACE (("plist/validate_propertyseq: invalid property\n"));
 | 
			
		||||
| 
						 | 
				
			
			@ -498,12 +500,12 @@ static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		|||
      return ERR_INVALID;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  *len = align4u((unsigned)(seq - dd->buf));
 | 
			
		||||
  *len = align4u((size_t)(seq - dd->buf));
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  /* Not truly an alias: it allocates an array of pointers that alias
 | 
			
		||||
     the individual components. Also: see validate_propertyseq */
 | 
			
		||||
| 
						 | 
				
			
			@ -522,7 +524,7 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
 | 
			
		|||
  memcpy (&pseq->n, seq, sizeof (pseq->n));
 | 
			
		||||
  if (dd->bswap)
 | 
			
		||||
      pseq->n = bswap4u (pseq->n);
 | 
			
		||||
  seq += sizeof (unsigned);
 | 
			
		||||
  seq += sizeof (uint32_t);
 | 
			
		||||
  if (pseq->n >= UINT_MAX / sizeof(*props))
 | 
			
		||||
  {
 | 
			
		||||
    TRACE (("plist/alias_propertyseq: length %u out of range\n", pseq->n));
 | 
			
		||||
| 
						 | 
				
			
			@ -537,9 +539,9 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
 | 
			
		|||
    props = os_malloc (pseq->n * sizeof (*props));
 | 
			
		||||
    for (i = 0; i < pseq->n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t) (seqend - seq);
 | 
			
		||||
      if ((result = alias_property (&props[i], &dd1, &len1)) != 0)
 | 
			
		||||
      {
 | 
			
		||||
        TRACE (("plist/alias_propertyseq: invalid property\n"));
 | 
			
		||||
| 
						 | 
				
			
			@ -555,7 +557,7 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
 | 
			
		|||
    }
 | 
			
		||||
    pseq->props = props;
 | 
			
		||||
  }
 | 
			
		||||
  *len = align4u((unsigned)(seq - dd->buf));
 | 
			
		||||
  *len = align4u((size_t)(seq - dd->buf));
 | 
			
		||||
  return 0;
 | 
			
		||||
 fail:
 | 
			
		||||
  os_free (props);
 | 
			
		||||
| 
						 | 
				
			
			@ -608,11 +610,11 @@ static void duplicate_propertyseq (_Out_ nn_propertyseq_t *dest, _In_ const nn_p
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  struct dd ddV = *dd;
 | 
			
		||||
  unsigned lenN;
 | 
			
		||||
  unsigned lenV;
 | 
			
		||||
  size_t lenN;
 | 
			
		||||
  size_t lenV;
 | 
			
		||||
  int rc;
 | 
			
		||||
 | 
			
		||||
  /* Check name. */
 | 
			
		||||
| 
						 | 
				
			
			@ -622,7 +624,7 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
 | 
			
		|||
    TRACE (("plist/validate_property: name validation failed\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenN = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenN = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u(lenN);     /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* Check value. */
 | 
			
		||||
| 
						 | 
				
			
			@ -634,7 +636,7 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
 | 
			
		|||
    TRACE (("plist/validate_property: value validation failed\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenV = sizeof(unsigned) + /* cdr sequence len arg + */
 | 
			
		||||
  lenV = sizeof(uint32_t) + /* cdr sequence len arg + */
 | 
			
		||||
         align4u(lenV);     /* seqlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  *len = lenN + lenV;
 | 
			
		||||
| 
						 | 
				
			
			@ -643,11 +645,11 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  struct dd ddV = *dd;
 | 
			
		||||
  unsigned lenN;
 | 
			
		||||
  unsigned lenV;
 | 
			
		||||
  size_t lenN;
 | 
			
		||||
  size_t lenV;
 | 
			
		||||
  int rc;
 | 
			
		||||
 | 
			
		||||
  /* Get name */
 | 
			
		||||
| 
						 | 
				
			
			@ -657,7 +659,7 @@ static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const str
 | 
			
		|||
    TRACE (("plist/alias_property: invalid name buffer\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenN = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  lenN = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
         align4u(lenN);     /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* Get value */
 | 
			
		||||
| 
						 | 
				
			
			@ -669,7 +671,7 @@ static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const str
 | 
			
		|||
    TRACE (("plist/validate_property: invalid value buffer\n"));
 | 
			
		||||
    return rc;
 | 
			
		||||
  }
 | 
			
		||||
  lenV = sizeof(unsigned) +           /* cdr sequence len arg + */
 | 
			
		||||
  lenV = sizeof(uint32_t) +           /* cdr sequence len arg + */
 | 
			
		||||
         align4u(prop->value.length); /* seqlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* We got this from the wire; so it has been propagated. */
 | 
			
		||||
| 
						 | 
				
			
			@ -703,7 +705,7 @@ static void duplicate_binaryproperty (_Out_ nn_binaryproperty_t *dest, _In_ cons
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  const unsigned char *seq = dd->buf;
 | 
			
		||||
  const unsigned char *seqend = seq + dd->bufsz;
 | 
			
		||||
| 
						 | 
				
			
			@ -731,10 +733,10 @@ static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned
 | 
			
		|||
  {
 | 
			
		||||
    for (i = 0; i < n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      int rc;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t) (seqend - seq);
 | 
			
		||||
      if ((rc = validate_binaryproperty (&dd1, &len1)) != 0)
 | 
			
		||||
      {
 | 
			
		||||
        TRACE (("plist/validate_binarypropertyseq: invalid property\n"));
 | 
			
		||||
| 
						 | 
				
			
			@ -748,12 +750,12 @@ static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned
 | 
			
		|||
      return ERR_INVALID;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  *len = align4u((unsigned)(seq - dd->buf));
 | 
			
		||||
  *len = align4u((size_t)(seq - dd->buf));
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_Success_(return == 0)
 | 
			
		||||
static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ const struct dd *dd, _Out_ unsigned *len)
 | 
			
		||||
static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ const struct dd *dd, _Out_ size_t *len)
 | 
			
		||||
{
 | 
			
		||||
  /* Not truly an alias: it allocates an array of pointers that alias
 | 
			
		||||
     the individual components. Also: see validate_binarypropertyseq */
 | 
			
		||||
| 
						 | 
				
			
			@ -772,7 +774,7 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
 | 
			
		|||
  memcpy (&pseq->n, seq, sizeof (pseq->n));
 | 
			
		||||
  if (dd->bswap)
 | 
			
		||||
      pseq->n = bswap4u (pseq->n);
 | 
			
		||||
  seq += sizeof (unsigned);
 | 
			
		||||
  seq += sizeof (uint32_t);
 | 
			
		||||
  if (pseq->n >= UINT_MAX / sizeof(*props))
 | 
			
		||||
  {
 | 
			
		||||
    TRACE (("plist/alias_binarypropertyseq: length %u out of range\n", pseq->n));
 | 
			
		||||
| 
						 | 
				
			
			@ -787,9 +789,9 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
 | 
			
		|||
    props = os_malloc (pseq->n * sizeof (*props));
 | 
			
		||||
    for (i = 0; i < pseq->n && seq <= seqend; i++)
 | 
			
		||||
    {
 | 
			
		||||
      unsigned len1;
 | 
			
		||||
      size_t len1;
 | 
			
		||||
      dd1.buf = seq;
 | 
			
		||||
      dd1.bufsz = (unsigned) (seqend - seq);
 | 
			
		||||
      dd1.bufsz = (size_t) (seqend - seq);
 | 
			
		||||
      if ((result = alias_binaryproperty (&props[i], &dd1, &len1)) != 0)
 | 
			
		||||
      {
 | 
			
		||||
        TRACE (("plist/alias_binarypropertyseq: invalid property\n"));
 | 
			
		||||
| 
						 | 
				
			
			@ -805,7 +807,7 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
 | 
			
		|||
    }
 | 
			
		||||
    pseq->props = props;
 | 
			
		||||
  }
 | 
			
		||||
  *len = align4u((unsigned)(seq - dd->buf));
 | 
			
		||||
  *len = align4u((size_t)(seq - dd->buf));
 | 
			
		||||
  return 0;
 | 
			
		||||
 fail:
 | 
			
		||||
  os_free (props);
 | 
			
		||||
| 
						 | 
				
			
			@ -1012,7 +1014,7 @@ void nn_plist_unalias (nn_plist_t *ps)
 | 
			
		|||
static int do_octetseq (nn_octetseq_t *dst, uint64_t *present, uint64_t *aliased, uint64_t wanted, uint64_t fl, const struct dd *dd)
 | 
			
		||||
{
 | 
			
		||||
  int res;
 | 
			
		||||
  unsigned len;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  if (!(wanted & fl))
 | 
			
		||||
    return NN_STRICT_P ? validate_octetseq (dd, &len) : 0;
 | 
			
		||||
  if ((res = alias_octetseq (dst, dd)) >= 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -1039,7 +1041,7 @@ static int do_blob (nn_octetseq_t *dst, uint64_t *present, uint64_t *aliased, ui
 | 
			
		|||
static int do_string (char **dst, uint64_t *present, uint64_t *aliased, uint64_t wanted, uint64_t fl, const struct dd *dd)
 | 
			
		||||
{
 | 
			
		||||
  int res;
 | 
			
		||||
  unsigned len;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  if (!(wanted & fl))
 | 
			
		||||
    return NN_STRICT_P ? validate_string (dd, &len) : 0;
 | 
			
		||||
  if ((res = alias_string ((const unsigned char **) dst, dd, &len)) >= 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -1321,7 +1323,7 @@ int validate_liveliness_qospolicy (const nn_liveliness_qospolicy_t *q)
 | 
			
		|||
 | 
			
		||||
static void bswap_external_reliability_qospolicy (nn_external_reliability_qospolicy_t *qext)
 | 
			
		||||
{
 | 
			
		||||
  qext->kind = bswap4 (qext->kind);
 | 
			
		||||
  qext->kind = bswap4u (qext->kind);
 | 
			
		||||
  bswap_duration (&qext->max_blocking_time);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1915,9 +1917,9 @@ static int do_prismtech_participant_version_info (nn_prismtech_participant_versi
 | 
			
		|||
  else
 | 
			
		||||
  {
 | 
			
		||||
    int res;
 | 
			
		||||
    unsigned sz = NN_PRISMTECH_PARTICIPANT_VERSION_INFO_FIXED_CDRSIZE - sizeof(unsigned);
 | 
			
		||||
    unsigned *pu = (unsigned *)dd->buf;
 | 
			
		||||
    unsigned len;
 | 
			
		||||
    unsigned sz = NN_PRISMTECH_PARTICIPANT_VERSION_INFO_FIXED_CDRSIZE - sizeof(uint32_t);
 | 
			
		||||
    uint32_t *pu = (uint32_t *)dd->buf;
 | 
			
		||||
    size_t len;
 | 
			
		||||
    struct dd dd1 = *dd;
 | 
			
		||||
 | 
			
		||||
    memcpy (pvi, dd->buf, sz);
 | 
			
		||||
| 
						 | 
				
			
			@ -2069,7 +2071,7 @@ _Success_(return == 0)
 | 
			
		|||
static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present, _Inout_ uint64_t *aliased, _In_ uint64_t wanted, _In_ uint64_t fl, _In_ const struct dd *dd)
 | 
			
		||||
{
 | 
			
		||||
  struct dd ddtmp = *dd;
 | 
			
		||||
  unsigned len;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  int res;
 | 
			
		||||
 | 
			
		||||
  memset(dh, 0, sizeof(nn_dataholder_t));
 | 
			
		||||
| 
						 | 
				
			
			@ -2082,7 +2084,7 @@ static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present,
 | 
			
		|||
      /* check class_id */
 | 
			
		||||
      if ((res = validate_string (&ddtmp, &len)) == 0)
 | 
			
		||||
      {
 | 
			
		||||
        len = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
        len = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
              align4u(len);      /* strlen + possible padding */
 | 
			
		||||
        /* check properties */
 | 
			
		||||
        ddtmp.buf = &(dd->buf[len]);
 | 
			
		||||
| 
						 | 
				
			
			@ -2117,7 +2119,7 @@ static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present,
 | 
			
		|||
    TRACE (("plist/do_dataholder: invalid class_id\n"));
 | 
			
		||||
    return res;
 | 
			
		||||
  }
 | 
			
		||||
  len = sizeof(unsigned) + /* cdr string len arg + */
 | 
			
		||||
  len = sizeof(uint32_t) + /* cdr string len arg + */
 | 
			
		||||
        align4u(len);      /* strlen + possible padding */
 | 
			
		||||
 | 
			
		||||
  /* get properties */
 | 
			
		||||
| 
						 | 
				
			
			@ -3046,7 +3048,7 @@ int nn_plist_init_frommsg
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    dd.buf = (const unsigned char *) (par + 1);
 | 
			
		||||
    dd.bufsz = (unsigned) length;
 | 
			
		||||
    dd.bufsz = length;
 | 
			
		||||
    if ((res = init_one_parameter (dest, &dest_tmp, pwanted, qwanted, pid, &dd)) < 0)
 | 
			
		||||
    {
 | 
			
		||||
      /* make sure we print a trace message on error */
 | 
			
		||||
| 
						 | 
				
			
			@ -3070,7 +3072,7 @@ unsigned char *nn_plist_quickscan (struct nn_rsample_info *dest, const struct nn
 | 
			
		|||
     following parameter list, or NULL on error.  Most errors will go
 | 
			
		||||
     undetected, unlike nn_plist_init_frommsg(). */
 | 
			
		||||
  const unsigned char *pl;
 | 
			
		||||
 | 
			
		||||
  (void)rmsg;
 | 
			
		||||
  dest->statusinfo = 0;
 | 
			
		||||
  dest->pt_wr_info_zoff = NN_OFF_TO_ZOFF (0);
 | 
			
		||||
  dest->complex_qos = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1067,7 +1067,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
 | 
			
		|||
       gradually lowering rate.  If we just got a request for a
 | 
			
		||||
       retransmit, and there is more to be retransmitted, surely the
 | 
			
		||||
       rate should be kept up for now */
 | 
			
		||||
    writer_hbcontrol_note_asyncwrite (wr, &whcst, now_mt ());
 | 
			
		||||
    writer_hbcontrol_note_asyncwrite (wr, now_mt ());
 | 
			
		||||
  }
 | 
			
		||||
  /* If "final" flag not set, we must respond with a heartbeat. Do it
 | 
			
		||||
     now if we haven't done so already */
 | 
			
		||||
| 
						 | 
				
			
			@ -1543,7 +1543,7 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
 | 
			
		|||
    struct whc_state whcst;
 | 
			
		||||
    wr->whc->ops->get_state(wr->whc, &whcst);
 | 
			
		||||
    force_heartbeat_to_peer (wr, &whcst, prd, 1);
 | 
			
		||||
    writer_hbcontrol_note_asyncwrite (wr, &whcst, now_mt ());
 | 
			
		||||
    writer_hbcontrol_note_asyncwrite (wr, now_mt ());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 out:
 | 
			
		||||
| 
						 | 
				
			
			@ -1792,11 +1792,12 @@ static serstate_t make_raw_serstate
 | 
			
		|||
)
 | 
			
		||||
{
 | 
			
		||||
  serstate_t st = ddsi_serstate_new (topic);
 | 
			
		||||
  ddsi_serstate_set_msginfo (st, statusinfo, tstamp, NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (st, statusinfo, tstamp);
 | 
			
		||||
  st->kind = justkey ? STK_KEY : STK_DATA;
 | 
			
		||||
  /* the CDR header is always fully contained in the first fragment
 | 
			
		||||
     (see valid_DataFrag), so extracting it is easy */
 | 
			
		||||
  assert (fragchain->min == 0);
 | 
			
		||||
  (void)sz;
 | 
			
		||||
 | 
			
		||||
  /* alignment at head-of-stream is guaranteed, requesting 1 byte
 | 
			
		||||
     alignment is therefore fine for pasting together fragments of
 | 
			
		||||
| 
						 | 
				
			
			@ -1891,7 +1892,7 @@ static serdata_t extract_sample_from_data
 | 
			
		|||
    {
 | 
			
		||||
      serstate_t st;
 | 
			
		||||
      st = ddsi_serstate_new (topic);
 | 
			
		||||
      ddsi_serstate_set_msginfo (st, statusinfo, tstamp, NULL);
 | 
			
		||||
      ddsi_serstate_set_msginfo (st, statusinfo, tstamp);
 | 
			
		||||
      st->kind = STK_KEY;
 | 
			
		||||
      ddsi_serstate_append_blob (st, 1, sizeof (qos->keyhash), qos->keyhash.value);
 | 
			
		||||
      sample = ddsi_serstate_fix_with_key (st, topic, sampleinfo->bswap);
 | 
			
		||||
| 
						 | 
				
			
			@ -3285,8 +3286,8 @@ static int check_and_handle_deafness_recover(struct local_deaf_state *st)
 | 
			
		|||
      ddsi_conn_free(data);
 | 
			
		||||
      rebuildws = 1;
 | 
			
		||||
      st->state = LDSR_REJOIN;
 | 
			
		||||
      /* FALLS THROUGH */
 | 
			
		||||
    }
 | 
			
		||||
      /* FALLS THROUGH */
 | 
			
		||||
    case LDSR_REJOIN:
 | 
			
		||||
      TRACE(("check_and_handle_deafness_recover: state %d rejoin on disc socket\n", (int)st->state));
 | 
			
		||||
      if (ddsi_rejoin_transferred_mcgroups(gv.disc_conn_mc) < 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "os/os.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ cleanup_thread_state(
 | 
			
		|||
    _In_opt_ void *data)
 | 
			
		||||
{
 | 
			
		||||
    struct thread_state1 *ts = get_thread_state(os_threadIdSelf());
 | 
			
		||||
 | 
			
		||||
    (void)data;
 | 
			
		||||
    assert(ts->state == THREAD_STATE_ALIVE);
 | 
			
		||||
    assert(vtime_asleep_p(ts->vtime));
 | 
			
		||||
    reset_thread_state(ts);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ int64_t writer_hbcontrol_intv (const struct writer *wr, const struct whc_state *
 | 
			
		|||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow)
 | 
			
		||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, nn_mtime_t tnow)
 | 
			
		||||
{
 | 
			
		||||
  struct hbcontrol * const hbc = &wr->hbcontrol;
 | 
			
		||||
  nn_mtime_t tnext;
 | 
			
		||||
| 
						 | 
				
			
			@ -284,7 +284,7 @@ struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_
 | 
			
		|||
  /* Update statistics, intervals, scheduling of heartbeat event,
 | 
			
		||||
     &c. -- there's no real difference between async and sync so we
 | 
			
		||||
     reuse the async version. */
 | 
			
		||||
  writer_hbcontrol_note_asyncwrite (wr, whcst, tnow);
 | 
			
		||||
  writer_hbcontrol_note_asyncwrite (wr, tnow);
 | 
			
		||||
 | 
			
		||||
  *hbansreq = writer_hbcontrol_ack_required_generic (wr, whcst, tlast, tnow, 1);
 | 
			
		||||
  if (*hbansreq >= 2) {
 | 
			
		||||
| 
						 | 
				
			
			@ -467,6 +467,7 @@ int create_fragment_message (struct writer *wr, seqno_t seq, const struct nn_pli
 | 
			
		|||
  unsigned fragstart, fraglen;
 | 
			
		||||
  enum nn_xmsg_kind xmsg_kind = isnew ? NN_XMSG_KIND_DATA : NN_XMSG_KIND_DATA_REXMIT;
 | 
			
		||||
  int ret = 0;
 | 
			
		||||
  (void)plist;
 | 
			
		||||
 | 
			
		||||
  ASSERT_MUTEX_HELD (&wr->e.lock);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -920,7 +921,9 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
 | 
			
		|||
  wr->whc->ops->get_state(wr->whc, &whcst);
 | 
			
		||||
 | 
			
		||||
  {
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    nn_vendorid_t ownvendorid = MY_VENDOR_ID;
 | 
			
		||||
#endif
 | 
			
		||||
    ASSERT_MUTEX_HELD (&wr->e.lock);
 | 
			
		||||
    assert (wr->throttling == 0);
 | 
			
		||||
    assert (vtime_awake_p (lookup_thread_state ()->vtime));
 | 
			
		||||
| 
						 | 
				
			
			@ -1004,6 +1007,7 @@ static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_p
 | 
			
		|||
 | 
			
		||||
  /* If GC not allowed, we must be sure to never block when writing.  That is only the case for (true, aggressive) KEEP_LAST writers, and also only if there is no limit to how much unacknowledged data the WHC may contain. */
 | 
			
		||||
  assert(gc_allowed || (wr->xqos->history.kind == NN_KEEP_LAST_HISTORY_QOS && wr->aggressive_keep_last && wr->whc_low == INT32_MAX));
 | 
			
		||||
  (void)gc_allowed;
 | 
			
		||||
 | 
			
		||||
  if (ddsi_serdata_size (serdata) > config.max_sample_size)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1112,7 +1116,7 @@ static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_p
 | 
			
		|||
    else
 | 
			
		||||
    {
 | 
			
		||||
      if (wr->heartbeat_xevent)
 | 
			
		||||
        writer_hbcontrol_note_asyncwrite (wr, &whcst, tnow);
 | 
			
		||||
        writer_hbcontrol_note_asyncwrite (wr, tnow);
 | 
			
		||||
      enqueue_sample_wrlock_held (wr, seq, plist, serdata, NULL, 1);
 | 
			
		||||
      os_mutexUnlock (&wr->e.lock);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1138,7 +1138,7 @@ static void write_pmd_message (struct nn_xpack *xp, struct participant *pp, unsi
 | 
			
		|||
  serstate = ddsi_serstate_new (NULL);
 | 
			
		||||
  ddsi_serstate_append_blob (serstate, 4, sizeof (u.pad), &u.pmd);
 | 
			
		||||
  serstate_set_key (serstate, 0, &u.pmd);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
 | 
			
		||||
  ddsi_serstate_set_msginfo (serstate, 0, now ());
 | 
			
		||||
  serdata = ddsi_serstate_fix (serstate);
 | 
			
		||||
 | 
			
		||||
  /* HORRIBLE HACK ALERT -- serstate/serdata looks at whether topic is
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,9 +230,9 @@ struct nn_xpack
 | 
			
		|||
#endif /* DDSI_INCLUDE_ENCRYPTION */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static unsigned align4u (unsigned x)
 | 
			
		||||
static size_t align4u (size_t x)
 | 
			
		||||
{
 | 
			
		||||
  return (x + 3u) & (unsigned)-4;
 | 
			
		||||
  return (x + 3) & ~(size_t)3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* XMSGPOOL ------------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			@ -472,7 +472,7 @@ void nn_xmsg_submsg_init (struct nn_xmsg *msg, struct nn_xmsg_marker marker, Sub
 | 
			
		|||
{
 | 
			
		||||
  SubmessageHeader_t *hdr = (SubmessageHeader_t *) (msg->data->payload + marker.offset);
 | 
			
		||||
  assert (submsg_is_compatible (msg, smkind));
 | 
			
		||||
  hdr->submessageId = smkind;
 | 
			
		||||
  hdr->submessageId = (unsigned char)smkind;
 | 
			
		||||
  hdr->flags = PLATFORM_IS_LITTLE_ENDIAN ? SMFLAG_ENDIANNESS : 0;
 | 
			
		||||
  hdr->octetsToNextHeader = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -554,15 +554,15 @@ void nn_xmsg_add_entityid (struct nn_xmsg * m)
 | 
			
		|||
  nn_xmsg_submsg_setnext (m, sm);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nn_xmsg_serdata (struct nn_xmsg *m, serdata_t serdata, unsigned off, unsigned len)
 | 
			
		||||
void nn_xmsg_serdata (struct nn_xmsg *m, serdata_t serdata, size_t off, size_t len)
 | 
			
		||||
{
 | 
			
		||||
  if (!ddsi_serdata_is_empty (serdata))
 | 
			
		||||
  {
 | 
			
		||||
    unsigned len4 = align4u (len);
 | 
			
		||||
    size_t len4 = align4u (len);
 | 
			
		||||
    assert (m->refd_payload == NULL);
 | 
			
		||||
    m->refd_payload = ddsi_serdata_ref (serdata);
 | 
			
		||||
    m->refd_payload_iov.iov_base = (char *) &m->refd_payload->hdr + off;
 | 
			
		||||
    m->refd_payload_iov.iov_len = len4;
 | 
			
		||||
    m->refd_payload_iov.iov_len = (ddsi_iov_len_t) len4;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -752,13 +752,14 @@ void nn_xmsg_setwriterseq_fragid (struct nn_xmsg *msg, const nn_guid_t *wrguid,
 | 
			
		|||
  msg->kindspecific.data.wrfragid = wrfragid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *str)
 | 
			
		||||
size_t nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *str)
 | 
			
		||||
{
 | 
			
		||||
  unsigned len = (unsigned) strlen (str) + 1;
 | 
			
		||||
  size_t len = strlen (str) + 1;
 | 
			
		||||
  assert (len <= UINT32_MAX);
 | 
			
		||||
  if (buf) {
 | 
			
		||||
    /* Add cdr string */
 | 
			
		||||
    struct cdrstring *p = (struct cdrstring *) buf;
 | 
			
		||||
    p->length = len;
 | 
			
		||||
    p->length = (uint32_t)len;
 | 
			
		||||
    memcpy (p->contents, str, len);
 | 
			
		||||
    /* clear padding */
 | 
			
		||||
    if (len < align4u (len)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -770,7 +771,7 @@ unsigned nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *st
 | 
			
		|||
  return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octetseq_t *seq)
 | 
			
		||||
size_t nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octetseq_t *seq)
 | 
			
		||||
{
 | 
			
		||||
  unsigned len = seq->length;
 | 
			
		||||
  if (buf) {
 | 
			
		||||
| 
						 | 
				
			
			@ -783,15 +784,15 @@ unsigned nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octet
 | 
			
		|||
      memset (buf + len, 0, align4u (len) - len);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  len = 4 +           /* cdr sequence len arg + */
 | 
			
		||||
        align4u(len); /* seqlen + possible padding */
 | 
			
		||||
  return len;
 | 
			
		||||
  return 4 +           /* cdr sequence len arg + */
 | 
			
		||||
         align4u(len); /* seqlen + possible padding */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsigned nn_xmsg_add_dataholder_padded (_Inout_opt_ unsigned char *buf, const struct nn_dataholder *dh)
 | 
			
		||||
size_t nn_xmsg_add_dataholder_padded (_Inout_opt_ unsigned char *buf, const struct nn_dataholder *dh)
 | 
			
		||||
{
 | 
			
		||||
  unsigned i, len;
 | 
			
		||||
  unsigned i;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  unsigned dummy = 0;
 | 
			
		||||
  unsigned *cnt = &dummy;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -870,7 +871,8 @@ void nn_xmsg_addpar_octetseq (struct nn_xmsg *m, unsigned pid, const nn_octetseq
 | 
			
		|||
void nn_xmsg_addpar_stringseq (struct nn_xmsg *m, unsigned pid, const nn_stringseq_t *sseq)
 | 
			
		||||
{
 | 
			
		||||
  unsigned char *tmp;
 | 
			
		||||
  unsigned i, len = 0;
 | 
			
		||||
  uint32_t i;
 | 
			
		||||
  size_t len = 0;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < sseq->n; i++)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -879,8 +881,8 @@ void nn_xmsg_addpar_stringseq (struct nn_xmsg *m, unsigned pid, const nn_strings
 | 
			
		|||
 | 
			
		||||
  tmp = nn_xmsg_addpar (m, pid, 4 + len);
 | 
			
		||||
 | 
			
		||||
  *((unsigned *) tmp) = sseq->n;
 | 
			
		||||
  tmp += sizeof (int);
 | 
			
		||||
  *((uint32_t *) tmp) = sseq->n;
 | 
			
		||||
  tmp += sizeof (uint32_t);
 | 
			
		||||
  for (i = 0; i < sseq->n; i++)
 | 
			
		||||
  {
 | 
			
		||||
    tmp += nn_xmsg_add_string_padded(tmp, sseq->strs[i]);
 | 
			
		||||
| 
						 | 
				
			
			@ -995,11 +997,12 @@ void nn_xmsg_addpar_share (struct nn_xmsg *m, unsigned pid, const struct nn_shar
 | 
			
		|||
void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, unsigned pid, const struct nn_subscription_keys_qospolicy *q)
 | 
			
		||||
{
 | 
			
		||||
  unsigned char *tmp;
 | 
			
		||||
  unsigned i, len = 8; /* use_key_list, length of key_list */
 | 
			
		||||
  size_t len = 8; /* use_key_list, length of key_list */
 | 
			
		||||
  unsigned i;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < q->key_list.n; i++)
 | 
			
		||||
  {
 | 
			
		||||
    unsigned len1 = (unsigned) strlen (q->key_list.strs[i]) + 1;
 | 
			
		||||
    size_t len1 = strlen (q->key_list.strs[i]) + 1;
 | 
			
		||||
    len += 4 + align4u (len1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1011,13 +1014,14 @@ void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, unsigned pid, const st
 | 
			
		|||
      tmp[i] = 0;
 | 
			
		||||
  }
 | 
			
		||||
  tmp += sizeof (int);
 | 
			
		||||
  *((unsigned *) tmp) = q->key_list.n;
 | 
			
		||||
  tmp += sizeof (unsigned);
 | 
			
		||||
  *((uint32_t *) tmp) = q->key_list.n;
 | 
			
		||||
  tmp += sizeof (uint32_t);
 | 
			
		||||
  for (i = 0; i < q->key_list.n; i++)
 | 
			
		||||
  {
 | 
			
		||||
    struct cdrstring *p = (struct cdrstring *) tmp;
 | 
			
		||||
    unsigned len1 = (unsigned) strlen (q->key_list.strs[i]) + 1;
 | 
			
		||||
    p->length = len1;
 | 
			
		||||
    size_t len1 = strlen (q->key_list.strs[i]) + 1;
 | 
			
		||||
    assert (len1 <= UINT32_MAX);
 | 
			
		||||
    p->length = (uint32_t)len1;
 | 
			
		||||
    memcpy (p->contents, q->key_list.strs[i], len1);
 | 
			
		||||
    if (len1 < align4u (len1))
 | 
			
		||||
      memset (p->contents + len1, 0, align4u (len1) - len1);
 | 
			
		||||
| 
						 | 
				
			
			@ -1077,7 +1081,7 @@ void nn_xmsg_addpar_eotinfo (struct nn_xmsg *m, unsigned pid, const struct nn_pr
 | 
			
		|||
void nn_xmsg_addpar_dataholder (_In_ struct nn_xmsg *m, _In_ unsigned pid, _In_ const struct nn_dataholder *dh)
 | 
			
		||||
{
 | 
			
		||||
    unsigned char *tmp;
 | 
			
		||||
    unsigned len;
 | 
			
		||||
    size_t len;
 | 
			
		||||
 | 
			
		||||
    /* Get total payload length. */
 | 
			
		||||
    len = nn_xmsg_add_dataholder_padded(NULL, dh);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue