Ejemplo n.º 1
0
DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_topic_data (
					DDS_DomainParticipant     dp,
					DDS_TopicBuiltinTopicData *data,
					DDS_InstanceHandle_t      handle)
{
	Entity_t		*ep;
	DDS_ReturnCode_t	ret;

	ctrc_begind (DCPS_ID, DCPS_DP_G_DISC_T, &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_TOPIC ||
	     !entity_discovered (ep->flags) ||
	     entity_ignored (ep->flags)) {
		ret = DDS_RETCODE_BAD_PARAMETER;
		goto done;
	}
	if (dcps_get_builtin_topic_data (data, (Topic_t *) ep, 0)) {
		ret = DDS_RETCODE_OUT_OF_RESOURCES;
		goto done;
	}

    done:
	lock_release (dp->lock);
	return (ret);
}
Ejemplo n.º 2
0
static void *read_builtin_topic_data (Change_t *cp)
{
	Entity_t			*ep;
	DDS_TopicBuiltinTopicData	*dp;

	ep = entity_ptr (cp->c_writer);
	if (!ep)
		return (NULL);
	if (ep->type != ET_TOPIC ||
	    (ep->flags & EF_REMOTE) == 0)
		return (NULL);

	dp = xmalloc (sizeof (DDS_TopicBuiltinTopicData));
	if (!dp)
		return (NULL);

	if (dcps_get_builtin_topic_data (dp, (Topic_t *) ep, 1)) {
		xfree (dp);
		return (NULL);
	}
	return (dp);
}