diff --git a/include/fastdds/dds/core/Types.hpp b/include/fastdds/dds/core/Types.hpp index 8f24af6545b..667616d0a25 100644 --- a/include/fastdds/dds/core/Types.hpp +++ b/include/fastdds/dds/core/Types.hpp @@ -23,6 +23,8 @@ namespace dds { typedef uint32_t DomainId_t; +const DomainId_t DOMAIN_ID_UNKNOWN = 0xFFFFFFFF; + const int32_t LENGTH_UNLIMITED = -1; } // namespace dds diff --git a/include/fastdds/dds/core/policy/ParameterTypes.hpp b/include/fastdds/dds/core/policy/ParameterTypes.hpp index 0d8d273361d..c09da61d6d1 100644 --- a/include/fastdds/dds/core/policy/ParameterTypes.hpp +++ b/include/fastdds/dds/core/policy/ParameterTypes.hpp @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -525,6 +526,43 @@ class ParameterGuid_t : public Parameter_t #define PARAMETER_GUID_LENGTH 16 +/** + * @ingroup PARAMETER_MODULE + */ +class ParameterDomainId_t : public Parameter_t +{ +public: + + //!Domain ID.
By default, DOMAIN_ID_UNKNOWN. + uint32_t domain_id; + + /** + * @brief Constructor without parameters + */ + ParameterDomainId_t() + : domain_id(DOMAIN_ID_UNKNOWN) + { + } + + /** + * Constructor using a parameter PID and the parameter length + * + * @param pid Pid of the parameter + * @param in_length Its associated length + */ + ParameterDomainId_t( + ParameterId_t pid, + uint16_t in_length) + : Parameter_t(pid, in_length) + , domain_id(DOMAIN_ID_UNKNOWN) + { + domain_id = DOMAIN_ID_UNKNOWN; + } + +}; + +#define PARAMETER_DOMAINID_LENGTH 4 + /** * @ingroup PARAMETER_MODULE */ diff --git a/include/fastdds/rtps/builtin/data/ParticipantProxyData.hpp b/include/fastdds/rtps/builtin/data/ParticipantProxyData.hpp index e2b1987d732..88a18655bee 100644 --- a/include/fastdds/rtps/builtin/data/ParticipantProxyData.hpp +++ b/include/fastdds/rtps/builtin/data/ParticipantProxyData.hpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,8 @@ class ParticipantProxyData GUID_t m_guid; //!Vendor ID fastdds::rtps::VendorId_t m_VendorId; + //!Domain ID + fastdds::dds::DomainId_t m_domain_id; //!Expects Inline QOS. bool m_expectsInlineQos; //!Available builtin endpoints diff --git a/include/fastdds/rtps/transport/test_UDPv4TransportDescriptor.h b/include/fastdds/rtps/transport/test_UDPv4TransportDescriptor.h index 6d62a49443c..277cde7a531 100644 --- a/include/fastdds/rtps/transport/test_UDPv4TransportDescriptor.h +++ b/include/fastdds/rtps/transport/test_UDPv4TransportDescriptor.h @@ -47,8 +47,16 @@ struct test_UDPv4TransportDescriptor : public SocketTransportDescriptor //! Test shim parameters //! Percentage of data messages being dropped mutable std::atomic dropDataMessagesPercentage; + //! Percentage of Data[P] messages being dropped + mutable std::atomic dropParticipantBuiltinDataMessagesPercentage; + //! Percentage of Data[W] messages being dropped + mutable std::atomic dropPublicationBuiltinDataMessagesPercentage; + //! Percentage of Data[R] messages being dropped + mutable std::atomic dropSubscriptionBuiltinDataMessagesPercentage; //! Filtering function for dropping data messages filter drop_data_messages_filter_; + //! Filtering function for dropping builtin data messages + filter drop_builtin_data_messages_filter_; //! Flag to enable dropping of discovery Participant DATA(P) messages bool dropParticipantBuiltinTopicData; //! Flag to enable dropping of discovery Writer DATA(W) messages diff --git a/include/fastrtps/qos/ParameterTypes.h b/include/fastrtps/qos/ParameterTypes.h index 7c712d8a735..6ba7757d3bf 100644 --- a/include/fastrtps/qos/ParameterTypes.h +++ b/include/fastrtps/qos/ParameterTypes.h @@ -53,6 +53,7 @@ using ParameterPort_t = fastdds::dds::ParameterPort_t; using ParameterGuid_t = fastdds::dds::ParameterGuid_t; using ParameterProtocolVersion_t = fastdds::dds::ParameterProtocolVersion_t; using ParameterVendorId_t = fastdds::dds::ParameterVendorId_t; +using ParameterDomainId_t = fastdds::dds::ParameterDomainId_t; using ParameterIP4Address_t = fastdds::dds::ParameterIP4Address_t; using ParameterBool_t = fastdds::dds::ParameterBool_t; using ParameterStatusInfo_t = fastdds::dds::ParameterStatusInfo_t; diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 29b0421fc45..a7d73bd3309 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -131,6 +131,7 @@ set(${PROJECT_NAME}_source_files rtps/builtin/discovery/participant/DirectMessageSender.cpp rtps/builtin/discovery/participant/PDP.cpp rtps/builtin/discovery/participant/PDPClient.cpp + rtps/builtin/discovery/participant/PDPClientListener.cpp rtps/builtin/discovery/participant/PDPListener.cpp rtps/builtin/discovery/participant/PDPServer.cpp rtps/builtin/discovery/participant/PDPServerListener.cpp diff --git a/src/cpp/fastdds/core/policy/ParameterSerializer.hpp b/src/cpp/fastdds/core/policy/ParameterSerializer.hpp index eb3664479ba..6d9cff6e72a 100644 --- a/src/cpp/fastdds/core/policy/ParameterSerializer.hpp +++ b/src/cpp/fastdds/core/policy/ParameterSerializer.hpp @@ -433,6 +433,28 @@ inline bool ParameterSerializer::read_content_from_cdr_mess return valid; } +template<> +inline bool ParameterSerializer::add_content_to_cdr_message( + const ParameterDomainId_t& parameter, + fastrtps::rtps::CDRMessage_t* cdr_message) +{ + return fastrtps::rtps::CDRMessage::addUInt32(cdr_message, parameter.domain_id); +} + +template<> +inline bool ParameterSerializer::read_content_from_cdr_message( + ParameterDomainId_t& parameter, + fastrtps::rtps::CDRMessage_t* cdr_message, + const uint16_t parameter_length) +{ + if (parameter_length != PARAMETER_DOMAINID_LENGTH) + { + return false; + } + parameter.length = parameter_length; + return fastrtps::rtps::CDRMessage::readUInt32(cdr_message, ¶meter.domain_id); +} + template<> inline bool ParameterSerializer::add_content_to_cdr_message( const ParameterIP4Address_t& parameter, diff --git a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp index d5cab4a3a13..a78cb3c2181 100644 --- a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp +++ b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp @@ -52,6 +52,7 @@ ParticipantProxyData::ParticipantProxyData( const RTPSParticipantAllocationAttributes& allocation) : m_protocolVersion(c_ProtocolVersion) , m_VendorId(c_VendorId_Unknown) + , m_domain_id(fastdds::dds::DOMAIN_ID_UNKNOWN) , m_expectsInlineQos(false) , m_availableBuiltinEndpoints(0) , m_networkConfiguration(0) @@ -78,6 +79,7 @@ ParticipantProxyData::ParticipantProxyData( : m_protocolVersion(pdata.m_protocolVersion) , m_guid(pdata.m_guid) , m_VendorId(pdata.m_VendorId) + , m_domain_id(pdata.m_domain_id) , m_expectsInlineQos(pdata.m_expectsInlineQos) , m_availableBuiltinEndpoints(pdata.m_availableBuiltinEndpoints) , m_networkConfiguration(pdata.m_networkConfiguration) @@ -151,6 +153,9 @@ uint32_t ParticipantProxyData::get_serialized_size( // PID_VENDORID ret_val += 4 + 4; + // PID_DOMAIN_ID + ret_val += 4 + PARAMETER_DOMAINID_LENGTH; + if (m_expectsInlineQos) { // PID_EXPECTS_INLINE_QOS @@ -252,6 +257,14 @@ bool ParticipantProxyData::writeToCDRMessage( return false; } } + { + ParameterDomainId_t p(fastdds::dds::PID_DOMAIN_ID, 4); + p.domain_id = this->m_domain_id; + if (!fastdds::dds::ParameterSerializer::add_to_cdr_message(p, msg)) + { + return false; + } + } if (this->m_expectsInlineQos) { ParameterBool_t p(fastdds::dds::PID_EXPECTS_INLINE_QOS, PARAMETER_BOOL_LENGTH, m_expectsInlineQos); @@ -443,6 +456,18 @@ bool ParticipantProxyData::readFromCDRMessage( is_shm_transport_available &= (m_VendorId == c_VendorId_eProsima); break; } + case fastdds::dds::PID_DOMAIN_ID: + { + ParameterDomainId_t p(pid, plength); + if (!fastdds::dds::ParameterSerializer::read_from_cdr_message(p, msg, + plength)) + { + return false; + } + + m_domain_id = p.domain_id; + break; + } case fastdds::dds::PID_EXPECTS_INLINE_QOS: { ParameterBool_t p(pid, plength); @@ -740,6 +765,7 @@ void ParticipantProxyData::clear() m_guid = GUID_t(); //set_VendorId_Unknown(m_VendorId); m_VendorId = c_VendorId_Unknown; + m_domain_id = fastdds::dds::DOMAIN_ID_UNKNOWN; m_expectsInlineQos = false; m_availableBuiltinEndpoints = 0; m_networkConfiguration = 0; @@ -771,6 +797,7 @@ void ParticipantProxyData::copy( m_guid = pdata.m_guid; m_VendorId[0] = pdata.m_VendorId[0]; m_VendorId[1] = pdata.m_VendorId[1]; + m_domain_id = pdata.m_domain_id; m_availableBuiltinEndpoints = pdata.m_availableBuiltinEndpoints; m_networkConfiguration = pdata.m_networkConfiguration; metatraffic_locators = pdata.metatraffic_locators; diff --git a/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.cpp b/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.cpp index fd8d4fcbbbd..0333ab49e9d 100644 --- a/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.cpp @@ -86,6 +86,17 @@ void PDPSecurityInitiatorListener::process_alive_data( } +bool PDPSecurityInitiatorListener::check_discovery_conditions( + ParticipantProxyData& /* participant_data */) +{ + /* Do not check PID_VENDOR_ID */ + // In Discovery Server we don't impose + // domain ids to be the same + /* Do not check PID_DOMAIN_ID */ + /* Do not check PARTICIPANT_TYPE */ + return true; +} + } /* namespace rtps */ } /* namespace fastrtps */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.hpp b/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.hpp index dfab8a1a6d0..2301562bc30 100644 --- a/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.hpp +++ b/src/cpp/rtps/builtin/discovery/participant/DS/PDPSecurityInitiatorListener.hpp @@ -55,6 +55,9 @@ class PDPSecurityInitiatorListener : public PDPListener protected: + bool check_discovery_conditions( + ParticipantProxyData& participant_data) override; + void process_alive_data( ParticipantProxyData* old_data, ParticipantProxyData& new_data, diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index 235fefc2d89..d6621a328ad 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -232,6 +232,7 @@ void PDP::initializeParticipantProxyData( RTPSParticipantAttributes& attributes = mp_RTPSParticipant->getAttributes(); bool announce_locators = !mp_RTPSParticipant->is_intraprocess_only(); + participant_data->m_domain_id = mp_RTPSParticipant->get_domain_id(); participant_data->m_leaseDuration = attributes.builtin.discovery_config.leaseDuration; //set_VendorId_eProsima(participant_data->m_VendorId); participant_data->m_VendorId = c_VendorId_eProsima; diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index 6fc9437b075..3ceba316ccb 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -357,7 +358,7 @@ bool PDPClient::create_ds_pdp_reliable_endpoints( } #endif // HAVE_SECURITY - endpoints.reader.listener_.reset(new PDPListener(this)); + endpoints.reader.listener_.reset(new PDPClientListener(this)); RTPSReader* reader = nullptr; #if HAVE_SECURITY diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp new file mode 100644 index 00000000000..4852d338955 --- /dev/null +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp @@ -0,0 +1,63 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file PDPClientListener.cpp + * + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +using ParameterList = eprosima::fastdds::dds::ParameterList; + +namespace eprosima { +namespace fastrtps { +namespace rtps { + +PDPClientListener::PDPClientListener( + PDP* parent_pdp) + : PDPListener(parent_pdp) +{ +} + +bool PDPClientListener::check_discovery_conditions( + ParticipantProxyData& /* participant_data */) +{ + /* Do not check PID_VENDOR_ID */ + // In Discovery Server we don't impose + // domain ids to be the same + /* Do not check PID_DOMAIN_ID */ + /* Do not check PARTICIPANT_TYPE */ + return true; +} + +} /* namespace rtps */ +} /* namespace fastrtps */ +} /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.hpp b/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.hpp new file mode 100644 index 00000000000..13f96980361 --- /dev/null +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.hpp @@ -0,0 +1,59 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file PDPClientListener.h + * + */ + +#ifndef _FASTDDS_RTPS_PDPCLIENTLISTENER_H_ +#define _FASTDDS_RTPS_PDPCLIENTLISTENER_H_ + +#include + +namespace eprosima { +namespace fastrtps { +namespace rtps { + +/** + * Class PDPClientListener used by a PDP discovery client. + * This class is implemented in order to use the same structure than with any other RTPSReader. + * @ingroup DISCOVERY_MODULE + */ +class PDPClientListener : public PDPListener +{ + +public: + + /** + * @param parent Pointer to object creating this object + */ + PDPClientListener( + PDP* parent); + + virtual ~PDPClientListener() override = default; + +protected: + + bool check_discovery_conditions( + ParticipantProxyData& pdata) override; + +}; + + +} /* namespace rtps */ +} /* namespace fastrtps */ +} /* namespace eprosima */ + +#endif /* _FASTDDS_RTPS_PDPCLIENTLISTENER_H_ */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp index 9f0c422c243..4369ba53111 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp @@ -114,6 +114,11 @@ void PDPListener::on_new_cache_change_added( return; } + if (!check_discovery_conditions(temp_participant_data_)) + { + return; + } + // Filter locators const auto& pattr = parent_pdp_->getRTPSParticipant()->getAttributes(); fastdds::rtps::network::external_locators::filter_remote_locators(temp_participant_data_, @@ -274,6 +279,26 @@ void PDPListener::process_alive_data( reader->getMutex().lock(); } +bool PDPListener::check_discovery_conditions( + ParticipantProxyData& participant_data) +{ + bool ret = true; + uint32_t remote_participant_domain_id = participant_data.m_domain_id; + + // In PDPSimple, do not match if the participant is from a different domain. + // If the domain id is unknown, it is assumed to be the same domain + if (remote_participant_domain_id != parent_pdp_->getRTPSParticipant()->get_domain_id() && + remote_participant_domain_id != fastdds::dds::DOMAIN_ID_UNKNOWN) + { + EPROSIMA_LOG_INFO(RTPS_PDP_DISCOVERY, "Received participant with different domain id (" + << remote_participant_domain_id << ") than ours (" + << parent_pdp_->getRTPSParticipant()->get_domain_id() << ")"); + ret = false; + } + + return ret; +} + bool PDPListener::get_key( CacheChange_t* change) { diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPListener.h b/src/cpp/rtps/builtin/discovery/participant/PDPListener.h index 329549a6ac9..74256bf2d08 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPListener.h +++ b/src/cpp/rtps/builtin/discovery/participant/PDPListener.h @@ -80,6 +80,17 @@ class PDPListener : public ReaderListener RTPSReader* reader, std::unique_lock& lock); + /** + * Checks discovery conditions of an incoming DATA(p). + * This method is called from PDPListener::onNewCacheChangeAdded() just right after + * having deserialized the DATA(p) message. + * + * @param [in] pdata ParticipantProxyData from the DATA(p) message. + * @remarks Whether discovery routine should continue or discard the participant. + */ + virtual bool check_discovery_conditions( + ParticipantProxyData& participant_data); + /** * Get the key of a CacheChange_t * @param change Pointer to the CacheChange_t diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index 44993dbc7e0..73ee72bbf2f 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -148,98 +148,17 @@ void PDPServerListener::on_new_cache_change_added( return; } - const auto& pattr = pdp_server()->getRTPSParticipant()->getAttributes(); - fastdds::rtps::network::external_locators::filter_remote_locators(participant_data, - pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators, - pattr.ignore_non_matching_locators); - - /* Check PID_VENDOR_ID */ - if (participant_data.m_VendorId != fastrtps::rtps::c_VendorId_eProsima) + auto ret = check_server_discovery_conditions(participant_data); + if (!ret.first) { - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, - "DATA(p|Up) from different vendor is not supported for Discover-Server operation"); return; } + bool is_client = ret.second; - fastdds::dds::ParameterPropertyList_t properties = participant_data.m_properties; - - /* Check DS_VERSION */ - auto ds_version = std::find_if( - properties.begin(), - properties.end(), - [](const dds::ParameterProperty_t& property) - { - return property.first() == dds::parameter_property_ds_version; - }); - - if (ds_version != properties.end()) - { - if (std::stof(ds_version->second()) < 1.0) - { - EPROSIMA_LOG_ERROR(RTPS_PDP_LISTENER, "Minimum " << dds::parameter_property_ds_version - << " is 1.0, found: " << ds_version->second()); - return; - } - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant " << dds::parameter_property_ds_version << ": " - << ds_version->second()); - } - else - { - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, dds::parameter_property_ds_version << " is not set. Assuming 1.0"); - } - - /* Check PARTICIPANT_TYPE */ - bool is_client = true; - auto participant_type = std::find_if( - properties.begin(), - properties.end(), - [](const dds::ParameterProperty_t& property) - { - return property.first() == dds::parameter_property_participant_type; - }); - - if (participant_type != properties.end()) - { - if (participant_type->second() == ParticipantType::SERVER || - participant_type->second() == ParticipantType::BACKUP || - participant_type->second() == ParticipantType::SUPER_CLIENT) - { - is_client = false; - } - else if (participant_type->second() == ParticipantType::SIMPLE) - { - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Ignoring " << dds::parameter_property_participant_type << ": " - << participant_type->second()); - return; - } - else if (participant_type->second() != ParticipantType::CLIENT) - { - EPROSIMA_LOG_ERROR(RTPS_PDP_LISTENER, "Wrong " << dds::parameter_property_participant_type << ": " - << participant_type->second()); - return; - } - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant type " << participant_type->second()); - } - else - { - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, dds::parameter_property_participant_type << " is not set"); - // Fallback to checking whether participant is a SERVER looking for the persistence GUID - auto persistence_guid = std::find_if( - properties.begin(), - properties.end(), - [](const dds::ParameterProperty_t& property) - { - return property.first() == dds::parameter_property_persistence_guid; - }); - // The presence of persistence GUID property suggests a SERVER. This assumption is made to keep - // backwards compatibility with Discovery Server v1.0. However, any participant that has been configured - // as persistent will have this property. - if (persistence_guid != properties.end()) - { - is_client = false; - } - EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant is client: " << std::boolalpha << is_client); - } + const auto& pattr = pdp_server()->getRTPSParticipant()->getAttributes(); + fastdds::rtps::network::external_locators::filter_remote_locators(participant_data, + pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators, + pattr.ignore_non_matching_locators); // Check whether the participant is a client/server of this server or if it has been forwarded from // another entity (server). @@ -443,6 +362,113 @@ void PDPServerListener::on_new_cache_change_added( EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, ""); } +std::pair PDPServerListener::check_server_discovery_conditions( + ParticipantProxyData& participant_data) +{ + // is_valid, is_client + std::pair ret{true, true}; + + /* Check PID_VENDOR_ID */ + if (participant_data.m_VendorId != fastrtps::rtps::c_VendorId_eProsima) + { + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, + "DATA(p|Up) from different vendor is not supported for Discover-Server operation"); + ret.first = false; + } + + // In Discovery Server we don't impose + // domain ids to be the same + /* Do not check PID_DOMAIN_ID */ + + fastdds::dds::ParameterPropertyList_t properties = participant_data.m_properties; + + /* Check DS_VERSION */ + if (ret.first) + { + auto ds_version = std::find_if( + properties.begin(), + properties.end(), + [](const dds::ParameterProperty_t& property) + { + return property.first() == dds::parameter_property_ds_version; + }); + + if (ds_version != properties.end()) + { + if (std::stof(ds_version->second()) < 1.0) + { + EPROSIMA_LOG_ERROR(RTPS_PDP_LISTENER, "Minimum " << dds::parameter_property_ds_version + << " is 1.0, found: " << ds_version->second()); + ret.first = false; + } + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant " << dds::parameter_property_ds_version << ": " + << ds_version->second()); + } + else + { + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, dds::parameter_property_ds_version << " is not set. Assuming 1.0"); + } + } + + /* Check PARTICIPANT_TYPE */ + if (ret.first) + { + auto participant_type = std::find_if( + properties.begin(), + properties.end(), + [](const dds::ParameterProperty_t& property) + { + return property.first() == dds::parameter_property_participant_type; + }); + + if (participant_type != properties.end()) + { + if (participant_type->second() == ParticipantType::SERVER || + participant_type->second() == ParticipantType::BACKUP || + participant_type->second() == ParticipantType::SUPER_CLIENT) + { + ret.second = false; + } + else if (participant_type->second() == ParticipantType::SIMPLE) + { + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Ignoring " << dds::parameter_property_participant_type << ": " + << participant_type->second()); + ret.first = false; + } + else if (participant_type->second() != ParticipantType::CLIENT) + { + EPROSIMA_LOG_ERROR(RTPS_PDP_LISTENER, "Wrong " << dds::parameter_property_participant_type << ": " + << participant_type->second()); + ret.first = false; + } + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant type " << participant_type->second()); + } + else + { + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, dds::parameter_property_participant_type << " is not set"); + // Fallback to checking whether participant is a SERVER looking for the persistence GUID + auto persistence_guid = std::find_if( + properties.begin(), + properties.end(), + [](const dds::ParameterProperty_t& property) + { + return property.first() == dds::parameter_property_persistence_guid; + }); + // The presence of persistence GUID property suggests a SERVER. This assumption is made to keep + // backwards compatibility with Discovery Server v1.0. However, any participant that has been configured + // as persistent will have this property. + if (persistence_guid != properties.end()) + { + ret.second = false; + } + EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, + "Participant is client: " << std::boolalpha << ret.second); + } + } + + return ret; +} + } /* namespace rtps */ } /* namespace fastdds */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.hpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.hpp index d3a83a181fa..467e19e9966 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.hpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.hpp @@ -58,6 +58,19 @@ class PDPServerListener : public fastrtps::rtps::PDPListener void on_new_cache_change_added( fastrtps::rtps::RTPSReader* reader, const fastrtps::rtps::CacheChange_t* const change) override; + +protected: + + /** + * Checks discovery conditions on a discovery server entity. + * Essentially, it checks for incoming PIDS of remote proxy datas. + * @param participant_data Remote participant data to check. + * @return A pair of booleans. + * The first one indicates if the remote participant data is valid. + * The second one indicates if the remote participant data is a client. + */ + std::pair check_server_discovery_conditions( + fastrtps::rtps::ParticipantProxyData& participant_data); }; diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 7a3336fbf7b..2795617aa0c 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -278,6 +278,12 @@ RTPSParticipantImpl::RTPSParticipantImpl( , has_shm_transport_(false) , match_local_endpoints_(should_match_local_endpoints(PParam)) { + if (domain_id_ == fastdds::dds::DOMAIN_ID_UNKNOWN) + { + EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "Domain ID has to be set to a correct value"); + return; + } + if (c_GuidPrefix_Unknown != persistence_guid) { m_persistence_guid = GUID_t(persistence_guid, c_EntityId_RTPSParticipant); diff --git a/src/cpp/rtps/transport/test_UDPv4Transport.cpp b/src/cpp/rtps/transport/test_UDPv4Transport.cpp index 2b25aa5dd9b..fb008ff565a 100644 --- a/src/cpp/rtps/transport/test_UDPv4Transport.cpp +++ b/src/cpp/rtps/transport/test_UDPv4Transport.cpp @@ -45,7 +45,11 @@ test_UDPv4TransportDescriptor::DestinationLocatorFilter test_UDPv4Transport::loc test_UDPv4Transport::test_UDPv4Transport( const test_UDPv4TransportDescriptor& descriptor) : drop_data_messages_percentage_(descriptor.dropDataMessagesPercentage) + , drop_participant_builtin_data_messages_percentage_(descriptor.dropParticipantBuiltinDataMessagesPercentage) + , drop_publication_builtin_data_messages_percentage_(descriptor.dropPublicationBuiltinDataMessagesPercentage) + , drop_subscription_builtin_data_messages_percentage_(descriptor.dropSubscriptionBuiltinDataMessagesPercentage) , drop_data_messages_filter_(descriptor.drop_data_messages_filter_) + , drop_builtin_data_messages_filter_(descriptor.drop_builtin_data_messages_filter_) , drop_participant_builtin_topic_data_(descriptor.dropParticipantBuiltinTopicData) , drop_publication_builtin_topic_data_(descriptor.dropPublicationBuiltinTopicData) , drop_subscription_builtin_topic_data_(descriptor.dropSubscriptionBuiltinTopicData) @@ -78,10 +82,17 @@ test_UDPv4Transport::test_UDPv4Transport( test_UDPv4TransportDescriptor::test_UDPv4TransportDescriptor() : SocketTransportDescriptor(s_maximumMessageSize, s_maximumInitialPeersRange) , dropDataMessagesPercentage(0) + , dropParticipantBuiltinDataMessagesPercentage(0) + , dropPublicationBuiltinDataMessagesPercentage(0) + , dropSubscriptionBuiltinDataMessagesPercentage(0) , drop_data_messages_filter_([](CDRMessage_t&) { return false; }) + , drop_builtin_data_messages_filter_([](CDRMessage_t&) + { + return false; + }) , dropParticipantBuiltinTopicData(false) , dropPublicationBuiltinTopicData(false) , dropSubscriptionBuiltinTopicData(false) @@ -376,6 +387,14 @@ bool test_UDPv4Transport::packet_should_drop( { return true; } + else if (should_be_dropped(&drop_participant_builtin_data_messages_percentage_)) + { + return true; + } + else if (drop_builtin_data_messages_filter_(cdrMessage)) + { + return true; + } } else if (writer_id == fastrtps::rtps::c_EntityId_SEDPPubWriter) { @@ -383,6 +402,14 @@ bool test_UDPv4Transport::packet_should_drop( { return true; } + else if (should_be_dropped(&drop_publication_builtin_data_messages_percentage_)) + { + return true; + } + else if (drop_builtin_data_messages_filter_(cdrMessage)) + { + return true; + } } else if (writer_id == fastrtps::rtps::c_EntityId_SEDPSubWriter) { @@ -390,6 +417,14 @@ bool test_UDPv4Transport::packet_should_drop( { return true; } + else if (should_be_dropped(&drop_subscription_builtin_data_messages_percentage_)) + { + return true; + } + else if (drop_builtin_data_messages_filter_(cdrMessage)) + { + return true; + } } else { diff --git a/src/cpp/rtps/transport/test_UDPv4Transport.h b/src/cpp/rtps/transport/test_UDPv4Transport.h index 835949f25fa..b4a3511fbeb 100644 --- a/src/cpp/rtps/transport/test_UDPv4Transport.h +++ b/src/cpp/rtps/transport/test_UDPv4Transport.h @@ -85,7 +85,11 @@ class test_UDPv4Transport : public UDPv4Transport }; PercentageData drop_data_messages_percentage_; + PercentageData drop_participant_builtin_data_messages_percentage_; + PercentageData drop_publication_builtin_data_messages_percentage_; + PercentageData drop_subscription_builtin_data_messages_percentage_; test_UDPv4TransportDescriptor::filter drop_data_messages_filter_; + test_UDPv4TransportDescriptor::filter drop_builtin_data_messages_filter_; bool drop_participant_builtin_topic_data_; bool drop_publication_builtin_topic_data_; bool drop_subscription_builtin_topic_data_; diff --git a/test/blackbox/CMakeLists.txt b/test/blackbox/CMakeLists.txt index 725b8883b26..7af9d550192 100644 --- a/test/blackbox/CMakeLists.txt +++ b/test/blackbox/CMakeLists.txt @@ -173,6 +173,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builtin_transports_profile.xml ${CMAKE_CURRENT_BINARY_DIR}/builtin_transports_profile.xml) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/auth_handshake_props_profile.xml ${CMAKE_CURRENT_BINARY_DIR}/auth_handshake_props_profile.xml COPYONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/discovery_participants_initial_peers_profile.xml + ${CMAKE_CURRENT_BINARY_DIR}/discovery_participants_initial_peers_profile.xml) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/discovery_participants_client_server_profile.xml + ${CMAKE_CURRENT_BINARY_DIR}/discovery_participants_client_server_profile.xml) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/datagrams" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") if(FASTDDS_PIM_API_TESTS) diff --git a/test/blackbox/api/dds-pim/PubSubReader.hpp b/test/blackbox/api/dds-pim/PubSubReader.hpp index 906484ed2a2..180a01174f3 100644 --- a/test/blackbox/api/dds-pim/PubSubReader.hpp +++ b/test/blackbox/api/dds-pim/PubSubReader.hpp @@ -304,6 +304,7 @@ class PubSubReader , status_mask_(eprosima::fastdds::dds::StatusMask::all()) , topic_name_(topic_name) , initialized_(false) + , use_domain_id_from_profile_(false) , matched_(0) , participant_matched_(0) , receiving_(false) @@ -401,11 +402,21 @@ class PubSubReader DomainParticipantFactory::get_instance()->load_XML_profiles_file(xml_file_); if (!participant_profile_.empty()) { - participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( - (uint32_t)GET_PID() % 230, - participant_profile_, - &participant_listener_, - eprosima::fastdds::dds::StatusMask::none()); + if (use_domain_id_from_profile_) + { + participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( + participant_profile_, + &participant_listener_, + eprosima::fastdds::dds::StatusMask::none()); + } + else + { + participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( + (uint32_t)GET_PID() % 230, + participant_profile_, + &participant_listener_, + eprosima::fastdds::dds::StatusMask::none()); + } ASSERT_NE(participant_, nullptr); ASSERT_TRUE(participant_->is_enabled()); } @@ -1819,6 +1830,14 @@ class PubSubReader participant_profile_ = profile; } + void set_participant_profile( + const std::string& profile, + bool use_domain_id_from_profile) + { + set_participant_profile(profile); + use_domain_id_from_profile_ = use_domain_id_from_profile; + } + void set_datareader_profile( const std::string& profile) { @@ -2084,6 +2103,7 @@ class PubSubReader eprosima::fastrtps::rtps::GUID_t participant_guid_; eprosima::fastrtps::rtps::GUID_t datareader_guid_; bool initialized_; + bool use_domain_id_from_profile_; std::list total_msgs_; std::mutex mutex_; std::condition_variable cv_; diff --git a/test/blackbox/api/dds-pim/PubSubWriter.hpp b/test/blackbox/api/dds-pim/PubSubWriter.hpp index c2c43222e38..737d5c28c7d 100644 --- a/test/blackbox/api/dds-pim/PubSubWriter.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriter.hpp @@ -291,6 +291,7 @@ class PubSubWriter , datawriter_(nullptr) , status_mask_(eprosima::fastdds::dds::StatusMask::all()) , initialized_(false) + , use_domain_id_from_profile_(false) , matched_(0) , participant_matched_(0) , discovery_result_(false) @@ -364,11 +365,22 @@ class PubSubWriter DomainParticipantFactory::get_instance()->load_XML_profiles_file(xml_file_); if (!participant_profile_.empty()) { - participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( - (uint32_t)GET_PID() % 230, - participant_profile_, - &participant_listener_, - eprosima::fastdds::dds::StatusMask::none()); + if (use_domain_id_from_profile_) + { + participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( + participant_profile_, + &participant_listener_, + eprosima::fastdds::dds::StatusMask::none()); + } + else + { + participant_ = DomainParticipantFactory::get_instance()->create_participant_with_profile( + (uint32_t)GET_PID() % 230, + participant_profile_, + &participant_listener_, + eprosima::fastdds::dds::StatusMask::none()); + } + ASSERT_NE(participant_, nullptr); ASSERT_TRUE(participant_->is_enabled()); } @@ -1672,6 +1684,14 @@ class PubSubWriter participant_profile_ = profile; } + void set_participant_profile( + const std::string& profile, + bool use_domain_id_from_profile) + { + set_participant_profile(profile); + use_domain_id_from_profile_ = use_domain_id_from_profile; + } + void set_datawriter_profile( const std::string& profile) { @@ -1978,6 +1998,7 @@ class PubSubWriter eprosima::fastrtps::rtps::GUID_t participant_guid_; eprosima::fastrtps::rtps::GUID_t datawriter_guid_; bool initialized_; + bool use_domain_id_from_profile_; std::mutex mutexDiscovery_; std::condition_variable cv_; std::atomic matched_; diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 9b1dde81a14..535ba3ddb0e 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -2194,7 +2194,8 @@ TEST(Discovery, discovery_cyclone_participant_with_custom_pid) /* Create participant with custom transport and listener */ DiscoveryListener listener; - uint32_t domain_id = static_cast(GET_PID()) % 230; + /* We need to match the domain id in the datagram */ + uint32_t domain_id = 0; DomainParticipantFactory* factory = DomainParticipantFactory::get_instance(); DomainParticipant* participant = factory->create_participant(domain_id, participant_qos, &listener); ASSERT_NE(nullptr, participant); diff --git a/test/blackbox/common/DDSBlackboxTestsDiscovery.cpp b/test/blackbox/common/DDSBlackboxTestsDiscovery.cpp index 9c2ef1e5ef9..d5608070db2 100644 --- a/test/blackbox/common/DDSBlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDiscovery.cpp @@ -1925,3 +1925,180 @@ TEST(DDSDiscovery, DataracePDP) settings.intraprocess_delivery = prev_intraprocess_delivery; DomainParticipantFactory::get_instance()->set_library_settings(settings); } + +/*! + * @test: Test for validating correct behavior of PID_DOMAIN_ID + * + * This test checks that two PDP Simple participants with the same PID_DOMAIN_ID + * are able to discover each other. + * It also checks that the PID_DOMAIN_ID is sent and received. + * + */ +TEST(DDSDiscovery, pdp_simple_participants_exchange_same_pid_domain_id_and_discover) +{ + using namespace eprosima::fastdds::dds; + using namespace eprosima::fastdds::rtps; + using namespace eprosima::fastrtps::rtps; + + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + auto reader_test_transport = std::make_shared(); + auto writer_test_transport = std::make_shared(); + + bool reader_received_pid_domin_id = true; + bool writer_sends_pid_domin_id = true; + + auto find_pid_domain_id = [](CDRMessage_t& msg, bool& pid_was_found) + { + uint32_t qos_size = 0; + uint32_t original_pos = msg.pos; + bool is_sentinel = false; + + while (!is_sentinel) + { + msg.pos = original_pos + qos_size; + + ParameterId_t pid{eprosima::fastdds::dds::PID_SENTINEL}; + uint16_t plength = 0; + bool valid = true; + + valid &= eprosima::fastrtps::rtps::CDRMessage::readUInt16(&msg, (uint16_t*)&pid); + valid &= eprosima::fastrtps::rtps::CDRMessage::readUInt16(&msg, &plength); + + if (pid == eprosima::fastdds::dds::PID_SENTINEL) + { + // PID_SENTINEL is always considered of length 0 + plength = 0; + is_sentinel = true; + } + + qos_size += (4 + plength); + + // Align to 4 byte boundary and prepare for next iteration + qos_size = (qos_size + 3) & ~3; + + if (!valid || ((msg.pos + plength) > msg.length)) + { + return false; + } + else if (!is_sentinel) + { + if (pid == eprosima::fastdds::dds::PID_DOMAIN_ID) + { + uint32_t domain_id = 0; + eprosima::fastrtps::rtps::CDRMessage::readUInt32(&msg, &domain_id); + if (domain_id == (uint32_t)GET_PID() % 230) + { + pid_was_found = true; + } + break; + } + } + } + + // Do not drop the packet in any case + return false; + }; + + reader_test_transport->drop_builtin_data_messages_filter_ = [&](CDRMessage_t& msg) + { + return find_pid_domain_id(msg, reader_received_pid_domin_id); + }; + + writer_test_transport->drop_builtin_data_messages_filter_ = [&](CDRMessage_t& msg) + { + return find_pid_domain_id(msg, writer_sends_pid_domin_id); + }; + + reader.disable_builtin_transport().add_user_transport_to_pparams(reader_test_transport); + writer.disable_builtin_transport().add_user_transport_to_pparams(writer_test_transport); + + reader.init(); + writer.init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + reader.wait_discovery(); + writer.wait_discovery(); + + ASSERT_TRUE(writer_sends_pid_domin_id); + ASSERT_TRUE(reader_received_pid_domin_id); +} + +/*! + * @test: Test for validating correct behavior of PID_DOMAIN_ID + * + * This test checks that two PDP Simple participants in different domains + * do not discover each other despite the first one is initial peer of the second. + * + */ +TEST(DDSDiscovery, pdp_simple_initial_peer_participants_with_different_domain_ids_do_not_discover) +{ + PubSubWriter writer_domain_1(TEST_TOPIC_NAME); + PubSubReader reader_domain_2(TEST_TOPIC_NAME); + + writer_domain_1.set_xml_filename("discovery_participants_initial_peers_profile.xml"); + writer_domain_1.set_participant_profile("participant_from_domain_1", true); + writer_domain_1.init(); + EXPECT_TRUE(writer_domain_1.isInitialized()); + + reader_domain_2.set_xml_filename("discovery_participants_initial_peers_profile.xml"); + reader_domain_2.set_participant_profile("participant_from_domain_2", true); + reader_domain_2.init(); + EXPECT_TRUE(reader_domain_2.isInitialized()); + + writer_domain_1.wait_discovery(std::chrono::seconds(2)); + reader_domain_2.wait_discovery(std::chrono::seconds(2)); + + ASSERT_FALSE(writer_domain_1.is_matched()); + ASSERT_FALSE(reader_domain_2.is_matched()); +} + +/*! + * @test: Test for validating correct behavior of PID_DOMAIN_ID + * + * This test checks that a Discovery Server and a Client in different domains, + * discover each other. + * + */ +TEST(DDSDiscovery, client_server_participants_with_different_domain_ids_discover) +{ + PubSubReader server_domain_1(TEST_TOPIC_NAME); + PubSubWriter client_domain_2(TEST_TOPIC_NAME); + PubSubReader client_domain_3(TEST_TOPIC_NAME); + + server_domain_1.set_xml_filename("discovery_participants_client_server_profile.xml"); + server_domain_1.set_participant_profile("ds_server", true); + server_domain_1.init(); + EXPECT_TRUE(server_domain_1.isInitialized()); + + client_domain_2.set_xml_filename("discovery_participants_client_server_profile.xml"); + client_domain_2.set_participant_profile("ds_client_pub", true); + client_domain_2.init(); + EXPECT_TRUE(client_domain_2.isInitialized()); + + client_domain_3.set_xml_filename("discovery_participants_client_server_profile.xml"); + client_domain_3.set_participant_profile("ds_client_sub", true); + client_domain_3.init(); + EXPECT_TRUE(client_domain_3.isInitialized()); + + server_domain_1.wait_discovery(std::chrono::seconds(2)); + client_domain_2.wait_discovery(std::chrono::seconds(2)); + client_domain_3.wait_discovery(std::chrono::seconds(2)); + + ASSERT_TRUE(client_domain_2.is_matched()); + ASSERT_TRUE(client_domain_3.is_matched()); + + auto data = default_helloworld_data_generator(); + size_t data_size = data.size(); + + client_domain_3.startReception(data); + + client_domain_2.send(data); + EXPECT_TRUE(data.empty()); + + // All data received + EXPECT_EQ(client_domain_3.block_for_all(std::chrono::seconds(3)), data_size); +} diff --git a/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp b/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp index e43657e1ba2..328f4ad6df3 100644 --- a/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp +++ b/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp @@ -102,14 +102,15 @@ class MonitorServiceParticipant void setup( std::string profiles_file, - std::string profile) + std::string profile, + uint32_t domain_id) { //! Load XML profiles eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_file(profiles_file); eprosima::fastdds::dds::DomainParticipant* participant = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()-> - create_participant_with_profile((uint32_t)GET_PID() % 230, profile); + create_participant_with_profile(domain_id, profile); setup(participant); } @@ -1205,11 +1206,11 @@ TEST(DDSMonitorServiceTest, monitor_service_property) MonitorServiceParticipant MSP; //! Procedure - MSP.setup(xml_file, participant_profile_names.first); + MSP.setup(xml_file, participant_profile_names.first, 0); ASSERT_EQ(eprosima::fastdds::dds::RETCODE_OK, MSP.disable_monitor_service()); MSP.reset(); - MSP.setup(xml_file, participant_profile_names.second); + MSP.setup(xml_file, participant_profile_names.second, 0); //! Assertions ASSERT_EQ(eprosima::fastdds::dds::RETCODE_OK, MSP.disable_monitor_service()); @@ -1350,8 +1351,8 @@ TEST(DDSMonitorServiceTest, monitor_service_simple_connection_list) std::pair participant_profiles = {"monitor_service_connections_list_participant_1", "monitor_service_connections_list_participant_2"}; - MSP1.setup(xml_profile, participant_profiles.first); - MSP2.setup(xml_profile, participant_profiles.second); + MSP1.setup(xml_profile, participant_profiles.first, 0); + MSP2.setup(xml_profile, participant_profiles.second, 0); MSP1.enable_monitor_service(); MSP2.enable_monitor_service(); diff --git a/test/blackbox/discovery_participants_client_server_profile.xml b/test/blackbox/discovery_participants_client_server_profile.xml new file mode 100644 index 00000000000..8b938867898 --- /dev/null +++ b/test/blackbox/discovery_participants_client_server_profile.xml @@ -0,0 +1,71 @@ + + + + + 1 + + 44.53.00.5f.45.50.52.4f.53.49.4d.41 + + + SERVER + + + + +
127.0.0.1
+ 14521 +
+
+
+
+
+
+ + + 2 + + + + CLIENT + + + + + +
127.0.0.1
+ 14521 +
+
+
+
+
+
+
+
+
+ + + 3 + + + + CLIENT + + + + + +
127.0.0.1
+ 14521 +
+
+
+
+
+
+
+
+
+ +
+
diff --git a/test/blackbox/discovery_participants_initial_peers_profile.xml b/test/blackbox/discovery_participants_initial_peers_profile.xml new file mode 100644 index 00000000000..fe17378473d --- /dev/null +++ b/test/blackbox/discovery_participants_initial_peers_profile.xml @@ -0,0 +1,69 @@ + + + + + + transport + UDPv4 + + + + + 1 + + Participant.domain1 + NONE + + + transport + + + + + +
127.0.0.1
+ 11500 +
+
+
+
+
+
+ + + 2 + + Participant.domain2 + NONE + + + transport + + + + + +
127.0.0.1
+ 11500 +
+
+
+ + + + 11600 +
239.255.0.1
+
+
+
+
+
+
+
+
diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index 91eb7d26ef9..d594146c2e2 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -98,6 +98,7 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/DirectMessageSender.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDP.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp diff --git a/test/unittest/rtps/reader/CMakeLists.txt b/test/unittest/rtps/reader/CMakeLists.txt index 68b9aafe181..f613d1431b1 100644 --- a/test/unittest/rtps/reader/CMakeLists.txt +++ b/test/unittest/rtps/reader/CMakeLists.txt @@ -194,6 +194,7 @@ set(STATEFUL_READER_TESTS_SOURCE StatefulReaderTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/DirectMessageSender.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDP.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt index c74201184cf..8d99bd1e2d8 100644 --- a/test/unittest/statistics/dds/CMakeLists.txt +++ b/test/unittest/statistics/dds/CMakeLists.txt @@ -200,6 +200,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/DirectMessageSender.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDP.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -376,6 +377,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/DirectMessageSender.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDP.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPClientListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp diff --git a/versions.md b/versions.md index d3b9ae7b17f..53b11992372 100644 --- a/versions.md +++ b/versions.md @@ -49,7 +49,7 @@ Forthcoming * `payload_owner` moved from `CacheChange_t` to `SerializedPayload_t`. * `SerializedPayload_t` copies are now forbidden. * Refactor of `get_payload` methods. - +* Use `PID_DOMAIN_ID` during PDP. Version 2.14.0 --------------