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 <eb@ilities.com>
This commit is contained in:
parent
f12b36e112
commit
42500e7fb8
3 changed files with 9 additions and 0 deletions
|
@ -210,6 +210,7 @@ typedef struct dds_builtintopic_endpoint
|
||||||
{
|
{
|
||||||
dds_builtintopic_guid_t key;
|
dds_builtintopic_guid_t key;
|
||||||
dds_builtintopic_guid_t participant_key;
|
dds_builtintopic_guid_t participant_key;
|
||||||
|
dds_instance_handle_t participant_instance_handle;
|
||||||
char *topic_name;
|
char *topic_name;
|
||||||
char *type_name;
|
char *type_name;
|
||||||
dds_qos_t *qos;
|
dds_qos_t *qos;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
struct ddsi_serdata_builtintopic {
|
struct ddsi_serdata_builtintopic {
|
||||||
struct ddsi_serdata c;
|
struct ddsi_serdata c;
|
||||||
nn_guid_t key;
|
nn_guid_t key;
|
||||||
|
dds_instance_handle_t pphandle;
|
||||||
nn_xqos_t xqos;
|
nn_xqos_t xqos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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)
|
static void from_entity_pp (struct ddsi_serdata_builtintopic *d, const struct participant *pp)
|
||||||
{
|
{
|
||||||
nn_xqos_copy(&d->xqos, &pp->plist->qos);
|
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)
|
static void from_entity_proxypp (struct ddsi_serdata_builtintopic *d, const struct proxy_participant *proxypp)
|
||||||
{
|
{
|
||||||
nn_xqos_copy(&d->xqos, &proxypp->plist->qos);
|
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)
|
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)
|
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);
|
nn_xqos_copy(&d->xqos, rd->xqos);
|
||||||
set_topic_type_from_sertopic(d, rd->topic);
|
set_topic_type_from_sertopic(d, rd->topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void from_entity_prd (struct ddsi_serdata_builtintopic *d, const struct proxy_reader *prd)
|
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);
|
nn_xqos_copy(&d->xqos, prd->c.xqos);
|
||||||
assert (d->xqos.present & QP_TOPIC_NAME);
|
assert (d->xqos.present & QP_TOPIC_NAME);
|
||||||
assert (d->xqos.present & QP_TYPE_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)
|
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);
|
nn_xqos_copy(&d->xqos, wr->xqos);
|
||||||
set_topic_type_from_sertopic(d, wr->topic);
|
set_topic_type_from_sertopic(d, wr->topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void from_entity_pwr (struct ddsi_serdata_builtintopic *d, const struct proxy_writer *pwr)
|
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);
|
nn_xqos_copy(&d->xqos, pwr->c.xqos);
|
||||||
assert (d->xqos.present & QP_TOPIC_NAME);
|
assert (d->xqos.present & QP_TOPIC_NAME);
|
||||||
assert (d->xqos.present & QP_TYPE_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 = d->key;
|
||||||
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
|
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
|
||||||
convkey (&sample->participant_key, &ppguid);
|
convkey (&sample->participant_key, &ppguid);
|
||||||
|
sample->participant_instance_handle = d->pphandle;
|
||||||
if (d->c.kind == SDK_DATA)
|
if (d->c.kind == SDK_DATA)
|
||||||
{
|
{
|
||||||
assert (d->xqos.present & QP_TOPIC_NAME);
|
assert (d->xqos.present & QP_TOPIC_NAME);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue