DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_participant_data ( DDS_DomainParticipant dp, DDS_ParticipantBuiltinTopicData *data, DDS_InstanceHandle_t handle) { Entity_t *ep; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_G_DISC_P, &dp, sizeof (dp)); ctrc_contd (&data, sizeof (data)); ctrc_contd (&handle, sizeof (handle)); ctrc_endd (); if (!data || !handle) return (DDS_RETCODE_BAD_PARAMETER); if (!domain_ptr (dp, 1, &ret)) return (ret); if ((dp->participant.p_flags & EF_ENABLED) == 0) { lock_release (dp->lock); return (DDS_RETCODE_NOT_ENABLED); } ep = entity_ptr (handle); if (!ep || ep->type != ET_PARTICIPANT || !entity_discovered (ep->flags)) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } if (dcps_get_builtin_participant_data (data, (Participant_t *) ep)) { ret = DDS_RETCODE_OUT_OF_RESOURCES; goto done; } done: lock_release (dp->lock); return (ret); }
static void *read_builtin_participant_data (Change_t *cp) { Entity_t *ep; DDS_ParticipantBuiltinTopicData *dp; ep = entity_ptr (cp->c_writer); if (!ep) return (NULL); if (ep->type != ET_PARTICIPANT || (ep->flags & EF_REMOTE) == 0) return (NULL); dp = xmalloc (sizeof (DDS_ParticipantBuiltinTopicData)); if (!dp) return (NULL); if (dcps_get_builtin_participant_data (dp, (Participant_t *) ep)) { xfree (dp); return (NULL); } return (dp); }