コード例 #1
0
ファイル: disc_ctt.c プロジェクト: tinq-iot/tinq
static void ctt_participant_crypto_tokens (
				Domain_t                             *dp,
				DDS_ParticipantVolatileSecureMessage *info)
{
	Participant_t	*pp;

	prof_start (disc_ctt_ptok);

	pp = participant_lookup (dp, (GuidPrefix_t *) info->message_identity.source_guid);
	if (!pp)
		return;

	sec_set_remote_participant_tokens (dp->participant.p_crypto,
					   pp->p_crypto,
					   &info->message_data);

	prof_stop (disc_ctt_ptok, 1);
}
コード例 #2
0
ファイル: disc_ctt.c プロジェクト: tinq-iot/tinq
static void ctt_data_reader_crypto_tokens (
				Domain_t                             *dp,
				DDS_ParticipantVolatileSecureMessage *info)
{
	Participant_t		*pp;
	Endpoint_t		*lep, *rep;
	EntityId_t		*eidp;
	DataReaderCrypto_t 	crypto;

	prof_start (disc_ctt_rtok);

	pp = participant_lookup (dp, (GuidPrefix_t *) info->source_endpoint_key);
	if (!pp)
		return;

	if (memcmp (dp->participant.p_guid_prefix.prefix,
		    info->destination_endpoint_key,
		    12)) {
		warn_printf ("CTT: DataReader Token error: incorrect participant GUID.");
		return;
	}
	lep = endpoint_lookup (&dp->participant, (EntityId_t *) &info->destination_endpoint_key [12]);
	if (!lep) {
		warn_printf ("CTT: DataReader Token error: not a local DataWriter.");
		return;
	}
	rep = endpoint_lookup (pp, (EntityId_t *) &info->source_endpoint_key [12]);
	if (!rep ||
	    (crypto = rtps_peer_reader_crypto_get ((Writer_t *) lep,
					      (DiscoveredReader_t *) rep)) == 0) {
		eidp = (EntityId_t *) (info->source_endpoint_key + 12);
		log_printf (SEC_ID, 0, "CTT: DataReader Token remember (0x%04x)!\r\n", eidp->w);
		sec_remember_remote_datareader_tokens (((Writer_t *) lep)->w_crypto,
						       pp->p_crypto,
						       eidp,
						       &info->message_data);
	}
	else
		sec_set_remote_datareader_tokens (((Writer_t *) lep)->w_crypto,
						  crypto,
						  &info->message_data);
	prof_stop (disc_ctt_rtok, 1);
}
コード例 #3
0
ファイル: disc_msg.c プロジェクト: FlavioFalcao/tinq-core
void msg_data_event (Reader_t *rp, NotificationType_t t, int secure)
{
	Domain_t		*dp = rp->r_subscriber->domain;
	Participant_t		*pp;
	unsigned		nchanges;
	ChangeData_t		change;
	ParticipantMessageData	*info = NULL;
#ifdef DISC_MSG_DUMP
	InfoType_t		type;
#endif
	int			error;

	ARG_NOT_USED (secure)

	if (t != NT_DATA_AVAILABLE)
		return;

	rp->r_status &= ~DDS_DATA_AVAILABLE_STATUS;
	do {
		nchanges = 1;
		/*dtrc_print0 ("PMSG: get samples");*/
		error = disc_get_data (rp, &change);
		if (error) {
			/*dtrc_print0 ("- none\r\n");*/
			break;
		}
		/*dtrc_print1 ("- valid(%u)\r\n", change.kind);*/
		if (change.kind != ALIVE) {
			/*error = hc_get_key (cdp, change.h, &info, 0);
			if (error)
				continue;*/

#ifdef DISC_MSG_DUMP
			type = EI_DELETE;
#endif
			hc_inst_free (rp->r_cache, change.h);
		}
		else {
#ifdef DISC_MSG_DUMP
			if (change.is_new)
				type = EI_NEW;
			else
				type = EI_UPDATE;
#endif
			info = change.data;
		}
		pp = entity_participant (change.writer);
		if (!pp ||				/* Not found. */
		    pp == &dp->participant ||		/* Own sent info. */
		    entity_ignored (pp->p_flags)) {	/* Ignored. */
			hc_inst_free (rp->r_cache, change.h);
			continue;	/* Filter out unneeded info. */
		}

		/* If it's a liveliness indication, then propagate it. */ 
		if (info) {
#ifdef DISC_MSG_DUMP

			/* Message from remote participant. */
			if (spdp_log)
				msg_data_info (pp, info, 'R', type);
#endif
			if (info->kind [0] == 0 &&
			    info->kind [1] == 0 &&
			    info->kind [2] == 0 &&
			    (info->kind [3] == 1 || info->kind [3] == 2)) {
				pp = participant_lookup (dp, &info->participantGuidPrefix);
				if (pp)
					liveliness_participant_event (pp, info->kind [3] != 1);
			}
			xfree (info);
		}
		hc_inst_free (rp->r_cache, change.h);
	}
	while (nchanges);
}