diff --git a/examples/cpp/xtypes/SubscriberApp.cpp b/examples/cpp/xtypes/SubscriberApp.cpp index a27894b9b2..23952a4371 100644 --- a/examples/cpp/xtypes/SubscriberApp.cpp +++ b/examples/cpp/xtypes/SubscriberApp.cpp @@ -190,17 +190,18 @@ void SubscriberApp::on_data_available( void SubscriberApp::on_data_writer_discovery( DomainParticipant* /*participant*/, - eprosima::fastdds::rtps::WriterDiscoveryInfo&& info, + eprosima::fastdds::rtps::WriterDiscoveryStatus /*reason*/, + const eprosima::fastdds::dds::PublicationBuiltinTopicData& info, bool& should_be_ignored) { // We don't want to ignore the writer should_be_ignored = false; // Check if the discovered topic is the one we are interested in - if (topic_name_ == info.info.topicName().to_string()) + if (topic_name_ == info.topic_name.to_string()) { // Get remote type information and use it to retrieve the type object - auto type_info = info.info.type_information().type_information; + auto type_info = info.type_information.type_information; auto type_id = type_info.complete().typeid_with_size().type_id(); if (RETCODE_OK != DomainParticipantFactory::get_instance()->type_object_registry().get_type_object( @@ -208,8 +209,8 @@ void SubscriberApp::on_data_writer_discovery( remote_type_object_)) { std::cout << "Cannot get discovered type from registry:" << std::endl; - std::cout << " - Topic name: " << info.info.topicName() << std::endl; - std::cout << " - Type name: " << info.info.typeName() << std::endl; + std::cout << " - Topic name: " << info.topic_name << std::endl; + std::cout << " - Type name: " << info.type_name << std::endl; } // Notify run thread that type has been discovered diff --git a/examples/cpp/xtypes/SubscriberApp.hpp b/examples/cpp/xtypes/SubscriberApp.hpp index c4e18ccda7..b34c9b0a84 100644 --- a/examples/cpp/xtypes/SubscriberApp.hpp +++ b/examples/cpp/xtypes/SubscriberApp.hpp @@ -60,7 +60,8 @@ class SubscriberApp : public Application, public DomainParticipantListener void on_data_writer_discovery( DomainParticipant* participant, - eprosima::fastdds::rtps::WriterDiscoveryInfo&& info, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, + const eprosima::fastdds::dds::PublicationBuiltinTopicData& info, bool& should_be_ignored) override; //! Run subscriber diff --git a/include/fastdds/config/doxygen_modules.hpp b/include/fastdds/config/doxygen_modules.hpp index 8bd8d1ff3a..bbe668edbc 100644 --- a/include/fastdds/config/doxygen_modules.hpp +++ b/include/fastdds/config/doxygen_modules.hpp @@ -19,6 +19,8 @@ #ifndef FASTDDS_CONFIG__DOXYGEN_MODULES_HPP #define FASTDDS_CONFIG__DOXYGEN_MODULES_HPP +#include + //Description of doxygen modules, not used in actual code. /*! @@ -40,16 +42,35 @@ * This Module contains the DDS Layer defined by the OMG. */ +/*! + * @defgroup dds_xtypes_typeobject DDS TypeObject API + * @ingroup FASTDDS_MODULE + */ + +/*! + * @defgroup dynamic_language_binding DDS Dynamic Types API + * @ingroup FASTDDS_MODULE + */ + /** @defgroup FASTDDS_QOS_MODULE Fast DDS Quality of Service (QoS) Module. * @ingroup FASTDDS_MODULE * @brief QOS class used to define the public entities that the user should use to control this library. */ +/** @defgroup DEADLINE_MODULE Deadline Module + * @ingroup FASTDDS_QOS_MODULE + * This module contains the classes associated with the DEADLINE QoS. + */ + /** @defgroup RTPS_ATTRIBUTES_MODULE RTPS Attributes Module. * @ingroup RTPS_MODULE * @brief Attributes class used to define the public entities that the user should use to control this library. */ +/** @defgroup FASTDDS_ATTRIBUTES_MODULE High-level Attributes Module. + * @ingroup FASTDDS_MODULE + */ + /** @defgroup COMMON_MODULE Common Module. * @ingroup RTPS_MODULE * Common structures used by multiple elements. @@ -120,6 +141,13 @@ #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#ifdef FASTDDS_STATISTICS +/** @defgroup STATISTICS_MODULE Statistics Module + * @ingroup MANAGEMENT_MODULE + * This module contains the classes associated with the Statistics Protocols. + */ +#endif // ifdef FASTDDS_STATISTICS + /** @defgroup UTILITIES_MODULE Shared Utilities * @ingroup FASTDDS_GENERAL_API * Shared utilities that can be used by one or more classes in different modules. diff --git a/include/fastdds/dds/builtin/topic/BuiltinTopicKey.hpp b/include/fastdds/dds/builtin/topic/BuiltinTopicKey.hpp index 58fbcec1b2..d85b8412d0 100644 --- a/include/fastdds/dds/builtin/topic/BuiltinTopicKey.hpp +++ b/include/fastdds/dds/builtin/topic/BuiltinTopicKey.hpp @@ -14,32 +14,21 @@ /** * @file BuiltinTopicKey.hpp - * */ #ifndef FASTDDS_DDS_BUILTIN_TOPIC__BUILTINTOPICKEY_HPP #define FASTDDS_DDS_BUILTIN_TOPIC__BUILTINTOPICKEY_HPP -#include +#include namespace eprosima { namespace fastdds { namespace dds { -namespace builtin { -// following API definition: -// #define BUILTIN_TOPIC_KEY_TYPE_NATIVE uint32_t +using BuiltinTopicKey_t = rtps::BuiltinTopicKey_t; -struct BuiltinTopicKey_t -{ - // BUILTIN_TOPIC_KEY_TYPE_NATIVE = long type - //!Value - uint32_t value[3]; -}; - -} // builtin -} // dds -} // fastdds -} // eprosima +} // namespace dds +} // namespace fastdds +} // namespace eprosima #endif // FASTDDS_DDS_BUILTIN_TOPIC__BUILTINTOPICKEY_HPP diff --git a/include/fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp b/include/fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp index 48c0bdc74c..a036476c3a 100644 --- a/include/fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp +++ b/include/fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp @@ -14,87 +14,21 @@ /** * @file PublicationBuiltinTopicData.hpp - * */ #ifndef FASTDDS_DDS_BUILTIN_TOPIC__PUBLICATIONBUILTINTOPICDATA_HPP #define FASTDDS_DDS_BUILTIN_TOPIC__PUBLICATIONBUILTINTOPICDATA_HPP -#include -#include +#include namespace eprosima { namespace fastdds { namespace dds { -namespace builtin { -struct PublicationBuiltinTopicData -{ - //! Builtin topic Key - BuiltinTopicKey_t key; +using PublicationBuiltinTopicData = rtps::PublicationBuiltinTopicData; - //! Builtin participant topic Key - BuiltinTopicKey_t participant_key; - - //! Topic name - std::string topic_name; - - //! Type name - std::string type_name; - - // DataWriter Qos - - //!Durability Qos, implemented in the library. - DurabilityQosPolicy durability; - - //!Durability Service Qos, NOT implemented in the library. - DurabilityServiceQosPolicy durability_service; - - //!Deadline Qos, implemented in the library. - DeadlineQosPolicy deadline; - - //!Latency Budget Qos, NOT implemented in the library. - LatencyBudgetQosPolicy latency_budget; - - //!Liveliness Qos, implemented in the library. - LivelinessQosPolicy liveliness; - - //!Reliability Qos, implemented in the library. - ReliabilityQosPolicy reliability; - - //!Lifespan Qos, implemented in the library. - LifespanQosPolicy lifespan; - - //!User Data Qos, implemented in the library. - UserDataQosPolicy user_data; - - //!Ownership Qos, implemented in the library. - OwnershipQosPolicy ownership; - - //!Ownership Strength Qos, implemented in the library. - OwnershipStrengthQosPolicy ownership_strength; - - //!Destination Order Qos, NOT implemented in the library. - DestinationOrderQosPolicy destination_order; - - // Publisher Qos - - //!Presentation Qos, NOT implemented in the library. - PresentationQosPolicy presentation; - - //!Partition Qos, implemented in the library. - PartitionQosPolicy partition; - - //!Topic Data Qos, NOT implemented in the library. - TopicDataQosPolicy topic_data; - - //!Group Data Qos, implemented in the library. - GroupDataQosPolicy group_data; -}; - -} // builtin -} // dds -} // fastdds -} // eprosima +} // namespace dds +} // namespace fastdds +} // namespace eprosima #endif // FASTDDS_DDS_BUILTIN_TOPIC__PUBLICATIONBUILTINTOPICDATA_HPP diff --git a/include/fastdds/dds/domain/DomainParticipantListener.hpp b/include/fastdds/dds/domain/DomainParticipantListener.hpp index 9eb2709699..8adbfd0337 100644 --- a/include/fastdds/dds/domain/DomainParticipantListener.hpp +++ b/include/fastdds/dds/domain/DomainParticipantListener.hpp @@ -20,12 +20,13 @@ #ifndef FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTLISTENER_HPP #define FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTLISTENER_HPP +#include #include #include #include #include #include -#include +#include namespace eprosima { namespace fastdds { @@ -116,18 +117,21 @@ class DomainParticipantListener : * This method is called when a new DataWriter is discovered, or a previously discovered DataWriter changes * its QOS or is removed. * - * @param [out] participant Pointer to the Participant which discovered the remote DataWriter. - * @param [out] info Remote DataWriter information. User can take ownership of the object. - * @param [out] should_be_ignored Flag to indicate the library to automatically ignore the discovered DataWriter. + * @param [in] participant Pointer to the Participant which discovered the remote writer. + * @param [in] reason The reason motivating this method to be called. + * @param [in] info Remote writer information. + * @param [out] should_be_ignored Flag to indicate the library to automatically ignore the discovered writer. */ virtual void on_data_writer_discovery( DomainParticipant* participant, - rtps::WriterDiscoveryInfo&& info, + rtps::WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, bool& should_be_ignored) { static_cast(participant); + static_cast(reason); static_cast(info); - static_cast(should_be_ignored); + should_be_ignored = false; } // TODO: Methods in DomainParticipantListener (p.33 - DDS) diff --git a/include/fastdds/dds/subscriber/DataReader.hpp b/include/fastdds/dds/subscriber/DataReader.hpp index 96fb86b9c0..805966361e 100644 --- a/include/fastdds/dds/subscriber/DataReader.hpp +++ b/include/fastdds/dds/subscriber/DataReader.hpp @@ -977,7 +977,7 @@ class DataReader : public DomainEntity * @warning Not supported yet. Currently returns RETCODE_UNSUPPORTED */ FASTDDS_EXPORTED_API ReturnCode_t get_matched_publication_data( - builtin::PublicationBuiltinTopicData& publication_data, + PublicationBuiltinTopicData& publication_data, const fastdds::rtps::InstanceHandle_t& publication_handle) const; /** diff --git a/include/fastdds/rtps/builtin/data/BuiltinTopicKey.hpp b/include/fastdds/rtps/builtin/data/BuiltinTopicKey.hpp new file mode 100644 index 0000000000..56d5a4a764 --- /dev/null +++ b/include/fastdds/rtps/builtin/data/BuiltinTopicKey.hpp @@ -0,0 +1,38 @@ +// 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 BuiltinTopicKey.hpp + * + */ + +#ifndef FASTDDS_RTPS_BUILTIN_DATA__BUILTINTOPICKEY_HPP +#define FASTDDS_RTPS_BUILTIN_DATA__BUILTINTOPICKEY_HPP + +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +struct BuiltinTopicKey_t +{ + uint32_t value[3]; +}; + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // FASTDDS_RTPS_BUILTIN_DATA__BUILTINTOPICKEY_HPP diff --git a/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp b/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp new file mode 100644 index 0000000000..5fe3f9a161 --- /dev/null +++ b/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp @@ -0,0 +1,141 @@ +// 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 PublicationBuiltinTopicData.hpp + */ + +#ifndef FASTDDS_RTPS_BUILTIN_DATA__PUBLICATIONBUILTINTOPICDATA_HPP +#define FASTDDS_RTPS_BUILTIN_DATA__PUBLICATIONBUILTINTOPICDATA_HPP + +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +/// Structure PublicationBuiltinTopicData, contains the information on a discovered publication. +struct PublicationBuiltinTopicData +{ + /// Builtin topic Key + BuiltinTopicKey_t key; + + /// Builtin participant topic Key + BuiltinTopicKey_t participant_key; + + /// Topic name + fastcdr::string_255 topic_name; + + /// Type name + fastcdr::string_255 type_name; + + // DataWriter Qos + + /// Durability Qos, implemented in the library. + dds::DurabilityQosPolicy durability; + + /// Durability Service Qos, NOT implemented in the library. + dds::DurabilityServiceQosPolicy durability_service; + + /// Deadline Qos, implemented in the library. + dds::DeadlineQosPolicy deadline; + + /// Latency Budget Qos, NOT implemented in the library. + dds::LatencyBudgetQosPolicy latency_budget; + + /// Liveliness Qos, implemented in the library. + dds::LivelinessQosPolicy liveliness; + + /// Reliability Qos, implemented in the library. + dds::ReliabilityQosPolicy reliability; + + /// Lifespan Qos, implemented in the library. + dds::LifespanQosPolicy lifespan; + + /// User Data Qos, implemented in the library. + dds::UserDataQosPolicy user_data; + + /// Ownership Qos, implemented in the library. + dds::OwnershipQosPolicy ownership; + + /// Ownership Strength Qos, implemented in the library. + dds::OwnershipStrengthQosPolicy ownership_strength; + + /// Destination Order Qos, NOT implemented in the library. + dds::DestinationOrderQosPolicy destination_order; + + // Publisher Qos + + /// Presentation Qos, NOT implemented in the library. + dds::PresentationQosPolicy presentation; + + /// Partition Qos, implemented in the library. + dds::PartitionQosPolicy partition; + + /// Topic Data Qos, NOT implemented in the library. + dds::TopicDataQosPolicy topic_data; + + /// Group Data Qos, implemented in the library. + dds::GroupDataQosPolicy group_data; + + // X-Types 1.3 + + /// Type information + dds::xtypes::TypeInformationParameter type_information; + + /// Data representation + dds::DataRepresentationQosPolicy representation; + + // eProsima extensions + + /// Disable positive acks, implemented in the library. + dds::DisablePositiveACKsQosPolicy disable_positive_acks; + + /// Information for data sharing compatibility check. + dds::DataSharingQosPolicy data_sharing; + + /// GUID + GUID_t guid; + + /// Persistence GUID + GUID_t persistence_guid; + + /// Participant GUID + GUID_t participant_guid; + + /// Remote locators + RemoteLocatorList remote_locators; + + /// Maximum serialized size of data type + uint32_t max_serialized_size = 0; + + /// Network configuration + NetworkConfigSet_t loopback_transformation; + +}; + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // FASTDDS_RTPS_BUILTIN_DATA__PUBLICATIONBUILTINTOPICDATA_HPP diff --git a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp index bfcd8e7f41..e0cca2941d 100644 --- a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp +++ b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp @@ -34,7 +34,6 @@ namespace rtps { * An entry for the @ref LocatorSelector. * * This class holds the locators of a remote endpoint along with data required for the locator selection algorithm. - * Can be easily integrated inside other classes, such as @ref ReaderProxyData and @ref WriterProxyData. */ struct LocatorSelectorEntry { diff --git a/include/fastdds/rtps/participant/RTPSParticipant.hpp b/include/fastdds/rtps/participant/RTPSParticipant.hpp index 4da4a64c7e..05298312f7 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/include/fastdds/rtps/participant/RTPSParticipant.hpp @@ -58,11 +58,11 @@ class TopicAttributes; namespace rtps { +struct PublicationBuiltinTopicData; class RTPSParticipantImpl; class RTPSParticipantListener; class RTPSWriter; class RTPSReader; -class WriterProxyData; class ReaderProxyData; class EndpointAttributes; class WriterAttributes; @@ -162,7 +162,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); + const ContentFilterProperty* content_filter = nullptr); /** * Update participant attributes. @@ -195,7 +195,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); + const ContentFilterProperty* content_filter = nullptr); /** * Returns a list with the participant names. @@ -291,7 +291,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant * * @return A vector with all registered transports' netmask filter information. */ - std::vector get_netmask_filter_info() const; + std::vector get_netmask_filter_info() const; #if HAVE_SECURITY @@ -404,11 +404,11 @@ class FASTDDS_EXPORTED_API RTPSParticipant * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::ParticipantProxyData& data, + ParticipantProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg); /** - * fills in the WriterProxyData from a MonitorService Message + * fills in the PublicationBuiltinTopicData from a MonitorService Message * * @param [out] data Proxy to fill. * @param [in] msg MonitorService Message to get the proxy information from. @@ -416,8 +416,8 @@ class FASTDDS_EXPORTED_API RTPSParticipant * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg); + PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg); /** * fills in the ReaderProxyData from a MonitorService Message @@ -428,7 +428,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::ReaderProxyData& data, + ReaderProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg); #endif // FASTDDS_STATISTICS diff --git a/include/fastdds/rtps/participant/RTPSParticipantListener.hpp b/include/fastdds/rtps/participant/RTPSParticipantListener.hpp index 832b42584f..4e8b6f1338 100644 --- a/include/fastdds/rtps/participant/RTPSParticipantListener.hpp +++ b/include/fastdds/rtps/participant/RTPSParticipantListener.hpp @@ -20,9 +20,10 @@ #ifndef FASTDDS_RTPS_PARTICIPANT__RTPSPARTICIPANTLISTENER_HPP #define FASTDDS_RTPS_PARTICIPANT__RTPSPARTICIPANTLISTENER_HPP +#include #include #include -#include +#include namespace eprosima { namespace fastdds { @@ -98,16 +99,19 @@ class FASTDDS_EXPORTED_API RTPSParticipantListener * This method is called when a new Writer is discovered, or a previously discovered writer changes * its QOS or is removed. * - * @param [out] participant Pointer to the Participant which discovered the remote writer. - * @param [out] info Remote writer information. User can take ownership of the object. - * @param [out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Writer. + * @param [in] participant Pointer to the Participant which discovered the remote writer. + * @param [in] reason The reason motivating this method to be called. + * @param [in] info Remote writer information. + * @param [out] should_be_ignored Flag to indicate the library to automatically ignore the discovered writer. */ - virtual void onWriterDiscovery( + virtual void on_writer_discovery( RTPSParticipant* participant, - WriterDiscoveryInfo&& info, + WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, bool& should_be_ignored) { static_cast(participant); + static_cast(reason); static_cast(info); should_be_ignored = false; } diff --git a/include/fastdds/rtps/reader/RTPSReader.hpp b/include/fastdds/rtps/reader/RTPSReader.hpp index 4f8ec70bdb..56e7c55b1d 100644 --- a/include/fastdds/rtps/reader/RTPSReader.hpp +++ b/include/fastdds/rtps/reader/RTPSReader.hpp @@ -24,7 +24,9 @@ #include #include +#include #include +#include #include #include #include @@ -42,7 +44,6 @@ namespace rtps { struct CacheChange_t; class ReaderListener; class RTPSParticipantImpl; -class WriterProxyData; /** * Class RTPSReader, manages the reception of data from its matched writers. @@ -55,14 +56,14 @@ class RTPSReader : public Endpoint public: /** - * @brief Add a matched writer represented by its attributes. + * @brief Add a matched writer represented by its publication info. * - * @param wdata Discovery information regarding the writer to add. + * @param info Publication info of the writer being matched. * * @return True if correctly added. */ FASTDDS_EXPORTED_API virtual bool matched_writer_add( - const WriterProxyData& wdata) = 0; + const PublicationBuiltinTopicData& info) = 0; /** * @brief Remove a writer from the matched writers. diff --git a/include/fastdds/rtps/reader/ReaderListener.hpp b/include/fastdds/rtps/reader/ReaderListener.hpp index 325e3f4007..a55b414900 100644 --- a/include/fastdds/rtps/reader/ReaderListener.hpp +++ b/include/fastdds/rtps/reader/ReaderListener.hpp @@ -23,10 +23,11 @@ #include #include #include -#include +#include #include #include -#include +#include + namespace eprosima { namespace fastdds { @@ -130,9 +131,9 @@ class FASTDDS_EXPORTED_API ReaderListener */ virtual void on_writer_discovery( RTPSReader* reader, - WriterDiscoveryInfo::DISCOVERY_STATUS reason, + WriterDiscoveryStatus reason, const GUID_t& writer_guid, - const WriterProxyData* writer_info) + const PublicationBuiltinTopicData* writer_info) { static_cast(reader); static_cast(reason); diff --git a/include/fastdds/rtps/writer/WriterDiscoveryInfo.hpp b/include/fastdds/rtps/writer/WriterDiscoveryInfo.hpp deleted file mode 100644 index 38b8e68724..0000000000 --- a/include/fastdds/rtps/writer/WriterDiscoveryInfo.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2018 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 WriterDiscoveryInfo.hpp - */ -#ifndef FASTDDS_RTPS_WRITER__WRITERDISCOVERYINFO_HPP -#define FASTDDS_RTPS_WRITER__WRITERDISCOVERYINFO_HPP - -#include -#include - -namespace eprosima { -namespace fastdds { -namespace rtps { - -/** - * Class WriterDiscoveryInfo with discovery information of the writer. - * @ingroup RTPS_MODULE - */ -struct WriterDiscoveryInfo -{ -public: - - //!Enum DISCOVERY_STATUS, four different status for discovered writers. - //!@ingroup RTPS_MODULE - // *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ; - // at the end of the enum, which does not build. -#if defined(_WIN32) - enum FASTDDS_EXPORTED_API DISCOVERY_STATUS -#else - enum DISCOVERY_STATUS -#endif // if defined(_WIN32) - { - DISCOVERED_WRITER, - CHANGED_QOS_WRITER, - REMOVED_WRITER, - IGNORED_WRITER - }; - // *INDENT-ON* - WriterDiscoveryInfo( - const WriterProxyData& data) - : status(DISCOVERED_WRITER) - , info(data) - { - } - - virtual ~WriterDiscoveryInfo() - { - } - - //! Status - DISCOVERY_STATUS status; - - //! Participant discovery info - const WriterProxyData& info; -}; - -} // namespace rtps -} // namespace fastdds -} // namespace eprosima - -#endif // FASTDDS_RTPS_WRITER__WRITERDISCOVERYINFO_HPP diff --git a/include/fastdds/rtps/writer/WriterDiscoveryStatus.hpp b/include/fastdds/rtps/writer/WriterDiscoveryStatus.hpp new file mode 100644 index 0000000000..f356ee6128 --- /dev/null +++ b/include/fastdds/rtps/writer/WriterDiscoveryStatus.hpp @@ -0,0 +1,47 @@ +// Copyright 2018 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 WriterDiscoveryStatus.hpp + */ +#ifndef FASTDDS_RTPS_WRITER__WRITERDISCOVERYSTATUS_HPP +#define FASTDDS_RTPS_WRITER__WRITERDISCOVERYSTATUS_HPP + +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +/// Enum WriterDiscoveryStatus, four different status for discovered writers. +// *INDENT-OFF* : Does not understand the #if correctly and ends up removing the ; +// at the end of the enum, which does not build. +#if defined(_WIN32) +enum class FASTDDS_EXPORTED_API WriterDiscoveryStatus +#else +enum class WriterDiscoveryStatus +#endif // if defined(_WIN32) +{ + DISCOVERED_WRITER, + CHANGED_QOS_WRITER, + REMOVED_WRITER, + IGNORED_WRITER +}; +// *INDENT-ON* + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // FASTDDS_RTPS_WRITER__WRITERDISCOVERYSTATUS_HPP diff --git a/include/fastdds/statistics/dds/domain/DomainParticipant.hpp b/include/fastdds/statistics/dds/domain/DomainParticipant.hpp index fb9082426f..7dd736fa83 100644 --- a/include/fastdds/statistics/dds/domain/DomainParticipant.hpp +++ b/include/fastdds/statistics/dds/domain/DomainParticipant.hpp @@ -22,6 +22,7 @@ #include +#include #include #include #include @@ -33,7 +34,7 @@ namespace fastdds { namespace rtps { class ReaderProxyData; -class WriterProxyData; + } // namespace rtps namespace statistics { @@ -148,19 +149,6 @@ class DomainParticipant : public eprosima::fastdds::dds::DomainParticipant fastdds::rtps::ParticipantProxyData& data, statistics::MonitorServiceStatusData& msg); - /** - * fills in the WriterProxyData from a MonitorService Message - * - * @param [out] data Proxy to fill. - * @param [in] msg MonitorService Message to get the proxy information from. - * - * @return RETCODE_OK if the operation succeeds. - * @return RETCODE_ERROR if the operation fails. - */ - FASTDDS_EXPORTED_API eprosima::fastdds::dds::ReturnCode_t fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - statistics::MonitorServiceStatusData& msg); - /** * fills in the ReaderProxyData from a MonitorService Message * @@ -188,7 +176,7 @@ class DomainParticipant : public eprosima::fastdds::dds::DomainParticipant const statistics::MonitorServiceStatusData& msg); /** - * fills in the WriterProxyData from a MonitorService Message + * fills in the PublicationBuiltinTopicData from a MonitorService Message * * @param [out] data Proxy to fill. * @param [in] msg MonitorService Message to get the proxy information from. @@ -197,7 +185,7 @@ class DomainParticipant : public eprosima::fastdds::dds::DomainParticipant * @return RETCODE_ERROR if the operation fails. */ FASTDDS_EXPORTED_API eprosima::fastdds::dds::ReturnCode_t fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, + fastdds::dds::PublicationBuiltinTopicData& data, const statistics::MonitorServiceStatusData& msg); /** diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 21896a47f9..027af6ae51 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -118,6 +118,7 @@ set(${PROJECT_NAME}_source_files rtps/attributes/TopicAttributes.cpp rtps/builtin/BuiltinProtocols.cpp rtps/builtin/data/ParticipantProxyData.cpp + rtps/builtin/data/ProxyDataConverters.cpp rtps/builtin/data/ReaderProxyData.cpp rtps/builtin/data/WriterProxyData.cpp rtps/builtin/discovery/database/backup/SharedBackupFunctions.cpp diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp index c8bdd3be94..68b7dfea02 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include +#include #include #include #include @@ -166,7 +166,7 @@ bool TypeLookupManager::assign_remote_endpoints( EPROSIMA_LOG_INFO(TYPELOOKUP_SERVICE, "Adding remote writer to the local Builtin Request Reader"); temp_writer_proxy_data_->guid().entityId = fastdds::rtps::c_EntityId_TypeLookup_request_writer; temp_writer_proxy_data_->persistence_guid().entityId = fastdds::rtps::c_EntityId_TypeLookup_request_writer; - builtin_request_reader_->matched_writer_add(*temp_writer_proxy_data_); + builtin_request_reader_->matched_writer_add_edp(*temp_writer_proxy_data_); } auxendp = endp; @@ -177,7 +177,7 @@ bool TypeLookupManager::assign_remote_endpoints( EPROSIMA_LOG_INFO(TYPELOOKUP_SERVICE, "Adding remote writer to the local Builtin Reply Reader"); temp_writer_proxy_data_->guid().entityId = fastdds::rtps::c_EntityId_TypeLookup_reply_writer; temp_writer_proxy_data_->persistence_guid().entityId = fastdds::rtps::c_EntityId_TypeLookup_reply_writer; - builtin_reply_reader_->matched_writer_add(*temp_writer_proxy_data_); + builtin_reply_reader_->matched_writer_add_edp(*temp_writer_proxy_data_); } auxendp = endp; diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.hpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.hpp index 99ba4abc1a..13ed8e9124 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.hpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.hpp @@ -26,13 +26,14 @@ #include #include -#include #include #include #include #include #include + +#include #include namespace std { diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index ade365b237..806d3843f3 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -86,8 +86,7 @@ using rtps::EndpointKind_t; using rtps::ReaderDiscoveryInfo; using rtps::ReaderProxyData; using rtps::ResourceEvent; -using rtps::WriterDiscoveryInfo; -using rtps::WriterProxyData; +using rtps::WriterDiscoveryStatus; DomainParticipantImpl::DomainParticipantImpl( DomainParticipant* dp, @@ -1579,9 +1578,10 @@ void DomainParticipantImpl::MyRTPSParticipantListener::onReaderDiscovery( } } -void DomainParticipantImpl::MyRTPSParticipantListener::onWriterDiscovery( +void DomainParticipantImpl::MyRTPSParticipantListener::on_writer_discovery( RTPSParticipant*, - WriterDiscoveryInfo&& info, + WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, bool& should_be_ignored) { should_be_ignored = false; @@ -1592,7 +1592,7 @@ void DomainParticipantImpl::MyRTPSParticipantListener::onWriterDiscovery( DomainParticipantListener* listener = participant_->listener_; if (nullptr != listener) { - listener->on_data_writer_discovery(participant_->participant_, std::move(info), should_be_ignored); + listener->on_data_writer_discovery(participant_->participant_, reason, info, should_be_ignored); } } } diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp index 785bf393cc..f937b80f54 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp @@ -48,11 +48,11 @@ namespace fastdds { namespace rtps { +struct PublicationBuiltinTopicData; class RTPSParticipant; -class WriterProxyData; class ReaderProxyData; -} //namespace rtps +} // namespace rtps class PublisherAttributes; class SubscriberAttributes; @@ -650,9 +650,10 @@ class DomainParticipantImpl fastdds::rtps::ReaderDiscoveryInfo&& info, bool& should_be_ignored) override; - void onWriterDiscovery( + void on_writer_discovery( fastdds::rtps::RTPSParticipant* participant, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, bool& should_be_ignored) override; DomainParticipantImpl* participant_; diff --git a/src/cpp/fastdds/subscriber/DataReader.cpp b/src/cpp/fastdds/subscriber/DataReader.cpp index 019cc55a89..39d716f66f 100644 --- a/src/cpp/fastdds/subscriber/DataReader.cpp +++ b/src/cpp/fastdds/subscriber/DataReader.cpp @@ -391,7 +391,7 @@ ReturnCode_t DataReader::get_subscription_matched_status( } ReturnCode_t DataReader::get_matched_publication_data( - builtin::PublicationBuiltinTopicData& publication_data, + PublicationBuiltinTopicData& publication_data, const fastdds::rtps::InstanceHandle_t& publication_handle) const { static_cast (publication_data); diff --git a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp index bd5528e8a8..25846afd8b 100644 --- a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp +++ b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp @@ -26,10 +26,10 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp b/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp new file mode 100644 index 0000000000..a2a8c78e53 --- /dev/null +++ b/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp @@ -0,0 +1,200 @@ +// 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 ProxyDataConverters.cpp + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +typedef uint32_t BuiltinTopicKeyValue[3]; + +static void from_proxy_to_builtin( + const EntityId_t& entity_id, + BuiltinTopicKeyValue& builtin_key_value) +{ + builtin_key_value[0] = 0; + builtin_key_value[1] = 0; + builtin_key_value[2] = static_cast(entity_id.value[0]) << 24 + | static_cast(entity_id.value[1]) << 16 + | static_cast(entity_id.value[2]) << 8 + | static_cast(entity_id.value[3]); +} + +static void from_proxy_to_builtin( + const GuidPrefix_t& guid_prefix, + BuiltinTopicKeyValue& dds_key) +{ + dds_key[0] = static_cast(guid_prefix.value[0]) << 24 + | static_cast(guid_prefix.value[1]) << 16 + | static_cast(guid_prefix.value[2]) << 8 + | static_cast(guid_prefix.value[3]); + dds_key[1] = static_cast(guid_prefix.value[4]) << 24 + | static_cast(guid_prefix.value[5]) << 16 + | static_cast(guid_prefix.value[6]) << 8 + | static_cast(guid_prefix.value[7]); + dds_key[2] = static_cast(guid_prefix.value[8]) << 24 + | static_cast(guid_prefix.value[9]) << 16 + | static_cast(guid_prefix.value[10]) << 8 + | static_cast(guid_prefix.value[11]); +} + +static void from_builtin_to_proxy( + const BuiltinTopicKeyValue& dds_key, + EntityId_t& entity_id) +{ + entity_id.value[0] = static_cast((dds_key[2] >> 24) & 0xFF); + entity_id.value[1] = static_cast((dds_key[2] >> 16) & 0xFF); + entity_id.value[2] = static_cast((dds_key[2] >> 8) & 0xFF); + entity_id.value[3] = static_cast(dds_key[2] & 0xFF); +} + +static void from_builtin_to_proxy( + const BuiltinTopicKeyValue& dds_key, + GuidPrefix_t& guid_prefix) +{ + guid_prefix.value[0] = static_cast((dds_key[0] >> 24) & 0xFF); + guid_prefix.value[1] = static_cast((dds_key[0] >> 16) & 0xFF); + guid_prefix.value[2] = static_cast((dds_key[0] >> 8) & 0xFF); + guid_prefix.value[3] = static_cast(dds_key[0] & 0xFF); + + guid_prefix.value[4] = static_cast((dds_key[1] >> 24) & 0xFF); + guid_prefix.value[5] = static_cast((dds_key[1] >> 16) & 0xFF); + guid_prefix.value[6] = static_cast((dds_key[1] >> 8) & 0xFF); + guid_prefix.value[7] = static_cast(dds_key[1] & 0xFF); + + guid_prefix.value[8] = static_cast((dds_key[2] >> 24) & 0xFF); + guid_prefix.value[9] = static_cast((dds_key[2] >> 16) & 0xFF); + guid_prefix.value[10] = static_cast((dds_key[2] >> 8) & 0xFF); + guid_prefix.value[11] = static_cast(dds_key[2] & 0xFF); +} + +void from_proxy_to_builtin( + const ParticipantProxyData& proxy_data, + ParticipantBuiltinTopicData& builtin_data) +{ + static_cast(proxy_data); + static_cast(builtin_data); +} + +void from_proxy_to_builtin( + const ReaderProxyData& proxy_data, + SubscriptionBuiltinTopicData& builtin_data) +{ + static_cast(proxy_data); + static_cast(builtin_data); +} + +void from_proxy_to_builtin( + const WriterProxyData& proxy_data, + PublicationBuiltinTopicData& builtin_data) +{ + from_proxy_to_builtin(proxy_data.guid().entityId, builtin_data.key.value); + from_proxy_to_builtin(proxy_data.guid().guidPrefix, builtin_data.participant_key.value); + + builtin_data.topic_name = proxy_data.topicName(); + builtin_data.type_name = proxy_data.typeName(); + builtin_data.durability = proxy_data.m_qos.m_durability; + builtin_data.durability_service = proxy_data.m_qos.m_durabilityService; + builtin_data.deadline = proxy_data.m_qos.m_deadline; + builtin_data.latency_budget = proxy_data.m_qos.m_latencyBudget; + builtin_data.liveliness = proxy_data.m_qos.m_liveliness; + builtin_data.reliability = proxy_data.m_qos.m_reliability; + builtin_data.lifespan = proxy_data.m_qos.m_lifespan; + builtin_data.user_data = proxy_data.m_qos.m_userData; + builtin_data.ownership = proxy_data.m_qos.m_ownership; + builtin_data.ownership_strength = proxy_data.m_qos.m_ownershipStrength; + builtin_data.destination_order = proxy_data.m_qos.m_destinationOrder; + + builtin_data.presentation = proxy_data.m_qos.m_presentation; + builtin_data.partition = proxy_data.m_qos.m_partition; + builtin_data.topic_data = proxy_data.m_qos.m_topicData; + builtin_data.group_data = proxy_data.m_qos.m_groupData; + + if (proxy_data.has_type_information()) + { + builtin_data.type_information = proxy_data.type_information(); + } + builtin_data.representation = proxy_data.m_qos.representation; + + builtin_data.disable_positive_acks = proxy_data.m_qos.m_disablePositiveACKs; + builtin_data.data_sharing = proxy_data.m_qos.data_sharing; + builtin_data.guid = proxy_data.guid(); + builtin_data.persistence_guid = proxy_data.persistence_guid(); + builtin_data.participant_guid = iHandle2GUID(proxy_data.RTPSParticipantKey()); + builtin_data.remote_locators = proxy_data.remote_locators(); + builtin_data.max_serialized_size = proxy_data.typeMaxSerialized(); + builtin_data.loopback_transformation = proxy_data.networkConfiguration(); +} + +void from_builtin_to_proxy( + const PublicationBuiltinTopicData& builtin_data, + WriterProxyData& proxy_data) +{ + from_builtin_to_proxy(builtin_data.participant_key.value, proxy_data.guid().guidPrefix); + from_builtin_to_proxy(builtin_data.key.value, proxy_data.guid().entityId); + + proxy_data.topicName(builtin_data.topic_name); + proxy_data.typeName(builtin_data.type_name); + proxy_data.m_qos.m_durability = builtin_data.durability; + proxy_data.m_qos.m_durabilityService = builtin_data.durability_service; + proxy_data.m_qos.m_deadline = builtin_data.deadline; + proxy_data.m_qos.m_latencyBudget = builtin_data.latency_budget; + proxy_data.m_qos.m_liveliness = builtin_data.liveliness; + proxy_data.m_qos.m_reliability = builtin_data.reliability; + proxy_data.m_qos.m_lifespan = builtin_data.lifespan; + proxy_data.m_qos.m_userData = builtin_data.user_data; + proxy_data.m_qos.m_ownership = builtin_data.ownership; + proxy_data.m_qos.m_ownershipStrength = builtin_data.ownership_strength; + proxy_data.m_qos.m_destinationOrder = builtin_data.destination_order; + + proxy_data.m_qos.m_presentation = builtin_data.presentation; + proxy_data.m_qos.m_partition = builtin_data.partition; + proxy_data.m_qos.m_topicData = builtin_data.topic_data; + proxy_data.m_qos.m_groupData = builtin_data.group_data; + + proxy_data.type_information(builtin_data.type_information); + proxy_data.m_qos.representation = builtin_data.representation; + + proxy_data.m_qos.m_disablePositiveACKs = builtin_data.disable_positive_acks; + proxy_data.m_qos.data_sharing = builtin_data.data_sharing; + proxy_data.guid(builtin_data.guid); + proxy_data.persistence_guid(builtin_data.persistence_guid); + proxy_data.RTPSParticipantKey(builtin_data.participant_guid); + proxy_data.set_locators(builtin_data.remote_locators); + proxy_data.typeMaxSerialized(builtin_data.max_serialized_size); + proxy_data.networkConfiguration(builtin_data.loopback_transformation); +} + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima diff --git a/src/cpp/rtps/builtin/data/ProxyDataConverters.hpp b/src/cpp/rtps/builtin/data/ProxyDataConverters.hpp new file mode 100644 index 0000000000..bb2621ee8f --- /dev/null +++ b/src/cpp/rtps/builtin/data/ProxyDataConverters.hpp @@ -0,0 +1,73 @@ +// 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. + +#ifndef RTPS_BUILTIN_DATA__PROXYDATACONVERTERS_HPP +#define RTPS_BUILTIN_DATA__PROXYDATACONVERTERS_HPP + +namespace eprosima { +namespace fastdds { +namespace rtps { + +struct ParticipantBuiltinTopicData; +class ParticipantProxyData; +struct PublicationBuiltinTopicData; +class ReaderProxyData; +struct SubscriptionBuiltinTopicData; +class WriterProxyData; + +/** + * Convert a ParticipantProxyData to a ParticipantBuiltinTopicData. + * + * @param [in] proxy_data ParticipantProxyData to convert. + * @param [out] builtin_data ParticipantBuiltinTopicData to fill. + */ +void from_proxy_to_builtin( + const ParticipantProxyData& proxy_data, + ParticipantBuiltinTopicData& builtin_data); + +/** + * Convert a ReaderProxyData to a SubscriptionBuiltinTopicData. + * + * @param [in] proxy_data ReaderProxyData to convert. + * @param [out] builtin_data SubscriptionBuiltinTopicData to fill. + */ +void from_proxy_to_builtin( + const ReaderProxyData& proxy_data, + SubscriptionBuiltinTopicData& builtin_data); + +/** + * Convert a WriterProxyData to a PublicationBuiltinTopicData. + * + * @param [in] proxy_data WriterProxyData to convert. + * @param [out] builtin_data PublicationBuiltinTopicData to fill. + */ +void from_proxy_to_builtin( + const WriterProxyData& proxy_data, + PublicationBuiltinTopicData& builtin_data); + +/** + * Convert a PublicationBuiltinTopicData to a WriterProxyData. + * + * @param [in] builtin_data PublicationBuiltinTopicData to convert. + * @param [out] proxy_data WriterProxyData to fill. + */ +void from_builtin_to_proxy( + const PublicationBuiltinTopicData& proxy_data, + WriterProxyData& builtin_data); + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // RTPS_BUILTIN_DATA__PROXYDATACONVERTERS_HPP diff --git a/src/cpp/rtps/builtin/data/WriterProxyData.cpp b/src/cpp/rtps/builtin/data/WriterProxyData.cpp index aeb424160e..c892798988 100644 --- a/src/cpp/rtps/builtin/data/WriterProxyData.cpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.cpp @@ -20,9 +20,9 @@ #include #include #include -#include #include +#include #include #include "ProxyDataFilters.hpp" diff --git a/include/fastdds/rtps/builtin/data/WriterProxyData.hpp b/src/cpp/rtps/builtin/data/WriterProxyData.hpp similarity index 99% rename from include/fastdds/rtps/builtin/data/WriterProxyData.hpp rename to src/cpp/rtps/builtin/data/WriterProxyData.hpp index 23004666e4..630d5ab527 100644 --- a/include/fastdds/rtps/builtin/data/WriterProxyData.hpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.hpp @@ -14,7 +14,6 @@ /** * @file WriterProxyData.hpp - * */ #ifndef FASTDDS_RTPS_BUILTIN_DATA__WRITERPROXYDATA_HPP diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp index f438f86210..e94c18e9f4 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include #include +#include #include #include #include @@ -765,7 +765,9 @@ bool EDP::pairingReader( const GUID_t& participant_guid, const ReaderProxyData& rdata) { - (void)participant_guid; + static_cast(participant_guid); + + BaseReader* reader = BaseReader::downcast(R); EPROSIMA_LOG_INFO(RTPS_EDP, rdata.guid() << " in topic: \"" << rdata.topicName() << "\""); std::lock_guard pguard(*mp_PDP->getMutex()); @@ -784,45 +786,45 @@ bool EDP::pairingReader( MatchingFailureMask no_match_reason; fastdds::dds::PolicyMask incompatible_qos; bool valid = valid_matching(&rdata, wdatait, no_match_reason, incompatible_qos); - const GUID_t& reader_guid = R->getGuid(); + const GUID_t& reader_guid = reader->getGuid(); const GUID_t& writer_guid = wdatait->guid(); if (valid) { #if HAVE_SECURITY if (!mp_RTPSParticipant->security_manager().discovered_writer(reader_guid, (*pit)->m_guid, - *wdatait, R->getAttributes().security_attributes())) + *wdatait, reader->getAttributes().security_attributes())) { EPROSIMA_LOG_ERROR(RTPS_EDP, "Security manager returns an error for reader " << reader_guid); } #else - if (R->matched_writer_add(*wdatait)) + if (reader->matched_writer_add_edp(*wdatait)) { static_cast(reader_guid); // Void cast to force usage if we don't have LOG_INFOs EPROSIMA_LOG_INFO(RTPS_EDP_MATCH, "WP:" << wdatait->guid() << " match R:" << reader_guid << ". RLoc:" << wdatait->remote_locators()); //MATCHED AND ADDED CORRECTLY: - if (R->get_listener() != nullptr) + if (reader->get_listener() != nullptr) { MatchingInfo info; info.status = MATCHED_MATCHING; info.remoteEndpointGuid = writer_guid; - R->get_listener()->on_reader_matched(R, info); + reader->get_listener()->on_reader_matched(reader, info); } } #endif // if HAVE_SECURITY } else { - if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && R->get_listener() != nullptr) + if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && reader->get_listener() != nullptr) { - R->get_listener()->on_requested_incompatible_qos(R, incompatible_qos); + reader->get_listener()->on_requested_incompatible_qos(reader, incompatible_qos); } //EPROSIMA_LOG_INFO(RTPS_EDP,RTPS_CYAN<<"Valid Matching to writerProxy: "<m_guid<matched_writer_is_matched(wdatait->guid()) - && R->matched_writer_remove(wdatait->guid())) + if (reader->matched_writer_is_matched(wdatait->guid()) + && reader->matched_writer_remove(wdatait->guid())) { #if HAVE_SECURITY mp_RTPSParticipant->security_manager().remove_writer(reader_guid, participant_guid, @@ -830,12 +832,12 @@ bool EDP::pairingReader( #endif // if HAVE_SECURITY //MATCHED AND ADDED CORRECTLY: - if (R->get_listener() != nullptr) + if (reader->get_listener() != nullptr) { MatchingInfo info; info.status = REMOVED_MATCHING; info.remoteEndpointGuid = writer_guid; - R->get_listener()->on_reader_matched(R, info); + reader->get_listener()->on_reader_matched(reader, info); } } } @@ -1151,7 +1153,7 @@ bool EDP::pairing_writer_proxy_with_any_local_reader( EPROSIMA_LOG_ERROR(RTPS_EDP, "Security manager returns an error for reader " << readerGUID); } #else - if (r.matched_writer_add(*wdata)) + if (r.matched_writer_add_edp(*wdata)) { EPROSIMA_LOG_INFO(RTPS_EDP_MATCH, "WP:" << wdata->guid() << " match R:" << r.getGuid() << ". WLoc:" << @@ -1285,7 +1287,7 @@ bool EDP::pairing_remote_writer_with_local_reader_after_security( { found = true; - if (r.matched_writer_add(remote_writer_data)) + if (r.matched_writer_add_edp(remote_writer_data)) { EPROSIMA_LOG_INFO(RTPS_EDP, "Valid Matching to local reader: " << readerGUID.entityId); diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.h b/src/cpp/rtps/builtin/discovery/endpoint/EDP.h index 10a9d57614..7f187a38e6 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.h @@ -30,9 +30,9 @@ #include #include #include -#include #include +#include #include #define MATCH_FAILURE_REASON_COUNT size_t(16) diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp index a14528453a..9fcc57a39f 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp @@ -24,10 +24,10 @@ #include #include #include -#include #include #include +#include #include #if HAVE_SECURITY #include diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp index 3d3841e193..c2d0270c2e 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp @@ -31,12 +31,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -772,7 +772,7 @@ void EDPSimple::assignRemoteEndpoints( EPROSIMA_LOG_INFO(RTPS_EDP, "Adding SEDP Pub Writer to my Pub Reader"); temp_writer_proxy_data->guid().entityId = c_EntityId_SEDPPubWriter; temp_writer_proxy_data->set_persistence_entity_id(c_EntityId_SEDPPubWriter); - publications_reader_.first->matched_writer_add(*temp_writer_proxy_data); + publications_reader_.first->matched_writer_add_edp(*temp_writer_proxy_data); } auxendp = endp; auxendp &= fastdds::rtps::DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR; @@ -789,7 +789,7 @@ void EDPSimple::assignRemoteEndpoints( EPROSIMA_LOG_INFO(RTPS_EDP, "Adding SEDP Sub Writer to my Sub Reader"); temp_writer_proxy_data->guid().entityId = c_EntityId_SEDPSubWriter; temp_writer_proxy_data->set_persistence_entity_id(c_EntityId_SEDPSubWriter); - subscriptions_reader_.first->matched_writer_add(*temp_writer_proxy_data); + subscriptions_reader_.first->matched_writer_add_edp(*temp_writer_proxy_data); } auxendp = endp; auxendp &= fastdds::rtps::DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR; @@ -1032,12 +1032,12 @@ bool EDPSimple::pairing_remote_writer_with_local_builtin_reader_after_security( if (local_reader.entityId == sedp_builtin_publications_secure_reader) { - publications_secure_reader_.first->matched_writer_add(remote_writer_data); + publications_secure_reader_.first->matched_writer_add_edp(remote_writer_data); returned_value = true; } else if (local_reader.entityId == sedp_builtin_subscriptions_secure_reader) { - subscriptions_secure_reader_.first->matched_writer_add(remote_writer_data); + subscriptions_secure_reader_.first->matched_writer_add_edp(remote_writer_data); returned_value = true; } diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h index 42dee37c1d..0c59ec0957 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h @@ -22,8 +22,8 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC #include -#include +#include #include #include "EDPUtils.hpp" diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp index d5672548c7..17e7e2aad8 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp @@ -25,13 +25,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.h b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.h index 684ed249d2..2edfc2d6ca 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.h @@ -22,10 +22,10 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC #include -#include #include #include +#include #include #include diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp index bebf22239f..6f3651aa43 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp @@ -27,10 +27,10 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index dd2de6e7c1..ca1b5811fc 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -29,16 +29,18 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include +#include #include +#include #include #include #include @@ -825,10 +827,11 @@ bool PDP::removeWriterProxyData( if (listener) { RTPSParticipant* participant = mp_RTPSParticipant->getUserRTPSParticipant(); - WriterDiscoveryInfo info(std::move(*pW)); bool should_be_ignored = false; - info.status = WriterDiscoveryInfo::REMOVED_WRITER; - listener->onWriterDiscovery(participant, std::move(info), should_be_ignored); + auto status = WriterDiscoveryStatus::REMOVED_WRITER; + PublicationBuiltinTopicData info; + from_proxy_to_builtin(*pW, info); + listener->on_writer_discovery(participant, status, info, should_be_ignored); } // Clear writer proxy data and move to pool in order to allow reuse @@ -844,13 +847,6 @@ bool PDP::removeWriterProxyData( return false; } -bool PDP::removeWriterProxyData( - const GUID_t& /*writer_guid*/, - WriterDiscoveryInfo::DISCOVERY_STATUS /*reason*/) -{ - return false; -} - bool PDP::lookup_participant_name( const GUID_t& guid, fastcdr::string_255& name) @@ -1020,10 +1016,11 @@ WriterProxyData* PDP::addWriterProxyData( if (listener) { RTPSParticipant* participant = mp_RTPSParticipant->getUserRTPSParticipant(); - WriterDiscoveryInfo info(*ret_val); bool should_be_ignored = false; - info.status = WriterDiscoveryInfo::CHANGED_QOS_WRITER; - listener->onWriterDiscovery(participant, std::move(info), should_be_ignored); + auto status = WriterDiscoveryStatus::CHANGED_QOS_WRITER; + PublicationBuiltinTopicData info; + from_proxy_to_builtin(*ret_val, info); + listener->on_writer_discovery(participant, status, info, should_be_ignored); } return ret_val; @@ -1071,10 +1068,11 @@ WriterProxyData* PDP::addWriterProxyData( if (listener) { RTPSParticipant* participant = mp_RTPSParticipant->getUserRTPSParticipant(); - WriterDiscoveryInfo info(*ret_val); bool should_be_ignored = false; - info.status = WriterDiscoveryInfo::DISCOVERED_WRITER; - listener->onWriterDiscovery(participant, std::move(info), should_be_ignored); + auto status = WriterDiscoveryStatus::DISCOVERED_WRITER; + PublicationBuiltinTopicData info; + from_proxy_to_builtin(*ret_val, info); + listener->on_writer_discovery(participant, status, info, should_be_ignored); } return ret_val; @@ -1303,10 +1301,11 @@ void PDP::actions_on_remote_participant_removed( if (listener) { RTPSParticipant* participant = mp_RTPSParticipant->getUserRTPSParticipant(); - WriterDiscoveryInfo info(std::move(*wit)); bool should_be_ignored = false; - info.status = WriterDiscoveryInfo::REMOVED_WRITER; - listener->onWriterDiscovery(participant, std::move(info), should_be_ignored); + auto status = WriterDiscoveryStatus::REMOVED_WRITER; + PublicationBuiltinTopicData info; + from_proxy_to_builtin(*wit, info); + listener->on_writer_discovery(participant, status, info, should_be_ignored); } } } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.h b/src/cpp/rtps/builtin/discovery/participant/PDP.h index 1bb78b528f..585e4e7fd7 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.h +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.h @@ -29,15 +29,15 @@ #include #include #include -#include #include #include #include #include #include -#include +#include #include +#include #include #include #include @@ -285,17 +285,6 @@ class PDP : public fastdds::statistics::rtps::IProxyQueryable bool removeWriterProxyData( const GUID_t& writer_guid); - /** - * This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant. - * - * @param [in] writer_guid GUID_t of the writer to remove. - * @param [in] reason Why the writer is being removed (dropped, removed, or ignored) - * @return true if found and deleted. - */ - bool removeWriterProxyData( - const GUID_t& writer_guid, - WriterDiscoveryInfo::DISCOVERY_STATUS reason); - /** * Create the SPDP Writer and Reader * @return True if correct. diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index 0697bfcf82..8b34808942 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -548,7 +548,7 @@ bool PDPClient::pairing_remote_writer_with_local_reader_after_security( if (local_reader == endpoints->reader.reader_->getGuid()) { - endpoints->reader.reader_->matched_writer_add(remote_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(remote_writer_data); return true; } @@ -641,7 +641,7 @@ void PDPClient::removeRemoteEndpoints( temp_writer_data->set_remote_locators(pdata->metatraffic_locators, network, true); temp_writer_data->m_qos.m_reliability.kind = dds::RELIABLE_RELIABILITY_QOS; temp_writer_data->m_qos.m_durability.kind = dds::TRANSIENT_DURABILITY_QOS; - endpoints->reader.reader_->matched_writer_add(*temp_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(*temp_writer_data); } } @@ -894,7 +894,7 @@ void PDPClient::match_pdp_writer_nts_( else #endif // HAVE_SECURITY { - endpoints->reader.reader_->matched_writer_add(*temp_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(*temp_writer_data); } } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 69bb2cb53b..e1eacaca27 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -578,7 +578,7 @@ void PDPServer::match_reliable_pdp_endpoints( else #endif // HAVE_SECURITY { - endpoints->reader.reader_->matched_writer_add(*temp_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(*temp_writer_data); } } else @@ -682,7 +682,7 @@ bool PDPServer::pairing_remote_writer_with_local_reader_after_security( if (local_reader == endpoints->reader.reader_->getGuid()) { - endpoints->reader.reader_->matched_writer_add(remote_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(remote_writer_data); return true; } @@ -1995,7 +1995,7 @@ void PDPServer::match_pdp_writer_nts_( else #endif // HAVE_SECURITY { - endpoints->reader.reader_->matched_writer_add(*temp_writer_data); + endpoints->reader.reader_->matched_writer_add_edp(*temp_writer_data); } } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp index daa4ac39a0..56d8f0ee06 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -640,7 +641,7 @@ void PDPSimple::match_pdp_remote_endpoints( uint32_t pdp_writer_mask = fastdds::rtps::DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER; EntityId_t reader_entity_id = c_EntityId_SPDPReader; EntityId_t writer_entity_id = c_EntityId_SPDPWriter; - RTPSReader* reader = endpoints->reader.reader_; + BaseReader* reader = endpoints->reader.reader_; RTPSWriter* writer = endpoints->writer.writer_; #if HAVE_SECURITY @@ -684,7 +685,7 @@ void PDPSimple::match_pdp_remote_endpoints( else #endif // HAVE_SECURITY { - reader->matched_writer_add(*temp_writer_data); + reader->matched_writer_add_edp(*temp_writer_data); } } @@ -748,7 +749,7 @@ bool PDPSimple::pairing_remote_writer_with_local_reader_after_security( auto endpoints = dynamic_cast(builtin_endpoints_.get()); if ((nullptr != endpoints) && (local_reader == endpoints->secure_reader.reader_->getGuid())) { - endpoints->secure_reader.reader_->matched_writer_add(remote_writer_data); + endpoints->secure_reader.reader_->matched_writer_add_edp(remote_writer_data); return true; } diff --git a/src/cpp/rtps/builtin/liveliness/WLP.cpp b/src/cpp/rtps/builtin/liveliness/WLP.cpp index c5b4eff798..e2ba441e3b 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.cpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.cpp @@ -25,12 +25,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -469,7 +469,7 @@ bool WLP::pairing_remote_writer_with_local_reader_after_security( { if (local_reader.entityId == c_EntityId_ReaderLivelinessSecure) { - mp_builtinReaderSecure->matched_writer_add(remote_writer_data); + mp_builtinReaderSecure->matched_writer_add_edp(remote_writer_data); return true; } @@ -511,7 +511,7 @@ bool WLP::assignRemoteEndpoints( EPROSIMA_LOG_INFO(RTPS_LIVELINESS, "Adding remote writer to my local Builtin Reader"); temp_writer_proxy_data_.guid().entityId = c_EntityId_WriterLiveliness; temp_writer_proxy_data_.set_persistence_entity_id(c_EntityId_WriterLiveliness); - mp_builtinReader->matched_writer_add(temp_writer_proxy_data_); + mp_builtinReader->matched_writer_add_edp(temp_writer_proxy_data_); } auxendp = endp; auxendp &= fastdds::rtps::BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER; diff --git a/src/cpp/rtps/builtin/liveliness/WLP.hpp b/src/cpp/rtps/builtin/liveliness/WLP.hpp index 1cf0335103..49bfe40663 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.hpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.hpp @@ -27,11 +27,12 @@ #include #include -#include #include #include #include +#include + namespace eprosima { namespace fastdds { diff --git a/src/cpp/rtps/network/utils/external_locators.cpp b/src/cpp/rtps/network/utils/external_locators.cpp index 5266cf0e81..3b72c8c1a4 100644 --- a/src/cpp/rtps/network/utils/external_locators.cpp +++ b/src/cpp/rtps/network/utils/external_locators.cpp @@ -24,13 +24,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include namespace eprosima { diff --git a/src/cpp/rtps/network/utils/external_locators.hpp b/src/cpp/rtps/network/utils/external_locators.hpp index 7dd622bff9..dbf8ea6950 100644 --- a/src/cpp/rtps/network/utils/external_locators.hpp +++ b/src/cpp/rtps/network/utils/external_locators.hpp @@ -22,10 +22,11 @@ #include #include #include -#include #include #include +#include + namespace eprosima { namespace fastdds { namespace rtps { diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index a2a1265b7a..b511ea0ddc 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -87,7 +87,7 @@ bool RTPSParticipant::registerReader( RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter) + const ContentFilterProperty* content_filter) { return mp_impl->registerReader(Reader, topicAtt, rqos, content_filter); } @@ -110,7 +110,7 @@ bool RTPSParticipant::updateReader( RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter) + const ContentFilterProperty* content_filter) { return mp_impl->updateLocalReader(Reader, topicAtt, rqos, content_filter); } @@ -191,7 +191,7 @@ bool RTPSParticipant::ignore_reader( return false; } -std::vector RTPSParticipant::get_netmask_filter_info() const +std::vector RTPSParticipant::get_netmask_filter_info() const { return mp_impl->get_netmask_filter_info(); } @@ -261,21 +261,21 @@ bool RTPSParticipant::disable_monitor_service() const } bool RTPSParticipant::fill_discovery_data_from_cdr_message( - fastdds::rtps::ParticipantProxyData& data, + ParticipantProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg) { return mp_impl->fill_discovery_data_from_cdr_message(data, msg); } bool RTPSParticipant::fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg) + PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg) { return mp_impl->fill_discovery_data_from_cdr_message(data, msg); } bool RTPSParticipant::fill_discovery_data_from_cdr_message( - fastdds::rtps::ReaderProxyData& data, + ReaderProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg) { return mp_impl->fill_discovery_data_from_cdr_message(data, msg); diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 4d34fe97de..7038ceb197 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -2952,24 +2953,40 @@ bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( } bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg) + fastdds::rtps::PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg) { bool ret = true; CDRMessage_t serialized_msg{0}; serialized_msg.wraps = true; - serialized_msg.buffer = msg.value().entity_proxy().data(); + serialized_msg.buffer = const_cast(msg.value().entity_proxy().data()); serialized_msg.length = static_cast(msg.value().entity_proxy().size()); - ret = data.readFromCDRMessage( + const auto& alloc_limits = m_att.allocation; + WriterProxyData writer_data( + alloc_limits.locators.max_unicast_locators, + alloc_limits.locators.max_multicast_locators, + alloc_limits.data_limits); + + ret = writer_data.readFromCDRMessage( &serialized_msg, network_factory(), has_shm_transport(), false, c_VendorId_eProsima); - return ret && (data.guid().entityId.is_writer()); + if (ret) + { + ret = writer_data.guid().entityId.is_writer(); + } + + if (ret) + { + from_proxy_to_builtin(writer_data, data); + } + + return ret; } bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index bddaa120cd..3ffcc5eebb 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -48,6 +47,7 @@ #include #include "../flowcontrol/FlowControllerFactory.hpp" +#include #include #include #include @@ -111,6 +111,7 @@ class MessageReceiver; namespace rtps { +struct PublicationBuiltinTopicData; class RTPSParticipant; class RTPSParticipantListener; class BuiltinProtocols; @@ -143,8 +144,6 @@ class RTPSParticipantImpl #endif // if HAVE_SECURITY { - using BaseReader = fastdds::rtps::BaseReader; - /* Receiver Control block is a struct we use to encapsulate the resources that take part in message reception. It contains: @@ -296,7 +295,7 @@ class RTPSParticipantImpl */ template bool sendSync( - const std::vector& buffers, + const std::vector& buffers, const uint32_t& total_bytes, const GUID_t& sender_guid, const LocatorIteratorT& destination_locators_begin, @@ -612,7 +611,7 @@ class RTPSParticipantImpl //!SenderResource List std::timed_mutex m_send_resources_mutex_; - fastdds::rtps::SendResourceList send_resource_list_; + SendResourceList send_resource_list_; //!Participant Listener RTPSParticipantListener* mp_participantListener; @@ -727,7 +726,7 @@ class RTPSParticipantImpl /* * Flow controller factory. */ - fastdds::rtps::FlowControllerFactory flow_controller_factory_; + FlowControllerFactory flow_controller_factory_; #if HAVE_SECURITY security::ParticipantSecurityAttributes security_attributes_; @@ -916,7 +915,7 @@ class RTPSParticipantImpl RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); + const ContentFilterProperty* content_filter = nullptr); /** * Update participant attributes. @@ -949,7 +948,7 @@ class RTPSParticipantImpl RTPSReader* Reader, const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); + const ContentFilterProperty* content_filter = nullptr); /** * Get the participant attributes @@ -1110,7 +1109,7 @@ class RTPSParticipantImpl * * @return A vector with all registered transports' netmask filter information. */ - std::vector get_netmask_filter_info() const; + std::vector get_netmask_filter_info() const; template static bool preprocess_endpoint_attributes( @@ -1227,11 +1226,11 @@ class RTPSParticipantImpl * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::ParticipantProxyData& data, + ParticipantProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg); /** - * fills in the WriterProxyData from a MonitorService Message + * fills in the PublicationBuiltinTopicData from a MonitorService Message * * @param [out] data Proxy to fill. * @param [in] msg MonitorService Message to get the proxy information from. @@ -1239,8 +1238,8 @@ class RTPSParticipantImpl * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg); + PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg); /** * fills in the ReaderProxyData from a MonitorService Message @@ -1251,7 +1250,7 @@ class RTPSParticipantImpl * @return true if the operation succeeds. */ bool fill_discovery_data_from_cdr_message( - fastdds::rtps::ReaderProxyData& data, + ReaderProxyData& data, fastdds::statistics::MonitorServiceStatusData& msg); bool get_entity_connections( diff --git a/src/cpp/rtps/reader/BaseReader.cpp b/src/cpp/rtps/reader/BaseReader.cpp index 6587a8ac05..6ecacb5ee9 100644 --- a/src/cpp/rtps/reader/BaseReader.cpp +++ b/src/cpp/rtps/reader/BaseReader.cpp @@ -23,8 +23,8 @@ #include #include -#include #include +#include #include #include #include @@ -35,11 +35,14 @@ #include #include +#include +#include #include #include #include #include #include +#include #include #include @@ -122,6 +125,19 @@ BaseReader::~BaseReader() payload_pool_.reset(); } +bool BaseReader::matched_writer_add( + const PublicationBuiltinTopicData& info) +{ + const auto& alloc = mp_RTPSParticipant->getRTPSParticipantAttributes().allocation; + WriterProxyData wdata( + alloc.locators.max_unicast_locators, + alloc.locators.max_multicast_locators, + alloc.data_limits); + + from_builtin_to_proxy(info, wdata); + return matched_writer_add_edp(wdata); +} + ReaderListener* BaseReader::get_listener() const { std::lock_guard lock(mp_mutex); diff --git a/src/cpp/rtps/reader/BaseReader.hpp b/src/cpp/rtps/reader/BaseReader.hpp index 378b9fd8af..11762943e5 100644 --- a/src/cpp/rtps/reader/BaseReader.hpp +++ b/src/cpp/rtps/reader/BaseReader.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,19 @@ class BaseReader public: + bool matched_writer_add( + const PublicationBuiltinTopicData& info) final; + + /** + * @brief Add a matched writer represented by its attributes. + * + * @param wdata Discovery information regarding the writer to add. + * + * @return True if correctly added. + */ + virtual bool matched_writer_add_edp( + const WriterProxyData& wdata) = 0; + fastdds::rtps::ReaderListener* get_listener() const override; void set_listener( diff --git a/src/cpp/rtps/reader/StatefulReader.cpp b/src/cpp/rtps/reader/StatefulReader.cpp index 21a8beedf8..512b20d55b 100644 --- a/src/cpp/rtps/reader/StatefulReader.cpp +++ b/src/cpp/rtps/reader/StatefulReader.cpp @@ -24,13 +24,16 @@ #include #include +#include #include #include #include +#include #include "reader_utils.hpp" #include "rtps/RTPSDomainImpl.hpp" #include +#include #include #include #include @@ -195,7 +198,7 @@ void StatefulReader::init( } } -bool StatefulReader::matched_writer_add( +bool StatefulReader::matched_writer_add_edp( const WriterProxyData& wdata) { assert(wdata.guid() != c_Guid_Unknown); @@ -238,7 +241,10 @@ bool StatefulReader::matched_writer_add( { // call the listener without the lock taken guard.unlock(); - listener->on_writer_discovery(this, WriterDiscoveryInfo::CHANGED_QOS_WRITER, wdata.guid(), &wdata); + PublicationBuiltinTopicData info; + from_proxy_to_builtin(wdata, info); + listener->on_writer_discovery( + this, WriterDiscoveryStatus::CHANGED_QOS_WRITER, wdata.guid(), &info); } #ifdef FASTDDS_STATISTICS @@ -360,7 +366,9 @@ bool StatefulReader::matched_writer_add( if (nullptr != listener) { - listener->on_writer_discovery(this, WriterDiscoveryInfo::DISCOVERED_WRITER, wdata.guid(), &wdata); + PublicationBuiltinTopicData info; + from_proxy_to_builtin(wdata, info); + listener->on_writer_discovery(this, WriterDiscoveryStatus::DISCOVERED_WRITER, wdata.guid(), &info); } #ifdef FASTDDS_STATISTICS @@ -425,7 +433,7 @@ bool StatefulReader::matched_writer_remove( // call the listener without the lock taken ReaderListener* listener = listener_; lock.unlock(); - listener->on_writer_discovery(this, WriterDiscoveryInfo::REMOVED_WRITER, writer_guid, nullptr); + listener->on_writer_discovery(this, WriterDiscoveryStatus::REMOVED_WRITER, writer_guid, nullptr); } #ifdef FASTDDS_STATISTICS diff --git a/src/cpp/rtps/reader/StatefulReader.hpp b/src/cpp/rtps/reader/StatefulReader.hpp index 1e10666337..1a97d1a037 100644 --- a/src/cpp/rtps/reader/StatefulReader.hpp +++ b/src/cpp/rtps/reader/StatefulReader.hpp @@ -83,7 +83,7 @@ class StatefulReader : public fastdds::rtps::BaseReader * @param wdata Attributes of the writer to add. * @return True if correctly added. */ - bool matched_writer_add( + bool matched_writer_add_edp( const WriterProxyData& wdata) override; /** diff --git a/src/cpp/rtps/reader/StatelessReader.cpp b/src/cpp/rtps/reader/StatelessReader.cpp index cd935d1e9f..4a67995e7e 100644 --- a/src/cpp/rtps/reader/StatelessReader.cpp +++ b/src/cpp/rtps/reader/StatelessReader.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include "reader_utils.hpp" #include "rtps/RTPSDomainImpl.hpp" #include +#include #include #include #include @@ -96,7 +98,7 @@ StatelessReader::StatelessReader( { } -bool StatelessReader::matched_writer_add( +bool StatelessReader::matched_writer_add_edp( const WriterProxyData& wdata) { ReaderListener* listener = nullptr; @@ -123,8 +125,10 @@ bool StatelessReader::matched_writer_add( { // call the listener without the lock taken guard.unlock(); - listener->on_writer_discovery(this, WriterDiscoveryInfo::CHANGED_QOS_WRITER, wdata.guid(), - &wdata); + PublicationBuiltinTopicData info; + from_proxy_to_builtin(wdata, info); + listener->on_writer_discovery(this, WriterDiscoveryStatus::CHANGED_QOS_WRITER, wdata.guid(), + &info); } #ifdef FASTDDS_STATISTICS @@ -211,7 +215,9 @@ bool StatelessReader::matched_writer_add( if (nullptr != listener) { - listener->on_writer_discovery(this, WriterDiscoveryInfo::DISCOVERED_WRITER, wdata.guid(), &wdata); + PublicationBuiltinTopicData info; + from_proxy_to_builtin(wdata, info); + listener->on_writer_discovery(this, WriterDiscoveryStatus::DISCOVERED_WRITER, wdata.guid(), &info); } #ifdef FASTDDS_STATISTICS @@ -259,7 +265,7 @@ bool StatelessReader::matched_writer_remove( // call the listener without lock ReaderListener* listener = listener_; guard.unlock(); - listener->on_writer_discovery(this, WriterDiscoveryInfo::REMOVED_WRITER, writer_guid, nullptr); + listener->on_writer_discovery(this, WriterDiscoveryStatus::REMOVED_WRITER, writer_guid, nullptr); } #ifdef FASTDDS_STATISTICS diff --git a/src/cpp/rtps/reader/StatelessReader.hpp b/src/cpp/rtps/reader/StatelessReader.hpp index ae87b8c982..0bfb916936 100644 --- a/src/cpp/rtps/reader/StatelessReader.hpp +++ b/src/cpp/rtps/reader/StatelessReader.hpp @@ -80,7 +80,7 @@ class StatelessReader : public fastdds::rtps::BaseReader * @param wdata Pointer to the WPD object to add. * @return True if correctly added. */ - bool matched_writer_add( + bool matched_writer_add_edp( const WriterProxyData& wdata) override; /** diff --git a/src/cpp/rtps/reader/WriterProxy.cpp b/src/cpp/rtps/reader/WriterProxy.cpp index fbfda2b694..1a00e61076 100644 --- a/src/cpp/rtps/reader/WriterProxy.cpp +++ b/src/cpp/rtps/reader/WriterProxy.cpp @@ -20,11 +20,11 @@ #include #include -#include #include #include "rtps/RTPSDomainImpl.hpp" #include "utils/collections/node_size_helpers.hpp" +#include #include #include #include diff --git a/src/cpp/rtps/reader/WriterProxy.h b/src/cpp/rtps/reader/WriterProxy.h index 65ad44bc46..953ecbc4fc 100644 --- a/src/cpp/rtps/reader/WriterProxy.h +++ b/src/cpp/rtps/reader/WriterProxy.h @@ -20,6 +20,12 @@ #define FASTDDS_RTPS_READER_WRITERPROXY_H_ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#include +#include + +#include +#include + #include #include #include @@ -27,14 +33,9 @@ #include #include #include -#include #include -#include -#include - -#include -#include +#include // Testing purpose #ifndef TEST_FRIENDS diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index 68010b3f56..0a57e5c463 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -28,11 +28,11 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -2111,7 +2111,7 @@ void SecurityManager::match_builtin_endpoints( temp_stateless_writer_proxy_data_->m_qos.m_reliability.kind = eprosima::fastdds::dds::BEST_EFFORT_RELIABILITY_QOS; temp_stateless_writer_proxy_data_->m_qos.m_durability.kind = eprosima::fastdds::dds::VOLATILE_DURABILITY_QOS; - participant_stateless_message_reader_->matched_writer_add(*temp_stateless_writer_proxy_data_); + participant_stateless_message_reader_->matched_writer_add_edp(*temp_stateless_writer_proxy_data_); } if (participant_stateless_message_writer_ != nullptr && @@ -2151,7 +2151,7 @@ void SecurityManager::match_builtin_key_exchange_endpoints( temp_volatile_writer_proxy_data_->topicKind(NO_KEY); temp_volatile_writer_proxy_data_->m_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; temp_volatile_writer_proxy_data_->m_qos.m_durability.kind = eprosima::fastdds::dds::VOLATILE_DURABILITY_QOS; - participant_volatile_message_secure_reader_->matched_writer_add(*temp_volatile_writer_proxy_data_); + participant_volatile_message_secure_reader_->matched_writer_add_edp(*temp_volatile_writer_proxy_data_); } if (participant_volatile_message_secure_writer_ != nullptr && diff --git a/src/cpp/rtps/security/SecurityManager.h b/src/cpp/rtps/security/SecurityManager.h index 5fc16fc175..0d382e7651 100644 --- a/src/cpp/rtps/security/SecurityManager.h +++ b/src/cpp/rtps/security/SecurityManager.h @@ -28,12 +28,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/cpp/security/accesscontrol/Permissions.cpp b/src/cpp/security/accesscontrol/Permissions.cpp index 85e2351ede..e6645a91bc 100644 --- a/src/cpp/security/accesscontrol/Permissions.cpp +++ b/src/cpp/security/accesscontrol/Permissions.cpp @@ -35,8 +35,8 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cpp/statistics/fastdds/domain/DomainParticipant.cpp b/src/cpp/statistics/fastdds/domain/DomainParticipant.cpp index 86417739a3..a08d194626 100644 --- a/src/cpp/statistics/fastdds/domain/DomainParticipant.cpp +++ b/src/cpp/statistics/fastdds/domain/DomainParticipant.cpp @@ -126,8 +126,8 @@ fastdds::dds::ReturnCode_t DomainParticipant::fill_discovery_data_from_cdr_messa } fastdds::dds::ReturnCode_t DomainParticipant::fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg) + fastdds::dds::PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg) { #ifdef FASTDDS_STATISTICS return static_cast(impl_)->fill_discovery_data_from_cdr_message(data, msg); diff --git a/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp index 7ba349c5d2..5188a5562a 100644 --- a/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp @@ -337,8 +337,8 @@ ReturnCode_t DomainParticipantImpl::fill_discovery_data_from_cdr_message( } ReturnCode_t DomainParticipantImpl::fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg) + fastdds::dds::PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg) { ReturnCode_t ret{efd::RETCODE_OK}; diff --git a/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.hpp b/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.hpp index dac1dfd2ea..0113aa4928 100644 --- a/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.hpp +++ b/src/cpp/statistics/fastdds/domain/DomainParticipantImpl.hpp @@ -168,8 +168,8 @@ class DomainParticipantImpl : public efd::DomainParticipantImpl, * @return RETCODE_ERROR if the operation fails. */ efd::ReturnCode_t fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& data, - fastdds::statistics::MonitorServiceStatusData& msg); + fastdds::dds::PublicationBuiltinTopicData& data, + const fastdds::statistics::MonitorServiceStatusData& msg); /** * fills in the ReaderProxyData from a MonitorService Message diff --git a/src/cpp/xmlparser/XMLEndpointParser.cpp b/src/cpp/xmlparser/XMLEndpointParser.cpp index 9d7795fb40..4e495ecd39 100644 --- a/src/cpp/xmlparser/XMLEndpointParser.cpp +++ b/src/cpp/xmlparser/XMLEndpointParser.cpp @@ -26,9 +26,9 @@ #include #include -#include #include +#include #include #include diff --git a/src/cpp/xmlparser/XMLEndpointParser.h b/src/cpp/xmlparser/XMLEndpointParser.h index 2967df18b8..978cb8a7d1 100644 --- a/src/cpp/xmlparser/XMLEndpointParser.h +++ b/src/cpp/xmlparser/XMLEndpointParser.h @@ -29,8 +29,8 @@ #include #include -#include +#include #include #include diff --git a/test/blackbox/api/dds-pim/PubSubReader.hpp b/test/blackbox/api/dds-pim/PubSubReader.hpp index b7170637fe..4daac8e509 100644 --- a/test/blackbox/api/dds-pim/PubSubReader.hpp +++ b/test/blackbox/api/dds-pim/PubSubReader.hpp @@ -77,6 +77,9 @@ class PubSubReader typedef TypeSupport type_support; typedef typename type_support::type type; + typedef std::function EndpointDiscoveryFunctor; protected: @@ -121,13 +124,14 @@ class PubSubReader void on_data_writer_discovery( eprosima::fastdds::dds::DomainParticipant*, - eprosima::fastdds::rtps::WriterDiscoveryInfo&& info, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, + const eprosima::fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override { if (reader_.onEndpointDiscovery_ != nullptr) { std::unique_lock lock(reader_.mutexDiscovery_); - reader_.discovery_result_ |= reader_.onEndpointDiscovery_(info); + reader_.discovery_result_ |= reader_.onEndpointDiscovery_(reason, info); reader_.cvDiscovery_.notify_one(); } } @@ -1690,7 +1694,7 @@ class PubSubReader } void setOnEndpointDiscoveryFunction( - std::function f) + EndpointDiscoveryFunctor f) { onEndpointDiscovery_ = f; } @@ -2125,7 +2129,7 @@ class PubSubReader std::string datareader_profile_ = ""; std::function onDiscovery_; - std::function onEndpointDiscovery_; + EndpointDiscoveryFunctor onEndpointDiscovery_; //! True to take data from history. On False, read_ is checked. bool take_; diff --git a/test/blackbox/api/dds-pim/PubSubWriter.hpp b/test/blackbox/api/dds-pim/PubSubWriter.hpp index 4dca47fb26..8b8d75632d 100644 --- a/test/blackbox/api/dds-pim/PubSubWriter.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriter.hpp @@ -139,20 +139,23 @@ class PubSubWriter void on_data_writer_discovery( eprosima::fastdds::dds::DomainParticipant*, - eprosima::fastdds::rtps::WriterDiscoveryInfo&& info, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, + const eprosima::fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override { - if (info.status == eprosima::fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER) + using eprosima::fastdds::rtps::WriterDiscoveryStatus; + + if (reason == WriterDiscoveryStatus::DISCOVERED_WRITER) { - writer_.add_writer_info(info.info); + writer_.add_writer_info(info); } - else if (info.status == eprosima::fastdds::rtps::WriterDiscoveryInfo::CHANGED_QOS_WRITER) + else if (reason == WriterDiscoveryStatus::CHANGED_QOS_WRITER) { - writer_.change_writer_info(info.info); + writer_.change_writer_info(info); } - else if (info.status == eprosima::fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER) + else if (reason == WriterDiscoveryStatus::REMOVED_WRITER) { - writer_.remove_writer_info(info.info); + writer_.remove_writer_info(info); } } @@ -1787,24 +1790,24 @@ class PubSubWriter #endif // if HAVE_SECURITY void add_writer_info( - const eprosima::fastdds::rtps::WriterProxyData& writer_data) + const eprosima::fastdds::dds::PublicationBuiltinTopicData& writer_data) { mutexEntitiesInfoList_.lock(); - auto ret = mapWriterInfoList_.insert(std::make_pair(writer_data.guid(), writer_data)); + auto ret = mapWriterInfoList_.insert(std::make_pair(writer_data.guid, writer_data)); if (!ret.second) { ret.first->second = writer_data; } - auto ret_topic = mapTopicCountList_.insert(std::make_pair(writer_data.topicName().to_string(), 1)); + auto ret_topic = mapTopicCountList_.insert(std::make_pair(writer_data.topic_name, 1)); if (!ret_topic.second) { ++ret_topic.first->second; } - for (auto partition : writer_data.m_qos.m_partition.names()) + for (auto partition : writer_data.partition.names()) { auto ret_partition = mapPartitionCountList_.insert(std::make_pair(partition, 1)); @@ -1819,19 +1822,19 @@ class PubSubWriter } void change_writer_info( - const eprosima::fastdds::rtps::WriterProxyData& writer_data) + const eprosima::fastdds::dds::PublicationBuiltinTopicData& writer_data) { mutexEntitiesInfoList_.lock(); - auto ret = mapWriterInfoList_.insert(std::make_pair(writer_data.guid(), writer_data)); + auto ret = mapWriterInfoList_.insert(std::make_pair(writer_data.guid, writer_data)); ASSERT_FALSE(ret.second); - eprosima::fastdds::rtps::WriterProxyData old_writer_data = ret.first->second; + eprosima::fastdds::dds::PublicationBuiltinTopicData old_writer_data = ret.first->second; ret.first->second = writer_data; - ASSERT_GT(mapTopicCountList_.count(writer_data.topicName().to_string()), 0ul); + ASSERT_GT(mapTopicCountList_.count(writer_data.topic_name.to_string()), 0ul); // Remove previous partitions - for (auto partition : old_writer_data.m_qos.m_partition.names()) + for (auto partition : old_writer_data.partition.names()) { auto partition_it = mapPartitionCountList_.find(partition); ASSERT_TRUE(partition_it != mapPartitionCountList_.end()); @@ -1843,7 +1846,7 @@ class PubSubWriter } // Add new partitions - for (auto partition : writer_data.m_qos.m_partition.names()) + for (auto partition : writer_data.partition.names()) { auto ret_partition = mapPartitionCountList_.insert(std::make_pair(partition, 1)); @@ -1928,19 +1931,19 @@ class PubSubWriter } void remove_writer_info( - const eprosima::fastdds::rtps::WriterProxyData& writer_data) + const eprosima::fastdds::dds::PublicationBuiltinTopicData& writer_data) { std::unique_lock lock(mutexEntitiesInfoList_); - ASSERT_GT(mapWriterInfoList_.count(writer_data.guid()), 0ul); + ASSERT_GT(mapWriterInfoList_.count(writer_data.guid), 0ul); - mapWriterInfoList_.erase(writer_data.guid()); + mapWriterInfoList_.erase(writer_data.guid); - ASSERT_GT(mapTopicCountList_.count(writer_data.topicName().to_string()), 0ul); + ASSERT_GT(mapTopicCountList_.count(writer_data.topic_name.to_string()), 0ul); - --mapTopicCountList_[writer_data.topicName().to_string()]; + --mapTopicCountList_[writer_data.topic_name.to_string()]; - for (auto partition : writer_data.m_qos.m_partition.names()) + for (auto partition : writer_data.partition.names()) { auto partition_it = mapPartitionCountList_.find(partition); ASSERT_TRUE(partition_it != mapPartitionCountList_.end()); @@ -2006,7 +2009,7 @@ class PubSubWriter eprosima::fastdds::dds::TypeSupport type_; std::mutex mutexEntitiesInfoList_; std::condition_variable cvEntitiesInfoList_; - std::map mapWriterInfoList_; + std::map mapWriterInfoList_; std::map mapReaderInfoList_; std::map mapTopicCountList_; std::map mapPartitionCountList_; diff --git a/test/blackbox/api/dds-pim/PubSubWriterReader.hpp b/test/blackbox/api/dds-pim/PubSubWriterReader.hpp index 01b22e471b..3f5da3a875 100644 --- a/test/blackbox/api/dds-pim/PubSubWriterReader.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriterReader.hpp @@ -132,19 +132,21 @@ class PubSubWriterReader void on_data_writer_discovery( eprosima::fastdds::dds::DomainParticipant* participant, - eprosima::fastdds::rtps::WriterDiscoveryInfo&& info, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, + const eprosima::fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override { - (void)participant; + using eprosima::fastdds::rtps::WriterDiscoveryStatus; + static_cast(participant); - switch (info.status) + switch (reason) { - case eprosima::fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER: - info_add(discovered_publishers_, info.info.guid()); + case WriterDiscoveryStatus::DISCOVERED_WRITER: + info_add(discovered_publishers_, info.guid); break; - case eprosima::fastdds::rtps::WriterDiscoveryInfo::REMOVED_WRITER: - info_remove(discovered_publishers_, info.info.guid()); + case WriterDiscoveryStatus::REMOVED_WRITER: + info_remove(discovered_publishers_, info.guid); break; default: diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 934f64f809..010194bfa9 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -973,16 +973,17 @@ TEST_P(Discovery, PubSubAsReliableHelloworldEndpointUserData) ASSERT_TRUE(writer.isInitialized()); - reader.setOnEndpointDiscoveryFunction([&writer](const WriterDiscoveryInfo& info) -> bool + reader.setOnEndpointDiscoveryFunction([&writer](WriterDiscoveryStatus /*reason*/, + const PublicationBuiltinTopicData& info) -> bool { - if (info.info.guid() == writer.datawriter_guid()) + if (info.guid == writer.datawriter_guid()) { std::cout << "Received USER_DATA from the writer: "; - for (auto i: info.info.m_qos.m_userData) + for (auto i: info.user_data) { std::cout << i << ' '; } - return info.info.m_qos.m_userData == std::vector({'a', 'b', 'c', 'd'}); + return info.user_data == std::vector({'a', 'b', 'c', 'd'}); } return false; diff --git a/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp b/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp index a7391d3957..26ab452aa1 100644 --- a/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp +++ b/test/blackbox/common/DDSBlackboxTestsMonitorService.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include @@ -725,7 +726,7 @@ struct ProxySampleValidator : public SampleValidator } else if (guid.entityId.is_writer()) { - WriterProxyData wdata(4, 4); + PublicationBuiltinTopicData wdata; ASSERT_EQ(participant->fill_discovery_data_from_cdr_message(wdata, data), diff --git a/test/blackbox/common/RTPSAsSocketReader.hpp b/test/blackbox/common/RTPSAsSocketReader.hpp index edfb01f009..8c54ac9b00 100644 --- a/test/blackbox/common/RTPSAsSocketReader.hpp +++ b/test/blackbox/common/RTPSAsSocketReader.hpp @@ -41,7 +41,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -296,32 +297,38 @@ class RTPSAsSocketReader std::cout << "ERROR: locator has to be registered previous to call this" << std::endl; } - //Add remote writer (in this case a reader in the same machine) + // Add remote writer (in this case a reader in the same machine) eprosima::fastdds::rtps::GUID_t guid = participant_->getGuid(); - eprosima::fastdds::rtps::WriterProxyData wattr(4u, 1u); eprosima::fastdds::rtps::Locator_t loc; IPLocator::setIPv4(loc, ip_); loc.port = static_cast(port_); - wattr.add_multicast_locator(loc); - wattr.m_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; - wattr.guid().guidPrefix.value[0] = guid.guidPrefix.value[0]; - wattr.guid().guidPrefix.value[1] = guid.guidPrefix.value[1]; - wattr.guid().guidPrefix.value[2] = guid.guidPrefix.value[2]; - wattr.guid().guidPrefix.value[3] = guid.guidPrefix.value[3]; - wattr.guid().guidPrefix.value[4] = guid.guidPrefix.value[4]; - wattr.guid().guidPrefix.value[5] = guid.guidPrefix.value[5]; - wattr.guid().guidPrefix.value[6] = guid.guidPrefix.value[6]; - wattr.guid().guidPrefix.value[7] = guid.guidPrefix.value[7]; - wattr.guid().guidPrefix.value[8] = 2; - wattr.guid().guidPrefix.value[9] = 0; - wattr.guid().guidPrefix.value[10] = 0; - wattr.guid().guidPrefix.value[11] = 0; - wattr.guid().entityId.value[0] = 0; - wattr.guid().entityId.value[1] = 0; - wattr.guid().entityId.value[2] = 2; - wattr.guid().entityId.value[3] = 3; - reader_->matched_writer_add(wattr); + + eprosima::fastdds::rtps::GUID_t wguid; + wguid.guidPrefix.value[0] = guid.guidPrefix.value[0]; + wguid.guidPrefix.value[1] = guid.guidPrefix.value[1]; + wguid.guidPrefix.value[2] = guid.guidPrefix.value[2]; + wguid.guidPrefix.value[3] = guid.guidPrefix.value[3]; + wguid.guidPrefix.value[4] = guid.guidPrefix.value[4]; + wguid.guidPrefix.value[5] = guid.guidPrefix.value[5]; + wguid.guidPrefix.value[6] = guid.guidPrefix.value[6]; + wguid.guidPrefix.value[7] = guid.guidPrefix.value[7]; + wguid.guidPrefix.value[8] = 2; + wguid.guidPrefix.value[9] = 0; + wguid.guidPrefix.value[10] = 0; + wguid.guidPrefix.value[11] = 0; + wguid.entityId.value[0] = 0; + wguid.entityId.value[1] = 0; + wguid.entityId.value[2] = 2; + wguid.entityId.value[3] = 3; + + eprosima::fastdds::rtps::PublicationBuiltinTopicData pub_info{}; + pub_info.reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; + pub_info.remote_locators.add_multicast_locator(loc); + pub_info.guid = wguid; + pub_info.persistence_guid = wguid; + + reader_->matched_writer_add(pub_info); } } diff --git a/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp b/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp index 85a621c787..bc593085bb 100644 --- a/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include "RTPSWithRegistrationReader.hpp" @@ -91,27 +92,27 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscovery) reader.set_on_writer_discovery( [&mutex, &cv, &iteration, &writer_guid, &user_data]( - WriterDiscoveryInfo::DISCOVERY_STATUS reason, + WriterDiscoveryStatus reason, const GUID_t& w_guid, - const WriterProxyData* w_data) + const PublicationBuiltinTopicData* w_data) { std::unique_lock lock(mutex); writer_guid = w_guid; if (nullptr != w_data) { - user_data = w_data->m_qos.m_userData; + user_data = w_data->user_data; } - if (Iterations::NONE == iteration && WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER == reason) + if (Iterations::NONE == iteration && WriterDiscoveryStatus::DISCOVERED_WRITER == reason) { iteration = Iterations::DISCOVERED_WRITER; } else if (Iterations::DISCOVERED_WRITER == iteration && - WriterDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_WRITER == reason) + WriterDiscoveryStatus::CHANGED_QOS_WRITER == reason) { iteration = Iterations::CHANGED_QOS_WRITER; } else if (Iterations::CHANGED_QOS_WRITER == iteration && - WriterDiscoveryInfo::DISCOVERY_STATUS::REMOVED_WRITER == reason) + WriterDiscoveryStatus::REMOVED_WRITER == reason) { iteration = Iterations::REMOVED_WRITER; } @@ -124,7 +125,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscovery) ).init(); ASSERT_TRUE(reader.isInitialized()); - // Test first iteration: expect WriterDiscoveryInfo::DISCOVERED_WRITER. + // Test first iteration: expect WriterDiscoveryStatus::DISCOVERED_WRITER. writer.user_data({0, 1, 2, 3}).init(); ASSERT_TRUE(writer.isInitialized()); { @@ -138,7 +139,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscovery) ASSERT_EQ(std::vector({0, 1, 2, 3}), user_data); } - // Test second iteration: expect WriterDiscoveryInfo::CHANGED_QOS_WRITER. + // Test second iteration: expect WriterDiscoveryStatus::CHANGED_QOS_WRITER. writer.user_data({2, 3, 4, 5, 6}).update(); { std::unique_lock lock(mutex); @@ -151,7 +152,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscovery) ASSERT_EQ(std::vector({2, 3, 4, 5, 6}), user_data); } - // Test second iteration: expect WriterDiscoveryInfo::REMOVED_WRITER. + // Test second iteration: expect WriterDiscoveryStatus::REMOVED_WRITER. GUID_t w_guid = writer.guid(); writer.destroy(); { @@ -287,18 +288,18 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscoveryIncompatibleQoS) reader.set_on_writer_discovery( [&mutex, &cv, &iteration, &writer_guid]( - WriterDiscoveryInfo::DISCOVERY_STATUS reason, + WriterDiscoveryStatus reason, const GUID_t& w_guid, - const WriterProxyData*) + const PublicationBuiltinTopicData*) { std::unique_lock lock(mutex); writer_guid = w_guid; - if (Iterations::NONE == iteration && WriterDiscoveryInfo::DISCOVERY_STATUS::DISCOVERED_WRITER == reason) + if (Iterations::NONE == iteration && WriterDiscoveryStatus::DISCOVERED_WRITER == reason) { iteration = Iterations::DISCOVERED_WRITER; } else if (Iterations::DISCOVERED_WRITER == iteration && - WriterDiscoveryInfo::DISCOVERY_STATUS::REMOVED_WRITER == reason) + WriterDiscoveryStatus::REMOVED_WRITER == reason) { iteration = Iterations::REMOVED_WRITER; } @@ -311,7 +312,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscoveryIncompatibleQoS) ).init(); ASSERT_TRUE(reader.isInitialized()); - // Test first iteration: expect WriterDiscoveryInfo::DISCOVERED_WRITER. + // Test first iteration: expect WriterDiscoveryStatus::DISCOVERED_WRITER. writer.init(); ASSERT_TRUE(writer.isInitialized()); { @@ -324,7 +325,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscoveryIncompatibleQoS) ASSERT_EQ(writer.guid(), writer_guid); } - // Test second iteration: expect WriterDiscoveryInfo::CHANGED_QOS_WRITER. + // Test second iteration: expect WriterDiscoveryStatus::CHANGED_QOS_WRITER. std::vector partitions({"A"}); writer.partitions(partitions).update(); { @@ -337,7 +338,7 @@ TEST_P(RTPSDiscovery, ReaderListenerOnWriterDiscoveryIncompatibleQoS) ASSERT_EQ(writer.guid(), writer_guid); } - // Test second iteration: expect WriterDiscoveryInfo::REMOVED_WRITER. + // Test second iteration: expect WriterDiscoveryStatus::REMOVED_WRITER. writer.destroy(); { std::unique_lock lock(mutex); diff --git a/test/blackbox/common/RTPSWithRegistrationReader.hpp b/test/blackbox/common/RTPSWithRegistrationReader.hpp index f2b3b253b9..7a8ddc552f 100644 --- a/test/blackbox/common/RTPSWithRegistrationReader.hpp +++ b/test/blackbox/common/RTPSWithRegistrationReader.hpp @@ -57,9 +57,9 @@ class RTPSWithRegistrationReader typedef typename type_support::type type; using OnWriterDiscoveryFunctor = std::function; private: @@ -104,9 +104,9 @@ class RTPSWithRegistrationReader void on_writer_discovery( eprosima::fastdds::rtps::RTPSReader* reader, - eprosima::fastdds::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS reason, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, const eprosima::fastdds::rtps::GUID_t& writer_guid, - const eprosima::fastdds::rtps::WriterProxyData* writer_info) override + const eprosima::fastdds::rtps::PublicationBuiltinTopicData* writer_info) override { reader_.on_writer_discovery(reader, reason, writer_guid, writer_info); } @@ -611,9 +611,9 @@ class RTPSWithRegistrationReader void on_writer_discovery( eprosima::fastdds::rtps::RTPSReader* reader, - eprosima::fastdds::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS reason, + eprosima::fastdds::rtps::WriterDiscoveryStatus reason, const eprosima::fastdds::rtps::GUID_t& writer_guid, - const eprosima::fastdds::rtps::WriterProxyData* writer_info) + const eprosima::fastdds::rtps::PublicationBuiltinTopicData* writer_info) { ASSERT_EQ(reader_, reader); diff --git a/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h b/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h index da2c4faca3..9ed7f674cb 100644 --- a/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h +++ b/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h @@ -22,9 +22,9 @@ #include #include -#include -#include +#include +#include #include namespace eprosima { diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp index 50242b7a47..74258d958e 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp @@ -62,11 +62,11 @@ class TopicAttributes; namespace rtps { +struct PublicationBuiltinTopicData; class RTPSParticipantImpl; class RTPSParticipantListener; class RTPSWriter; class RTPSReader; -class WriterProxyData; class ReaderProxyData; class ResourceEvent; class WLP; @@ -133,8 +133,8 @@ class FASTDDS_EXPORTED_API RTPSParticipant } bool fill_discovery_data_from_cdr_message( - fastdds::rtps::WriterProxyData& /*data*/, - fastdds::statistics::MonitorServiceStatusData& /*msg*/) + fastdds::rtps::PublicationBuiltinTopicData& /*data*/, + const fastdds::statistics::MonitorServiceStatusData& /*msg*/) { return true; } diff --git a/test/mock/rtps/RTPSReader/fastdds/rtps/reader/RTPSReader.hpp b/test/mock/rtps/RTPSReader/fastdds/rtps/reader/RTPSReader.hpp index 19a5f0941e..2b780a6750 100644 --- a/test/mock/rtps/RTPSReader/fastdds/rtps/reader/RTPSReader.hpp +++ b/test/mock/rtps/RTPSReader/fastdds/rtps/reader/RTPSReader.hpp @@ -21,14 +21,16 @@ #include +#include #include #include -#include #include #include #include #include +#include + namespace eprosima { namespace fastdds { namespace rtps { @@ -53,9 +55,8 @@ class RTPSReader : public Endpoint virtual ~RTPSReader() = default; - virtual bool matched_writer_add( - const WriterProxyData& wdata) = 0; + const PublicationBuiltinTopicData& wdata) = 0; virtual bool matched_writer_remove( const GUID_t& wdata, diff --git a/test/mock/rtps/RTPSReader/rtps/reader/BaseReader.hpp b/test/mock/rtps/RTPSReader/rtps/reader/BaseReader.hpp index 9eea8c379a..3310c25ffc 100644 --- a/test/mock/rtps/RTPSReader/rtps/reader/BaseReader.hpp +++ b/test/mock/rtps/RTPSReader/rtps/reader/BaseReader.hpp @@ -24,12 +24,13 @@ #include #include #include -#include #include #include #include #include +#include + namespace eprosima { namespace fastdds { @@ -79,6 +80,16 @@ class BaseReader : public fastdds::rtps::RTPSReader return static_cast(endpoint); } + bool matched_writer_add( + const PublicationBuiltinTopicData& wdata) final + { + static_cast(wdata); + return false; + } + + virtual bool matched_writer_add_edp( + const WriterProxyData& wdata) = 0; + fastdds::rtps::ReaderListener* get_listener() const override { return listener_; diff --git a/test/mock/rtps/SecurityManager/rtps/security/SecurityManager.h b/test/mock/rtps/SecurityManager/rtps/security/SecurityManager.h index c54c1cd906..a87b3bfca3 100644 --- a/test/mock/rtps/SecurityManager/rtps/security/SecurityManager.h +++ b/test/mock/rtps/SecurityManager/rtps/security/SecurityManager.h @@ -21,7 +21,8 @@ #include #include -#include + +#include namespace eprosima { namespace fastdds { diff --git a/test/mock/rtps/SecurityPluginFactory/rtps/security/MockAccessControlPlugin.h b/test/mock/rtps/SecurityPluginFactory/rtps/security/MockAccessControlPlugin.h index 2806b56c98..d12137f363 100644 --- a/test/mock/rtps/SecurityPluginFactory/rtps/security/MockAccessControlPlugin.h +++ b/test/mock/rtps/SecurityPluginFactory/rtps/security/MockAccessControlPlugin.h @@ -20,9 +20,9 @@ #define FASTDDS_RTPS_SECURITY__MOCKACCESSCONTROLPLUGIN_H #include -#include #include +#include #include #include diff --git a/test/mock/rtps/StatefulReader/rtps/reader/StatefulReader.hpp b/test/mock/rtps/StatefulReader/rtps/reader/StatefulReader.hpp index d8e05b1653..cdbfa110c8 100644 --- a/test/mock/rtps/StatefulReader/rtps/reader/StatefulReader.hpp +++ b/test/mock/rtps/StatefulReader/rtps/reader/StatefulReader.hpp @@ -59,7 +59,7 @@ class StatefulReader : public fastdds::rtps::BaseReader } // *INDENT-OFF* Uncrustify makes a mess with MOCK_METHOD macros - MOCK_METHOD1(matched_writer_add, bool(const WriterProxyData&)); + MOCK_METHOD1(matched_writer_add_edp, bool(const WriterProxyData&)); MOCK_METHOD2(matched_writer_remove, bool(const GUID_t&, bool)); diff --git a/test/mock/rtps/StatelessReader/rtps/reader/StatelessReader.hpp b/test/mock/rtps/StatelessReader/rtps/reader/StatelessReader.hpp index 2813965f4c..978e973d9b 100644 --- a/test/mock/rtps/StatelessReader/rtps/reader/StatelessReader.hpp +++ b/test/mock/rtps/StatelessReader/rtps/reader/StatelessReader.hpp @@ -40,7 +40,7 @@ class StatelessReader : public fastdds::rtps::BaseReader virtual ~StatelessReader() = default; - MOCK_METHOD1(matched_writer_add, bool(const WriterProxyData&)); + MOCK_METHOD1(matched_writer_add_edp, bool(const WriterProxyData&)); MOCK_METHOD2(matched_writer_remove, bool(const GUID_t&, bool)); diff --git a/test/mock/rtps/WriterProxyData/fastdds/rtps/builtin/data/WriterProxyData.hpp b/test/mock/rtps/WriterProxyData/rtps/builtin/data/WriterProxyData.hpp similarity index 100% rename from test/mock/rtps/WriterProxyData/fastdds/rtps/builtin/data/WriterProxyData.hpp rename to test/mock/rtps/WriterProxyData/rtps/builtin/data/WriterProxyData.hpp diff --git a/test/mock/rtps/external_locators/rtps/network/utils/external_locators.hpp b/test/mock/rtps/external_locators/rtps/network/utils/external_locators.hpp index 8701535492..85de8da83a 100644 --- a/test/mock/rtps/external_locators/rtps/network/utils/external_locators.hpp +++ b/test/mock/rtps/external_locators/rtps/network/utils/external_locators.hpp @@ -22,10 +22,11 @@ #include #include #include -#include #include #include +#include + namespace eprosima { namespace fastdds { namespace rtps { diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index 4bd68e2534..09d7162d0d 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -82,6 +82,7 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/BuiltinProtocols.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.cpp diff --git a/test/unittest/dds/publisher/DataWriterTests.cpp b/test/unittest/dds/publisher/DataWriterTests.cpp index 467f2146dc..ccc278a988 100644 --- a/test/unittest/dds/publisher/DataWriterTests.cpp +++ b/test/unittest/dds/publisher/DataWriterTests.cpp @@ -370,13 +370,14 @@ TEST(DataWriterTests, get_guid) void on_data_writer_discovery( DomainParticipant*, - fastdds::rtps::WriterDiscoveryInfo&& info, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::dds::PublicationBuiltinTopicData& info, bool& /*should_be_ignored*/) override { std::unique_lock lock(mutex); - if (fastdds::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER == info.status) + if (fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER == reason) { - guid = info.info.guid(); + guid = info.guid; cv.notify_one(); } } diff --git a/test/unittest/dds/status/ListenerTests.cpp b/test/unittest/dds/status/ListenerTests.cpp index 2fd342eb43..6673accbfa 100644 --- a/test/unittest/dds/status/ListenerTests.cpp +++ b/test/unittest/dds/status/ListenerTests.cpp @@ -78,7 +78,7 @@ class RTPSReaderMock : public eprosima::fastdds::rtps::BaseReader virtual ~RTPSReaderMock() = default; - bool matched_writer_add( + bool matched_writer_add_edp( const eprosima::fastdds::rtps::WriterProxyData&) override { return true; diff --git a/test/unittest/dds/subscriber/DataReaderTests.cpp b/test/unittest/dds/subscriber/DataReaderTests.cpp index dad247d0f4..e57edf2698 100644 --- a/test/unittest/dds/subscriber/DataReaderTests.cpp +++ b/test/unittest/dds/subscriber/DataReaderTests.cpp @@ -2636,7 +2636,7 @@ TEST_F(DataReaderUnsupportedTests, UnsupportedDataReaderMethods) DataReader* data_reader = subscriber->create_datareader(topic, DATAREADER_QOS_DEFAULT); ASSERT_NE(data_reader, nullptr); - builtin::PublicationBuiltinTopicData publication_data; + PublicationBuiltinTopicData publication_data; InstanceHandle_t publication_handle; EXPECT_EQ( RETCODE_UNSUPPORTED, diff --git a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp index ed21dab841..e2f41ceb0b 100644 --- a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp +++ b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp @@ -23,13 +23,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/test/unittest/rtps/builtin/CMakeLists.txt b/test/unittest/rtps/builtin/CMakeLists.txt index 649737cc15..a2bc6004d9 100644 --- a/test/unittest/rtps/builtin/CMakeLists.txt +++ b/test/unittest/rtps/builtin/CMakeLists.txt @@ -21,6 +21,7 @@ set(BUILTIN_DATA_SERIALIZATION_TESTS_SOURCE BuiltinDataSerializationTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/xtypes/type_representation/dds_xtypes_typeobjectPubSubTypes.cxx ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/GuidPrefix_t.cpp diff --git a/test/unittest/rtps/discovery/CMakeLists.txt b/test/unittest/rtps/discovery/CMakeLists.txt index 4c88823dad..51721bcbf1 100644 --- a/test/unittest/rtps/discovery/CMakeLists.txt +++ b/test/unittest/rtps/discovery/CMakeLists.txt @@ -119,6 +119,7 @@ set(PDPTESTS_SOURCE PDPTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/PropertyPolicy.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/participant/PDP.cpp diff --git a/test/unittest/rtps/discovery/EdpTests.cpp b/test/unittest/rtps/discovery/EdpTests.cpp index 3b62a5f61b..476a329c09 100644 --- a/test/unittest/rtps/discovery/EdpTests.cpp +++ b/test/unittest/rtps/discovery/EdpTests.cpp @@ -16,8 +16,8 @@ #include #include -#include +#include #include #include #include diff --git a/test/unittest/rtps/discovery/PDPTests.cpp b/test/unittest/rtps/discovery/PDPTests.cpp index 0eeea4a4f7..21278e6cf4 100644 --- a/test/unittest/rtps/discovery/PDPTests.cpp +++ b/test/unittest/rtps/discovery/PDPTests.cpp @@ -28,10 +28,10 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/test/unittest/rtps/reader/CMakeLists.txt b/test/unittest/rtps/reader/CMakeLists.txt index 55678686e4..6198079716 100644 --- a/test/unittest/rtps/reader/CMakeLists.txt +++ b/test/unittest/rtps/reader/CMakeLists.txt @@ -178,6 +178,7 @@ set(STATEFUL_READER_TESTS_SOURCE StatefulReaderTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/BuiltinProtocols.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.cpp diff --git a/test/unittest/rtps/reader/StatefulReaderTests.cpp b/test/unittest/rtps/reader/StatefulReaderTests.cpp index 697bbe95bf..f3828aace7 100644 --- a/test/unittest/rtps/reader/StatefulReaderTests.cpp +++ b/test/unittest/rtps/reader/StatefulReaderTests.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -36,6 +35,8 @@ #include #include +#include + #ifdef FASTDDS_STATISTICS void register_monitorservice_types_type_objects() diff --git a/test/unittest/rtps/reader/WriterProxyAcknackTests.cpp b/test/unittest/rtps/reader/WriterProxyAcknackTests.cpp index 0db1bf5def..737a10277c 100644 --- a/test/unittest/rtps/reader/WriterProxyAcknackTests.cpp +++ b/test/unittest/rtps/reader/WriterProxyAcknackTests.cpp @@ -21,8 +21,9 @@ #define TEST_FRIENDS \ FRIEND_TEST(WriterProxyAcknackTests, AcknackBackoff); -#include #include + +#include #include #include #include diff --git a/test/unittest/rtps/reader/WriterProxyStopTest.cpp b/test/unittest/rtps/reader/WriterProxyStopTest.cpp index 0cf4cd2c66..0bdb521937 100644 --- a/test/unittest/rtps/reader/WriterProxyStopTest.cpp +++ b/test/unittest/rtps/reader/WriterProxyStopTest.cpp @@ -17,8 +17,9 @@ #include #include -#include #include + +#include #include #include #include diff --git a/test/unittest/rtps/reader/WriterProxyTests.cpp b/test/unittest/rtps/reader/WriterProxyTests.cpp index 4a5abc891e..8b0cc0d059 100644 --- a/test/unittest/rtps/reader/WriterProxyTests.cpp +++ b/test/unittest/rtps/reader/WriterProxyTests.cpp @@ -21,8 +21,9 @@ FRIEND_TEST(WriterProxyTests, ReceivedChangeSet); \ FRIEND_TEST(WriterProxyTests, IrrelevantChangeSet); -#include #include + +#include #include #include #include diff --git a/test/unittest/security/accesscontrol/AccessControlTests.cpp b/test/unittest/security/accesscontrol/AccessControlTests.cpp index f918bec3a9..2077d355d0 100644 --- a/test/unittest/security/accesscontrol/AccessControlTests.cpp +++ b/test/unittest/security/accesscontrol/AccessControlTests.cpp @@ -18,7 +18,8 @@ #include #include -#include + +#include #include #include #include diff --git a/test/unittest/security/authentication/AuthenticationPluginTests.hpp b/test/unittest/security/authentication/AuthenticationPluginTests.hpp index bf2c173bb4..2a3c2f562b 100644 --- a/test/unittest/security/authentication/AuthenticationPluginTests.hpp +++ b/test/unittest/security/authentication/AuthenticationPluginTests.hpp @@ -21,8 +21,8 @@ #include #include #include -#include +#include #include #include diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt index 9d58a3e720..5fff5dc79d 100644 --- a/test/unittest/statistics/dds/CMakeLists.txt +++ b/test/unittest/statistics/dds/CMakeLists.txt @@ -184,6 +184,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/BuiltinProtocols.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.cpp @@ -363,6 +364,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/BuiltinProtocols.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.cpp diff --git a/test/unittest/xmlparser/XMLEndpointParserTests.cpp b/test/unittest/xmlparser/XMLEndpointParserTests.cpp index 1ff2a239a7..3de518d54e 100644 --- a/test/unittest/xmlparser/XMLEndpointParserTests.cpp +++ b/test/unittest/xmlparser/XMLEndpointParserTests.cpp @@ -25,8 +25,8 @@ #include #include #include -#include +#include #include #include "../logging/mock/MockConsumer.h" diff --git a/versions.md b/versions.md index 997cec7f40..c5b3bcdc14 100644 --- a/versions.md +++ b/versions.md @@ -16,8 +16,12 @@ Forthcoming * Several methods that were meant for internal use have been removed from public API * All public methods now have `snake_case` names * All public attributes now have `snake_case` names +* Discovery callbacks refactor: + * on_data_writer_discovery now receives a `WriterDiscoveryStatus` and a `PublicationBuiltinTopicData` instead of a `WriterDiscoveryInfo` * Public API that is no longer public: * XML Parser API no longer public. + * WriterProxyData + * WriterDiscoveryInfo * ParticipantAttributes * ReplierAttributes * RequesterAttributes