diff --git a/include/fastrtps/rtps/builtin/discovery/endpoint/EDP.h b/include/fastrtps/rtps/builtin/discovery/endpoint/EDP.h index 8b99d2608e3..fa8f69b6e1c 100644 --- a/include/fastrtps/rtps/builtin/discovery/endpoint/EDP.h +++ b/include/fastrtps/rtps/builtin/discovery/endpoint/EDP.h @@ -191,6 +191,12 @@ class EDP bool pairing_remote_writer_with_local_reader_after_security(const GUID_t& local_reader, const WriterProxyData& remote_writer_data); + + virtual bool pairing_remote_writer_with_local_builtin_reader_after_security(const GUID_t& /*local_reader*/, + const WriterProxyData& /*remote_writer_data*/) { return false; } + + virtual bool pairing_remote_reader_with_local_builtin_writer_after_security(const GUID_t& /*local_writer*/, + const ReaderProxyData& /*remote_reader_data*/) { return false; } #endif //! Pointer to the PDPSimple object that contains the endpoint discovery protocol. diff --git a/include/fastrtps/rtps/builtin/discovery/endpoint/EDPSimple.h b/include/fastrtps/rtps/builtin/discovery/endpoint/EDPSimple.h index 2a7597b4eb9..181229e9e9d 100644 --- a/include/fastrtps/rtps/builtin/discovery/endpoint/EDPSimple.h +++ b/include/fastrtps/rtps/builtin/discovery/endpoint/EDPSimple.h @@ -134,6 +134,12 @@ class EDPSimple : public EDP #if HAVE_SECURITY bool create_sedp_secure_endpoints(); + + bool pairing_remote_writer_with_local_builtin_reader_after_security(const GUID_t& local_reader, + const WriterProxyData& remote_writer_data); + + bool pairing_remote_reader_with_local_builtin_writer_after_security(const GUID_t& local_writer, + const ReaderProxyData& remote_reader_data); #endif }; diff --git a/src/cpp/rtps/Endpoint.cpp b/src/cpp/rtps/Endpoint.cpp index 15864d3c2c7..c90dd095054 100644 --- a/src/cpp/rtps/Endpoint.cpp +++ b/src/cpp/rtps/Endpoint.cpp @@ -26,7 +26,7 @@ namespace eprosima { namespace fastrtps{ namespace rtps { -Endpoint::Endpoint(RTPSParticipantImpl* pimpl,GUID_t& guid,EndpointAttributes& att): +Endpoint::Endpoint(RTPSParticipantImpl* pimpl, GUID_t& guid, EndpointAttributes& att): mp_RTPSParticipant(pimpl), m_guid(guid), m_att(att), diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp index cc825406da7..7b2269eb811 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp @@ -421,7 +421,7 @@ bool EDP::pairingReader(RTPSReader* R, const ParticipantProxyData& pdata, const { #if HAVE_SECURITY if(!mp_RTPSParticipant->security_manager().discovered_writer(R->m_guid, (*pit)->m_guid, - **wdatait)) + **wdatait, R->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for reader " << R->getGuid()); } @@ -485,7 +485,7 @@ bool EDP::pairingWriter(RTPSWriter* W, const ParticipantProxyData& pdata, const { #if HAVE_SECURITY if(!mp_RTPSParticipant->security_manager().discovered_reader(W->getGuid(), (*pit)->m_guid, - **rdatait)) + **rdatait, W->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for writer " << W->getGuid()); } @@ -551,7 +551,7 @@ bool EDP::pairing_reader_proxy_with_any_local_writer(ParticipantProxyData* pdata { #if HAVE_SECURITY if(!mp_RTPSParticipant->security_manager().discovered_reader(writerGUID, pdata->m_guid, - *rdata)) + *rdata, (*wit)->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for writer " << writerGUID); } @@ -619,7 +619,7 @@ bool EDP::pairing_reader_proxy_with_local_writer(const GUID_t& local_writer, con if(valid) { if(!mp_RTPSParticipant->security_manager().discovered_reader(writerGUID, - remote_participant_guid, rdata)) + remote_participant_guid, rdata, (*wit)->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for writer " << writerGUID); } @@ -676,10 +676,12 @@ bool EDP::pairing_remote_reader_with_local_writer_after_security(const GUID_t& l return true; } + + return false; } } - return false; + return pairing_remote_reader_with_local_builtin_writer_after_security(local_writer, remote_reader_data); } #endif @@ -707,7 +709,7 @@ bool EDP::pairing_writer_proxy_with_any_local_reader(ParticipantProxyData *pdata { #if HAVE_SECURITY if(!mp_RTPSParticipant->security_manager().discovered_writer(readerGUID, pdata->m_guid, - *wdata)) + *wdata, (*rit)->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for reader " << readerGUID); } @@ -775,8 +777,7 @@ bool EDP::pairing_writer_proxy_with_local_reader(const GUID_t& local_reader, con if(valid) { if(!mp_RTPSParticipant->security_manager().discovered_writer(readerGUID, - remote_participant_guid, - wdata)) + remote_participant_guid, wdata, (*rit)->getAttributes()->security_attributes())) { logError(RTPS_EDP, "Security manager returns an error for reader " << readerGUID); } @@ -834,10 +835,12 @@ bool EDP::pairing_remote_writer_with_local_reader_after_security(const GUID_t& l return true; } + + return false; } } - return false; + return pairing_remote_writer_with_local_builtin_reader_after_security(local_reader, remote_writer_data); } #endif diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp index 05c36e6d6e4..f7ea22018db 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp @@ -265,7 +265,8 @@ bool EDPSimple::createSEDPEndpoints() if(mp_RTPSParticipant->getRTPSParticipantAttributes().throughputController.bytesPerPeriod != UINT32_MAX && mp_RTPSParticipant->getRTPSParticipantAttributes().throughputController.periodMillisecs != 0) watt.mode = ASYNCHRONOUS_WRITER; - created &=this->mp_RTPSParticipant->createWriter(&waux,watt,mp_SubWriter.second,nullptr,c_EntityId_SEDPSubWriter,true); + created &=this->mp_RTPSParticipant->createWriter(&waux, watt, mp_SubWriter.second, nullptr, + c_EntityId_SEDPSubWriter, true); if(created) { #if HAVE_SECURITY @@ -511,14 +512,15 @@ bool EDPSimple::processLocalWriterProxyData(RTPSWriter* local_writer, WriterProx #if HAVE_SECURITY if(local_writer->getAttributes()->security_attributes().is_discovered_protected) { - writer = &sedp_builtin_subscriptions_secure_writer_; - reader = &sedp_builtin_subscriptions_secure_reader_; + writer = &sedp_builtin_publications_secure_writer_; + reader = &sedp_builtin_publications_secure_reader_; } #endif if(writer->first !=nullptr) { - CacheChange_t* change = writer->first->new_change([]() -> uint32_t {return DISCOVERY_PUBLICATION_DATA_MAX_SIZE;}, ALIVE, wdata->key()); + CacheChange_t* change = writer->first->new_change([]() -> uint32_t {return DISCOVERY_PUBLICATION_DATA_MAX_SIZE;}, + ALIVE, wdata->key()); if(change != nullptr) { wdata->toParameterList(); @@ -567,20 +569,33 @@ bool EDPSimple::processLocalWriterProxyData(RTPSWriter* local_writer, WriterProx bool EDPSimple::removeLocalWriter(RTPSWriter* W) { logInfo(RTPS_EDP,W->getGuid().entityId); - if(mp_PubWriter.first!=nullptr) + + auto* writer = &mp_PubWriter; + auto* reader = &mp_PubReader; + +#if HAVE_SECURITY + if(W->getAttributes()->security_attributes().is_discovered_protected) + { + writer = &sedp_builtin_publications_secure_writer_; + reader = &sedp_builtin_publications_secure_reader_; + } +#endif + + if(writer->first!=nullptr) { InstanceHandle_t iH; iH = W->getGuid(); - CacheChange_t* change = mp_PubWriter.first->new_change([]() -> uint32_t {return DISCOVERY_PUBLICATION_DATA_MAX_SIZE;}, NOT_ALIVE_DISPOSED_UNREGISTERED,iH); + CacheChange_t* change = writer->first->new_change([]() -> uint32_t {return DISCOVERY_PUBLICATION_DATA_MAX_SIZE;}, + NOT_ALIVE_DISPOSED_UNREGISTERED,iH); if(change != nullptr) { { - std::lock_guard guard(*mp_PubWriter.second->getMutex()); - for(auto ch = mp_PubWriter.second->changesBegin();ch!=mp_PubWriter.second->changesEnd();++ch) + std::lock_guard guard(*writer->second->getMutex()); + for(auto ch = writer->second->changesBegin(); ch != writer->second->changesEnd(); ++ch) { if((*ch)->instanceHandle == change->instanceHandle) { - mp_PubWriter.second->remove_change(*ch); + writer->second->remove_change(*ch); break; } } @@ -588,9 +603,9 @@ bool EDPSimple::removeLocalWriter(RTPSWriter* W) } if(this->mp_pubListen->getAttachedListener() != nullptr) - this->mp_pubListen->getAttachedListener()->onNewCacheChangeAdded(mp_PubReader.first, change); + this->mp_pubListen->getAttachedListener()->onNewCacheChangeAdded(reader->first, change); - mp_PubWriter.second->add_change(change); + writer->second->add_change(change); } } return mp_PDP->removeWriterProxyData(W->getGuid()); @@ -599,29 +614,42 @@ bool EDPSimple::removeLocalWriter(RTPSWriter* W) bool EDPSimple::removeLocalReader(RTPSReader* R) { logInfo(RTPS_EDP,R->getGuid().entityId); - if(mp_SubWriter.first!=nullptr) + + auto* writer = &mp_SubWriter; + auto* reader = &mp_SubReader; + +#if HAVE_SECURITY + if(R->getAttributes()->security_attributes().is_discovered_protected) + { + writer = &sedp_builtin_subscriptions_secure_writer_; + reader = &sedp_builtin_subscriptions_secure_reader_; + } +#endif + + if(writer->first!=nullptr) { InstanceHandle_t iH; iH = (R->getGuid()); - CacheChange_t* change = mp_SubWriter.first->new_change([]() -> uint32_t {return DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;}, NOT_ALIVE_DISPOSED_UNREGISTERED,iH); + CacheChange_t* change = writer->first->new_change([]() -> uint32_t {return DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;}, + NOT_ALIVE_DISPOSED_UNREGISTERED,iH); if(change != nullptr) { { - std::lock_guard guard(*mp_SubWriter.second->getMutex()); - for(auto ch = mp_SubWriter.second->changesBegin();ch!=mp_SubWriter.second->changesEnd();++ch) + std::lock_guard guard(*writer->second->getMutex()); + for(auto ch = writer->second->changesBegin(); ch != writer->second->changesEnd(); ++ch) { if((*ch)->instanceHandle == change->instanceHandle) { - mp_SubWriter.second->remove_change(*ch); + writer->second->remove_change(*ch); break; } } } if(this->mp_subListen->getAttachedListener() != nullptr) - this->mp_subListen->getAttachedListener()->onNewCacheChangeAdded(mp_SubReader.first, change); + this->mp_subListen->getAttachedListener()->onNewCacheChangeAdded(reader->first, change); - mp_SubWriter.second->add_change(change); + writer->second->add_change(change); } } return mp_PDP->removeReaderProxyData(R->getGuid()); @@ -707,15 +735,20 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata) //auxendp = 1; if(auxendp != 0 && sedp_builtin_publications_secure_reader_.first != nullptr) { - RemoteWriterAttributes watt(pdata.m_VendorId); - watt.guid.guidPrefix = pdata.m_guid.guidPrefix; - watt.guid.entityId = c_EntityId_SEDPSubWriter; - watt.endpoint.unicastLocatorList = pdata.m_metatrafficUnicastLocatorList; - watt.endpoint.multicastLocatorList = pdata.m_metatrafficMulticastLocatorList; - watt.endpoint.reliabilityKind = RELIABLE; - watt.endpoint.durabilityKind = TRANSIENT_LOCAL; - mp_SubReader.first->matched_writer_add(watt); - sedp_builtin_publications_secure_reader_.first->matched_writer_add(watt); + WriterProxyData watt; + watt.guid().guidPrefix = pdata.m_guid.guidPrefix; + watt.guid().entityId = sedp_builtin_publications_secure_writer; + watt.unicastLocatorList(pdata.m_metatrafficUnicastLocatorList); + watt.multicastLocatorList(pdata.m_metatrafficMulticastLocatorList); + watt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + watt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; + if(!mp_RTPSParticipant->security_manager().discovered_builtin_writer( + sedp_builtin_publications_secure_reader_.first->getGuid(), pdata.m_guid, watt, + sedp_builtin_publications_secure_reader_.first->getAttributes()->security_attributes())) + { + logError(RTPS_EDP, "Security manager returns an error for writer " << + sedp_builtin_publications_secure_reader_.first->getGuid()); + } } auxendp = endp; @@ -724,16 +757,21 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata) //auxendp = 1; if(auxendp != 0 && sedp_builtin_publications_secure_writer_.first!=nullptr) { - logInfo(RTPS_EDP,"Adding SEDP Sub Reader to my Sub Writer"); - RemoteReaderAttributes ratt(pdata.m_VendorId); - ratt.expectsInlineQos = false; - ratt.guid.guidPrefix = pdata.m_guid.guidPrefix; - ratt.guid.entityId = c_EntityId_SEDPSubReader; - ratt.endpoint.unicastLocatorList = pdata.m_metatrafficUnicastLocatorList; - ratt.endpoint.multicastLocatorList = pdata.m_metatrafficMulticastLocatorList; - ratt.endpoint.durabilityKind = TRANSIENT_LOCAL; - ratt.endpoint.reliabilityKind = RELIABLE; - sedp_builtin_publications_secure_writer_.first->matched_reader_add(ratt); + ReaderProxyData ratt; + ratt.m_expectsInlineQos = false; + ratt.guid().guidPrefix = pdata.m_guid.guidPrefix; + ratt.guid().entityId = sedp_builtin_publications_secure_reader; + ratt.unicastLocatorList(pdata.m_metatrafficUnicastLocatorList); + ratt.multicastLocatorList(pdata.m_metatrafficMulticastLocatorList); + ratt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; + ratt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + if(!mp_RTPSParticipant->security_manager().discovered_builtin_reader( + sedp_builtin_publications_secure_writer_.first->getGuid(), pdata.m_guid, ratt, + sedp_builtin_publications_secure_writer_.first->getAttributes()->security_attributes())) + { + logError(RTPS_EDP, "Security manager returns an error for writer " << + sedp_builtin_publications_secure_writer_.first->getGuid()); + } } auxendp = endp; @@ -742,15 +780,20 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata) //auxendp = 1; if(auxendp != 0 && sedp_builtin_subscriptions_secure_reader_.first != nullptr) { - RemoteWriterAttributes watt(pdata.m_VendorId); - watt.guid.guidPrefix = pdata.m_guid.guidPrefix; - watt.guid.entityId = c_EntityId_SEDPSubWriter; - watt.endpoint.unicastLocatorList = pdata.m_metatrafficUnicastLocatorList; - watt.endpoint.multicastLocatorList = pdata.m_metatrafficMulticastLocatorList; - watt.endpoint.reliabilityKind = RELIABLE; - watt.endpoint.durabilityKind = TRANSIENT_LOCAL; - mp_SubReader.first->matched_writer_add(watt); - sedp_builtin_publications_secure_reader_.first->matched_writer_add(watt); + WriterProxyData watt; + watt.guid().guidPrefix = pdata.m_guid.guidPrefix; + watt.guid().entityId = sedp_builtin_subscriptions_secure_writer; + watt.unicastLocatorList(pdata.m_metatrafficUnicastLocatorList); + watt.multicastLocatorList(pdata.m_metatrafficMulticastLocatorList); + watt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + watt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; + if(!mp_RTPSParticipant->security_manager().discovered_builtin_writer( + sedp_builtin_subscriptions_secure_reader_.first->getGuid(), pdata.m_guid, watt, + sedp_builtin_subscriptions_secure_reader_.first->getAttributes()->security_attributes())) + { + logError(RTPS_EDP, "Security manager returns an error for writer " << + sedp_builtin_subscriptions_secure_reader_.first->getGuid()); + } } auxendp = endp; @@ -760,15 +803,21 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata) if(auxendp != 0 && sedp_builtin_subscriptions_secure_writer_.first!=nullptr) { logInfo(RTPS_EDP,"Adding SEDP Sub Reader to my Sub Writer"); - RemoteReaderAttributes ratt(pdata.m_VendorId); - ratt.expectsInlineQos = false; - ratt.guid.guidPrefix = pdata.m_guid.guidPrefix; - ratt.guid.entityId = c_EntityId_SEDPSubReader; - ratt.endpoint.unicastLocatorList = pdata.m_metatrafficUnicastLocatorList; - ratt.endpoint.multicastLocatorList = pdata.m_metatrafficMulticastLocatorList; - ratt.endpoint.durabilityKind = TRANSIENT_LOCAL; - ratt.endpoint.reliabilityKind = RELIABLE; - sedp_builtin_subscriptions_secure_writer_.first->matched_reader_add(ratt); + ReaderProxyData ratt; + ratt.m_expectsInlineQos = false; + ratt.guid().guidPrefix = pdata.m_guid.guidPrefix; + ratt.guid().entityId = sedp_builtin_subscriptions_secure_reader; + ratt.unicastLocatorList(pdata.m_metatrafficUnicastLocatorList); + ratt.multicastLocatorList(pdata.m_metatrafficMulticastLocatorList); + ratt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; + ratt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + if(!mp_RTPSParticipant->security_manager().discovered_builtin_reader( + sedp_builtin_subscriptions_secure_writer_.first->getGuid(), pdata.m_guid, ratt, + sedp_builtin_subscriptions_secure_writer_.first->getAttributes()->security_attributes())) + { + logError(RTPS_EDP, "Security manager returns an error for writer " << + sedp_builtin_subscriptions_secure_writer_.first->getGuid()); + } } #endif } @@ -853,12 +902,16 @@ void EDPSimple::removeRemoteEndpoints(ParticipantProxyData* pdata) { RemoteWriterAttributes watt; watt.guid.guidPrefix = pdata->m_guid.guidPrefix; - watt.guid.entityId = c_EntityId_SEDPPubWriter; + watt.guid.entityId = sedp_builtin_publications_secure_writer; watt.endpoint.unicastLocatorList = pdata->m_metatrafficUnicastLocatorList; watt.endpoint.multicastLocatorList = pdata->m_metatrafficMulticastLocatorList; watt.endpoint.reliabilityKind = RELIABLE; watt.endpoint.durabilityKind = TRANSIENT_LOCAL; - sedp_builtin_publications_secure_reader_.first->matched_writer_remove(watt); + if(sedp_builtin_publications_secure_reader_.first->matched_writer_remove(watt)) + { + mp_RTPSParticipant->security_manager().remove_writer( + sedp_builtin_publications_secure_reader_.first->getGuid(), pdata->m_guid, watt.guid); + } } auxendp = endp; @@ -868,14 +921,17 @@ void EDPSimple::removeRemoteEndpoints(ParticipantProxyData* pdata) if(auxendp != 0 && sedp_builtin_publications_secure_writer_.first != nullptr) { RemoteReaderAttributes ratt; - ratt.expectsInlineQos = false; ratt.guid.guidPrefix = pdata->m_guid.guidPrefix; - ratt.guid.entityId = c_EntityId_SEDPPubReader; + ratt.guid.entityId = sedp_builtin_publications_secure_reader; ratt.endpoint.unicastLocatorList = pdata->m_metatrafficUnicastLocatorList; ratt.endpoint.multicastLocatorList = pdata->m_metatrafficMulticastLocatorList; ratt.endpoint.durabilityKind = TRANSIENT_LOCAL; ratt.endpoint.reliabilityKind = RELIABLE; - sedp_builtin_publications_secure_writer_.first->matched_reader_remove(ratt); + if(sedp_builtin_publications_secure_writer_.first->matched_reader_remove(ratt)) + { + mp_RTPSParticipant->security_manager().remove_reader( + sedp_builtin_publications_secure_writer_.first->getGuid(), pdata->m_guid, ratt.guid); + } } auxendp = endp; @@ -887,12 +943,16 @@ void EDPSimple::removeRemoteEndpoints(ParticipantProxyData* pdata) logInfo(RTPS_EDP,"Adding SEDP Sub Writer to my Sub Reader"); RemoteWriterAttributes watt; watt.guid.guidPrefix = pdata->m_guid.guidPrefix; - watt.guid.entityId = c_EntityId_SEDPSubWriter; + watt.guid.entityId = sedp_builtin_subscriptions_secure_writer; watt.endpoint.unicastLocatorList = pdata->m_metatrafficUnicastLocatorList; watt.endpoint.multicastLocatorList = pdata->m_metatrafficMulticastLocatorList; watt.endpoint.reliabilityKind = RELIABLE; watt.endpoint.durabilityKind = TRANSIENT_LOCAL; - sedp_builtin_subscriptions_secure_reader_.first->matched_writer_remove(watt); + if(sedp_builtin_subscriptions_secure_reader_.first->matched_writer_remove(watt)) + { + mp_RTPSParticipant->security_manager().remove_writer( + sedp_builtin_subscriptions_secure_reader_.first->getGuid(), pdata->m_guid, watt.guid); + } } auxendp = endp; auxendp &= DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_DETECTOR; @@ -902,18 +962,61 @@ void EDPSimple::removeRemoteEndpoints(ParticipantProxyData* pdata) { logInfo(RTPS_EDP,"Adding SEDP Sub Reader to my Sub Writer"); RemoteReaderAttributes ratt; - ratt.expectsInlineQos = false; ratt.guid.guidPrefix = pdata->m_guid.guidPrefix; - ratt.guid.entityId = c_EntityId_SEDPSubReader; + ratt.guid.entityId = sedp_builtin_subscriptions_secure_reader; ratt.endpoint.unicastLocatorList = pdata->m_metatrafficUnicastLocatorList; ratt.endpoint.multicastLocatorList = pdata->m_metatrafficMulticastLocatorList; ratt.endpoint.durabilityKind = TRANSIENT_LOCAL; ratt.endpoint.reliabilityKind = RELIABLE; - sedp_builtin_subscriptions_secure_writer_.first->matched_reader_remove(ratt); + if(sedp_builtin_subscriptions_secure_writer_.first->matched_reader_remove(ratt)) + { + mp_RTPSParticipant->security_manager().remove_reader( + sedp_builtin_subscriptions_secure_writer_.first->getGuid(), pdata->m_guid, ratt.guid); + } } #endif } +#if HAVE_SECURITY +bool EDPSimple::pairing_remote_writer_with_local_builtin_reader_after_security(const GUID_t& local_reader, + const WriterProxyData& remote_writer_data) +{ + bool returned_value = false; + + if(local_reader.entityId == sedp_builtin_publications_secure_reader) + { + sedp_builtin_publications_secure_reader_.first->matched_writer_add(remote_writer_data.toRemoteWriterAttributes()); + returned_value = true; + } + else if(local_reader.entityId == sedp_builtin_subscriptions_secure_reader) + { + sedp_builtin_subscriptions_secure_reader_.first->matched_writer_add(remote_writer_data.toRemoteWriterAttributes()); + returned_value = true; + } + + return returned_value; +} + +bool EDPSimple::pairing_remote_reader_with_local_builtin_writer_after_security(const GUID_t& local_writer, + const ReaderProxyData& remote_reader_data) +{ + bool returned_value = false; + + if(local_writer.entityId == sedp_builtin_publications_secure_writer) + { + sedp_builtin_publications_secure_writer_.first->matched_reader_add(remote_reader_data.toRemoteReaderAttributes()); + returned_value = true; + } + else if(local_writer.entityId == sedp_builtin_subscriptions_secure_writer) + { + sedp_builtin_subscriptions_secure_writer_.first->matched_reader_add(remote_reader_data.toRemoteReaderAttributes()); + returned_value = true; + } + + return returned_value; +} +#endif + } /* namespace rtps */ } /* namespace fastrtps */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp index fc06779a529..2902c2d04dc 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp @@ -81,8 +81,12 @@ PDPSimple::~PDPSimple() if(mp_resendParticipantTimer != nullptr) delete(mp_resendParticipantTimer); + mp_RTPSParticipant->disableReader(mp_SPDPReader); + if(mp_EDP!=nullptr) + { delete(mp_EDP); + } mp_RTPSParticipant->deleteUserEndpoint(mp_SPDPWriter); mp_RTPSParticipant->deleteUserEndpoint(mp_SPDPReader); @@ -710,15 +714,15 @@ bool PDPSimple::removeRemoteParticipant(GUID_t& partGUID) } } -#if HAVE_SECURITY - mp_builtin->mp_participantImpl->security_manager().remove_participant(*pdata); -#endif - if(mp_builtin->mp_WLP != nullptr) this->mp_builtin->mp_WLP->removeRemoteEndpoints(pdata); this->mp_EDP->removeRemoteEndpoints(pdata); this->removeRemoteEndpoints(pdata); +#if HAVE_SECURITY + mp_builtin->mp_participantImpl->security_manager().remove_participant(*pdata); +#endif + this->mp_SPDPReaderHistory->getMutex()->lock(); for(std::vector::iterator it=this->mp_SPDPReaderHistory->changesBegin(); it!=this->mp_SPDPReaderHistory->changesEnd();++it) diff --git a/src/cpp/rtps/messages/RTPSMessageGroup.cpp b/src/cpp/rtps/messages/RTPSMessageGroup.cpp index 87131414937..895ff46aed4 100644 --- a/src/cpp/rtps/messages/RTPSMessageGroup.cpp +++ b/src/cpp/rtps/messages/RTPSMessageGroup.cpp @@ -303,8 +303,7 @@ bool RTPSMessageGroup::add_info_dst_in_buffer(CDRMessage_t* buffer, const std::v if(added) { #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { buffer->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -363,8 +362,7 @@ bool RTPSMessageGroup::add_info_ts_in_buffer(const std::vector& remote_r } #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -425,8 +423,7 @@ bool RTPSMessageGroup::add_data(const CacheChange_t& change, const std::vectorgetAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -523,8 +520,7 @@ bool RTPSMessageGroup::add_data_frag(const CacheChange_t& change, const uint32_t change_to_add.serializedPayload.data = NULL; #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -572,8 +568,7 @@ bool RTPSMessageGroup::add_heartbeat(const std::vector& remote_readers, } #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -630,8 +625,7 @@ bool RTPSMessageGroup::add_gap(std::set& changesSeqNum, } #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -683,8 +677,7 @@ bool RTPSMessageGroup::add_acknack(const GUID_t& remote_writer, SequenceNumberSe } #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); @@ -729,8 +722,7 @@ bool RTPSMessageGroup::add_nackfrag(const GUID_t& remote_writer, SequenceNumber_ } #if HAVE_SECURITY - if(endpoint_->getAttributes()->security_attributes().is_submessage_protected && - endpoint_->supports_rtps_protection()) + if(endpoint_->getAttributes()->security_attributes().is_submessage_protected) { submessage_msg_->pos = from_buffer_position; CDRMessage::initCDRMsg(encrypt_msg_); diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 9aa8b3ecd50..7099affc1e4 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -470,7 +470,16 @@ bool RTPSParticipantImpl::createWriter(RTPSWriter** WriterOut, if(!isBuiltin) { if(!m_security_manager.register_local_writer(SWriter->getGuid(), - param.endpoint.properties, param.endpoint.security_attributes())) + param.endpoint.properties, SWriter->getAttributes()->security_attributes())) + { + delete(SWriter); + return false; + } + } + else + { + if(!m_security_manager.register_local_builtin_writer(SWriter->getGuid(), + SWriter->getAttributes()->security_attributes())) { delete(SWriter); return false; @@ -580,7 +589,16 @@ bool RTPSParticipantImpl::createReader(RTPSReader** ReaderOut, if(!isBuiltin) { if(!m_security_manager.register_local_reader(SReader->getGuid(), - param.endpoint.properties, param.endpoint.security_attributes())) + param.endpoint.properties, SReader->getAttributes()->security_attributes())) + { + delete(SReader); + return false; + } + } + else + { + if(!m_security_manager.register_local_builtin_reader(SReader->getGuid(), + SReader->getAttributes()->security_attributes())) { delete(SReader); return false; @@ -625,8 +643,16 @@ bool RTPSParticipantImpl::enableReader(RTPSReader *reader) return true; } - - +// Avoid to receive PDPSimple reader a DATA while calling ~PDPSimple and EDP was destroy already. +void RTPSParticipantImpl::disableReader(RTPSReader *reader) +{ + m_receiverResourcelistMutex.lock(); + for(auto it = m_receiverResourcelist.begin(); it != m_receiverResourcelist.end(); ++it) + { + (*it).mp_receiver->removeEndpoint(reader); + } + m_receiverResourcelistMutex.unlock(); +} bool RTPSParticipantImpl::registerWriter(RTPSWriter* Writer,TopicAttributes& topicAtt,WriterQos& wqos) { @@ -904,9 +930,8 @@ bool RTPSParticipantImpl::deleteUserEndpoint(Endpoint* p_endpoint) } #if HAVE_SECURITY - if (p_endpoint->supports_rtps_protection() && - (p_endpoint->getAttributes()->security_attributes().is_submessage_protected || - p_endpoint->getAttributes()->security_attributes().is_payload_protected)) + if(p_endpoint->getAttributes()->security_attributes().is_submessage_protected || + p_endpoint->getAttributes()->security_attributes().is_payload_protected) { m_security_manager.unregister_local_writer(p_endpoint->getGuid()); } @@ -920,9 +945,8 @@ bool RTPSParticipantImpl::deleteUserEndpoint(Endpoint* p_endpoint) } #if HAVE_SECURITY - if(p_endpoint->supports_rtps_protection() && - (p_endpoint->getAttributes()->security_attributes().is_submessage_protected || - p_endpoint->getAttributes()->security_attributes().is_payload_protected) ) + if(p_endpoint->getAttributes()->security_attributes().is_submessage_protected || + p_endpoint->getAttributes()->security_attributes().is_payload_protected) { m_security_manager.unregister_local_reader(p_endpoint->getGuid()); } diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index e8e0f0ba0b9..76825db3988 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -373,6 +373,8 @@ class RTPSParticipantImpl bool enableReader(RTPSReader *reader); + void disableReader(RTPSReader *reader); + /** * Register a Writer in the BuiltinProtocols. * @param Writer Pointer to the RTPSWriter. diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index 643cbce5ac1..77184acf6ce 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -2001,7 +2001,8 @@ bool SecurityManager::register_local_writer(const GUID_t& writer_guid, const Pro } } - if(returned_value && crypto_plugin_ != nullptr) + if(returned_value && crypto_plugin_ != nullptr && (security_attributes.is_submessage_protected || + security_attributes.is_payload_protected)) { DatawriterCryptoHandle* writer_handle = crypto_plugin_->cryptokeyfactory()->register_local_datawriter( *local_participant_crypto_handle_, writer_properties.properties(), exception); @@ -2021,6 +2022,31 @@ bool SecurityManager::register_local_writer(const GUID_t& writer_guid, const Pro return returned_value; } +bool SecurityManager::register_local_builtin_writer(const GUID_t& writer_guid, EndpointSecurityAttributes& security_attributes) +{ + bool returned_value = true; + SecurityException exception; + + if(crypto_plugin_ != nullptr && security_attributes.is_submessage_protected) + { + DatawriterCryptoHandle* writer_handle = crypto_plugin_->cryptokeyfactory()->register_local_datawriter( + *local_participant_crypto_handle_, PropertySeq(), exception); + + if(writer_handle != nullptr && !writer_handle->nil()) + { + std::unique_lock lock(mutex_); + writer_handles_.emplace(writer_guid, writer_handle); + } + else + { + logError(SECURITY, "Cannot register local writer in crypto plugin. (" << exception.what() << ")"); + returned_value = false; + } + } + + return returned_value; +} + bool SecurityManager::unregister_local_writer(const GUID_t& writer_guid) { if(crypto_plugin_ == nullptr) @@ -2045,10 +2071,6 @@ bool SecurityManager::unregister_local_writer(const GUID_t& writer_guid) return true; } - else - { - logError(SECURITY, "Cannot find local writer " << writer_guid << std::endl); - } return false; } @@ -2136,7 +2158,8 @@ bool SecurityManager::register_local_reader(const GUID_t& reader_guid, const Pro } } - if(returned_value && crypto_plugin_ != nullptr) + if(returned_value && crypto_plugin_ != nullptr && (security_attributes.is_submessage_protected || + security_attributes.is_payload_protected)) { DatareaderCryptoHandle* reader_handle = crypto_plugin_->cryptokeyfactory()->register_local_datareader( @@ -2157,6 +2180,31 @@ bool SecurityManager::register_local_reader(const GUID_t& reader_guid, const Pro return returned_value; } +bool SecurityManager::register_local_builtin_reader(const GUID_t& reader_guid, EndpointSecurityAttributes& security_attributes) +{ + bool returned_value = true; + SecurityException exception; + + if(crypto_plugin_ != nullptr && security_attributes.is_submessage_protected) + { + DatareaderCryptoHandle* reader_handle = crypto_plugin_->cryptokeyfactory()->register_local_datareader( + *local_participant_crypto_handle_, PropertySeq(), exception); + + if(reader_handle != nullptr && !reader_handle->nil()) + { + std::unique_lock lock(mutex_); + reader_handles_.emplace(reader_guid, reader_handle); + } + else + { + logError(SECURITY, "Cannot register local reader in crypto plugin. (" << exception.what() << ")"); + returned_value = false; + } + } + + return returned_value; +} + bool SecurityManager::unregister_local_reader(const GUID_t& reader_guid) { if(crypto_plugin_ == nullptr) @@ -2181,16 +2229,52 @@ bool SecurityManager::unregister_local_reader(const GUID_t& reader_guid) return true; } - else + + return false; +} + +bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& remote_participant_key, + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes) +{ + return discovered_reader(writer_guid, remote_participant_key, remote_reader_data, security_attributes, false); +} + +void SecurityManager::remove_reader(const GUID_t& writer_guid, const GUID_t& /*remote_participant_key*/, + const GUID_t& remote_reader_guid) +{ + if(crypto_plugin_ == nullptr) + return; + + std::unique_lock lock(mutex_); + + auto local_writer = writer_handles_.find(writer_guid); + + if(local_writer != writer_handles_.end()) { - logError(SECURITY, "Cannot find local reader " << reader_guid << std::endl); + SecurityException exception; + + auto rit = local_writer->second.associated_readers.find(remote_reader_guid); + + if(rit != local_writer->second.associated_readers.end()) + { + crypto_plugin_->cryptokeyfactory()->unregister_datareader(std::get<1>(rit->second), exception); + local_writer->second.associated_readers.erase(rit); + } + else + { + logInfo(SECURITY, "Cannot find remote reader " << remote_reader_guid << std::endl); + } } +} - return false; +bool SecurityManager::discovered_builtin_reader(const GUID_t& writer_guid, const GUID_t& remote_participant_key, + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes) +{ + return discovered_reader(writer_guid, remote_participant_key, remote_reader_data, security_attributes, true); } bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& remote_participant_key, - ReaderProxyData& remote_reader_data) + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes, bool is_builtin) { std::unique_lock lock(mutex_); PermissionsHandle* remote_permissions = nullptr; @@ -2219,7 +2303,7 @@ bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& bool returned_value = true; SecurityException exception; - if(access_plugin_ != nullptr && remote_permissions != nullptr) + if(!is_builtin && access_plugin_ != nullptr && remote_permissions != nullptr) { if((returned_value = access_plugin_->check_remote_datareader( *remote_permissions, domain_id_, remote_reader_data, exception)) == false) @@ -2228,15 +2312,14 @@ bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& } } - if(returned_value && crypto_plugin_ != nullptr) + if(returned_value && crypto_plugin_ != nullptr && (security_attributes.is_submessage_protected || + security_attributes.is_payload_protected)) { auto local_writer = writer_handles_.find(writer_guid); returned_value = false; if(local_writer != writer_handles_.end()) { - - if(remote_participant_crypto_handle != nullptr) { DatareaderCryptoHandle* remote_reader_handle = crypto_plugin_->cryptokeyfactory()->register_matched_remote_datareader( @@ -2425,6 +2508,7 @@ bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& } else if(returned_value) { + lock.unlock(); participant_->pdpsimple()->getEDP()->pairing_remote_reader_with_local_writer_after_security( writer_guid, remote_reader_data); } @@ -2432,40 +2516,48 @@ bool SecurityManager::discovered_reader(const GUID_t& writer_guid, const GUID_t& return returned_value; } -void SecurityManager::remove_reader(const GUID_t& writer_guid, const GUID_t& /*remote_participant_key*/, - const GUID_t& remote_reader_guid) +bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& remote_participant_key, + WriterProxyData& remote_writer_data, const EndpointSecurityAttributes& security_attributes) +{ + return discovered_writer(reader_guid, remote_participant_key, remote_writer_data, security_attributes, false); +} + +void SecurityManager::remove_writer(const GUID_t& reader_guid, const GUID_t& /*remote_participant_key*/, + const GUID_t& remote_writer_guid) { if(crypto_plugin_ == nullptr) return; std::unique_lock lock(mutex_); - auto local_writer = writer_handles_.find(writer_guid); + auto local_reader = reader_handles_.find(reader_guid); - if(local_writer != writer_handles_.end()) + if(local_reader != reader_handles_.end()) { SecurityException exception; - auto rit = local_writer->second.associated_readers.find(remote_reader_guid); + auto wit = local_reader->second.associated_writers.find(remote_writer_guid); - if(rit != local_writer->second.associated_readers.end()) + if(wit != local_reader->second.associated_writers.end()) { - crypto_plugin_->cryptokeyfactory()->unregister_datareader(std::get<1>(rit->second), exception); - local_writer->second.associated_readers.erase(rit); + crypto_plugin_->cryptokeyfactory()->unregister_datawriter(std::get<1>(wit->second), exception); + local_reader->second.associated_writers.erase(wit); } else { - logInfo(SECURITY, "Cannot find remote reader " << remote_reader_guid << std::endl); + logInfo(SECURITY, "Cannot find remote writer " << remote_writer_guid << std::endl); } } - else - { - logError(SECURITY, "Cannot find local writer " << writer_guid << std::endl); - } +} + +bool SecurityManager::discovered_builtin_writer(const GUID_t& reader_guid, const GUID_t& remote_participant_key, + WriterProxyData& remote_writer_data, const EndpointSecurityAttributes& security_attributes) +{ + return discovered_writer(reader_guid, remote_participant_key, remote_writer_data, security_attributes, true); } bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& remote_participant_key, - WriterProxyData& remote_writer_data) + WriterProxyData& remote_writer_data, const EndpointSecurityAttributes& security_attributes, bool is_builtin) { std::unique_lock lock(mutex_); PermissionsHandle* remote_permissions = nullptr; @@ -2494,7 +2586,7 @@ bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& bool returned_value = true; SecurityException exception; - if(access_plugin_ != nullptr && remote_permissions != nullptr) + if(!is_builtin && access_plugin_ != nullptr && remote_permissions != nullptr) { if((returned_value = access_plugin_->check_remote_datawriter( *remote_permissions, domain_id_, remote_writer_data, exception)) == false) @@ -2503,7 +2595,8 @@ bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& } } - if(returned_value && crypto_plugin_ != nullptr) + if(returned_value && crypto_plugin_ != nullptr && (security_attributes.is_submessage_protected || + security_attributes.is_payload_protected)) { auto local_reader = reader_handles_.find(reader_guid); returned_value = false; @@ -2512,8 +2605,6 @@ bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& { if(remote_participant_crypto_handle != nullptr) { - - DatawriterCryptoHandle* remote_writer_handle = crypto_plugin_->cryptokeyfactory()->register_matched_remote_datawriter( *local_reader->second.reader_handle, *remote_participant_crypto_handle, *shared_secret_handle, exception); @@ -2701,6 +2792,7 @@ bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& } else if(returned_value) { + lock.unlock(); participant_->pdpsimple()->getEDP()->pairing_remote_writer_with_local_reader_after_security( reader_guid, remote_writer_data); } @@ -2708,38 +2800,6 @@ bool SecurityManager::discovered_writer(const GUID_t& reader_guid, const GUID_t& return returned_value; } -void SecurityManager::remove_writer(const GUID_t& reader_guid, const GUID_t& /*remote_participant_key*/, - const GUID_t& remote_writer_guid) -{ - if(crypto_plugin_ == nullptr) - return; - - std::unique_lock lock(mutex_); - - auto local_reader = reader_handles_.find(reader_guid); - - if(local_reader != reader_handles_.end()) - { - SecurityException exception; - - auto wit = local_reader->second.associated_writers.find(remote_writer_guid); - - if(wit != local_reader->second.associated_writers.end()) - { - crypto_plugin_->cryptokeyfactory()->unregister_datawriter(std::get<1>(wit->second), exception); - local_reader->second.associated_writers.erase(wit); - } - else - { - logInfo(SECURITY, "Cannot find remote writer " << remote_writer_guid << std::endl); - } - } - else - { - logError(SECURITY, "Cannot find local reader " << reader_guid << std::endl); - } -} - bool SecurityManager::encode_writer_submessage(const CDRMessage_t& input_message, CDRMessage_t& output_message, const GUID_t& writer_guid, const std::vector& receiving_list) { diff --git a/src/cpp/rtps/security/SecurityManager.h b/src/cpp/rtps/security/SecurityManager.h index 9694b99e7bb..99f99cba68d 100644 --- a/src/cpp/rtps/security/SecurityManager.h +++ b/src/cpp/rtps/security/SecurityManager.h @@ -77,25 +77,35 @@ class SecurityManager bool register_local_writer(const GUID_t& writer_guid, const PropertyPolicy& writer_properties, EndpointSecurityAttributes& security_attributes); + bool register_local_builtin_writer(const GUID_t& writer_guid, EndpointSecurityAttributes& security_attributes); + bool unregister_local_writer(const GUID_t& writer_guid); bool register_local_reader(const GUID_t& reader_guid, const PropertyPolicy& reader_properties, EndpointSecurityAttributes& security_attributes); + bool register_local_builtin_reader(const GUID_t& reader_guid, EndpointSecurityAttributes& security_attributes); + bool unregister_local_reader(const GUID_t& reader_guid); bool discovered_reader(const GUID_t& writer_guid, const GUID_t& remote_participant, - ReaderProxyData& remote_reader_data); + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes); void remove_reader(const GUID_t& writer_guid, const GUID_t& remote_participant, const GUID_t& remote_reader_guid); + bool discovered_builtin_reader(const GUID_t& writer_guid, const GUID_t& remote_participant, + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes); + bool discovered_writer(const GUID_t& reader_guid, const GUID_t& remote_participant, - WriterProxyData& remote_writer_guid); + WriterProxyData& remote_writer_guid, const EndpointSecurityAttributes& security_attributes); void remove_writer(const GUID_t& reader_guid, const GUID_t& remote_participant, const GUID_t& remote_writer_guid); + bool discovered_builtin_writer(const GUID_t& reader_guid, const GUID_t& remote_participant, + WriterProxyData& remote_writer_guid, const EndpointSecurityAttributes& security_attributes); + bool get_identity_token(IdentityToken** identity_token); bool return_identity_token(IdentityToken* identity_token); @@ -334,6 +344,14 @@ class SecurityManager bool create_participant_volatile_message_secure_reader(); void delete_participant_volatile_message_secure_reader(); + bool discovered_reader(const GUID_t& writer_guid, const GUID_t& remote_participant, + ReaderProxyData& remote_reader_data, const EndpointSecurityAttributes& security_attributes, + bool is_builtin); + + bool discovered_writer(const GUID_t& reader_guid, const GUID_t& remote_participant, + WriterProxyData& remote_writer_guid, const EndpointSecurityAttributes& security_attributes, + bool is_builtin); + void match_builtin_endpoints(const ParticipantProxyData& participant_data); void unmatch_builtin_endpoints(const ParticipantProxyData& participant_data);