diff --git a/include/fastdds/dds/domain/DomainParticipant.hpp b/include/fastdds/dds/domain/DomainParticipant.hpp index 39806856c91..f7078f2a2df 100644 --- a/include/fastdds/dds/domain/DomainParticipant.hpp +++ b/include/fastdds/dds/domain/DomainParticipant.hpp @@ -423,7 +423,7 @@ class DomainParticipant : public Entity /** * Locally ignore a remote domain participant. * - * @note This action is not required to be reversible. + * @note This action is not reversible. * * @param handle Identifier of the remote participant to ignore * @return RETURN_OK code if everything correct, error code otherwise @@ -437,7 +437,7 @@ class DomainParticipant : public Entity /** * Locally ignore a topic. * - * @note This action is not required to be reversible. + * @note This action is not reversible. * * @param handle Identifier of the topic to ignore * @return RETURN_OK code if everything correct, error code otherwise @@ -449,9 +449,9 @@ class DomainParticipant : public Entity const InstanceHandle_t& handle); /** - * Locally ignore a datawriter. + * Locally ignore a remote datawriter. * - * @note This action is not required to be reversible. + * @note This action is not reversible. * * @param handle Identifier of the datawriter to ignore * @return RETURN_OK code if everything correct, error code otherwise @@ -463,9 +463,9 @@ class DomainParticipant : public Entity const InstanceHandle_t& handle); /** - * Locally ignore a datareader. + * Locally ignore a remote datareader. * - * @note This action is not required to be reversible. + * @note This action is not reversible. * * @param handle Identifier of the datareader to ignore * @return RETURN_OK code if everything correct, error code otherwise diff --git a/include/fastdds/dds/domain/DomainParticipantListener.hpp b/include/fastdds/dds/domain/DomainParticipantListener.hpp index 596e295dfe2..5a05d8019da 100644 --- a/include/fastdds/dds/domain/DomainParticipantListener.hpp +++ b/include/fastdds/dds/domain/DomainParticipantListener.hpp @@ -67,28 +67,48 @@ class DomainParticipantListener : * This method is called when a new Participant is discovered, or a previously discovered participant changes * its QOS or is removed. * - * @param participant Pointer to the Participant which discovered the remote participant. - * @param info Remote participant information. User can take ownership of the object. + * @param[out] participant Pointer to the Participant which discovered the remote participant. + * @param[out] info Remote participant information. User can take ownership of the object. */ virtual void on_participant_discovery( DomainParticipant* participant, fastrtps::rtps::ParticipantDiscoveryInfo&& info) { - (void)participant, (void)info; + static_cast(participant); + static_cast(info); + } + + /*! + * This method is called when a new Participant is discovered, or a previously discovered participant changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote participant. + * @param[out] info Remote participant information. User can take ownership of the object. + * @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant. + */ + virtual void on_participant_discovery( + DomainParticipant* participant, + fastrtps::rtps::ParticipantDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); } #if HAVE_SECURITY /*! * This method is called when a new Participant is authenticated. * - * @param participant Pointer to the authenticated Participant. - * @param info Remote participant authentication information. User can take ownership of the object. + * @param[out] participant Pointer to the authenticated Participant. + * @param[out] info Remote participant authentication information. User can take ownership of the object. */ virtual void onParticipantAuthentication( DomainParticipant* participant, fastrtps::rtps::ParticipantAuthenticationInfo&& info) { - (void)participant, (void)info; + static_cast(participant); + static_cast(info); } #endif // if HAVE_SECURITY @@ -97,28 +117,66 @@ class DomainParticipantListener : * This method is called when a new Subscriber is discovered, or a previously discovered subscriber changes * its QOS or is removed. * - * @param participant Pointer to the Participant which discovered the remote subscriber. - * @param info Remote subscriber information. User can take ownership of the object. + * @param[out] participant Pointer to the Participant which discovered the remote subscriber. + * @param[out] info Remote subscriber information. User can take ownership of the object. */ virtual void on_subscriber_discovery( DomainParticipant* participant, fastrtps::rtps::ReaderDiscoveryInfo&& info) { - (void)participant, (void)info; + static_cast(participant); + static_cast(info); + } + + /*! + * This method is called when a new Subscriber is discovered, or a previously discovered subscriber changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote subscriber. + * @param[out] info Remote subscriber information. User can take ownership of the object. + * @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant. + */ + virtual void on_subscriber_discovery( + DomainParticipant* participant, + fastrtps::rtps::ReaderDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); } /*! * This method is called when a new Publisher is discovered, or a previously discovered publisher changes * its QOS or is removed. * - * @param participant Pointer to the Participant which discovered the remote publisher. - * @param info Remote publisher information. User can take ownership of the object. + * @param[out] participant Pointer to the Participant which discovered the remote publisher. + * @param[out] info Remote publisher information. User can take ownership of the object. */ virtual void on_publisher_discovery( DomainParticipant* participant, fastrtps::rtps::WriterDiscoveryInfo&& info) { - (void)participant, (void)info; + static_cast(participant); + static_cast(info); + } + + /*! + * This method is called when a new Publisher is discovered, or a previously discovered publisher changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote publisher. + * @param[out] info Remote publisher information. User can take ownership of the object. + * @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant. + */ + virtual void on_publisher_discovery( + DomainParticipant* participant, + fastrtps::rtps::WriterDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); } /*! @@ -136,7 +194,12 @@ class DomainParticipantListener : const fastrtps::types::TypeObject* object, fastrtps::types::DynamicType_ptr dyn_type) { - (void)participant, (void)request_sample_id, (void)topic, (void)identifier, (void)object, (void)dyn_type; + static_cast(participant); + static_cast(request_sample_id); + static_cast(topic); + static_cast(identifier); + static_cast(object); + static_cast(dyn_type); } /*! @@ -149,7 +212,9 @@ class DomainParticipantListener : const fastrtps::rtps::SampleIdentity& request_sample_id, const fastrtps::types::TypeIdentifierWithSizeSeq& dependencies) { - (void)participant, (void)request_sample_id, (void)dependencies; + static_cast(participant); + static_cast(request_sample_id); + static_cast(dependencies); } /*! @@ -161,7 +226,10 @@ class DomainParticipantListener : const fastrtps::string_255 type_name, const fastrtps::types::TypeInformation& type_information) { - (void)participant, (void)topic_name, (void)type_name, (void)type_information; + static_cast(participant); + static_cast(topic_name); + static_cast(type_name); + static_cast(type_information); } // TODO: Methods in DomainParticipantListener (p.33 - DDS) diff --git a/include/fastdds/rtps/builtin/discovery/participant/PDP.h b/include/fastdds/rtps/builtin/discovery/participant/PDP.h index 8e84de94e40..45a583ab587 100644 --- a/include/fastdds/rtps/builtin/discovery/participant/PDP.h +++ b/include/fastdds/rtps/builtin/discovery/participant/PDP.h @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -223,20 +225,44 @@ class PDP /** * This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant. - * @param reader_guid GUID_t of the reader to remove. + * + * @param[in] reader_guid GUID_t of the reader to remove. * @return true if found and deleted. */ bool removeReaderProxyData( const GUID_t& reader_guid); + /** + * This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant. + * + * @param[in] reader_guid GUID_t of the reader to remove. + * @param[in] reason Why the reader is being removed (dropped, removed, or ignored) + * @return true if found and deleted. + */ + bool removeReaderProxyData( + const GUID_t& reader_guid, + ReaderDiscoveryInfo::DISCOVERY_STATUS reason); + /** * This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant. - * @param writer_guid GUID_t of the wtiter to remove. + * + * @param[in] writer_guid GUID_t of the wtiter to remove. * @return true if found and deleted. */ 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 wtiter 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. @@ -276,7 +302,7 @@ class PDP /** * This method removes a remote RTPSParticipant and all its writers and readers. * @param participant_guid GUID_t of the remote RTPSParticipant. - * @param reason Why the participant is being removed (dropped vs removed) + * @param reason Why the participant is being removed (dropped, removed, or ignored) * @return true if correct. */ virtual bool remove_remote_participant( diff --git a/include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h b/include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h index e444bba6063..ef0acb9752e 100644 --- a/include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h +++ b/include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h @@ -44,7 +44,8 @@ struct ParticipantDiscoveryInfo DISCOVERED_PARTICIPANT, CHANGED_QOS_PARTICIPANT, REMOVED_PARTICIPANT, - DROPPED_PARTICIPANT + DROPPED_PARTICIPANT, + IGNORED_PARTICIPANT }; ParticipantDiscoveryInfo( diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index 723a51021bb..105de41ec20 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -256,6 +256,33 @@ class RTPS_DllAPI RTPSParticipant */ void enable(); + /** + * @brief Ignore all messages coming from the RTPSParticipant + * + * @param[in] participant_guid RTPSParticipant GUID to be ignored + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_participant( + const GuidPrefix_t& participant_guid); + + /** + * @brief Ignore all messages coming from the RTPSWriter + * + * @param[in] writer_guid RTPSWriter GUID to be ignored + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_writer( + const GUID_t& writer_guid); + + /** + * @brief Ignore all messages coming from the RTPSReader + * + * @param[in] reader_guid RTPSReader GUID to be ignored + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_reader( + const GUID_t& reader_guid); + #if HAVE_SECURITY /** diff --git a/include/fastdds/rtps/participant/RTPSParticipantListener.h b/include/fastdds/rtps/participant/RTPSParticipantListener.h index df7683d2b36..69e869a332e 100644 --- a/include/fastdds/rtps/participant/RTPSParticipantListener.h +++ b/include/fastdds/rtps/participant/RTPSParticipantListener.h @@ -28,110 +28,195 @@ #include #include -namespace eprosima{ -namespace fastrtps{ -namespace rtps{ +namespace eprosima { +namespace fastrtps { +namespace rtps { class RTPSParticipant; /** -* Class RTPSParticipantListener with virtual method that the user can overload to respond to certain events. -* @ingroup RTPS_MODULE -*/ + * Class RTPSParticipantListener with virtual method that the user can overload to respond to certain events. + * @ingroup RTPS_MODULE + */ class RTPS_DllAPI RTPSParticipantListener { - public: - - RTPSParticipantListener(){}; - - virtual ~RTPSParticipantListener(){}; - - /*! - * This method is called when a new Participant is discovered, or a previously discovered participant changes - * its QOS or is removed. - * @param participant Pointer to the Participant which discovered the remote participant. - * @param info Remote participant information. User can take ownership of the object. - */ - virtual void onParticipantDiscovery(RTPSParticipant* participant, ParticipantDiscoveryInfo&& info) - { - (void)participant, (void)info; - } +public: + + RTPSParticipantListener() + { + } + + virtual ~RTPSParticipantListener() + { + } + + /*! + * This method is called when a new Participant is discovered, or a previously discovered participant changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote participant. + * @param[out] info Remote participant information. User can take ownership of the object. + */ + virtual void onParticipantDiscovery( + RTPSParticipant* participant, + ParticipantDiscoveryInfo&& info) + { + static_cast(participant); + static_cast(info); + } + + /*! + * This method is called when a new Participant is discovered, or a previously discovered participant changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote participant. + * @param[out] info Remote participant information. User can take ownership of the object. + * @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant. + */ + virtual void onParticipantDiscovery( + RTPSParticipant* participant, + ParticipantDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); + } #if HAVE_SECURITY - virtual void onParticipantAuthentication(RTPSParticipant* participant, ParticipantAuthenticationInfo&& info) - { - (void)participant, (void)info; - } -#endif - - /*! - * This method is called when a new Reader is discovered, or a previously discovered reader changes - * its QOS or is removed. - * @param participant Pointer to the Participant which discovered the remote reader. - * @param info Remote reader information. User can take ownership of the object. - */ - virtual void onReaderDiscovery(RTPSParticipant* participant, ReaderDiscoveryInfo&& info) - { - (void)participant, (void)info; - } - - /*! - * This method is called when a new Writer is discovered, or a previously discovered writer changes - * its QOS or is removed. - * @param participant Pointer to the Participant which discovered the remote writer. - * @param info Remote writer information. User can take ownership of the object. - */ - virtual void onWriterDiscovery(RTPSParticipant* participant, WriterDiscoveryInfo&& info) - { - (void)participant, (void)info; - } - - /*! - * This method is called when a participant discovers a new Type - * The ownership of all object belongs to the caller so if needs to be used after the - * method ends, a full copy should be perform (except for dyn_type due to its shared_ptr nature. - * The field "topic" it is only available if the type was discovered using "Discovery-Time Data Typing", - * in which case the field request_sample_id will contain INVALID_SAMPLE_IDENTITY. - * If the type was discovered using TypeLookup Service then "topic" will be empty, but will have - * the request_sample_id of the petition that caused the discovery. - * For example: - * fastrtps::types::TypeIdentifier new_type_id = *identifier; - */ - virtual void on_type_discovery( - RTPSParticipant* participant, - const SampleIdentity& request_sample_id, - const string_255& topic, - const types::TypeIdentifier* identifier, - const types::TypeObject* object, - types::DynamicType_ptr dyn_type) - { - (void)participant, (void)request_sample_id, (void)topic, (void)identifier, (void)object, (void)dyn_type; - } - - /*! - * This method is called when the typelookup client received a reply to a getTypeDependencies request. - * The user may want to retrieve these new types using the getTypes request and create a new - * DynamicType using the retrieved TypeObject. - */ - virtual void on_type_dependencies_reply( - RTPSParticipant* participant, - const SampleIdentity& request_sample_id, - const types::TypeIdentifierWithSizeSeq& dependencies) - { - (void)participant, (void)request_sample_id, (void)dependencies; - } - - /*! - * This method is called when a participant receives a TypeInformation while discovering another participant. - */ - virtual void on_type_information_received( - RTPSParticipant* participant, - const string_255& topic_name, - const string_255& type_name, - const types::TypeInformation& type_information) - { - (void)participant, (void)topic_name, (void)type_name, (void)type_information; - } + virtual void onParticipantAuthentication( + RTPSParticipant* participant, + ParticipantAuthenticationInfo&& info) + { + static_cast(participant); + static_cast(info); + } + +#endif // if HAVE_SECURITY + + /*! + * This method is called when a new Reader is discovered, or a previously discovered reader changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote reader. + * @param[out] info Remote reader information. User can take ownership of the object. + */ + virtual void onReaderDiscovery( + RTPSParticipant* participant, + ReaderDiscoveryInfo&& info) + { + static_cast(participant); + static_cast(info); + } + + /*! + * This method is called when a new Reader is discovered, or a previously discovered reader changes + * its QOS or is removed. + * + * @param[out] participant Pointer to the Participant which discovered the remote reader. + * @param[out] info Remote reader information. User can take ownership of the object. + * @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Reader. + */ + virtual void onReaderDiscovery( + RTPSParticipant* participant, + ReaderDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); + } + + /*! + * 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. + */ + virtual void onWriterDiscovery( + RTPSParticipant* participant, + WriterDiscoveryInfo&& info) + { + static_cast(participant); + static_cast(info); + } + + /*! + * 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. + */ + virtual void onWriterDiscovery( + RTPSParticipant* participant, + WriterDiscoveryInfo&& info, + bool& should_be_ignored) + { + static_cast(participant); + static_cast(info); + static_cast(should_be_ignored); + } + + /*! + * This method is called when a participant discovers a new Type + * The ownership of all object belongs to the caller so if needs to be used after the + * method ends, a full copy should be perform (except for dyn_type due to its shared_ptr nature. + * The field "topic" it is only available if the type was discovered using "Discovery-Time Data Typing", + * in which case the field request_sample_id will contain INVALID_SAMPLE_IDENTITY. + * If the type was discovered using TypeLookup Service then "topic" will be empty, but will have + * the request_sample_id of the petition that caused the discovery. + * For example: + * fastrtps::types::TypeIdentifier new_type_id = *identifier; + */ + virtual void on_type_discovery( + RTPSParticipant* participant, + const SampleIdentity& request_sample_id, + const string_255& topic, + const types::TypeIdentifier* identifier, + const types::TypeObject* object, + types::DynamicType_ptr dyn_type) + { + static_cast(participant); + static_cast(request_sample_id); + static_cast(topic); + static_cast(identifier); + static_cast(object); + static_cast(dyn_type); + } + + /*! + * This method is called when the typelookup client received a reply to a getTypeDependencies request. + * The user may want to retrieve these new types using the getTypes request and create a new + * DynamicType using the retrieved TypeObject. + */ + virtual void on_type_dependencies_reply( + RTPSParticipant* participant, + const SampleIdentity& request_sample_id, + const types::TypeIdentifierWithSizeSeq& dependencies) + { + static_cast(participant); + static_cast(request_sample_id); + static_cast(dependencies); + } + + /*! + * This method is called when a participant receives a TypeInformation while discovering another participant. + */ + virtual void on_type_information_received( + RTPSParticipant* participant, + const string_255& topic_name, + const string_255& type_name, + const types::TypeInformation& type_information) + { + static_cast(participant); + static_cast(topic_name); + static_cast(type_name); + static_cast(type_information); + } + }; } // namespace rtps diff --git a/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h b/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h index 534b6ad99d9..b71fd8c217b 100644 --- a/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h +++ b/include/fastdds/rtps/reader/ReaderDiscoveryInfo.h @@ -28,42 +28,47 @@ namespace fastrtps { namespace rtps { /** -* Class ReaderDiscoveryInfo with discovery information of the reader. -* @ingroup RTPS_MODULE -*/ + * Class ReaderDiscoveryInfo with discovery information of the reader. + * @ingroup RTPS_MODULE + */ struct ReaderDiscoveryInfo { - public: +public: - //!Enum DISCOVERY_STATUS, four different status for discovered readers. - //!@ingroup RTPS_MODULE + //!Enum DISCOVERY_STATUS, four different status for discovered readers. + //!@ingroup RTPS_MODULE #if defined(_WIN32) - enum RTPS_DllAPI DISCOVERY_STATUS + enum RTPS_DllAPI DISCOVERY_STATUS #else - enum DISCOVERY_STATUS -#endif - { - DISCOVERED_READER, - CHANGED_QOS_READER, - REMOVED_READER - }; + enum DISCOVERY_STATUS +#endif // if defined(_WIN32) + { + DISCOVERED_READER, + CHANGED_QOS_READER, + REMOVED_READER, + IGNORED_READER + }; - ReaderDiscoveryInfo(const ReaderProxyData& data) - : status(DISCOVERED_READER) - , info(data) - {} + ReaderDiscoveryInfo( + const ReaderProxyData& data) + : status(DISCOVERED_READER) + , info(data) + { + } - virtual ~ReaderDiscoveryInfo() {} + virtual ~ReaderDiscoveryInfo() + { + } - //! Status - DISCOVERY_STATUS status; + //! Status + DISCOVERY_STATUS status; - //! Participant discovery info - const ReaderProxyData& info; + //! Participant discovery info + const ReaderProxyData& info; }; -} -} -} +} // namespace rtps +} // namespace fastrtps +} // namespace eprosima #endif // _FASTDDS_RTPS_READER_READERDISCOVERYINFO_H__ diff --git a/include/fastdds/rtps/writer/WriterDiscoveryInfo.h b/include/fastdds/rtps/writer/WriterDiscoveryInfo.h index 2be27a33bd5..c3a1ae2b8b8 100644 --- a/include/fastdds/rtps/writer/WriterDiscoveryInfo.h +++ b/include/fastdds/rtps/writer/WriterDiscoveryInfo.h @@ -26,38 +26,43 @@ namespace fastrtps { namespace rtps { /** -* Class WriterDiscoveryInfo with discovery information of the writer. -* @ingroup RTPS_MODULE -*/ + * Class WriterDiscoveryInfo with discovery information of the writer. + * @ingroup RTPS_MODULE + */ struct WriterDiscoveryInfo { - public: +public: - //!Enum DISCOVERY_STATUS, four different status for discovered writers. - //!@ingroup RTPS_MODULE + //!Enum DISCOVERY_STATUS, four different status for discovered writers. + //!@ingroup RTPS_MODULE #if defined(_WIN32) - enum RTPS_DllAPI DISCOVERY_STATUS + enum RTPS_DllAPI DISCOVERY_STATUS #else - enum DISCOVERY_STATUS -#endif - { - DISCOVERED_WRITER, - CHANGED_QOS_WRITER, - REMOVED_WRITER - }; + enum DISCOVERY_STATUS +#endif // if defined(_WIN32) + { + DISCOVERED_WRITER, + CHANGED_QOS_WRITER, + REMOVED_WRITER, + IGNORED_WRITER + }; - WriterDiscoveryInfo(const WriterProxyData& data) - : status(DISCOVERED_WRITER) - , info(data) - {} + WriterDiscoveryInfo( + const WriterProxyData& data) + : status(DISCOVERED_WRITER) + , info(data) + { + } - virtual ~WriterDiscoveryInfo() {} + virtual ~WriterDiscoveryInfo() + { + } - //! Status - DISCOVERY_STATUS status; + //! Status + DISCOVERY_STATUS status; - //! Participant discovery info - const WriterProxyData& info; + //! Participant discovery info + const WriterProxyData& info; }; } diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index a2fad4742b5..aac79811f11 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -827,15 +827,13 @@ PublisherImpl* DomainParticipantImpl::create_publisher_impl( } */ -/* TODO - bool DomainParticipantImpl::ignore_participant( +bool DomainParticipantImpl::ignore_participant( const InstanceHandle_t& handle) - { - (void)handle; +{ + static_cast(handle); EPROSIMA_LOG_ERROR(PARTICIPANT, "Not implemented."); return false; - } - */ +} /* TODO bool DomainParticipantImpl::ignore_topic( @@ -847,25 +845,21 @@ PublisherImpl* DomainParticipantImpl::create_publisher_impl( } */ -/* TODO - bool DomainParticipantImpl::ignore_publication( +bool DomainParticipantImpl::ignore_publication( const InstanceHandle_t& handle) - { - (void)handle; +{ + static_cast(handle); EPROSIMA_LOG_ERROR(PARTICIPANT, "Not implemented."); return false; - } - */ +} -/* TODO - bool DomainParticipantImpl::ignore_subscription( +bool DomainParticipantImpl::ignore_subscription( const InstanceHandle_t& handle) - { - (void)handle; +{ + static_cast(handle); EPROSIMA_LOG_ERROR(PARTICIPANT, "Not implemented."); return false; - } - */ +} DomainId_t DomainParticipantImpl::get_domain_id() const { diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp index 000b24cea4b..6a6ac87c26d 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp @@ -328,25 +328,37 @@ class DomainParticipantImpl // TODO Subscriber* get_builtin_subscriber(); - /* TODO - bool ignore_participant( - const InstanceHandle_t& handle); + /** + * @brief Locally ignore a remote domain participant. + * + * @param[in] handle Identifier of the remote participant to ignore. + * @return true if correctly ignored. False otherwise. */ + bool ignore_participant( + const InstanceHandle_t& handle); /* TODO bool ignore_topic( const InstanceHandle_t& handle); */ - /* TODO - bool ignore_publication( - const InstanceHandle_t& handle); + /** + * @brief Locally ignore a remote datawriter. + * + * @param[in] handle Identifier of the remote datawriter to ignore. + * @return true if correctly ignored. False otherwise. */ - - /* TODO - bool ignore_subscription( + bool ignore_publication( const InstanceHandle_t& handle); + + /** + * @brief Locally ignore a remote datareader. + * + * @param[in] handle Identifier of the remote datareader to ignore. + * @return true if correctly ignored. False otherwise. */ + bool ignore_subscription( + const InstanceHandle_t& handle); DomainId_t get_domain_id() const; diff --git a/src/cpp/fastdds/publisher/DataWriterImpl.cpp b/src/cpp/fastdds/publisher/DataWriterImpl.cpp index 468aa670419..3837107fbbc 100644 --- a/src/cpp/fastdds/publisher/DataWriterImpl.cpp +++ b/src/cpp/fastdds/publisher/DataWriterImpl.cpp @@ -1264,6 +1264,8 @@ void DataWriterImpl::InnerDataWriterListener::on_reader_discovery( case fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::CHANGED_QOS_READER: data_writer_->process_reader_filter_info(reader_guid, *reader_info); break; + default: + break; } } } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index ac6086bae79..577ee918dd8 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -675,6 +675,13 @@ bool PDP::removeReaderProxyData( return false; } +bool PDP::removeReaderProxyData( + const GUID_t& /*reader_guid*/, + ReaderDiscoveryInfo::DISCOVERY_STATUS /*reason*/) +{ + return false; +} + bool PDP::removeWriterProxyData( const GUID_t& writer_guid) { @@ -713,6 +720,13 @@ 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, string_255& name) diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index 0875fe6006f..62c1d573bfc 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -178,6 +178,24 @@ void RTPSParticipant::enable() mp_impl->enable(); } +bool RTPSParticipant::ignore_participant( + const GuidPrefix_t& /*participant_guid*/) +{ + return false; +} + +bool RTPSParticipant::ignore_writer( + const GUID_t& /*writer_guid*/) +{ + return false; +} + +bool RTPSParticipant::ignore_reader( + const GUID_t& /*reader_guid*/) +{ + return false; +} + #if HAVE_SECURITY bool RTPSParticipant::is_security_enabled_for_writer( diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 768f632a252..9610a546f35 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -2509,6 +2509,42 @@ void RTPSParticipantImpl::get_default_unicast_locators() m_network_Factory.NormalizeLocators(m_att.defaultUnicastLocatorList); } +bool RTPSParticipantImpl::is_participant_ignored( + const GuidPrefix_t& /*participant_guid*/) +{ + return false; +} + +bool RTPSParticipantImpl::is_writer_ignored( + const GUID_t& /*writer_guid*/) +{ + return false; +} + +bool RTPSParticipantImpl::is_reader_ignored( + const GUID_t& /*reader_guid*/) +{ + return false; +} + +bool RTPSParticipantImpl::ignore_participant( + const GuidPrefix_t& /*participant_guid*/) +{ + return false; +} + +bool RTPSParticipantImpl::ignore_writer( + const GUID_t& /*writer_guid*/) +{ + return false; +} + +bool RTPSParticipantImpl::ignore_reader( + const GUID_t& /*reader_guid*/) +{ + return false; +} + #ifdef FASTDDS_STATISTICS bool RTPSParticipantImpl::register_in_writer( diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index cf78a5295a2..b4b03bd644a 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #if defined(_WIN32) @@ -583,6 +584,13 @@ class RTPSParticipantImpl //! Determine if the RTPSParticipantImpl was initialized successfully. bool initialized_ = false; + //! Ignored entities collections + std::set ignored_participants_; + std::set ignored_writers_; + std::set ignored_readers_; + //! Protect ignored entities collection concurrent access + mutable shared_mutex ignored_mtx_; + RTPSParticipantImpl& operator =( const RTPSParticipantImpl&) = delete; @@ -989,6 +997,60 @@ class RTPSParticipantImpl */ void environment_file_has_changed(); + /** + * @brief Query if the participant is found in the ignored collection + * + * @param[in] participant_guid Participant to be queried + * @return True if found in the ignored collection. False otherwise. + */ + bool is_participant_ignored( + const GuidPrefix_t& participant_guid); + + /** + * @brief Query if the writer is found in the ignored collection + * + * @param[in] writer_guid Writer to be queried + * @return True if found in the ignored collection. False otherwise. + */ + bool is_writer_ignored( + const GUID_t& writer_guid); + + /** + * @brief Query if the reader is found in the ignored collection + * + * @param[in] reader_guid Reader to be queried + * @return True if found in the ignored collection. False otherwise. + */ + bool is_reader_ignored( + const GUID_t& reader_guid); + + /** + * @brief Add a Participant into the corresponding ignore collection. + * + * @param[in] participant_guid Participant that is to be ignored. + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_participant( + const GuidPrefix_t& participant_guid); + + /** + * @brief Add a Writer into the corresponding ignore collection. + * + * @param[in] writer_guid Writer that is to be ignored. + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_writer( + const GUID_t& writer_guid); + + /** + * @brief Add a Reader into the corresponding ignore collection. + * + * @param[in] reader_guid Reader that is to be ignored. + * @return True if correctly included into the ignore collection. False otherwise. + */ + bool ignore_reader( + const GUID_t& reader_guid); + template static bool preprocess_endpoint_attributes( const EntityId_t& entity_id, diff --git a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h index 70ab1ddac80..b9269a65c13 100644 --- a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h +++ b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h @@ -69,10 +69,10 @@ class MockParticipantListener : public RTPSParticipantListener RTPSParticipant* participant, ParticipantDiscoveryInfo&& info) override { - onParticipantDiscovery(participant, info); + onParticipantDiscovery_mock(participant, info); } - MOCK_METHOD2(onParticipantDiscovery, void (RTPSParticipant*, const ParticipantDiscoveryInfo&)); + MOCK_METHOD2(onParticipantDiscovery_mock, void (RTPSParticipant*, const ParticipantDiscoveryInfo&)); #if HAVE_SECURITY void onParticipantAuthentication( diff --git a/versions.md b/versions.md index 23d9a18e345..65de095019f 100644 --- a/versions.md +++ b/versions.md @@ -6,6 +6,10 @@ Forthcoming * Added `RTPSWriter::has_been_delivered` virtual method (ABI break on RTPS layer). * Refactor `StatefulWriter::get_disable_positive_acks` as virtual method of `RTPSWriter` (ABI break on RTPS layer). * Network headers made private (ABI break on RTPS layer). +* Added ignore RTPS entity API in RTPSParticipant (ABI break on RTPS layer). +* Overload `PDP::removeWriterProxyData` and `PDP::removeReaderProxyData` (ABI break on RTPS layer). +* Overload RTPS discovery callbacks in RTPSParticipantListener (ABI break on RTPS layer). +* Overload DDS discovery callbacks in DomainParticipantListener (ABI break on DDS layer). Version 2.9.0 -------------