From 42500e7fb86ca1e11c45332e8cba8f95f3088c2c Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Mon, 15 Apr 2019 11:21:52 +0200 Subject: [PATCH] add participant instance handle to builtin topics Extend the endpoint built-in topic data with the participant instance handle (the GUID was already present). Having the instance handle available makes it trivial to look up the participant, whereas a lookup of the GUID is rather impractical. Signed-off-by: Erik Boasson --- src/core/ddsc/include/dds/dds.h | 1 + src/core/ddsc/src/dds__serdata_builtintopic.h | 1 + src/core/ddsc/src/dds_serdata_builtintopic.c | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/src/core/ddsc/include/dds/dds.h b/src/core/ddsc/include/dds/dds.h index 3d5dc42..d701117 100644 --- a/src/core/ddsc/include/dds/dds.h +++ b/src/core/ddsc/include/dds/dds.h @@ -210,6 +210,7 @@ typedef struct dds_builtintopic_endpoint { dds_builtintopic_guid_t key; dds_builtintopic_guid_t participant_key; + dds_instance_handle_t participant_instance_handle; char *topic_name; char *type_name; dds_qos_t *qos; diff --git a/src/core/ddsc/src/dds__serdata_builtintopic.h b/src/core/ddsc/src/dds__serdata_builtintopic.h index 46ccf88..6afe2d1 100644 --- a/src/core/ddsc/src/dds__serdata_builtintopic.h +++ b/src/core/ddsc/src/dds__serdata_builtintopic.h @@ -19,6 +19,7 @@ struct ddsi_serdata_builtintopic { struct ddsi_serdata c; nn_guid_t key; + dds_instance_handle_t pphandle; nn_xqos_t xqos; }; diff --git a/src/core/ddsc/src/dds_serdata_builtintopic.c b/src/core/ddsc/src/dds_serdata_builtintopic.c index b62d405..33da2ca 100644 --- a/src/core/ddsc/src/dds_serdata_builtintopic.c +++ b/src/core/ddsc/src/dds_serdata_builtintopic.c @@ -73,11 +73,13 @@ static struct ddsi_serdata_builtintopic *serdata_builtin_new(const struct ddsi_s static void from_entity_pp (struct ddsi_serdata_builtintopic *d, const struct participant *pp) { nn_xqos_copy(&d->xqos, &pp->plist->qos); + d->pphandle = pp->e.iid; } static void from_entity_proxypp (struct ddsi_serdata_builtintopic *d, const struct proxy_participant *proxypp) { nn_xqos_copy(&d->xqos, &proxypp->plist->qos); + d->pphandle = proxypp->e.iid; } static void set_topic_type_from_sertopic (struct ddsi_serdata_builtintopic *d, const struct ddsi_sertopic *tp) @@ -96,12 +98,14 @@ static void set_topic_type_from_sertopic (struct ddsi_serdata_builtintopic *d, c static void from_entity_rd (struct ddsi_serdata_builtintopic *d, const struct reader *rd) { + d->pphandle = rd->c.pp->e.iid; nn_xqos_copy(&d->xqos, rd->xqos); set_topic_type_from_sertopic(d, rd->topic); } static void from_entity_prd (struct ddsi_serdata_builtintopic *d, const struct proxy_reader *prd) { + d->pphandle = prd->c.proxypp->e.iid; nn_xqos_copy(&d->xqos, prd->c.xqos); assert (d->xqos.present & QP_TOPIC_NAME); assert (d->xqos.present & QP_TYPE_NAME); @@ -109,12 +113,14 @@ static void from_entity_prd (struct ddsi_serdata_builtintopic *d, const struct p static void from_entity_wr (struct ddsi_serdata_builtintopic *d, const struct writer *wr) { + d->pphandle = wr->c.pp->e.iid; nn_xqos_copy(&d->xqos, wr->xqos); set_topic_type_from_sertopic(d, wr->topic); } static void from_entity_pwr (struct ddsi_serdata_builtintopic *d, const struct proxy_writer *pwr) { + d->pphandle = pwr->c.proxypp->e.iid; nn_xqos_copy(&d->xqos, pwr->c.xqos); assert (d->xqos.present & QP_TOPIC_NAME); assert (d->xqos.present & QP_TYPE_NAME); @@ -219,6 +225,7 @@ static bool to_sample_endpoint (const struct ddsi_serdata_builtintopic *d, struc ppguid = d->key; ppguid.entityid.u = NN_ENTITYID_PARTICIPANT; convkey (&sample->participant_key, &ppguid); + sample->participant_instance_handle = d->pphandle; if (d->c.kind == SDK_DATA) { assert (d->xqos.present & QP_TOPIC_NAME);