iid and tkmap are integral to this DDSI stack and should be part of it
They were made available from the DCPS layer to DDSI using some function pointers, but it makes more sense to have them as part of the DDSI core. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
19202d9de8
commit
29f542b916
30 changed files with 221 additions and 213 deletions
|
@ -13,7 +13,6 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds_alloc.c
|
dds_alloc.c
|
||||||
dds_builtin.c
|
dds_builtin.c
|
||||||
dds_coherent.c
|
dds_coherent.c
|
||||||
dds_iid.c
|
|
||||||
dds_participant.c
|
dds_participant.c
|
||||||
dds_reader.c
|
dds_reader.c
|
||||||
dds_writer.c
|
dds_writer.c
|
||||||
|
@ -24,7 +23,6 @@ PREPEND(srcs_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds_domain.c
|
dds_domain.c
|
||||||
dds_instance.c
|
dds_instance.c
|
||||||
dds_qos.c
|
dds_qos.c
|
||||||
dds_tkmap.c
|
|
||||||
dds_entity.c
|
dds_entity.c
|
||||||
dds_key.c
|
dds_key.c
|
||||||
dds_querycond.c
|
dds_querycond.c
|
||||||
|
@ -57,7 +55,6 @@ PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds__builtin.h
|
dds__builtin.h
|
||||||
dds__domain.h
|
dds__domain.h
|
||||||
dds__entity.h
|
dds__entity.h
|
||||||
dds__iid.h
|
|
||||||
dds__init.h
|
dds__init.h
|
||||||
dds__key.h
|
dds__key.h
|
||||||
dds__listener.h
|
dds__listener.h
|
||||||
|
@ -71,7 +68,6 @@ PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
dds__rhc.h
|
dds__rhc.h
|
||||||
dds__stream.h
|
dds__stream.h
|
||||||
dds__subscriber.h
|
dds__subscriber.h
|
||||||
dds__tkmap.h
|
|
||||||
dds__topic.h
|
dds__topic.h
|
||||||
dds__types.h
|
dds__types.h
|
||||||
dds__write.h
|
dds__write.h
|
||||||
|
|
|
@ -24,7 +24,7 @@ extern "C" {
|
||||||
struct rhc;
|
struct rhc;
|
||||||
struct nn_xqos;
|
struct nn_xqos;
|
||||||
struct ddsi_serdata;
|
struct ddsi_serdata;
|
||||||
struct tkmap_instance;
|
struct ddsi_tkmap_instance;
|
||||||
struct proxy_writer_info;
|
struct proxy_writer_info;
|
||||||
|
|
||||||
struct rhc * dds_rhc_new (dds_reader * reader, const struct ddsi_sertopic * topic);
|
struct rhc * dds_rhc_new (dds_reader * reader, const struct ddsi_sertopic * topic);
|
||||||
|
@ -36,7 +36,7 @@ uint32_t dds_rhc_lock_samples (struct rhc * rhc);
|
||||||
DDS_EXPORT bool dds_rhc_store
|
DDS_EXPORT bool dds_rhc_store
|
||||||
(
|
(
|
||||||
struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
||||||
struct ddsi_serdata * __restrict sample, struct tkmap_instance * __restrict tk
|
struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk
|
||||||
);
|
);
|
||||||
void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info);
|
void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info);
|
||||||
void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t wr_iid);
|
void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t wr_iid);
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
|
||||||
*
|
|
||||||
* This program and the accompanying materials are made available under the
|
|
||||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
|
||||||
* v. 1.0 which is available at
|
|
||||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
|
||||||
*/
|
|
||||||
#ifndef _DDS_TKMAP_H_
|
|
||||||
#define _DDS_TKMAP_H_
|
|
||||||
|
|
||||||
#include "dds__types.h"
|
|
||||||
#include "os/os_atomics.h"
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct tkmap;
|
|
||||||
struct ddsi_serdata;
|
|
||||||
struct dds_topic;
|
|
||||||
|
|
||||||
struct tkmap_instance
|
|
||||||
{
|
|
||||||
struct ddsi_serdata * m_sample;
|
|
||||||
struct tkmap * m_map;
|
|
||||||
uint64_t m_iid;
|
|
||||||
os_atomic_uint32_t m_refc;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct tkmap * dds_tkmap_new (void);
|
|
||||||
void dds_tkmap_free (_Inout_ _Post_invalid_ struct tkmap *tkmap);
|
|
||||||
void dds_tkmap_instance_ref (_In_ struct tkmap_instance *tk);
|
|
||||||
uint64_t dds_tkmap_lookup (_In_ struct tkmap *tkmap, _In_ const struct ddsi_serdata *serdata);
|
|
||||||
_Check_return_ bool dds_tkmap_get_key (_In_ struct tkmap * map, const struct ddsi_sertopic *topic, _In_ uint64_t iid, _Out_ void * sample);
|
|
||||||
_Check_return_ struct tkmap_instance * dds_tkmap_find(
|
|
||||||
_In_ struct ddsi_serdata * sd,
|
|
||||||
_In_ const bool rd,
|
|
||||||
_In_ const bool create);
|
|
||||||
_Check_return_ struct tkmap_instance * dds_tkmap_find_by_id (_In_ struct tkmap * map, _In_ uint64_t iid);
|
|
||||||
|
|
||||||
DDS_EXPORT _Check_return_ struct tkmap_instance * dds_tkmap_lookup_instance_ref (_In_ struct ddsi_serdata * sd);
|
|
||||||
DDS_EXPORT void dds_tkmap_instance_unref (_In_ struct tkmap_instance * tk);
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -259,13 +259,6 @@ typedef struct dds_waitset
|
||||||
}
|
}
|
||||||
dds_waitset;
|
dds_waitset;
|
||||||
|
|
||||||
typedef struct dds_iid
|
|
||||||
{
|
|
||||||
uint64_t counter;
|
|
||||||
uint32_t key[4];
|
|
||||||
}
|
|
||||||
dds_iid;
|
|
||||||
|
|
||||||
/* Globals */
|
/* Globals */
|
||||||
|
|
||||||
typedef struct dds_globals
|
typedef struct dds_globals
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
static int dds_domain_compare (const int32_t * a, const int32_t * b)
|
static int dds_domain_compare (const int32_t * a, const int32_t * b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__tkmap.h"
|
|
||||||
#include "dds__iid.h"
|
|
||||||
#include "dds__domain.h"
|
#include "dds__domain.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "dds__builtin.h"
|
#include "dds__builtin.h"
|
||||||
|
#include "ddsi/ddsi_iid.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_servicelease.h"
|
#include "ddsi/q_servicelease.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "ddsi/q_entity.h"
|
||||||
|
@ -239,7 +239,6 @@ extern void dds_fini (void)
|
||||||
|
|
||||||
static int dds__init_plugin (void)
|
static int dds__init_plugin (void)
|
||||||
{
|
{
|
||||||
dds_iid_init ();
|
|
||||||
if (dds_global.m_dur_init) (dds_global.m_dur_init) ();
|
if (dds_global.m_dur_init) (dds_global.m_dur_init) ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +246,6 @@ static int dds__init_plugin (void)
|
||||||
static void dds__fini_plugin (void)
|
static void dds__fini_plugin (void)
|
||||||
{
|
{
|
||||||
if (dds_global.m_dur_fini) (dds_global.m_dur_fini) ();
|
if (dds_global.m_dur_fini) (dds_global.m_dur_fini) ();
|
||||||
dds_iid_fini ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ddsi_plugin_init (void)
|
void ddsi_plugin_init (void)
|
||||||
|
@ -265,12 +263,6 @@ void ddsi_plugin_init (void)
|
||||||
ddsi_plugin.rhc_plugin.rhc_unregister_wr_fn = dds_rhc_unregister_wr;
|
ddsi_plugin.rhc_plugin.rhc_unregister_wr_fn = dds_rhc_unregister_wr;
|
||||||
ddsi_plugin.rhc_plugin.rhc_relinquish_ownership_fn = dds_rhc_relinquish_ownership;
|
ddsi_plugin.rhc_plugin.rhc_relinquish_ownership_fn = dds_rhc_relinquish_ownership;
|
||||||
ddsi_plugin.rhc_plugin.rhc_set_qos_fn = dds_rhc_set_qos;
|
ddsi_plugin.rhc_plugin.rhc_set_qos_fn = dds_rhc_set_qos;
|
||||||
ddsi_plugin.rhc_plugin.rhc_lookup_fn = dds_tkmap_lookup_instance_ref;
|
|
||||||
ddsi_plugin.rhc_plugin.rhc_unref_fn = dds_tkmap_instance_unref;
|
|
||||||
|
|
||||||
/* Register iid generator */
|
|
||||||
|
|
||||||
ddsi_plugin.iidgen_fn = dds_iid_gen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include "dds__write.h"
|
#include "dds__write.h"
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__tkmap.h"
|
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/q_entity.h"
|
#include "ddsi/q_entity.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "ddsi/q_thread.h"
|
||||||
|
@ -50,14 +50,14 @@ dds_dispose_ih(
|
||||||
return dds_dispose_ih_ts(writer, handle, dds_time());
|
return dds_dispose_ih_ts(writer, handle, dds_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tkmap_instance*
|
static struct ddsi_tkmap_instance*
|
||||||
dds_instance_find(
|
dds_instance_find(
|
||||||
_In_ const dds_topic *topic,
|
_In_ const dds_topic *topic,
|
||||||
_In_ const void *data,
|
_In_ const void *data,
|
||||||
_In_ const bool create)
|
_In_ const bool create)
|
||||||
{
|
{
|
||||||
struct ddsi_serdata *sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
struct ddsi_serdata *sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
||||||
struct tkmap_instance * inst = dds_tkmap_find (sd, false, create);
|
struct ddsi_tkmap_instance * inst = ddsi_tkmap_find (sd, false, create);
|
||||||
ddsi_serdata_unref (sd);
|
ddsi_serdata_unref (sd);
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,10 @@ dds_instance_remove(
|
||||||
_In_opt_ const void *data,
|
_In_opt_ const void *data,
|
||||||
_In_ dds_instance_handle_t handle)
|
_In_ dds_instance_handle_t handle)
|
||||||
{
|
{
|
||||||
struct tkmap_instance * inst;
|
struct ddsi_tkmap_instance * inst;
|
||||||
|
|
||||||
if (handle != DDS_HANDLE_NIL) {
|
if (handle != DDS_HANDLE_NIL) {
|
||||||
inst = dds_tkmap_find_by_id (gv.m_tkmap, handle);
|
inst = ddsi_tkmap_find_by_id (gv.m_tkmap, handle);
|
||||||
} else {
|
} else {
|
||||||
assert (data);
|
assert (data);
|
||||||
inst = dds_instance_find (topic, data, false);
|
inst = dds_instance_find (topic, data, false);
|
||||||
|
@ -83,7 +83,7 @@ dds_instance_remove(
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_awake(thr);
|
thread_state_awake(thr);
|
||||||
}
|
}
|
||||||
dds_tkmap_instance_unref (inst);
|
ddsi_tkmap_instance_unref (inst);
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep(thr);
|
thread_state_asleep(thr);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ dds_register_instance(
|
||||||
_Out_ dds_instance_handle_t *handle,
|
_Out_ dds_instance_handle_t *handle,
|
||||||
_In_ const void *data)
|
_In_ const void *data)
|
||||||
{
|
{
|
||||||
struct tkmap_instance * inst;
|
struct ddsi_tkmap_instance * inst;
|
||||||
dds_entity *wr;
|
dds_entity *wr;
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds__retcode_t rc;
|
||||||
|
@ -241,7 +241,7 @@ dds_unregister_instance_ih_ts(
|
||||||
bool autodispose = true;
|
bool autodispose = true;
|
||||||
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
dds_write_action action = DDS_WR_ACTION_UNREGISTER;
|
||||||
dds_entity *wr;
|
dds_entity *wr;
|
||||||
struct tkmap *map;
|
struct ddsi_tkmap *map;
|
||||||
const dds_topic *topic;
|
const dds_topic *topic;
|
||||||
void *sample;
|
void *sample;
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ dds_unregister_instance_ih_ts(
|
||||||
map = gv.m_tkmap;
|
map = gv.m_tkmap;
|
||||||
topic = dds_instance_info((dds_entity*)wr);
|
topic = dds_instance_info((dds_entity*)wr);
|
||||||
sample = dds_alloc (topic->m_descriptor->m_size);
|
sample = dds_alloc (topic->m_descriptor->m_size);
|
||||||
if (dds_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
|
if (ddsi_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
|
||||||
ret = dds_write_impl ((dds_writer*)wr, sample, timestamp, action);
|
ret = dds_write_impl ((dds_writer*)wr, sample, timestamp, action);
|
||||||
} else{
|
} else{
|
||||||
DDS_ERROR("No instance related with the provided handle is found\n");
|
DDS_ERROR("No instance related with the provided handle is found\n");
|
||||||
|
@ -354,10 +354,10 @@ dds_dispose_ih_ts(
|
||||||
|
|
||||||
rc = dds_writer_lock(writer, &wr);
|
rc = dds_writer_lock(writer, &wr);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
struct tkmap *map = gv.m_tkmap;
|
struct ddsi_tkmap *map = gv.m_tkmap;
|
||||||
const dds_topic *topic = dds_instance_info((dds_entity*)wr);
|
const dds_topic *topic = dds_instance_info((dds_entity*)wr);
|
||||||
void *sample = dds_alloc (topic->m_descriptor->m_size);
|
void *sample = dds_alloc (topic->m_descriptor->m_size);
|
||||||
if (dds_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
|
if (ddsi_tkmap_get_key (map, topic->m_stopic, handle, sample)) {
|
||||||
ret = dds_dispose_impl(wr, sample, handle, timestamp);
|
ret = dds_dispose_impl(wr, sample, handle, timestamp);
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR("No instance related with the provided handle is found\n");
|
DDS_ERROR("No instance related with the provided handle is found\n");
|
||||||
|
@ -381,7 +381,7 @@ dds_instance_lookup(
|
||||||
{
|
{
|
||||||
dds_instance_handle_t ih = DDS_HANDLE_NIL;
|
dds_instance_handle_t ih = DDS_HANDLE_NIL;
|
||||||
const dds_topic * topic;
|
const dds_topic * topic;
|
||||||
struct tkmap * map = gv.m_tkmap;
|
struct ddsi_tkmap * map = gv.m_tkmap;
|
||||||
struct ddsi_serdata *sd;
|
struct ddsi_serdata *sd;
|
||||||
|
|
||||||
if(data == NULL){
|
if(data == NULL){
|
||||||
|
@ -392,7 +392,7 @@ dds_instance_lookup(
|
||||||
topic = dds_instance_info_by_hdl (entity);
|
topic = dds_instance_info_by_hdl (entity);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
sd = ddsi_serdata_from_sample (topic->m_stopic, SDK_KEY, data);
|
||||||
ih = dds_tkmap_lookup (map, sd);
|
ih = ddsi_tkmap_lookup (map, sd);
|
||||||
ddsi_serdata_unref (sd);
|
ddsi_serdata_unref (sd);
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR("Acquired topic is NULL\n");
|
DDS_ERROR("Acquired topic is NULL\n");
|
||||||
|
@ -410,7 +410,7 @@ dds_instance_get_key(
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
const dds_topic * topic;
|
const dds_topic * topic;
|
||||||
struct tkmap * map = gv.m_tkmap;
|
struct ddsi_tkmap * map = gv.m_tkmap;
|
||||||
|
|
||||||
if(data == NULL){
|
if(data == NULL){
|
||||||
DDS_ERROR("Argument data is NULL\n");
|
DDS_ERROR("Argument data is NULL\n");
|
||||||
|
@ -426,7 +426,7 @@ dds_instance_get_key(
|
||||||
}
|
}
|
||||||
memset (data, 0, topic->m_descriptor->m_size);
|
memset (data, 0, topic->m_descriptor->m_size);
|
||||||
|
|
||||||
if (dds_tkmap_get_key (map, topic->m_stopic, inst, data)) {
|
if (ddsi_tkmap_get_key (map, topic->m_stopic, inst, data)) {
|
||||||
ret = DDS_RETCODE_OK;
|
ret = DDS_RETCODE_OK;
|
||||||
} else{
|
} else{
|
||||||
DDS_ERROR("No instance related with the provided entity is found\n");
|
DDS_ERROR("No instance related with the provided entity is found\n");
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "ddsi/q_thread.h"
|
||||||
|
@ -137,7 +137,7 @@ dds_read_impl(
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (hand != DDS_HANDLE_NIL) {
|
if (hand != DDS_HANDLE_NIL) {
|
||||||
if (dds_tkmap_find_by_id(gv.m_tkmap, hand) == NULL) {
|
if (ddsi_tkmap_find_by_id(gv.m_tkmap, hand) == NULL) {
|
||||||
DDS_ERROR("Could not find instance\n");
|
DDS_ERROR("Could not find instance\n");
|
||||||
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
|
ret = DDS_ERRNO(DDS_RETCODE_PRECONDITION_NOT_MET);
|
||||||
dds_read_unlock(rd, cond);
|
dds_read_unlock(rd, cond);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "dds__entity.h"
|
#include "dds__entity.h"
|
||||||
#include "dds__reader.h"
|
#include "dds__reader.h"
|
||||||
#include "dds__rhc.h"
|
#include "dds__rhc.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "util/ut_hopscotch.h"
|
#include "util/ut_hopscotch.h"
|
||||||
|
|
||||||
#include "util/ut_avl.h"
|
#include "util/ut_avl.h"
|
||||||
|
@ -253,7 +253,7 @@ struct rhc_instance
|
||||||
nn_wctime_t tstamp; /* source time stamp of last update */
|
nn_wctime_t tstamp; /* source time stamp of last update */
|
||||||
struct rhc_instance *next; /* next non-empty instance in arbitrary ordering */
|
struct rhc_instance *next; /* next non-empty instance in arbitrary ordering */
|
||||||
struct rhc_instance *prev;
|
struct rhc_instance *prev;
|
||||||
struct tkmap_instance *tk; /* backref into TK for unref'ing */
|
struct ddsi_tkmap_instance *tk; /* backref into TK for unref'ing */
|
||||||
struct rhc_sample a_sample; /* pre-allocated storage for 1 sample */
|
struct rhc_sample a_sample; /* pre-allocated storage for 1 sample */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ static void free_instance (void *vnode, void *varg)
|
||||||
{
|
{
|
||||||
remove_inst_from_nonempty_list (rhc, inst);
|
remove_inst_from_nonempty_list (rhc, inst);
|
||||||
}
|
}
|
||||||
dds_tkmap_instance_unref (inst->tk);
|
ddsi_tkmap_instance_unref (inst->tk);
|
||||||
dds_free (inst);
|
dds_free (inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,12 +1023,12 @@ static struct rhc_instance * alloc_new_instance
|
||||||
(
|
(
|
||||||
const struct proxy_writer_info *pwr_info,
|
const struct proxy_writer_info *pwr_info,
|
||||||
struct ddsi_serdata *serdata,
|
struct ddsi_serdata *serdata,
|
||||||
struct tkmap_instance *tk
|
struct ddsi_tkmap_instance *tk
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct rhc_instance *inst;
|
struct rhc_instance *inst;
|
||||||
|
|
||||||
dds_tkmap_instance_ref (tk);
|
ddsi_tkmap_instance_ref (tk);
|
||||||
inst = dds_alloc (sizeof (*inst));
|
inst = dds_alloc (sizeof (*inst));
|
||||||
inst->iid = tk->m_iid;
|
inst->iid = tk->m_iid;
|
||||||
inst->tk = tk;
|
inst->tk = tk;
|
||||||
|
@ -1052,7 +1052,7 @@ static rhc_store_result_t rhc_store_new_instance
|
||||||
struct rhc *rhc,
|
struct rhc *rhc,
|
||||||
const struct proxy_writer_info *pwr_info,
|
const struct proxy_writer_info *pwr_info,
|
||||||
struct ddsi_serdata *sample,
|
struct ddsi_serdata *sample,
|
||||||
struct tkmap_instance *tk,
|
struct ddsi_tkmap_instance *tk,
|
||||||
const bool has_data,
|
const bool has_data,
|
||||||
status_cb_data_t * cb_data
|
status_cb_data_t * cb_data
|
||||||
)
|
)
|
||||||
|
@ -1124,7 +1124,7 @@ static rhc_store_result_t rhc_store_new_instance
|
||||||
bool dds_rhc_store
|
bool dds_rhc_store
|
||||||
(
|
(
|
||||||
struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
||||||
struct ddsi_serdata * __restrict sample, struct tkmap_instance * __restrict tk
|
struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const uint64_t wr_iid = pwr_info->iid;
|
const uint64_t wr_iid = pwr_info->iid;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "ddsi/ddsi_sertopic.h"
|
||||||
#include "ddsi/q_ddsi_discovery.h"
|
#include "ddsi/q_ddsi_discovery.h"
|
||||||
#include "os/os_atomics.h"
|
#include "os/os_atomics.h"
|
||||||
#include "dds__iid.h"
|
#include "ddsi/ddsi_iid.h"
|
||||||
|
|
||||||
#define DDS_TOPIC_STATUS_MASK \
|
#define DDS_TOPIC_STATUS_MASK \
|
||||||
DDS_INCONSISTENT_TOPIC_STATUS
|
DDS_INCONSISTENT_TOPIC_STATUS
|
||||||
|
@ -423,7 +423,7 @@ dds_create_topic(
|
||||||
st = dds_alloc (sizeof (*st));
|
st = dds_alloc (sizeof (*st));
|
||||||
|
|
||||||
os_atomic_st32 (&st->c.refc, 1);
|
os_atomic_st32 (&st->c.refc, 1);
|
||||||
st->c.iid = dds_iid_gen ();
|
st->c.iid = ddsi_iid_gen ();
|
||||||
st->c.status_cb = dds_topic_status_cb;
|
st->c.status_cb = dds_topic_status_cb;
|
||||||
st->c.status_cb_entity = top;
|
st->c.status_cb_entity = top;
|
||||||
st->c.name_typename = key;
|
st->c.name_typename = key;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "ddsi/q_unused.h"
|
#include "ddsi/q_unused.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "ddsi/q_config.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
#include "util/ut_avl.h"
|
#include "util/ut_avl.h"
|
||||||
#include "util/ut_hopscotch.h"
|
#include "util/ut_hopscotch.h"
|
||||||
|
@ -55,7 +55,7 @@ struct whc_intvnode {
|
||||||
struct whc_idxnode {
|
struct whc_idxnode {
|
||||||
uint64_t iid;
|
uint64_t iid;
|
||||||
seqno_t prune_seq;
|
seqno_t prune_seq;
|
||||||
struct tkmap_instance *tk;
|
struct ddsi_tkmap_instance *tk;
|
||||||
unsigned headidx;
|
unsigned headidx;
|
||||||
#if __STDC_VERSION__ >= 199901L
|
#if __STDC_VERSION__ >= 199901L
|
||||||
struct whc_node *hist[];
|
struct whc_node *hist[];
|
||||||
|
@ -128,7 +128,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
|
||||||
static unsigned whc_default_remove_acked_messages (struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
static unsigned whc_default_remove_acked_messages (struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
||||||
static void whc_default_free_deferred_free_list (struct whc *whc, struct whc_node *deferred_free_list);
|
static void whc_default_free_deferred_free_list (struct whc *whc, struct whc_node *deferred_free_list);
|
||||||
static void whc_default_get_state(const struct whc *whc, struct whc_state *st);
|
static void whc_default_get_state(const struct whc *whc, struct whc_state *st);
|
||||||
static int whc_default_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk);
|
static int whc_default_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
|
||||||
static seqno_t whc_default_next_seq (const struct whc *whc, seqno_t seq);
|
static seqno_t whc_default_next_seq (const struct whc *whc, seqno_t seq);
|
||||||
static bool whc_default_borrow_sample (const struct whc *whc, seqno_t seq, struct whc_borrowed_sample *sample);
|
static bool whc_default_borrow_sample (const struct whc *whc, seqno_t seq, struct whc_borrowed_sample *sample);
|
||||||
static bool whc_default_borrow_sample_key (const struct whc *whc, const struct ddsi_serdata *serdata_key, struct whc_borrowed_sample *sample);
|
static bool whc_default_borrow_sample_key (const struct whc *whc, const struct ddsi_serdata *serdata_key, struct whc_borrowed_sample *sample);
|
||||||
|
@ -324,7 +324,7 @@ static struct whc_node *whc_findkey (const struct whc_impl *whc, const struct dd
|
||||||
} template;
|
} template;
|
||||||
struct whc_idxnode *n;
|
struct whc_idxnode *n;
|
||||||
check_whc (whc);
|
check_whc (whc);
|
||||||
template.idxn.iid = dds_tkmap_lookup(gv.m_tkmap, serdata_key);
|
template.idxn.iid = ddsi_tkmap_lookup(gv.m_tkmap, serdata_key);
|
||||||
n = ut_hhLookup (whc->idx_hash, &template.idxn);
|
n = ut_hhLookup (whc->idx_hash, &template.idxn);
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -537,7 +537,7 @@ static void delete_one_sample_from_idx (struct whc_impl *whc, struct whc_node *w
|
||||||
#endif
|
#endif
|
||||||
if (!ut_hhRemove (whc->idx_hash, idxn))
|
if (!ut_hhRemove (whc->idx_hash, idxn))
|
||||||
assert (0);
|
assert (0);
|
||||||
dds_tkmap_instance_unref(idxn->tk);
|
ddsi_tkmap_instance_unref(idxn->tk);
|
||||||
os_free (idxn);
|
os_free (idxn);
|
||||||
}
|
}
|
||||||
whcn->idxnode = NULL;
|
whcn->idxnode = NULL;
|
||||||
|
@ -1081,7 +1081,7 @@ static struct whc_node *whc_default_insert_seq (struct whc_impl *whc, seqno_t ma
|
||||||
return newn;
|
return newn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk)
|
static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
struct whc_impl * const whc = (struct whc_impl *)whc_generic;
|
||||||
struct whc_node *newn = NULL;
|
struct whc_node *newn = NULL;
|
||||||
|
@ -1190,7 +1190,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
|
||||||
unsigned i;
|
unsigned i;
|
||||||
idxn = os_malloc (sizeof (*idxn) + whc->idxdepth * sizeof (idxn->hist[0]));
|
idxn = os_malloc (sizeof (*idxn) + whc->idxdepth * sizeof (idxn->hist[0]));
|
||||||
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
|
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
|
||||||
dds_tkmap_instance_ref(tk);
|
ddsi_tkmap_instance_ref(tk);
|
||||||
idxn->iid = tk->m_iid;
|
idxn->iid = tk->m_iid;
|
||||||
idxn->tk = tk;
|
idxn->tk = tk;
|
||||||
idxn->prune_seq = 0;
|
idxn->prune_seq = 0;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "dds__writer.h"
|
#include "dds__writer.h"
|
||||||
#include "dds__write.h"
|
#include "dds__write.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/q_error.h"
|
#include "ddsi/q_error.h"
|
||||||
#include "ddsi/q_thread.h"
|
#include "ddsi/q_thread.h"
|
||||||
#include "ddsi/q_xmsg.h"
|
#include "ddsi/q_xmsg.h"
|
||||||
|
@ -115,7 +115,7 @@ static int
|
||||||
deliver_locally(
|
deliver_locally(
|
||||||
_In_ struct writer *wr,
|
_In_ struct writer *wr,
|
||||||
_In_ struct ddsi_serdata *payload,
|
_In_ struct ddsi_serdata *payload,
|
||||||
_In_ struct tkmap_instance *tk)
|
_In_ struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
dds_return_t ret = DDS_RETCODE_OK;
|
dds_return_t ret = DDS_RETCODE_OK;
|
||||||
os_mutexLock (&wr->rdary.rdary_lock);
|
os_mutexLock (&wr->rdary.rdary_lock);
|
||||||
|
@ -193,7 +193,7 @@ dds_write_impl(
|
||||||
const bool writekey = action & DDS_WR_KEY_BIT;
|
const bool writekey = action & DDS_WR_KEY_BIT;
|
||||||
dds_writer * writer = (dds_writer*) wr;
|
dds_writer * writer = (dds_writer*) wr;
|
||||||
struct writer * ddsi_wr = writer->m_wr;
|
struct writer * ddsi_wr = writer->m_wr;
|
||||||
struct tkmap_instance * tk;
|
struct ddsi_tkmap_instance * tk;
|
||||||
struct ddsi_serdata *d;
|
struct ddsi_serdata *d;
|
||||||
|
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
|
@ -220,7 +220,7 @@ dds_write_impl(
|
||||||
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
||||||
d->timestamp.v = tstamp;
|
d->timestamp.v = tstamp;
|
||||||
ddsi_serdata_ref(d);
|
ddsi_serdata_ref(d);
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (d);
|
tk = ddsi_tkmap_lookup_instance_ref(d);
|
||||||
w_rc = write_sample_gc (writer->m_xp, ddsi_wr, d, tk);
|
w_rc = write_sample_gc (writer->m_xp, ddsi_wr, d, tk);
|
||||||
|
|
||||||
if (w_rc >= 0) {
|
if (w_rc >= 0) {
|
||||||
|
@ -243,7 +243,7 @@ dds_write_impl(
|
||||||
ret = deliver_locally (ddsi_wr, d, tk);
|
ret = deliver_locally (ddsi_wr, d, tk);
|
||||||
}
|
}
|
||||||
ddsi_serdata_unref(d);
|
ddsi_serdata_unref(d);
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref(tk);
|
||||||
|
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep (thr);
|
thread_state_asleep (thr);
|
||||||
|
@ -267,7 +267,7 @@ dds_writecdr_impl(
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
const bool asleep = !vtime_awake_p (thr->vtime);
|
const bool asleep = !vtime_awake_p (thr->vtime);
|
||||||
struct writer * ddsi_wr = wr->m_wr;
|
struct writer * ddsi_wr = wr->m_wr;
|
||||||
struct tkmap_instance * tk;
|
struct ddsi_tkmap_instance * tk;
|
||||||
|
|
||||||
if (wr->m_topic->filter_fn) {
|
if (wr->m_topic->filter_fn) {
|
||||||
abort();
|
abort();
|
||||||
|
@ -283,7 +283,7 @@ dds_writecdr_impl(
|
||||||
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
||||||
d->timestamp.v = tstamp;
|
d->timestamp.v = tstamp;
|
||||||
ddsi_serdata_ref(d);
|
ddsi_serdata_ref(d);
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (d);
|
tk = ddsi_tkmap_lookup_instance_ref(d);
|
||||||
w_rc = write_sample_gc (wr->m_xp, ddsi_wr, d, tk);
|
w_rc = write_sample_gc (wr->m_xp, ddsi_wr, d, tk);
|
||||||
if (w_rc >= 0) {
|
if (w_rc >= 0) {
|
||||||
/* Flush out write unless configured to batch */
|
/* Flush out write unless configured to batch */
|
||||||
|
@ -306,7 +306,7 @@ dds_writecdr_impl(
|
||||||
ret = deliver_locally (ddsi_wr, d, tk);
|
ret = deliver_locally (ddsi_wr, d, tk);
|
||||||
}
|
}
|
||||||
ddsi_serdata_unref(d);
|
ddsi_serdata_unref(d);
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref(tk);
|
||||||
|
|
||||||
if (asleep) {
|
if (asleep) {
|
||||||
thread_state_asleep (thr);
|
thread_state_asleep (thr);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dds__qos.h"
|
#include "dds__qos.h"
|
||||||
#include "dds__err.h"
|
#include "dds__err.h"
|
||||||
#include "dds__init.h"
|
#include "dds__init.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
#include "ddsc/ddsc_project.h"
|
#include "ddsc/ddsc_project.h"
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ PREPEND(srcs_ddsi "${CMAKE_CURRENT_LIST_DIR}/src"
|
||||||
ddsi_sertopic.c
|
ddsi_sertopic.c
|
||||||
ddsi_sertopic_default.c
|
ddsi_sertopic_default.c
|
||||||
ddsi_rhc_plugin.c
|
ddsi_rhc_plugin.c
|
||||||
|
ddsi_iid.c
|
||||||
|
ddsi_tkmap.c
|
||||||
q_addrset.c
|
q_addrset.c
|
||||||
q_bitset_inlines.c
|
q_bitset_inlines.c
|
||||||
q_bswap.c
|
q_bswap.c
|
||||||
|
@ -74,6 +76,8 @@ PREPEND(hdrs_private_ddsi "${CMAKE_CURRENT_LIST_DIR}/include/ddsi"
|
||||||
ddsi_sertopic.h
|
ddsi_sertopic.h
|
||||||
ddsi_serdata_default.h
|
ddsi_serdata_default.h
|
||||||
ddsi_rhc_plugin.h
|
ddsi_rhc_plugin.h
|
||||||
|
ddsi_iid.h
|
||||||
|
ddsi_tkmap.h
|
||||||
probes-constants.h
|
probes-constants.h
|
||||||
q_addrset.h
|
q_addrset.h
|
||||||
q_align.h
|
q_align.h
|
||||||
|
|
|
@ -12,15 +12,25 @@
|
||||||
#ifndef _DDS_IID_H_
|
#ifndef _DDS_IID_H_
|
||||||
#define _DDS_IID_H_
|
#define _DDS_IID_H_
|
||||||
|
|
||||||
#include "dds__types.h"
|
#include "os/os.h"
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void dds_iid_init (void);
|
struct ddsi_iid {
|
||||||
void dds_iid_fini (void);
|
#if OS_ATOMIC64_SUPPORT
|
||||||
uint64_t dds_iid_gen (void);
|
os_atomic_uint64_t counter;
|
||||||
|
#else
|
||||||
|
os_mutex lock;
|
||||||
|
uint64_t counter;
|
||||||
|
#endif
|
||||||
|
uint32_t key[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
void ddsi_iid_init (void);
|
||||||
|
void ddsi_iid_fini (void);
|
||||||
|
uint64_t ddsi_iid_gen (void);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
struct rhc;
|
struct rhc;
|
||||||
struct nn_xqos;
|
struct nn_xqos;
|
||||||
struct tkmap_instance;
|
struct ddsi_tkmap_instance;
|
||||||
struct ddsi_serdata;
|
struct ddsi_serdata;
|
||||||
struct ddsi_sertopic;
|
struct ddsi_sertopic;
|
||||||
struct entity_common;
|
struct entity_common;
|
||||||
|
@ -33,14 +33,12 @@ struct ddsi_rhc_plugin
|
||||||
void (*rhc_fini_fn) (struct rhc *rhc);
|
void (*rhc_fini_fn) (struct rhc *rhc);
|
||||||
bool (*rhc_store_fn)
|
bool (*rhc_store_fn)
|
||||||
(struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
(struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info,
|
||||||
struct ddsi_serdata * __restrict sample, struct tkmap_instance * __restrict tk);
|
struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk);
|
||||||
void (*rhc_unregister_wr_fn)
|
void (*rhc_unregister_wr_fn)
|
||||||
(struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info);
|
(struct rhc * __restrict rhc, const struct proxy_writer_info * __restrict pwr_info);
|
||||||
void (*rhc_relinquish_ownership_fn)
|
void (*rhc_relinquish_ownership_fn)
|
||||||
(struct rhc * __restrict rhc, const uint64_t wr_iid);
|
(struct rhc * __restrict rhc, const uint64_t wr_iid);
|
||||||
void (*rhc_set_qos_fn) (struct rhc * rhc, const struct nn_xqos * qos);
|
void (*rhc_set_qos_fn) (struct rhc * rhc, const struct nn_xqos * qos);
|
||||||
struct tkmap_instance * (*rhc_lookup_fn) (struct ddsi_serdata *serdata);
|
|
||||||
void (*rhc_unref_fn) (struct tkmap_instance *tk);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void make_proxy_writer_info(struct proxy_writer_info *pwr_info, const struct entity_common *e, const struct nn_xqos *xqos);
|
void make_proxy_writer_info(struct proxy_writer_info *pwr_info, const struct entity_common *e, const struct nn_xqos *xqos);
|
||||||
|
|
52
src/core/ddsi/include/ddsi/ddsi_tkmap.h
Normal file
52
src/core/ddsi/include/ddsi/ddsi_tkmap.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials are made available under the
|
||||||
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||||
|
* v. 1.0 which is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
|
*/
|
||||||
|
#ifndef _DDS_TKMAP_H_
|
||||||
|
#define _DDS_TKMAP_H_
|
||||||
|
|
||||||
|
#include "dds__types.h"
|
||||||
|
#include "os/os_atomics.h"
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct ddsi_tkmap;
|
||||||
|
struct ddsi_serdata;
|
||||||
|
struct dds_topic;
|
||||||
|
|
||||||
|
struct ddsi_tkmap_instance
|
||||||
|
{
|
||||||
|
struct ddsi_serdata * m_sample;
|
||||||
|
struct ddsi_tkmap * m_map;
|
||||||
|
uint64_t m_iid;
|
||||||
|
os_atomic_uint32_t m_refc;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct ddsi_tkmap * ddsi_tkmap_new (void);
|
||||||
|
void ddsi_tkmap_free (_Inout_ _Post_invalid_ struct ddsi_tkmap *tkmap);
|
||||||
|
void ddsi_tkmap_instance_ref (_In_ struct ddsi_tkmap_instance *tk);
|
||||||
|
uint64_t ddsi_tkmap_lookup (_In_ struct ddsi_tkmap *tkmap, _In_ const struct ddsi_serdata *serdata);
|
||||||
|
_Check_return_ bool ddsi_tkmap_get_key (_In_ struct ddsi_tkmap * map, const struct ddsi_sertopic *topic, _In_ uint64_t iid, _Out_ void * sample);
|
||||||
|
_Check_return_ struct ddsi_tkmap_instance * ddsi_tkmap_find(
|
||||||
|
_In_ struct ddsi_serdata * sd,
|
||||||
|
_In_ const bool rd,
|
||||||
|
_In_ const bool create);
|
||||||
|
_Check_return_ struct ddsi_tkmap_instance * ddsi_tkmap_find_by_id (_In_ struct ddsi_tkmap * map, _In_ uint64_t iid);
|
||||||
|
|
||||||
|
DDS_EXPORT _Check_return_ struct ddsi_tkmap_instance * ddsi_tkmap_lookup_instance_ref (_In_ struct ddsi_serdata * sd);
|
||||||
|
DDS_EXPORT void ddsi_tkmap_instance_unref (_In_ struct ddsi_tkmap_instance * tk);
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -414,10 +414,6 @@ struct ddsi_plugin
|
||||||
|
|
||||||
/* Read cache */
|
/* Read cache */
|
||||||
struct ddsi_rhc_plugin rhc_plugin;
|
struct ddsi_rhc_plugin rhc_plugin;
|
||||||
|
|
||||||
/* IID generator */
|
|
||||||
|
|
||||||
uint64_t (*iidgen_fn) (void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct config OSAPI_EXPORT config;
|
extern struct config OSAPI_EXPORT config;
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
|
|
||||||
#include "util/ut_fibheap.h"
|
#include "util/ut_fibheap.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ddsi/q_plist.h"
|
#include "ddsi/q_plist.h"
|
||||||
#include "ddsi/q_protocol.h"
|
#include "ddsi/q_protocol.h"
|
||||||
#include "ddsi/q_nwif.h"
|
#include "ddsi/q_nwif.h"
|
||||||
#include "ddsi/q_sockwaitset.h"
|
#include "ddsi/q_sockwaitset.h"
|
||||||
|
#include "ddsi/ddsi_iid.h"
|
||||||
|
|
||||||
#ifdef DDSI_INCLUDE_ENCRYPTION
|
#ifdef DDSI_INCLUDE_ENCRYPTION
|
||||||
#include "ddsi/q_security.h" /* for q_securityDecoderSet */
|
#include "ddsi/q_security.h" /* for q_securityDecoderSet */
|
||||||
|
@ -47,7 +47,7 @@ struct ddsi_tran_listener;
|
||||||
struct ddsi_tran_factory;
|
struct ddsi_tran_factory;
|
||||||
struct ut_thread_pool_s;
|
struct ut_thread_pool_s;
|
||||||
struct debug_monitor;
|
struct debug_monitor;
|
||||||
struct tkmap;
|
struct ddsi_tkmap;
|
||||||
|
|
||||||
typedef struct ospl_in_addr_node {
|
typedef struct ospl_in_addr_node {
|
||||||
nn_locator_t loc;
|
nn_locator_t loc;
|
||||||
|
@ -90,7 +90,8 @@ struct q_globals {
|
||||||
volatile int deaf;
|
volatile int deaf;
|
||||||
volatile int mute;
|
volatile int mute;
|
||||||
|
|
||||||
struct tkmap * m_tkmap;
|
struct ddsi_tkmap * m_tkmap;
|
||||||
|
struct ddsi_iid dds_iid;
|
||||||
|
|
||||||
/* Hash tables for participants, readers, writers, proxy
|
/* Hash tables for participants, readers, writers, proxy
|
||||||
participants, proxy readers and proxy writers by GUID
|
participants, proxy readers and proxy writers by GUID
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct writer;
|
||||||
struct whc_state;
|
struct whc_state;
|
||||||
struct proxy_reader;
|
struct proxy_reader;
|
||||||
struct ddsi_serdata;
|
struct ddsi_serdata;
|
||||||
struct tkmap_instance;
|
struct ddsi_tkmap_instance;
|
||||||
|
|
||||||
/* Writing new data; serdata_twrite (serdata) is assumed to be really
|
/* Writing new data; serdata_twrite (serdata) is assumed to be really
|
||||||
recentish; serdata is unref'd. If xp == NULL, data is queued, else
|
recentish; serdata is unref'd. If xp == NULL, data is queued, else
|
||||||
|
@ -34,8 +34,8 @@ struct tkmap_instance;
|
||||||
"nogc": no GC may occur, so it may not block to throttle the writer if the high water mark of the WHC is reached, which implies true KEEP_LAST behaviour. This is true for all the DDSI built-in writers.
|
"nogc": no GC may occur, so it may not block to throttle the writer if the high water mark of the WHC is reached, which implies true KEEP_LAST behaviour. This is true for all the DDSI built-in writers.
|
||||||
"gc": GC may occur, which means the writer history and watermarks can be anything. This must be used for all application data.
|
"gc": GC may occur, which means the writer history and watermarks can be anything. This must be used for all application data.
|
||||||
*/
|
*/
|
||||||
int write_sample_gc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct tkmap_instance *tk);
|
int write_sample_gc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
|
||||||
int write_sample_nogc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct tkmap_instance *tk);
|
int write_sample_nogc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
|
||||||
int write_sample_gc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata);
|
int write_sample_gc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata);
|
||||||
int write_sample_nogc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata);
|
int write_sample_nogc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern "C" {
|
||||||
|
|
||||||
struct ddsi_serdata;
|
struct ddsi_serdata;
|
||||||
struct nn_plist;
|
struct nn_plist;
|
||||||
struct tkmap_instance;
|
struct ddsi_tkmap_instance;
|
||||||
struct whc_node; /* opaque, but currently used for deferred free lists */
|
struct whc_node; /* opaque, but currently used for deferred free lists */
|
||||||
struct whc;
|
struct whc;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ typedef void (*whc_free_t)(struct whc *whc);
|
||||||
reliable readers that have not acknowledged all data */
|
reliable readers that have not acknowledged all data */
|
||||||
/* max_drop_seq must go soon, it's way too ugly. */
|
/* max_drop_seq must go soon, it's way too ugly. */
|
||||||
/* plist may be NULL or os_malloc'd, WHC takes ownership of plist */
|
/* plist may be NULL or os_malloc'd, WHC takes ownership of plist */
|
||||||
typedef int (*whc_insert_t)(struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk);
|
typedef int (*whc_insert_t)(struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
|
||||||
typedef unsigned (*whc_downgrade_to_volatile_t)(struct whc *whc, struct whc_state *st);
|
typedef unsigned (*whc_downgrade_to_volatile_t)(struct whc *whc, struct whc_state *st);
|
||||||
typedef unsigned (*whc_remove_acked_messages_t)(struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
typedef unsigned (*whc_remove_acked_messages_t)(struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
||||||
typedef void (*whc_free_deferred_free_list_t)(struct whc *whc, struct whc_node *deferred_free_list);
|
typedef void (*whc_free_deferred_free_list_t)(struct whc *whc, struct whc_node *deferred_free_list);
|
||||||
|
@ -118,7 +118,7 @@ inline bool whc_sample_iter_borrow_next (struct whc_sample_iter *it, struct whc_
|
||||||
inline void whc_free (struct whc *whc) {
|
inline void whc_free (struct whc *whc) {
|
||||||
whc->ops->free (whc);
|
whc->ops->free (whc);
|
||||||
}
|
}
|
||||||
inline int whc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk) {
|
inline int whc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk) {
|
||||||
return whc->ops->insert (whc, max_drop_seq, seq, plist, serdata, tk);
|
return whc->ops->insert (whc, max_drop_seq, seq, plist, serdata, tk);
|
||||||
}
|
}
|
||||||
inline unsigned whc_downgrade_to_volatile (struct whc *whc, struct whc_state *st) {
|
inline unsigned whc_downgrade_to_volatile (struct whc *whc, struct whc_state *st) {
|
||||||
|
|
|
@ -9,13 +9,10 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "dds__iid.h"
|
#include "ddsi/ddsi_iid.h"
|
||||||
#include "ddsi/q_time.h"
|
#include "ddsi/q_time.h"
|
||||||
#include "ddsi/q_globals.h"
|
#include "ddsi/q_globals.h"
|
||||||
|
|
||||||
static os_mutex dds_iid_lock_g;
|
|
||||||
static dds_iid dds_iid_g;
|
|
||||||
|
|
||||||
static void dds_tea_encrypt (uint32_t v[2], const uint32_t k[4])
|
static void dds_tea_encrypt (uint32_t v[2], const uint32_t k[4])
|
||||||
{
|
{
|
||||||
/* TEA encryption straight from Wikipedia */
|
/* TEA encryption straight from Wikipedia */
|
||||||
|
@ -43,37 +40,50 @@ static void dds_tea_decrypt (uint32_t v[2], const uint32_t k[4])
|
||||||
v[0]=v0; v[1]=v1;
|
v[0]=v0; v[1]=v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t dds_iid_gen (void)
|
uint64_t ddsi_iid_gen (void)
|
||||||
{
|
{
|
||||||
uint64_t iid;
|
uint64_t iid;
|
||||||
union { uint64_t u64; uint32_t u32[2]; } tmp;
|
union { uint64_t u64; uint32_t u32[2]; } tmp;
|
||||||
|
|
||||||
os_mutexLock (&dds_iid_lock_g);
|
#if OS_ATOMIC64_SUPPORT
|
||||||
tmp.u64 = ++dds_iid_g.counter;
|
tmp.u64 = os_atomic_inc64_nv (&gv.dds_iid.counter);
|
||||||
dds_tea_encrypt (tmp.u32, dds_iid_g.key);
|
#else
|
||||||
|
os_mutexLock (&gv.dds_iid.lock);
|
||||||
|
tmp.u64 = ++gv.dds_iid.counter;
|
||||||
|
os_mutexUnlock (&gv.dds_iid.lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
dds_tea_encrypt (tmp.u32, gv.dds_iid.key);
|
||||||
iid = tmp.u64;
|
iid = tmp.u64;
|
||||||
os_mutexUnlock (&dds_iid_lock_g);
|
|
||||||
return iid;
|
return iid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_iid_init (void)
|
void ddsi_iid_init (void)
|
||||||
{
|
{
|
||||||
union { uint64_t u64; uint32_t u32[2]; } tmp;
|
union { uint64_t u64; uint32_t u32[2]; } tmp;
|
||||||
nn_wctime_t tnow = now ();
|
nn_wctime_t tnow = now ();
|
||||||
|
|
||||||
os_mutexInit (&dds_iid_lock_g);
|
#if ! OS_ATOMIC64_SUPPORT
|
||||||
|
os_mutexInit (&gv.dds_iid.lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
dds_iid_g.key[0] = (uint32_t) ((uintptr_t) &dds_iid_g);
|
gv.dds_iid.key[0] = (uint32_t) os_procIdSelf();
|
||||||
dds_iid_g.key[1] = (uint32_t) tnow.v;
|
gv.dds_iid.key[1] = (uint32_t) tnow.v;
|
||||||
dds_iid_g.key[2] = (uint32_t) (tnow.v >> 32);
|
gv.dds_iid.key[2] = (uint32_t) (tnow.v >> 32);
|
||||||
dds_iid_g.key[3] = 0xdeadbeef;
|
gv.dds_iid.key[3] = 0xdeadbeef;
|
||||||
|
|
||||||
tmp.u64 = 0;
|
tmp.u64 = 0;
|
||||||
dds_tea_decrypt (tmp.u32, dds_iid_g.key);
|
dds_tea_decrypt (tmp.u32, gv.dds_iid.key);
|
||||||
dds_iid_g.counter = tmp.u64;
|
#if OS_ATOMIC64_SUPPORT
|
||||||
|
os_atomic_st64 (&gv.dds_iid.counter, tmp.u64);
|
||||||
|
#else
|
||||||
|
gv.dds_iid.counter = tmp.u64;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_iid_fini (void)
|
void ddsi_iid_fini (void)
|
||||||
{
|
{
|
||||||
os_mutexDestroy (&dds_iid_lock_g);
|
#if ! OS_ATOMIC64_SUPPORT
|
||||||
|
os_mutexDestroy (&gv.dds_iid.lock);
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "dds__key.h"
|
#include "dds__key.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "ddsi/q_radmin.h"
|
#include "ddsi/q_radmin.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h"
|
#include "ddsi/ddsi_serdata_default.h"
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "ddsi/q_globals.h"
|
#include "ddsi/q_globals.h"
|
||||||
#include "ddsi/q_config.h"
|
#include "ddsi/q_config.h"
|
||||||
#include "ddsi/sysdeps.h"
|
#include "ddsi/sysdeps.h"
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_iid.h"
|
||||||
#include "dds__iid.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "util/ut_hopscotch.h"
|
#include "util/ut_hopscotch.h"
|
||||||
#include "dds__stream.h"
|
#include "dds__stream.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#define REFC_DELETE 0x80000000
|
#define REFC_DELETE 0x80000000
|
||||||
#define REFC_MASK 0x0fffffff
|
#define REFC_MASK 0x0fffffff
|
||||||
|
|
||||||
struct tkmap
|
struct ddsi_tkmap
|
||||||
{
|
{
|
||||||
struct ut_chh * m_hh;
|
struct ut_chh * m_hh;
|
||||||
os_mutex m_lock;
|
os_mutex m_lock;
|
||||||
|
@ -49,20 +49,20 @@ static void gc_buckets (void *a)
|
||||||
|
|
||||||
static void gc_tkmap_instance_impl (struct gcreq *gcreq)
|
static void gc_tkmap_instance_impl (struct gcreq *gcreq)
|
||||||
{
|
{
|
||||||
struct tkmap_instance *tk = gcreq->arg;
|
struct ddsi_tkmap_instance *tk = gcreq->arg;
|
||||||
ddsi_serdata_unref (tk->m_sample);
|
ddsi_serdata_unref (tk->m_sample);
|
||||||
dds_free (tk);
|
dds_free (tk);
|
||||||
gcreq_free (gcreq);
|
gcreq_free (gcreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gc_tkmap_instance (struct tkmap_instance *tk)
|
static void gc_tkmap_instance (struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
struct gcreq *gcreq = gcreq_new (gv.gcreq_queue, gc_tkmap_instance_impl);
|
struct gcreq *gcreq = gcreq_new (gv.gcreq_queue, gc_tkmap_instance_impl);
|
||||||
gcreq->arg = tk;
|
gcreq->arg = tk;
|
||||||
gcreq_enqueue (gcreq);
|
gcreq_enqueue (gcreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t dds_tk_hash (const struct tkmap_instance * inst)
|
static uint32_t dds_tk_hash (const struct ddsi_tkmap_instance * inst)
|
||||||
{
|
{
|
||||||
return inst->m_sample->hash;
|
return inst->m_sample->hash;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ static uint32_t dds_tk_hash_void (const void * inst)
|
||||||
return dds_tk_hash (inst);
|
return dds_tk_hash (inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dds_tk_equals (const struct tkmap_instance *a, const struct tkmap_instance *b)
|
static int dds_tk_equals (const struct ddsi_tkmap_instance *a, const struct ddsi_tkmap_instance *b)
|
||||||
{
|
{
|
||||||
return (a->m_sample->ops == b->m_sample->ops) ? ddsi_serdata_eqkey (a->m_sample, b->m_sample) : 0;
|
return (a->m_sample->ops == b->m_sample->ops) ? ddsi_serdata_eqkey (a->m_sample, b->m_sample) : 0;
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ static int dds_tk_equals_void (const void *a, const void *b)
|
||||||
return dds_tk_equals (a, b);
|
return dds_tk_equals (a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tkmap * dds_tkmap_new (void)
|
struct ddsi_tkmap * ddsi_tkmap_new (void)
|
||||||
{
|
{
|
||||||
struct tkmap *tkmap = dds_alloc (sizeof (*tkmap));
|
struct ddsi_tkmap *tkmap = dds_alloc (sizeof (*tkmap));
|
||||||
tkmap->m_hh = ut_chhNew (1, dds_tk_hash_void, dds_tk_equals_void, gc_buckets);
|
tkmap->m_hh = ut_chhNew (1, dds_tk_hash_void, dds_tk_equals_void, gc_buckets);
|
||||||
os_mutexInit (&tkmap->m_lock);
|
os_mutexInit (&tkmap->m_lock);
|
||||||
os_condInit (&tkmap->m_cond, &tkmap->m_lock);
|
os_condInit (&tkmap->m_cond, &tkmap->m_lock);
|
||||||
|
@ -93,12 +93,12 @@ struct tkmap * dds_tkmap_new (void)
|
||||||
|
|
||||||
static void free_tkmap_instance (void *vtk, UNUSED_ARG(void *f_arg))
|
static void free_tkmap_instance (void *vtk, UNUSED_ARG(void *f_arg))
|
||||||
{
|
{
|
||||||
struct tkmap_instance *tk = vtk;
|
struct ddsi_tkmap_instance *tk = vtk;
|
||||||
ddsi_serdata_unref (tk->m_sample);
|
ddsi_serdata_unref (tk->m_sample);
|
||||||
os_free (tk);
|
os_free (tk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_tkmap_free (_Inout_ _Post_invalid_ struct tkmap * map)
|
void ddsi_tkmap_free (_Inout_ _Post_invalid_ struct ddsi_tkmap * map)
|
||||||
{
|
{
|
||||||
ut_chhEnumUnsafe (map->m_hh, free_tkmap_instance, NULL);
|
ut_chhEnumUnsafe (map->m_hh, free_tkmap_instance, NULL);
|
||||||
ut_chhFree (map->m_hh);
|
ut_chhFree (map->m_hh);
|
||||||
|
@ -107,10 +107,10 @@ void dds_tkmap_free (_Inout_ _Post_invalid_ struct tkmap * map)
|
||||||
dds_free (map);
|
dds_free (map);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t dds_tkmap_lookup (_In_ struct tkmap * map, _In_ const struct ddsi_serdata * sd)
|
uint64_t ddsi_tkmap_lookup (_In_ struct ddsi_tkmap * map, _In_ const struct ddsi_serdata * sd)
|
||||||
{
|
{
|
||||||
struct tkmap_instance dummy;
|
struct ddsi_tkmap_instance dummy;
|
||||||
struct tkmap_instance * tk;
|
struct ddsi_tkmap_instance * tk;
|
||||||
dummy.m_sample = (struct ddsi_serdata *) sd;
|
dummy.m_sample = (struct ddsi_serdata *) sd;
|
||||||
tk = ut_chhLookup (map->m_hh, &dummy);
|
tk = ut_chhLookup (map->m_hh, &dummy);
|
||||||
return (tk) ? tk->m_iid : DDS_HANDLE_NIL;
|
return (tk) ? tk->m_iid : DDS_HANDLE_NIL;
|
||||||
|
@ -127,7 +127,7 @@ tkmap_get_key_arg;
|
||||||
|
|
||||||
static void dds_tkmap_get_key_fn (void * vtk, void * varg)
|
static void dds_tkmap_get_key_fn (void * vtk, void * varg)
|
||||||
{
|
{
|
||||||
struct tkmap_instance * tk = vtk;
|
struct ddsi_tkmap_instance * tk = vtk;
|
||||||
tkmap_get_key_arg * arg = (tkmap_get_key_arg*) varg;
|
tkmap_get_key_arg * arg = (tkmap_get_key_arg*) varg;
|
||||||
if (tk->m_iid == arg->m_iid)
|
if (tk->m_iid == arg->m_iid)
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ static void dds_tkmap_get_key_fn (void * vtk, void * varg)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Check_return_
|
_Check_return_
|
||||||
bool dds_tkmap_get_key (_In_ struct tkmap * map, const struct ddsi_sertopic *topic, _In_ uint64_t iid, _Out_ void * sample)
|
bool ddsi_tkmap_get_key (_In_ struct ddsi_tkmap * map, const struct ddsi_sertopic *topic, _In_ uint64_t iid, _Out_ void * sample)
|
||||||
{
|
{
|
||||||
tkmap_get_key_arg arg = { topic, iid, sample, false };
|
tkmap_get_key_arg arg = { topic, iid, sample, false };
|
||||||
os_mutexLock (&map->m_lock);
|
os_mutexLock (&map->m_lock);
|
||||||
|
@ -149,13 +149,13 @@ bool dds_tkmap_get_key (_In_ struct tkmap * map, const struct ddsi_sertopic *top
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint64_t m_iid;
|
uint64_t m_iid;
|
||||||
struct tkmap_instance * m_inst;
|
struct ddsi_tkmap_instance * m_inst;
|
||||||
}
|
}
|
||||||
tkmap_get_inst_arg;
|
tkmap_get_inst_arg;
|
||||||
|
|
||||||
static void dds_tkmap_get_inst_fn (void * vtk, void * varg)
|
static void dds_tkmap_get_inst_fn (void * vtk, void * varg)
|
||||||
{
|
{
|
||||||
struct tkmap_instance * tk = vtk;
|
struct ddsi_tkmap_instance * tk = vtk;
|
||||||
tkmap_get_inst_arg * arg = (tkmap_get_inst_arg*) varg;
|
tkmap_get_inst_arg * arg = (tkmap_get_inst_arg*) varg;
|
||||||
if (tk->m_iid == arg->m_iid)
|
if (tk->m_iid == arg->m_iid)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ static void dds_tkmap_get_inst_fn (void * vtk, void * varg)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Check_return_
|
_Check_return_
|
||||||
struct tkmap_instance * dds_tkmap_find_by_id (_In_ struct tkmap * map, _In_ uint64_t iid)
|
struct ddsi_tkmap_instance * ddsi_tkmap_find_by_id (_In_ struct ddsi_tkmap * map, _In_ uint64_t iid)
|
||||||
{
|
{
|
||||||
tkmap_get_inst_arg arg = { iid, NULL };
|
tkmap_get_inst_arg arg = { iid, NULL };
|
||||||
ut_chhEnumUnsafe (map->m_hh, dds_tkmap_get_inst_fn, &arg);
|
ut_chhEnumUnsafe (map->m_hh, dds_tkmap_get_inst_fn, &arg);
|
||||||
|
@ -184,14 +184,14 @@ struct tkmap_instance * dds_tkmap_find_by_id (_In_ struct tkmap * map, _In_ uint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Check_return_
|
_Check_return_
|
||||||
struct tkmap_instance * dds_tkmap_find(
|
struct ddsi_tkmap_instance * ddsi_tkmap_find(
|
||||||
_In_ struct ddsi_serdata * sd,
|
_In_ struct ddsi_serdata * sd,
|
||||||
_In_ const bool rd,
|
_In_ const bool rd,
|
||||||
_In_ const bool create)
|
_In_ const bool create)
|
||||||
{
|
{
|
||||||
struct tkmap_instance dummy;
|
struct ddsi_tkmap_instance dummy;
|
||||||
struct tkmap_instance * tk;
|
struct ddsi_tkmap_instance * tk;
|
||||||
struct tkmap * map = gv.m_tkmap;
|
struct ddsi_tkmap * map = gv.m_tkmap;
|
||||||
|
|
||||||
dummy.m_sample = sd;
|
dummy.m_sample = sd;
|
||||||
retry:
|
retry:
|
||||||
|
@ -222,7 +222,7 @@ retry:
|
||||||
tk->m_sample = ddsi_serdata_to_topicless (sd);
|
tk->m_sample = ddsi_serdata_to_topicless (sd);
|
||||||
tk->m_map = map;
|
tk->m_map = map;
|
||||||
os_atomic_st32 (&tk->m_refc, 1);
|
os_atomic_st32 (&tk->m_refc, 1);
|
||||||
tk->m_iid = dds_iid_gen ();
|
tk->m_iid = ddsi_iid_gen ();
|
||||||
if (!ut_chhAdd (map->m_hh, tk))
|
if (!ut_chhAdd (map->m_hh, tk))
|
||||||
{
|
{
|
||||||
/* Lost a race from another thread, retry */
|
/* Lost a race from another thread, retry */
|
||||||
|
@ -240,18 +240,18 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Check_return_
|
_Check_return_
|
||||||
struct tkmap_instance * dds_tkmap_lookup_instance_ref (_In_ struct ddsi_serdata * sd)
|
struct ddsi_tkmap_instance * ddsi_tkmap_lookup_instance_ref (_In_ struct ddsi_serdata * sd)
|
||||||
{
|
{
|
||||||
assert (vtime_awake_p (lookup_thread_state ()->vtime));
|
assert (vtime_awake_p (lookup_thread_state ()->vtime));
|
||||||
return dds_tkmap_find (sd, true, true);
|
return ddsi_tkmap_find (sd, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_tkmap_instance_ref (_In_ struct tkmap_instance *tk)
|
void ddsi_tkmap_instance_ref (_In_ struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
os_atomic_inc32 (&tk->m_refc);
|
os_atomic_inc32 (&tk->m_refc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dds_tkmap_instance_unref (_In_ struct tkmap_instance * tk)
|
void ddsi_tkmap_instance_unref (_In_ struct ddsi_tkmap_instance * tk)
|
||||||
{
|
{
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
assert (vtime_awake_p(lookup_thread_state()->vtime));
|
assert (vtime_awake_p(lookup_thread_state()->vtime));
|
||||||
|
@ -267,7 +267,7 @@ void dds_tkmap_instance_unref (_In_ struct tkmap_instance * tk)
|
||||||
} while (!os_atomic_cas32(&tk->m_refc, old, new));
|
} while (!os_atomic_cas32(&tk->m_refc, old, new));
|
||||||
if (new == REFC_DELETE)
|
if (new == REFC_DELETE)
|
||||||
{
|
{
|
||||||
struct tkmap *map = tk->m_map;
|
struct ddsi_tkmap *map = tk->m_map;
|
||||||
|
|
||||||
/* Remove from hash table */
|
/* Remove from hash table */
|
||||||
int removed = ut_chhRemove(map->m_hh, tk);
|
int removed = ut_chhRemove(map->m_hh, tk);
|
|
@ -42,6 +42,8 @@
|
||||||
|
|
||||||
#include "ddsi/sysdeps.h"
|
#include "ddsi/sysdeps.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
|
#include "ddsi/ddsi_iid.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
|
|
||||||
struct deleted_participant {
|
struct deleted_participant {
|
||||||
ut_avlNode_t avlnode;
|
ut_avlNode_t avlnode;
|
||||||
|
@ -158,7 +160,7 @@ static void entity_common_init (struct entity_common *e, const struct nn_guid *g
|
||||||
e->guid = *guid;
|
e->guid = *guid;
|
||||||
e->kind = kind;
|
e->kind = kind;
|
||||||
e->name = os_strdup (name ? name : "");
|
e->name = os_strdup (name ? name : "");
|
||||||
e->iid = (ddsi_plugin.iidgen_fn) ();
|
e->iid = ddsi_iid_gen ();
|
||||||
os_mutexInit (&e->lock);
|
os_mutexInit (&e->lock);
|
||||||
e->onlylocal = onlylocal;
|
e->onlylocal = onlylocal;
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1615,7 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
|
||||||
struct proxy_writer_info pwr_info;
|
struct proxy_writer_info pwr_info;
|
||||||
struct ddsi_serdata *payload = sample.serdata;
|
struct ddsi_serdata *payload = sample.serdata;
|
||||||
/* FIXME: whc has tk reference in its index nodes, which is what we really should be iterating over anyway, and so we don't really have to look them up anymore */
|
/* FIXME: whc has tk reference in its index nodes, which is what we really should be iterating over anyway, and so we don't really have to look them up anymore */
|
||||||
struct tkmap_instance *tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (payload);
|
struct ddsi_tkmap_instance *tk = ddsi_tkmap_lookup_instance_ref(payload);
|
||||||
make_proxy_writer_info(&pwr_info, &wr->e, wr->xqos);
|
make_proxy_writer_info(&pwr_info, &wr->e, wr->xqos);
|
||||||
(void)(ddsi_plugin.rhc_plugin.rhc_store_fn) (rd->rhc, &pwr_info, payload, tk);
|
(void)(ddsi_plugin.rhc_plugin.rhc_store_fn) (rd->rhc, &pwr_info, payload, tk);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,9 @@
|
||||||
#include "ddsi/ddsi_mcgroup.h"
|
#include "ddsi/ddsi_mcgroup.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h"
|
#include "ddsi/ddsi_serdata_default.h"
|
||||||
|
|
||||||
#include "dds__tkmap.h"
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
|
#include "ddsi/ddsi_iid.h"
|
||||||
|
|
||||||
static void add_peer_addresses (struct addrset *as, const struct config_peer_listelem *list)
|
static void add_peer_addresses (struct addrset *as, const struct config_peer_listelem *list)
|
||||||
{
|
{
|
||||||
|
@ -772,7 +773,7 @@ static struct ddsi_sertopic *make_special_topic (uint16_t enc_id, const struct d
|
||||||
st->c.ops = &ddsi_sertopic_ops_default;
|
st->c.ops = &ddsi_sertopic_ops_default;
|
||||||
st->c.serdata_ops = ops;
|
st->c.serdata_ops = ops;
|
||||||
st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
|
st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
|
||||||
st->c.iid = ddsi_plugin.iidgen_fn();
|
st->c.iid = ddsi_iid_gen ();
|
||||||
st->native_encoding_identifier = enc_id;
|
st->native_encoding_identifier = enc_id;
|
||||||
st->nkeys = 1;
|
st->nkeys = 1;
|
||||||
return (struct ddsi_sertopic *)st;
|
return (struct ddsi_sertopic *)st;
|
||||||
|
@ -880,6 +881,7 @@ int rtps_init (void)
|
||||||
/* Initialize implementation (Lite or OSPL) */
|
/* Initialize implementation (Lite or OSPL) */
|
||||||
|
|
||||||
ddsi_plugin_init ();
|
ddsi_plugin_init ();
|
||||||
|
ddsi_iid_init ();
|
||||||
|
|
||||||
gv.tstart = now (); /* wall clock time, used in logs */
|
gv.tstart = now (); /* wall clock time, used in logs */
|
||||||
|
|
||||||
|
@ -1060,7 +1062,7 @@ int rtps_init (void)
|
||||||
gv.spdp_defrag = nn_defrag_new (NN_DEFRAG_DROP_OLDEST, config.defrag_unreliable_maxsamples);
|
gv.spdp_defrag = nn_defrag_new (NN_DEFRAG_DROP_OLDEST, config.defrag_unreliable_maxsamples);
|
||||||
gv.spdp_reorder = nn_reorder_new (NN_REORDER_MODE_ALWAYS_DELIVER, config.primary_reorder_maxsamples);
|
gv.spdp_reorder = nn_reorder_new (NN_REORDER_MODE_ALWAYS_DELIVER, config.primary_reorder_maxsamples);
|
||||||
|
|
||||||
gv.m_tkmap = dds_tkmap_new ();
|
gv.m_tkmap = ddsi_tkmap_new ();
|
||||||
|
|
||||||
if (gv.m_factory->m_connless)
|
if (gv.m_factory->m_connless)
|
||||||
{
|
{
|
||||||
|
@ -1339,7 +1341,7 @@ err_mc_conn:
|
||||||
ddsi_conn_free (gv.data_conn_uc);
|
ddsi_conn_free (gv.data_conn_uc);
|
||||||
free_group_membership(gv.mship);
|
free_group_membership(gv.mship);
|
||||||
err_unicast_sockets:
|
err_unicast_sockets:
|
||||||
dds_tkmap_free (gv.m_tkmap);
|
ddsi_tkmap_free (gv.m_tkmap);
|
||||||
nn_reorder_free (gv.spdp_reorder);
|
nn_reorder_free (gv.spdp_reorder);
|
||||||
nn_defrag_free (gv.spdp_defrag);
|
nn_defrag_free (gv.spdp_defrag);
|
||||||
os_mutexDestroy (&gv.spdp_lock);
|
os_mutexDestroy (&gv.spdp_lock);
|
||||||
|
@ -1368,6 +1370,7 @@ err_unicast_sockets:
|
||||||
nn_plist_fini (&gv.default_plist_pp);
|
nn_plist_fini (&gv.default_plist_pp);
|
||||||
ddsi_serdatapool_free (gv.serpool);
|
ddsi_serdatapool_free (gv.serpool);
|
||||||
nn_xmsgpool_free (gv.xmsgpool);
|
nn_xmsgpool_free (gv.xmsgpool);
|
||||||
|
ddsi_iid_fini ();
|
||||||
(ddsi_plugin.fini_fn) ();
|
(ddsi_plugin.fini_fn) ();
|
||||||
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
||||||
err_network_partition_addrset:
|
err_network_partition_addrset:
|
||||||
|
@ -1621,7 +1624,7 @@ void rtps_term (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dds_tkmap_free (gv.m_tkmap);
|
ddsi_tkmap_free (gv.m_tkmap);
|
||||||
|
|
||||||
ephash_free (gv.guid_hash);
|
ephash_free (gv.guid_hash);
|
||||||
gv.guid_hash = NULL;
|
gv.guid_hash = NULL;
|
||||||
|
@ -1663,6 +1666,7 @@ OS_WARNING_MSVC_ON(6001);
|
||||||
|
|
||||||
ddsi_serdatapool_free (gv.serpool);
|
ddsi_serdatapool_free (gv.serpool);
|
||||||
nn_xmsgpool_free (gv.xmsgpool);
|
nn_xmsgpool_free (gv.xmsgpool);
|
||||||
|
ddsi_iid_fini ();
|
||||||
(ddsi_plugin.fini_fn) ();
|
(ddsi_plugin.fini_fn) ();
|
||||||
DDS_LOG(DDS_LC_CONFIG, "Finis.\n");
|
DDS_LOG(DDS_LC_CONFIG, "Finis.\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "ddsi/q_globals.h"
|
#include "ddsi/q_globals.h"
|
||||||
#include "ddsi/q_static_assert.h"
|
#include "ddsi/q_static_assert.h"
|
||||||
#include "ddsi/q_init.h"
|
#include "ddsi/q_init.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_mcgroup.h"
|
#include "ddsi/ddsi_mcgroup.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h" /* FIXME: get rid of this */
|
#include "ddsi/ddsi_serdata_default.h" /* FIXME: get rid of this */
|
||||||
|
@ -1995,8 +1996,8 @@ static int deliver_user_data (const struct nn_rsample_info *sampleinfo, const st
|
||||||
the PRISMTECH_WRITER_INFO thing is completely meaningless to
|
the PRISMTECH_WRITER_INFO thing is completely meaningless to
|
||||||
us */
|
us */
|
||||||
{
|
{
|
||||||
struct tkmap_instance * tk;
|
struct ddsi_tkmap_instance * tk;
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (payload);
|
tk = ddsi_tkmap_lookup_instance_ref(payload);
|
||||||
if (tk)
|
if (tk)
|
||||||
{
|
{
|
||||||
struct proxy_writer_info pwr_info;
|
struct proxy_writer_info pwr_info;
|
||||||
|
@ -2075,7 +2076,7 @@ retry:
|
||||||
if (pwr_locked) os_mutexLock (&pwr->e.lock);
|
if (pwr_locked) os_mutexLock (&pwr->e.lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref (tk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ddsi_serdata_unref (payload);
|
ddsi_serdata_unref (payload);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "ddsi/q_unused.h"
|
#include "ddsi/q_unused.h"
|
||||||
#include "ddsi/q_hbcontrol.h"
|
#include "ddsi/q_hbcontrol.h"
|
||||||
#include "ddsi/q_static_assert.h"
|
#include "ddsi/q_static_assert.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_sertopic.h"
|
#include "ddsi/ddsi_sertopic.h"
|
||||||
|
|
||||||
|
@ -851,7 +851,7 @@ int enqueue_sample_wrlock_held (struct writer *wr, seqno_t seq, const struct nn_
|
||||||
return enqueued ? 0 : -1;
|
return enqueued ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int insert_sample_in_whc (struct writer *wr, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk)
|
static int insert_sample_in_whc (struct writer *wr, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
/* returns: < 0 on error, 0 if no need to insert in whc, > 0 if inserted */
|
/* returns: < 0 on error, 0 if no need to insert in whc, > 0 if inserted */
|
||||||
int do_insert, insres, res;
|
int do_insert, insres, res;
|
||||||
|
@ -1027,7 +1027,7 @@ static int maybe_grow_whc (struct writer *wr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk, int end_of_txn, int gc_allowed)
|
static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk, int end_of_txn, int gc_allowed)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
seqno_t seq;
|
seqno_t seq;
|
||||||
|
@ -1163,33 +1163,33 @@ drop:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sample_gc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct tkmap_instance *tk)
|
int write_sample_gc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
return write_sample_eot (xp, wr, NULL, serdata, tk, 0, 1);
|
return write_sample_eot (xp, wr, NULL, serdata, tk, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sample_nogc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct tkmap_instance *tk)
|
int write_sample_nogc (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk)
|
||||||
{
|
{
|
||||||
return write_sample_eot (xp, wr, NULL, serdata, tk, 0, 0);
|
return write_sample_eot (xp, wr, NULL, serdata, tk, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sample_gc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata)
|
int write_sample_gc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata)
|
||||||
{
|
{
|
||||||
struct tkmap_instance *tk;
|
struct ddsi_tkmap_instance *tk;
|
||||||
int res;
|
int res;
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (serdata);
|
tk = ddsi_tkmap_lookup_instance_ref (serdata);
|
||||||
res = write_sample_eot (xp, wr, NULL, serdata, tk, 0, 1);
|
res = write_sample_eot (xp, wr, NULL, serdata, tk, 0, 1);
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref (tk);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sample_nogc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata)
|
int write_sample_nogc_notk (struct nn_xpack *xp, struct writer *wr, struct ddsi_serdata *serdata)
|
||||||
{
|
{
|
||||||
struct tkmap_instance *tk;
|
struct ddsi_tkmap_instance *tk;
|
||||||
int res;
|
int res;
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (serdata);
|
tk = ddsi_tkmap_lookup_instance_ref (serdata);
|
||||||
res = write_sample_eot (xp, wr, NULL, serdata, tk, 0, 0);
|
res = write_sample_eot (xp, wr, NULL, serdata, tk, 0, 0);
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref (tk);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern inline void whc_return_sample (struct whc *whc, struct whc_borrowed_sampl
|
||||||
extern inline void whc_sample_iter_init (const struct whc *whc, struct whc_sample_iter *it);
|
extern inline void whc_sample_iter_init (const struct whc *whc, struct whc_sample_iter *it);
|
||||||
extern inline bool whc_sample_iter_borrow_next (struct whc_sample_iter *it, struct whc_borrowed_sample *sample);
|
extern inline bool whc_sample_iter_borrow_next (struct whc_sample_iter *it, struct whc_borrowed_sample *sample);
|
||||||
extern inline void whc_free (struct whc *whc);
|
extern inline void whc_free (struct whc *whc);
|
||||||
extern int whc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct tkmap_instance *tk);
|
extern int whc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, struct nn_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk);
|
||||||
extern unsigned whc_downgrade_to_volatile (struct whc *whc, struct whc_state *st);
|
extern unsigned whc_downgrade_to_volatile (struct whc *whc, struct whc_state *st);
|
||||||
extern unsigned whc_remove_acked_messages (struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
extern unsigned whc_remove_acked_messages (struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list);
|
||||||
extern void whc_free_deferred_free_list (struct whc *whc, struct whc_node *deferred_free_list);
|
extern void whc_free_deferred_free_list (struct whc *whc, struct whc_node *deferred_free_list);
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "ddsi/q_xmsg.h"
|
#include "ddsi/q_xmsg.h"
|
||||||
#include "ddsi/ddsi_serdata.h"
|
#include "ddsi/ddsi_serdata.h"
|
||||||
#include "ddsi/ddsi_serdata_default.h"
|
#include "ddsi/ddsi_serdata_default.h"
|
||||||
|
#include "ddsi/ddsi_tkmap.h"
|
||||||
#include "dds__whc.h"
|
#include "dds__whc.h"
|
||||||
|
|
||||||
#include "ddsi/sysdeps.h"
|
#include "ddsi/sysdeps.h"
|
||||||
|
@ -1128,7 +1129,7 @@ static void write_pmd_message (struct nn_xpack *xp, struct participant *pp, unsi
|
||||||
char pad[offsetof (ParticipantMessageData_t, value) + PMD_DATA_LENGTH];
|
char pad[offsetof (ParticipantMessageData_t, value) + PMD_DATA_LENGTH];
|
||||||
} u;
|
} u;
|
||||||
struct ddsi_serdata *serdata;
|
struct ddsi_serdata *serdata;
|
||||||
struct tkmap_instance *tk;
|
struct ddsi_tkmap_instance *tk;
|
||||||
|
|
||||||
if ((wr = get_builtin_writer (pp, NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER)) == NULL)
|
if ((wr = get_builtin_writer (pp, NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER)) == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1150,9 +1151,9 @@ static void write_pmd_message (struct nn_xpack *xp, struct participant *pp, unsi
|
||||||
serdata = ddsi_serdata_from_sample (gv.rawcdr_topic, SDK_DATA, &raw);
|
serdata = ddsi_serdata_from_sample (gv.rawcdr_topic, SDK_DATA, &raw);
|
||||||
serdata->timestamp = now ();
|
serdata->timestamp = now ();
|
||||||
|
|
||||||
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (serdata);
|
tk = ddsi_tkmap_lookup_instance_ref(serdata);
|
||||||
write_sample_nogc (xp, wr, serdata, tk);
|
write_sample_nogc (xp, wr, serdata, tk);
|
||||||
(ddsi_plugin.rhc_plugin.rhc_unref_fn) (tk);
|
ddsi_tkmap_instance_unref(tk);
|
||||||
#undef PMD_DATA_LENGTH
|
#undef PMD_DATA_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue