Exemplo n.º 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);
}
Exemplo n.º 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);
}
Exemplo n.º 3
0
int dcps_get_local_subscription_data (DDS_SubscriptionBuiltinTopicData *dp,
				      Reader_t                         *rp)
{
	size_t		size, psize;
	char		*xp;
	UniQos_t	*uqp;

	size = str_len (rp->r_topic->name);
	size += str_len (rp->r_topic->type->type_name);
	if (rp->r_qos->qos.user_data) {
		ROUND_LEN (size);
		size += str_len (rp->r_qos->qos.user_data);
	}
	if (rp->r_subscriber->qos.partition) {
		ROUND_LEN (size);
		psize = partition_size (rp->r_subscriber->qos.partition);
		size += psize;
	}
	if (rp->r_topic->qos->qos.topic_data) {
		ROUND_LEN (size);
		size += str_len (rp->r_topic->qos->qos.topic_data);
	}
	if (rp->r_subscriber->qos.group_data) {
		ROUND_LEN (size);
		size += str_len (rp->r_subscriber->qos.group_data);
	}
	xp = xmalloc (size);
	if (!xp)
		return (DDS_RETCODE_OUT_OF_RESOURCES);

	dp->topic_name = xp;
	dp->key.value [0] = rp->r_subscriber->domain->participant.p_guid_prefix.w [0];
	dp->key.value [1] = rp->r_subscriber->domain->participant.p_guid_prefix.w [1];
	dp->key.value [2] = rp->r_entity_id.w;
	memcpy (&dp->participant_key,
		&rp->r_subscriber->domain->participant.p_guid_prefix,
		sizeof (DDS_BuiltinTopicKey_t));
	memcpy (xp, str_ptr (rp->r_topic->name),
				str_len (rp->r_topic->name));
	xp += str_len (rp->r_topic->name);
	dp->type_name = xp;
	memcpy (xp, str_ptr (rp->r_topic->type->type_name),
				str_len (rp->r_topic->type->type_name));
	xp += str_len (rp->r_topic->type->type_name);
	uqp = &rp->r_qos->qos;
	dp->durability.kind = uqp->durability_kind;
	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->ownership.kind = uqp->ownership_kind;
	dp->destination_order.kind = uqp->destination_order_kind;
	if (uqp->user_data)
		ROUND_PTR (xp);
	oseq_set (&dp->user_data.value, uqp->user_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->user_data.value);
	dp->time_based_filter = rp->r_time_based_filter;
	dp->presentation.access_scope = uqp->presentation_access_scope;
	dp->presentation.coherent_access = uqp->presentation_coherent_access;
	dp->presentation.ordered_access = uqp->presentation_ordered_access;
	if (uqp->partition)
		ROUND_PTR (xp);
	xp += partition_set (&dp->partition.name, rp->r_subscriber->qos.partition, (unsigned char *) xp);
	if (rp->r_topic->qos->qos.topic_data)
		ROUND_PTR (xp);
	oseq_set (&dp->topic_data.value, rp->r_topic->qos->qos.topic_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->topic_data.value);
	if (rp->r_subscriber->qos.group_data)
		ROUND_PTR (xp);
	oseq_set (&dp->group_data.value, rp->r_subscriber->qos.group_data, (unsigned char *) xp);
	return (DDS_RETCODE_OK);
}
Exemplo n.º 4
0
int dcps_get_local_publication_data (DDS_PublicationBuiltinTopicData *dp,
				     Writer_t                        *wp)
{
	size_t		size, psize;
	char		*xp;
	UniQos_t	*uqp;

	size = str_len (wp->w_topic->name);
	size += str_len (wp->w_topic->type->type_name);
	if (wp->w_qos->qos.user_data) {
		ROUND_LEN (size);
		size += str_len (wp->w_qos->qos.user_data);
	}
	if (wp->w_publisher->qos.partition) {
		ROUND_LEN (size);
		psize = partition_size (wp->w_publisher->qos.partition);
		size += psize;
	}
	if (wp->w_topic->qos->qos.topic_data) {
		ROUND_LEN (size);
		size += str_len (wp->w_topic->qos->qos.topic_data);
	}
	if (wp->w_publisher->qos.group_data) {
		ROUND_LEN (size);
		size += str_len (wp->w_publisher->qos.group_data);
	}
	xp = xmalloc (size);
	if (!xp)
		return (DDS_RETCODE_OUT_OF_RESOURCES);

	dp->topic_name = xp;
	dp->key.value [0] = wp->w_publisher->domain->participant.p_guid_prefix.w [0];
	dp->key.value [1] = wp->w_publisher->domain->participant.p_guid_prefix.w [1];
	dp->key.value [2] = wp->w_entity_id.w;
	memcpy (&dp->participant_key,
		&wp->w_publisher->domain->participant.p_guid_prefix,
		sizeof (DDS_BuiltinTopicKey_t));
	memcpy (xp, str_ptr (wp->w_topic->name),
						str_len (wp->w_topic->name));
	xp += str_len (wp->w_topic->name);
	dp->type_name = xp;
	memcpy (xp, str_ptr (wp->w_topic->type->type_name),
				     str_len (wp->w_topic->type->type_name));
	xp += str_len (wp->w_topic->type->type_name);
	uqp = &wp->w_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->lifespan = uqp->lifespan;
	if (uqp->user_data)
		ROUND_PTR (xp);
	oseq_set (&dp->user_data.value, uqp->user_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->user_data.value);
	dp->ownership.kind = uqp->ownership_kind;
	dp->ownership_strength = uqp->ownership_strength;
	dp->destination_order.kind = uqp->destination_order_kind;
	dp->presentation.access_scope = uqp->presentation_access_scope;
	dp->presentation.coherent_access = uqp->presentation_coherent_access;
	dp->presentation.ordered_access = uqp->presentation_ordered_access;
	if (uqp->partition)
		ROUND_PTR (xp);
	xp += partition_set (&dp->partition.name, wp->w_publisher->qos.partition, (unsigned char *) xp);
	if (wp->w_topic->qos->qos.topic_data)
		ROUND_PTR (xp);
	oseq_set (&dp->topic_data.value, wp->w_topic->qos->qos.topic_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->topic_data.value);
	if (wp->w_publisher->qos.group_data)
		ROUND_PTR (xp);
	oseq_set (&dp->group_data.value, wp->w_publisher->qos.group_data, (unsigned char *) xp);
	return (DDS_RETCODE_OK);
}
Exemplo n.º 5
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);
}
Exemplo n.º 6
0
int dcps_get_builtin_subscription_data (DDS_SubscriptionBuiltinTopicData *dp,
					DiscoveredReader_t               *drp)
{
	size_t		size, psize;
	char		*xp;
	UniQos_t	*uqp;

	size = str_len (drp->dr_topic->name);
	size += str_len (drp->dr_topic->type->type_name);
	if (drp->dr_qos->qos.user_data) {
		ROUND_LEN (size);
		size += str_len (drp->dr_qos->qos.user_data);
	}
	if (drp->dr_qos->qos.partition) {
		ROUND_LEN (size);
		psize = partition_size (drp->dr_qos->qos.partition);
		size += psize;
	}
	if (drp->dr_qos->qos.topic_data) {
		ROUND_LEN (size);
		size += str_len (drp->dr_qos->qos.topic_data);
	}
	if (drp->dr_qos->qos.group_data) {
		ROUND_LEN (size);
		size += str_len (drp->dr_qos->qos.group_data);
	}
	xp = xmalloc (size);
	if (!xp)
		return (DDS_RETCODE_OUT_OF_RESOURCES);

	dp->topic_name = xp;
	endpoint_key_from_guid (&drp->dr_participant->p_guid_prefix,
				&drp->dr_entity_id,
				(KeyHash_t *) &dp->key);
	memcpy (&dp->participant_key,
		&drp->dr_participant->p_guid_prefix,
		GUIDPREFIX_SIZE);
	if (sizeof (DDS_BuiltinTopicKey_t) > GUIDPREFIX_SIZE)
		dp->participant_key.value [3] = 0;
	memcpy (xp, str_ptr (drp->dr_topic->name),
				str_len (drp->dr_topic->name));
	xp += str_len (drp->dr_topic->name);
	dp->type_name = xp;
	memcpy (xp, str_ptr (drp->dr_topic->type->type_name),
				str_len (drp->dr_topic->type->type_name));
	xp += str_len (drp->dr_topic->type->type_name);
	uqp = &drp->dr_qos->qos;
	dp->durability.kind = uqp->durability_kind;
	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->ownership.kind = uqp->ownership_kind;
	dp->destination_order.kind = uqp->destination_order_kind;
	if (uqp->user_data)
		ROUND_PTR (xp);
	oseq_set (&dp->user_data.value, uqp->user_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->user_data.value);
	dp->time_based_filter = drp->dr_time_based_filter;
	dp->presentation.access_scope = uqp->presentation_access_scope;
	dp->presentation.coherent_access = uqp->presentation_coherent_access;
	dp->presentation.ordered_access = uqp->presentation_ordered_access;
	if (uqp->partition)
		ROUND_PTR (xp);
	xp += partition_set (&dp->partition.name, uqp->partition, (unsigned char *) xp);
	if (uqp->topic_data)
		ROUND_PTR (xp);
	oseq_set (&dp->topic_data.value, uqp->topic_data, (unsigned char *) xp);
	xp += DDS_SEQ_LENGTH (dp->topic_data.value);
	if (uqp->group_data)
		ROUND_PTR (xp);
	oseq_set (&dp->group_data.value, uqp->group_data, (unsigned char *) xp);
	return (DDS_RETCODE_OK);
}