Пример #1
0
int dcps_get_builtin_participant_data (DDS_ParticipantBuiltinTopicData *dp,
				       Participant_t                   *pp)
{
	int	error;

	memcpy (dp->key.value, &pp->p_guid_prefix, sizeof (DDS_BuiltinTopicKey_t));
#if 0
	error = get_builtin_key (pp->p_domain,
				 dp->key.value,
				 BT_Participant,
				 entity_handle (pp->p_flags));
	if (error)
		return (error);
#endif
	error = oseq_set (&dp->user_data.value, pp->p_user_data, NULL);
	return (error);
}
Пример #2
0
int dcps_get_builtin_participant_data (DDS_ParticipantBuiltinTopicData *dp,
				       Participant_t                   *pp)
{
	int	error;

	memcpy ((unsigned char *) dp->key.value, pp->p_guid_prefix.prefix, GUIDPREFIX_SIZE);
	if (sizeof (dp->key) > GUIDPREFIX_SIZE)
		dp->key.value [3] = 0;
#if 0
	error = get_builtin_key (pp->p_domain,
				 dp->key.value,
				 BT_Participant,
				 entity_handle (pp->p_flags));
	if (error)
		return (error);
#endif
	error = oseq_set (&dp->user_data.value, pp->p_user_data, NULL);
	return (error);
}
Пример #3
0
int dcps_get_builtin_topic_data (DDS_TopicBuiltinTopicData *dp,
				 Topic_t                   *tp,
				 int                       bi_reader)
{
	size_t		size;
	char		*xp;
	UniQos_t	*uqp;
	KeyHash_t	hash;
	int		error;

	size = str_len (tp->name) + 1;
	size += str_len (tp->type->type_name) + 1;
	if (tp->qos->qos.topic_data) {
		ROUND_LEN (size);
		size += str_len (tp->qos->qos.topic_data);
	}
	xp = xmalloc (size);
	if (!xp)
		return (DDS_RETCODE_OUT_OF_RESOURCES);

	dp->name = xp;
	if (bi_reader) { /* Key already in reader cache! */
		error = get_builtin_key (tp->domain, dp->key.value,
					 BT_Topic, tp->entity.handle);
		if (error)
			goto key_error;
	}
	else { /* (Re)calculate key value. */
		topic_key_from_name (str_ptr (tp->name),
				     str_len (tp->name) - 1,
				     str_ptr (tp->type->type_name),
				     str_len (tp->type->type_name) - 1,
				     &hash);
		memcpy (dp->key.value, &hash, sizeof (DDS_BuiltinTopicKey_t));
	}
	memcpy (xp, str_ptr (tp->name), str_len (tp->name));
	xp += str_len (tp->name);
	dp->type_name = xp;
	memcpy (xp, str_ptr (tp->type->type_name), str_len (tp->type->type_name));
	xp += str_len (tp->type->type_name);
	uqp = &tp->qos->qos;
	dp->durability.kind = uqp->durability_kind;
#ifdef DURABILITY_SERVICE
	dp->durability_service.service_cleanup_delay = uqp->ds_cleanup_delay;
	dp->durability_service.history_kind = uqp->ds_history_kind;
	dp->durability_service.history_depth = uqp->ds_history_depth;
	dp->durability_service.max_samples = uqp->ds_limits.max_samples;
	dp->durability_service.max_instances = uqp->ds_limits.max_instances;
	dp->durability_service.max_samples_per_instance = uqp->ds_limits.max_samples_per_instance;
#else
	dp->durability_service = qos_def_writer_qos.durability_service;
#endif
	dp->deadline = uqp->deadline;
	dp->latency_budget = uqp->latency_budget;
	dp->liveliness.kind = uqp->liveliness_kind;
	dp->liveliness.lease_duration = uqp->liveliness_lease_duration;
	dp->reliability.kind = uqp->reliability_kind;
	dp->reliability.max_blocking_time = uqp->reliability_max_blocking_time;
	dp->transport_priority = uqp->transport_priority;
	dp->lifespan = uqp->lifespan;
	dp->destination_order.kind = uqp->destination_order_kind;
	dp->history.kind = uqp->history_kind;
	dp->history.depth = uqp->history_depth;
	dp->resource_limits = uqp->resource_limits;
	dp->ownership.kind = uqp->ownership_kind;
	if (uqp->topic_data)
		ROUND_PTR (xp);
	oseq_set (&dp->topic_data.value, uqp->topic_data, (unsigned char *) xp);
	return (DDS_RETCODE_OK);

    key_error:
	xfree (dp->name);
	return (error);
}