Exemplo n.º 1
0
DDS_ReturnCode_t DDS_Subscriber_set_qos (DDS_Subscriber sp,
					 DDS_SubscriberQos *qos)
{
	Domain_t		*dp;
	DDS_ReturnCode_t	ret;

	ctrc_printd (DCPS_ID, DCPS_S_S_QOS, &sp, sizeof (sp));
	ctrc_contd (&qos, sizeof (qos));
	ctrc_endd ();

	if (!subscriber_ptr (sp, &ret))
		return (ret);

	dp = domain_ptr (sp->domain, 1, &ret);
	if (!dp)
		return (ret);

	if (qos == DDS_PUBLISHER_QOS_DEFAULT)
		qos = &sp->domain->def_subscriber_qos;
	else if (!qos_valid_subscriber_qos (qos)) {
		ret = DDS_RETCODE_BAD_PARAMETER;
		goto done;
	}
	ret = qos_subscriber_update (&sp->qos, qos);
	if (ret == DDS_RETCODE_OK)
		sl_walk (&sp->domain->participant.p_endpoints, update_reader_qos, sp);

    done:
	lock_release (dp->lock);
	return (ret);
}
Exemplo n.º 2
0
DDS_Subscriber DDS_DomainParticipant_create_subscriber (DDS_DomainParticipant        dp,
							const DDS_SubscriberQos      *qos,
							const DDS_SubscriberListener *listener,
							DDS_StatusMask               mask)
{
	Subscriber_t	*sp;
	int		enable;

	ctrc_begind (DCPS_ID, DCPS_DP_C_SUB, &dp, sizeof (dp));
	ctrc_contd (&qos, sizeof (qos));
	ctrc_contd (&listener, sizeof (listener));
	ctrc_contd (&mask, sizeof (mask));
	ctrc_endd ();

	prof_start (dcps_create_sub);

	if (!domain_ptr (dp, 1, NULL))
		return (NULL);

	if (qos == DDS_SUBSCRIBER_QOS_DEFAULT)
		qos = &dp->def_subscriber_qos;
	else if (!qos_valid_subscriber_qos (qos)) {
		sp = NULL;
		goto done;
	}
	sp = subscriber_create (dp, 0);
	if (!sp)
		goto done;

	qos_subscriber_new (&sp->qos, qos);
	if (listener)
		sp->listener = *listener;
	sp->mask = mask;
	enable = dp->autoenable;
	lock_release (dp->lock);
	if (enable)
		DDS_Subscriber_enable (sp);

	prof_stop (dcps_create_sub, 1);
	return (sp);

    done:
	lock_release (dp->lock);
	return (NULL);
}
Exemplo n.º 3
0
DDS_ReturnCode_t DDS_DomainParticipant_set_default_subscriber_qos (DDS_DomainParticipant dp,
								   DDS_SubscriberQos *qos)
{
	DDS_ReturnCode_t	ret;

	ctrc_begind (DCPS_ID, DCPS_DP_S_S_QOS, &dp, sizeof (dp));
	ctrc_contd (&qos, sizeof (qos));
	ctrc_endd ();

	/* Get Domain Participant. */
	if (!domain_ptr (dp, 1, &ret)) {
		log_printf (DCPS_ID, 0, "set_default_subscriber_qos: domain doesn't exist!\r\n");
		return (ret);
	}
	if (qos == DDS_SUBSCRIBER_QOS_DEFAULT)
		dp->def_subscriber_qos = qos_def_subscriber_qos;
	else if (qos_valid_subscriber_qos (qos))
		dp->def_subscriber_qos = *qos;
	else
		ret = DDS_RETCODE_INCONSISTENT_POLICY;

	lock_release (dp->lock);
	return (ret);
}