diff --git a/include/fastdds/rtps/transport/ChainingTransport.hpp b/include/fastdds/rtps/transport/ChainingTransport.hpp index 1fa44fe28e4..c1c84af9723 100644 --- a/include/fastdds/rtps/transport/ChainingTransport.hpp +++ b/include/fastdds/rtps/transport/ChainingTransport.hpp @@ -389,6 +389,16 @@ class ChainingTransport : public TransportInterface return low_level_transport_->is_locator_allowed(locator); } + /*! + * Call the low-level transport `is_locator_reachable()`. + * Must report whether the given locator is reachable by this transport. + */ + FASTDDS_EXPORTED_API bool is_locator_reachable( + const fastdds::rtps::Locator_t& locator) override + { + return low_level_transport_->is_locator_reachable(locator); + } + protected: std::unique_ptr low_level_transport_; diff --git a/include/fastdds/rtps/transport/TransportInterface.hpp b/include/fastdds/rtps/transport/TransportInterface.hpp index 7f2e6329b8f..aa14e8f13cb 100644 --- a/include/fastdds/rtps/transport/TransportInterface.hpp +++ b/include/fastdds/rtps/transport/TransportInterface.hpp @@ -117,6 +117,17 @@ class FASTDDS_EXPORTED_API TransportInterface virtual bool is_locator_allowed( const Locator&) const = 0; + /** + * Must report whether the given locator is reachable by this transport. + * + * @param [in] locator @ref Locator for which the reachability is checked. + * + * @return true if the input locator is reachable by this transport, false otherwise. + */ + virtual bool is_locator_reachable( + const Locator_t& locator) = 0; + + //! Returns the locator describing the main (most general) channel that can write to the provided remote locator. virtual Locator RemoteToMainLocal( const Locator& remote) const = 0; diff --git a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp index b9746004f03..9e494efdecf 100644 --- a/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp +++ b/src/cpp/rtps/builtin/data/ParticipantProxyData.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -446,16 +446,15 @@ bool ParticipantProxyData::writeToCDRMessage( bool ParticipantProxyData::readFromCDRMessage( CDRMessage_t* msg, bool use_encapsulation, - const NetworkFactory& network, - bool is_shm_transport_available, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id) { auto param_process = - [this, &network, &is_shm_transport_available, &should_filter_locators, source_vendor_id]( + [this, &network, &should_filter_locators, source_vendor_id]( CDRMessage_t* msg, const ParameterId_t& pid, uint16_t plength) { - static_cast(source_vendor_id); + m_VendorId = source_vendor_id; switch (pid){ case fastdds::dds::PID_KEY_HASH: { @@ -503,7 +502,6 @@ bool ParticipantProxyData::readFromCDRMessage( m_VendorId[0] = p.vendorId[0]; m_VendorId[1] = p.vendorId[1]; - is_shm_transport_available &= (m_VendorId == c_VendorId_eProsima); break; } case fastdds::dds::PID_PRODUCT_VERSION: @@ -613,7 +611,7 @@ bool ParticipantProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, metatraffic_locators, temp_locator, false); @@ -643,7 +641,7 @@ bool ParticipantProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, metatraffic_locators, temp_locator, true); @@ -673,7 +671,7 @@ bool ParticipantProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, default_locators, temp_locator, true); @@ -703,7 +701,7 @@ bool ParticipantProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, default_locators, temp_locator, false); diff --git a/src/cpp/rtps/builtin/data/ParticipantProxyData.hpp b/src/cpp/rtps/builtin/data/ParticipantProxyData.hpp index 540c80010f6..09e65d13219 100644 --- a/src/cpp/rtps/builtin/data/ParticipantProxyData.hpp +++ b/src/cpp/rtps/builtin/data/ParticipantProxyData.hpp @@ -28,11 +28,13 @@ #include #include #include +#include #include #include -#include #include +#include + namespace eprosima { namespace fastdds { namespace rtps { @@ -157,8 +159,7 @@ class ParticipantProxyData bool readFromCDRMessage( CDRMessage_t* msg, bool use_encapsulation, - const NetworkFactory& network, - bool is_shm_transport_available, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id = c_VendorId_eProsima); diff --git a/src/cpp/rtps/builtin/data/ProxyDataFilters.hpp b/src/cpp/rtps/builtin/data/ProxyDataFilters.hpp index 00270d6e200..5a6f802a3ce 100644 --- a/src/cpp/rtps/builtin/data/ProxyDataFilters.hpp +++ b/src/cpp/rtps/builtin/data/ProxyDataFilters.hpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _FASTDDS_RTPS_BUILTIN_DATA_PROXYDATAFILTERS_H_ -#define _FASTDDS_RTPS_BUILTIN_DATA_PROXYDATAFILTERS_H_ +#ifndef FASTDDS_RTPS_BUILTIN_DATA__PROXYDATAFILTERS_HPP +#define FASTDDS_RTPS_BUILTIN_DATA__PROXYDATAFILTERS_HPP #include + +#include #include namespace eprosima { @@ -30,27 +32,20 @@ class ProxyDataFilters public: /** - * This function filters out SHM locators when they cannot be used for communication on the local host. - * @param [in] is_shm_transport_available Indicates whether the participant has SHM transport enabled. + * @brief This function filters out unreachable locators. + * + * @param [in] network_factory Reference to the @ref NetworkFactory * @param [in,out] target_locators_list List where parsed locators are stored * @param [in] temp_locator New locator to parse * @param [in] is_unicast true if temp_locator is unicast, false if it is multicast */ static void filter_locators( - bool is_shm_transport_available, + NetworkFactory& network_factory, RemoteLocatorList& target_locators_list, const Locator_t& temp_locator, bool is_unicast) { - using SHMLocator = eprosima::fastdds::rtps::SHMLocator; - - bool can_use_locator = LOCATOR_KIND_SHM != temp_locator.kind; - if (!can_use_locator) - { - can_use_locator = is_shm_transport_available && SHMLocator::is_shm_and_from_this_host(temp_locator); - } - - if (can_use_locator) + if (network_factory.is_locator_reachable(temp_locator)) { if (is_unicast) { @@ -69,4 +64,4 @@ class ProxyDataFilters } /* namespace fastdds */ } /* namespace eprosima */ -#endif // _FASTDDS_RTPS_BUILTIN_DATA_PROXYDATAFILTERS_H_ +#endif // FASTDDS_RTPS_BUILTIN_DATA__PROXYDATAFILTERS_HPP diff --git a/src/cpp/rtps/builtin/data/ReaderProxyData.cpp b/src/cpp/rtps/builtin/data/ReaderProxyData.cpp index eedb89d3f88..0a75a6a84b9 100644 --- a/src/cpp/rtps/builtin/data/ReaderProxyData.cpp +++ b/src/cpp/rtps/builtin/data/ReaderProxyData.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include "ProxyDataFilters.hpp" @@ -647,15 +647,14 @@ bool ReaderProxyData::writeToCDRMessage( bool ReaderProxyData::readFromCDRMessage( CDRMessage_t* msg, - const NetworkFactory& network, - bool is_shm_transport_available, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id) { - auto param_process = [this, &network, &is_shm_transport_available, &should_filter_locators, source_vendor_id]( + auto param_process = [this, &network, &should_filter_locators, source_vendor_id]( CDRMessage_t* msg, const ParameterId_t& pid, uint16_t plength) { - VendorId_t vendor_id = c_VendorId_Unknown; + VendorId_t vendor_id = source_vendor_id; switch (pid) { @@ -668,7 +667,6 @@ bool ReaderProxyData::readFromCDRMessage( return false; } - is_shm_transport_available &= (p.vendorId == c_VendorId_eProsima); vendor_id = p.vendorId; break; } @@ -902,7 +900,7 @@ bool ReaderProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, remote_locators_, temp_locator, true); @@ -930,7 +928,7 @@ bool ReaderProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, remote_locators_, temp_locator, false); diff --git a/src/cpp/rtps/builtin/data/ReaderProxyData.hpp b/src/cpp/rtps/builtin/data/ReaderProxyData.hpp index 7712ef2ea61..9511c31d140 100644 --- a/src/cpp/rtps/builtin/data/ReaderProxyData.hpp +++ b/src/cpp/rtps/builtin/data/ReaderProxyData.hpp @@ -424,15 +424,13 @@ class ReaderProxyData * parameter list. * @param msg Pointer to the message. * @param network Reference to network factory for locator validation and transformation - * @param is_shm_transport_available Indicates whether the Reader is reachable by SHM. * @param should_filter_locators Whether to retrieve the locators before the external locators filtering * @param source_vendor_id VendorId of the source participant from which the message was received * @return true on success */ bool readFromCDRMessage( CDRMessage_t* msg, - const NetworkFactory& network, - bool is_shm_transport_available, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id = c_VendorId_eProsima); diff --git a/src/cpp/rtps/builtin/data/WriterProxyData.cpp b/src/cpp/rtps/builtin/data/WriterProxyData.cpp index c892798988f..857668b00a9 100644 --- a/src/cpp/rtps/builtin/data/WriterProxyData.cpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include "ProxyDataFilters.hpp" @@ -614,15 +614,14 @@ bool WriterProxyData::writeToCDRMessage( bool WriterProxyData::readFromCDRMessage( CDRMessage_t* msg, - const NetworkFactory& network, - bool is_shm_transport_available, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id) { - auto param_process = [this, &network, &is_shm_transport_available, &should_filter_locators, source_vendor_id]( + auto param_process = [this, &network, &should_filter_locators, source_vendor_id]( CDRMessage_t* msg, const ParameterId_t& pid, uint16_t plength) { - VendorId_t vendor_id = c_VendorId_Unknown; + VendorId_t vendor_id = source_vendor_id; switch (pid) { @@ -635,7 +634,6 @@ bool WriterProxyData::readFromCDRMessage( return false; } - is_shm_transport_available &= (p.vendorId == c_VendorId_eProsima); vendor_id = p.vendorId; break; } @@ -899,7 +897,7 @@ bool WriterProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, remote_locators_, temp_locator, true); @@ -926,7 +924,7 @@ bool WriterProxyData::readFromCDRMessage( m_guid.is_from_this_host())) { ProxyDataFilters::filter_locators( - is_shm_transport_available, + network, remote_locators_, temp_locator, false); diff --git a/src/cpp/rtps/builtin/data/WriterProxyData.hpp b/src/cpp/rtps/builtin/data/WriterProxyData.hpp index 7eb674628a3..7b0729f159c 100644 --- a/src/cpp/rtps/builtin/data/WriterProxyData.hpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.hpp @@ -451,8 +451,7 @@ class WriterProxyData //!Read a parameter list from a CDRMessage_t. bool readFromCDRMessage( CDRMessage_t* msg, - const NetworkFactory& network, - bool is_shm_transport_possible, + NetworkFactory& network, bool should_filter_locators, fastdds::rtps::VendorId_t source_vendor_id = c_VendorId_eProsima); diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp index b201eef08a5..c133fb3950c 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimpleListeners.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -70,13 +70,12 @@ void EDPBasePUBListener::add_writer_from_change( const EndpointAddedCallback& writer_added_callback /* = nullptr*/) { //LOAD INFORMATION IN DESTINATION WRITER PROXY DATA - const NetworkFactory& network = edp->mp_RTPSParticipant->network_factory(); + NetworkFactory& network = edp->mp_RTPSParticipant->network_factory(); CDRMessage_t tempMsg(change->serializedPayload); auto temp_writer_data = edp->get_temporary_writer_proxies_pool().get(); const auto type_server = change->writerGUID; - if (temp_writer_data->readFromCDRMessage(&tempMsg, network, - edp->mp_RTPSParticipant->has_shm_transport(), true, change->vendor_id)) + if (temp_writer_data->readFromCDRMessage(&tempMsg, network, true, change->vendor_id)) { if (temp_writer_data->guid().guidPrefix == edp->mp_RTPSParticipant->getGuid().guidPrefix) { @@ -215,13 +214,12 @@ void EDPBaseSUBListener::add_reader_from_change( const EndpointAddedCallback& reader_added_callback /* = nullptr*/) { //LOAD INFORMATION IN TEMPORAL READER PROXY DATA - const NetworkFactory& network = edp->mp_RTPSParticipant->network_factory(); + NetworkFactory& network = edp->mp_RTPSParticipant->network_factory(); CDRMessage_t tempMsg(change->serializedPayload); auto temp_reader_data = edp->get_temporary_reader_proxies_pool().get(); const auto type_server = change->writerGUID; - if (temp_reader_data->readFromCDRMessage(&tempMsg, network, - edp->mp_RTPSParticipant->has_shm_transport(), true, change->vendor_id)) + if (temp_reader_data->readFromCDRMessage(&tempMsg, network, true, change->vendor_id)) { if (temp_reader_data->guid().guidPrefix == edp->mp_RTPSParticipant->getGuid().guidPrefix) { diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp index f5563ef5af5..5e135c4c390 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp @@ -106,7 +106,7 @@ void PDPListener::on_new_cache_change_added( CDRMessage_t msg(change->serializedPayload); temp_participant_data_.clear(); if (temp_participant_data_.readFromCDRMessage(&msg, true, parent_pdp_->getRTPSParticipant()->network_factory(), - parent_pdp_->getRTPSParticipant()->has_shm_transport(), true, change_in->vendor_id)) + true, change_in->vendor_id)) { // After correctly reading it change->instanceHandle = temp_participant_data_.m_key; diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index 9f054fbb0c0..d928d9ab4c8 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -139,7 +139,6 @@ void PDPServerListener::on_new_cache_change_added( &msg, true, pdp_server()->getRTPSParticipant()->network_factory(), - pdp_server()->getRTPSParticipant()->has_shm_transport(), true, change_in->vendor_id)) { diff --git a/src/cpp/rtps/network/NetworkFactory.cpp b/src/cpp/rtps/network/NetworkFactory.cpp index 6102d017b4f..6e948c85553 100644 --- a/src/cpp/rtps/network/NetworkFactory.cpp +++ b/src/cpp/rtps/network/NetworkFactory.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include @@ -284,6 +284,20 @@ bool NetworkFactory::is_locator_remote_or_allowed( return (is_locator_supported(locator) && !is_fastdds_local) || is_locator_allowed(locator); } +bool NetworkFactory::is_locator_reachable( + const Locator_t& locator) +{ + for (auto& transport : mRegisteredTransports) + { + if (transport->is_locator_reachable(locator)) + { + return true; + } + } + + return false; +} + void NetworkFactory::select_locators( LocatorSelector& selector) const { diff --git a/src/cpp/rtps/network/NetworkFactory.h b/src/cpp/rtps/network/NetworkFactory.hpp similarity index 95% rename from src/cpp/rtps/network/NetworkFactory.h rename to src/cpp/rtps/network/NetworkFactory.hpp index 34e9a592809..4e282106988 100644 --- a/src/cpp/rtps/network/NetworkFactory.h +++ b/src/cpp/rtps/network/NetworkFactory.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H -#define FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H +#ifndef FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP +#define FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP #include #include @@ -195,6 +195,17 @@ class NetworkFactory const Locator_t& locator, bool is_fastdds_local) const; + /** + * Must report whether the given locator is reachable by at least one of the registered transports. + * + * @param [in] locator @ref Locator for which the reachability is checked. + * + * @return true if the input locator is reachable by at least one of the registered transports, + * false otherwise. + */ + bool is_locator_reachable( + const Locator_t& locator); + /** * Perform the locator selection algorithm. * @@ -351,4 +362,4 @@ class NetworkFactory } // namespace fastdds } // namespace eprosima -#endif // FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H +#endif // FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 5191ff89379..4a2bfdb7256 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -2958,7 +2958,6 @@ bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( &serialized_msg, true, network_factory(), - has_shm_transport(), false, c_VendorId_eProsima); @@ -2990,7 +2989,6 @@ bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( ret = writer_data.readFromCDRMessage( &serialized_msg, network_factory(), - has_shm_transport(), false, c_VendorId_eProsima); @@ -3026,7 +3024,6 @@ bool RTPSParticipantImpl::fill_discovery_data_from_cdr_message( ret = reader_data.readFromCDRMessage( &serialized_msg, network_factory(), - has_shm_transport(), false, c_VendorId_eProsima); diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index d125141d786..4eba5e83013 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index ca68fce8bfc..a11f5159a1f 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cpp/rtps/transport/TCPv4Transport.cpp b/src/cpp/rtps/transport/TCPv4Transport.cpp index 6552edf7a56..9f6b75b09bd 100644 --- a/src/cpp/rtps/transport/TCPv4Transport.cpp +++ b/src/cpp/rtps/transport/TCPv4Transport.cpp @@ -434,6 +434,12 @@ bool TCPv4Transport::is_locator_allowed( return is_interface_allowed(IPLocator::toIPv4string(locator)); } +bool TCPv4Transport::is_locator_reachable( + const Locator_t& locator) +{ + return IsLocatorSupported(locator); +} + bool TCPv4Transport::compare_locator_ip( const Locator& lh, const Locator& rh) const diff --git a/src/cpp/rtps/transport/TCPv4Transport.h b/src/cpp/rtps/transport/TCPv4Transport.h index 190b4d8302d..a21a4206988 100644 --- a/src/cpp/rtps/transport/TCPv4Transport.h +++ b/src/cpp/rtps/transport/TCPv4Transport.h @@ -96,6 +96,10 @@ class TCPv4Transport : public TCPTransportInterface bool is_locator_allowed( const Locator& locator) const override; + //! Checks for whether locator is reachable. + bool is_locator_reachable( + const Locator_t&) override; + //! Checks if the given ip has been included in the white list to use it. virtual bool is_interface_allowed( const std::string& iface) const override; diff --git a/src/cpp/rtps/transport/TCPv6Transport.cpp b/src/cpp/rtps/transport/TCPv6Transport.cpp index 5c9d727d894..9cb3d58a43d 100644 --- a/src/cpp/rtps/transport/TCPv6Transport.cpp +++ b/src/cpp/rtps/transport/TCPv6Transport.cpp @@ -317,6 +317,12 @@ bool TCPv6Transport::is_locator_allowed( return is_interface_allowed(IPLocator::toIPv6string(locator)); } +bool TCPv6Transport::is_locator_reachable( + const Locator_t& locator) +{ + return IsLocatorSupported(locator); +} + bool TCPv6Transport::is_interface_whitelist_empty() const { return interface_whitelist_.empty(); diff --git a/src/cpp/rtps/transport/TCPv6Transport.h b/src/cpp/rtps/transport/TCPv6Transport.h index dd3d40b7ade..03d90fdd6bb 100644 --- a/src/cpp/rtps/transport/TCPv6Transport.h +++ b/src/cpp/rtps/transport/TCPv6Transport.h @@ -98,6 +98,10 @@ class TCPv6Transport : public TCPTransportInterface bool is_locator_allowed( const Locator& locator) const override; + //! Checks for whether locator is reachable. + bool is_locator_reachable( + const Locator_t&) override; + //! Checks if the interfaces white list is empty. virtual bool is_interface_whitelist_empty() const override; diff --git a/src/cpp/rtps/transport/UDPv4Transport.cpp b/src/cpp/rtps/transport/UDPv4Transport.cpp index dd24c2b97f7..d04ee7e5499 100644 --- a/src/cpp/rtps/transport/UDPv4Transport.cpp +++ b/src/cpp/rtps/transport/UDPv4Transport.cpp @@ -603,6 +603,12 @@ bool UDPv4Transport::is_locator_allowed( return is_interface_allowed(IPLocator::toIPv4string(locator)); } +bool UDPv4Transport::is_locator_reachable( + const Locator_t& locator) +{ + return IsLocatorSupported(locator); +} + LocatorList UDPv4Transport::NormalizeLocator( const Locator& locator) { diff --git a/src/cpp/rtps/transport/UDPv4Transport.h b/src/cpp/rtps/transport/UDPv4Transport.h index 8f1d2c37f33..ceabb4c4a3a 100644 --- a/src/cpp/rtps/transport/UDPv4Transport.h +++ b/src/cpp/rtps/transport/UDPv4Transport.h @@ -147,6 +147,10 @@ class UDPv4Transport : public UDPTransportInterface bool is_locator_allowed( const Locator&) const override; + //! Checks for whether locator is reachable. + bool is_locator_reachable( + const Locator_t&) override; + //! Checks if the given interface is allowed by the white list. bool is_interface_allowed( const asio::ip::address_v4& ip) const; diff --git a/src/cpp/rtps/transport/UDPv6Transport.cpp b/src/cpp/rtps/transport/UDPv6Transport.cpp index af9447cda39..437b3c8825f 100644 --- a/src/cpp/rtps/transport/UDPv6Transport.cpp +++ b/src/cpp/rtps/transport/UDPv6Transport.cpp @@ -608,6 +608,12 @@ bool UDPv6Transport::is_locator_allowed( return is_interface_allowed(IPLocator::toIPv6string(locator)); } +bool UDPv6Transport::is_locator_reachable( + const Locator_t& locator) +{ + return IsLocatorSupported(locator); +} + LocatorList UDPv6Transport::NormalizeLocator( const Locator& locator) { diff --git a/src/cpp/rtps/transport/UDPv6Transport.h b/src/cpp/rtps/transport/UDPv6Transport.h index a96071371e4..0f4d4fb5758 100644 --- a/src/cpp/rtps/transport/UDPv6Transport.h +++ b/src/cpp/rtps/transport/UDPv6Transport.h @@ -134,6 +134,10 @@ class UDPv6Transport : public UDPTransportInterface bool is_locator_allowed( const Locator&) const override; + //! Checks for whether locator is reachable. + bool is_locator_reachable( + const Locator_t&) override; + /** * Method to get a list of interfaces to bind the socket associated to the given locator. * @return Vector of interfaces in string format. diff --git a/src/cpp/rtps/transport/shared_mem/SHMLocator.hpp b/src/cpp/rtps/transport/shared_mem/SHMLocator.hpp index f13dd0002ec..f48eb040180 100644 --- a/src/cpp/rtps/transport/shared_mem/SHMLocator.hpp +++ b/src/cpp/rtps/transport/shared_mem/SHMLocator.hpp @@ -17,6 +17,7 @@ #include #include +#include namespace eprosima { namespace fastdds { @@ -49,9 +50,7 @@ class SHMLocator locator.get_address()[0] = (type == Type::UNICAST) ? 'U' : 'M'; - auto host_id = Host::instance().id(); - locator.get_address()[1] = octet(host_id); - locator.get_address()[2] = octet(host_id >> 8); + memcpy(&locator.get_address()[1], SystemInfo::get_username_host_id_md5_digest(), 15u); return locator; } @@ -66,9 +65,8 @@ class SHMLocator { if (locator.kind == LOCATOR_KIND_SHM) { - auto host_id = Host::instance().id(); - - return locator.address[1] == octet(host_id) && locator.address[2] == octet(host_id >> 8); + return ((std::memcmp(&locator.address[1], SystemInfo::get_username_host_id_md5_digest(), + 15u) == 0)); } return false; diff --git a/src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp b/src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp index 8a51d2f46b9..98d19d53e34 100644 --- a/src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp +++ b/src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp @@ -1106,6 +1106,7 @@ class SharedMemGlobal if (port_node) { + std::cout << "open_portinternal " << domain_name_ << " port domain name " << port_node->domain_name << std::endl; port = std::make_shared(std::move(port_segment), port_node); } else diff --git a/src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp b/src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp index 6d78649f870..de555d9d682 100644 --- a/src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp +++ b/src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp @@ -152,6 +152,29 @@ bool SharedMemTransport::is_locator_allowed( return IsLocatorSupported(locator); } +bool SharedMemTransport::is_locator_reachable( + const Locator_t& locator) +{ + bool is_reachable = SHMLocator::is_shm_and_from_this_host(locator); + + if (is_reachable) + { + try + { + is_reachable = (nullptr != find_port(locator.port)); + } + catch (const std::exception& e) + { + EPROSIMA_LOG_INFO(RTPS_MSG_OUT, + "Local SHM locator '" << locator << + "' is not reachable; discarding. Reason: " << e.what()); + is_reachable = false; + } + } + + return is_reachable; +} + LocatorList SharedMemTransport::NormalizeLocator( const Locator& locator) { diff --git a/src/cpp/rtps/transport/shared_mem/SharedMemTransport.h b/src/cpp/rtps/transport/shared_mem/SharedMemTransport.h index 28d2ea52035..f11cdbcd8c6 100644 --- a/src/cpp/rtps/transport/shared_mem/SharedMemTransport.h +++ b/src/cpp/rtps/transport/shared_mem/SharedMemTransport.h @@ -225,6 +225,10 @@ class SharedMemTransport : public TransportInterface bool is_locator_allowed( const Locator&) const override; + //! Checks for whether locator is reachable. + bool is_locator_reachable( + const Locator_t&) override; + protected: std::shared_ptr shared_mem_manager_; diff --git a/src/cpp/utils/SystemInfo.cpp b/src/cpp/utils/SystemInfo.cpp index 3cefd7f3208..ebf25c2b056 100644 --- a/src/cpp/utils/SystemInfo.cpp +++ b/src/cpp/utils/SystemInfo.cpp @@ -152,6 +152,30 @@ fastdds::dds::ReturnCode_t SystemInfo::get_username( #endif // _WIN32 } +const unsigned char* SystemInfo::get_username_host_id_md5_digest() +{ + if (!username_host_id_md5_digest_initialized_) + { + std::lock_guard lock_guard(username_host_id_digest_mtx_); + if (!username_host_id_md5_digest_initialized_) + { + // Initialize user name and host id + auto host_id = Host::instance().id(); + std::string user_name_and_host_id; + + get_username(user_name_and_host_id); + user_name_and_host_id += std::to_string(host_id); + + username_host_id_md5_.init(); + username_host_id_md5_.update(user_name_and_host_id.c_str(), user_name_and_host_id.length()); + username_host_id_md5_.finalize(); + username_host_id_md5_digest_initialized_.store(true); + } + } + + return username_host_id_md5_.digest; +} + bool SystemInfo::file_exists( const std::string& filename) { @@ -332,6 +356,9 @@ std::string SystemInfo::environment_file_; bool SystemInfo::cached_interfaces_; std::vector SystemInfo::interfaces_; std::mutex SystemInfo::interfaces_mtx_; +std::atomic SystemInfo::username_host_id_md5_digest_initialized_{false}; +std::mutex SystemInfo::username_host_id_digest_mtx_; +fastdds::MD5 SystemInfo::username_host_id_md5_; } // eprosima diff --git a/src/cpp/utils/SystemInfo.hpp b/src/cpp/utils/SystemInfo.hpp index 2d8a6f26f52..dc924dcafc0 100644 --- a/src/cpp/utils/SystemInfo.hpp +++ b/src/cpp/utils/SystemInfo.hpp @@ -146,6 +146,13 @@ class SystemInfo static ReturnCode_t get_username( std::string& username); + /** + * Gets the resulting md5 digest of th user name and host id + * + * * \param [out] user_host_digest array of octets to store the digest + */ + static const unsigned char* get_username_host_id_md5_digest(); + /** * Check if the file with name \c filename exists. * \c filename can also include the path to the file. @@ -266,6 +273,9 @@ class SystemInfo static bool cached_interfaces_; static std::vector interfaces_; static std::mutex interfaces_mtx_; + static std::atomic username_host_id_md5_digest_initialized_; + static std::mutex username_host_id_digest_mtx_; + static fastdds::MD5 username_host_id_md5_; }; /** diff --git a/test/examples/configuration.compose.yml b/test/examples/configuration.compose.yml index f35dd6c3c00..79835caf303 100644 --- a/test/examples/configuration.compose.yml +++ b/test/examples/configuration.compose.yml @@ -26,6 +26,8 @@ services: EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/configuration FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/configuration/configuration_profile.xml SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${SUB_ARGS} + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/configuration@FILE_EXTENSION@ subscriber --samples 10 $${SUBSCRIBER_ADDITIONAL_ARGUMENTS}" publisher-subscriber: @@ -41,4 +43,6 @@ services: FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/configuration/configuration_profile.xml PUBLISHER_ADDITIONAL_ARGUMENTS: ${PUB_ARGS} SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${SUB_ARGS} + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/configuration@FILE_EXTENSION@ subscriber --samples 10 $${SUBSCRIBER_ADDITIONAL_ARGUMENTS} & $${EXAMPLE_DIR}/configuration@FILE_EXTENSION@ publisher --samples 10 --wait 2 $${PUBLISHER_ADDITIONAL_ARGUMENTS}" diff --git a/test/examples/custom_payload_pool.compose.yml b/test/examples/custom_payload_pool.compose.yml index bbccefb3c2e..79b1f520ec2 100644 --- a/test/examples/custom_payload_pool.compose.yml +++ b/test/examples/custom_payload_pool.compose.yml @@ -24,6 +24,8 @@ services: # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/custom_payload_pool + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/custom_payload_pool@FILE_EXTENSION@ subscriber --samples 10" publisher: @@ -36,6 +38,8 @@ services: # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/custom_payload_pool + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/custom_payload_pool@FILE_EXTENSION@ publisher --samples 10" depends_on: - subscriber diff --git a/test/examples/delivery_mechanisms_isolated.compose.yml b/test/examples/delivery_mechanisms_isolated.compose.yml deleted file mode 100644 index 124e3231edf..00000000000 --- a/test/examples/delivery_mechanisms_isolated.compose.yml +++ /dev/null @@ -1,76 +0,0 @@ -# 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. -version: "3" - -services: - subscriber: - image: @DOCKER_IMAGE_NAME@ - volumes: - - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ - - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ - @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ - environment: - # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows - LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ - EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/delivery_mechanisms - ISOLATED_SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${ISUB_ARGS} - # avoid network and ipc host to isolate this subscriber for sharing memory with other containers - networks: - delivery_mechanisms_net: - ipv4_address: 113.1.1.2 - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/delivery_mechanisms@FILE_EXTENSION@ subscriber --samples 10 $${ISOLATED_SUBSCRIBER_ADDITIONAL_ARGUMENTS}" - - publisher-subscriber: - image: @DOCKER_IMAGE_NAME@ - volumes: - - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ - - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ - @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ - environment: - # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows - LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ - EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/delivery_mechanisms - PUBLISHER_ADDITIONAL_ARGUMENTS: ${PUB_ARGS} - SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${SUB_ARGS} - # avoid network and ipc host to isolate this subscriber for sharing memory with other containers - networks: - delivery_mechanisms_net: - ipv4_address: 113.1.1.3 - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/delivery_mechanisms@FILE_EXTENSION@ subscriber --samples 10 $${SUBSCRIBER_ADDITIONAL_ARGUMENTS} & $${EXAMPLE_DIR}/delivery_mechanisms@FILE_EXTENSION@ publisher --samples 10 $${PUBLISHER_ADDITIONAL_ARGUMENTS}" - - pubsub: - image: @DOCKER_IMAGE_NAME@ - volumes: - - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ - - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ - @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ - environment: - # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows - LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ - EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/delivery_mechanisms - PUBSUB_ADDITIONAL_ARGUMENTS: ${PUBSUB_ARGS} - # avoid network and ipc host to isolate this subscriber for sharing memory with other containers - networks: - delivery_mechanisms_net: - ipv4_address: 113.1.1.4 - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/delivery_mechanisms@FILE_EXTENSION@ pubsub --samples 10 $${PUBSUB_ADDITIONAL_ARGUMENTS}" - -networks: - delivery_mechanisms_net: - driver: bridge - ipam: - driver: default - config: - - subnet: 113.1.1.0/24 - gateway: 113.1.1.1 diff --git a/test/examples/flow_control.compose.yml b/test/examples/flow_control.compose.yml index 7a048e51d82..02404d4c4ae 100644 --- a/test/examples/flow_control.compose.yml +++ b/test/examples/flow_control.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/flow_control@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/flow_control/flow_control_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ subscriber --samples 10" publisher: @@ -38,6 +40,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/flow_control FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/flow_control/flow_control_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ publisher --samples 10 --period 500 --max-bytes 300000 --scheduler PRIORITY-RESERVATION --bandwidth 99 --priority 1" depends_on: - subscriber diff --git a/test/examples/hello_world.compose.yml b/test/examples/hello_world.compose.yml index affe3533b8a..7da6c0aeba3 100644 --- a/test/examples/hello_world.compose.yml +++ b/test/examples/hello_world.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --waitset --samples 10" subscriber-publisher: @@ -38,6 +40,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 10 & $${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10" depends_on: - waitset-subscriber diff --git a/test/examples/request_reply.compose.yml b/test/examples/request_reply.compose.yml index d5399d18cc8..6661e12493c 100644 --- a/test/examples/request_reply.compose.yml +++ b/test/examples/request_reply.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/request_reply@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/request_reply/request_reply_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/request_reply@FILE_EXTENSION@ client 2 5 & timeout --preserve-status 3 $${EXAMPLE_DIR}/request_reply@FILE_EXTENSION@ server" alone-client: @@ -38,4 +40,6 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/request_reply@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/request_reply/request_reply_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/request_reply@FILE_EXTENSION@ client 67 24" diff --git a/test/examples/rtps.compose.yml b/test/examples/rtps.compose.yml index 0584a4ccda7..43620d0b8e2 100644 --- a/test/examples/rtps.compose.yml +++ b/test/examples/rtps.compose.yml @@ -24,6 +24,8 @@ services: # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/rtps@FILE_EXTENSION@ + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/rtps@FILE_EXTENSION@ reader --samples 20" sub-dds: @@ -37,6 +39,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/rtps/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 20" pub-rtps: @@ -49,6 +53,8 @@ services: # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/rtps + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/rtps@FILE_EXTENSION@ writer --samples 10" depends_on: - sub-rtps @@ -65,6 +71,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/rtps/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10" depends_on: - sub-rtps diff --git a/test/examples/security.compose.yml b/test/examples/security.compose.yml index 1abf5eddb90..d7a74c14114 100644 --- a/test/examples/security.compose.yml +++ b/test/examples/security.compose.yml @@ -26,6 +26,8 @@ services: EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/security CERTS_PATH: @PROJECT_BINARY_DIR@/examples/cpp/security/certs FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/security/secure_subscriber_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/security@FILE_EXTENSION@ subscriber --samples 10" publisher: @@ -40,5 +42,7 @@ services: EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/security CERTS_PATH: @PROJECT_BINARY_DIR@/examples/cpp/security/certs FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/security/secure_publisher_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/security@FILE_EXTENSION@ publisher --samples 10" diff --git a/test/examples/static_edp_discovery.compose.yml b/test/examples/static_edp_discovery.compose.yml index fd315d553ce..329c9e59bf4 100644 --- a/test/examples/static_edp_discovery.compose.yml +++ b/test/examples/static_edp_discovery.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/static_edp_discovery@FILE_EXTENSION@ XML_FILE: @PROJECT_BINARY_DIR@/examples/cpp/static_edp_discovery/HelloWorld_static_disc.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/static_edp_discovery@FILE_EXTENSION@ subscriber --samples 10 --xml $${XML_FILE}" subscriber-publisher: @@ -38,6 +40,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/static_edp_discovery XML_FILE: @PROJECT_BINARY_DIR@/examples/cpp/static_edp_discovery/HelloWorld_static_disc.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/static_edp_discovery@FILE_EXTENSION@ subscriber --samples 10 --xml $${XML_FILE} & $${EXAMPLE_DIR}/static_edp_discovery@FILE_EXTENSION@ publisher --samples 10 --xml $${XML_FILE}" depends_on: - subscriber diff --git a/test/examples/test_delivery_mechanisms_isolated.py b/test/examples/test_delivery_mechanisms_isolated.py deleted file mode 100644 index f69995c6d36..00000000000 --- a/test/examples/test_delivery_mechanisms_isolated.py +++ /dev/null @@ -1,144 +0,0 @@ -# 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. - -import subprocess -import pytest - -isolated_delivery_test_cases = [ - # Default builtin transports (UDP forced) - ('', '-s 20', '-s 20', '', 50), - ('', '-s 20', '-s 20', '--ignore-local-endpoints', 50), - # Large-data with only one publisher (testing TCP) - ('--mechanism large-data', '--unknown-argument', '--mechanism large-data', '--unknown-argument', 10), - # TCP takes longer to match, so explicitly expect much more samples in this case. - # TCP is configured through initial peers (a single locator), so we test only one publisher at a time - # Note: pubsub with TCP and ignore-local-endpoints NOT set is not supported, tested in expected output test cases - ('-s 100 --mechanism tcpv4 -a 113.1.1.3', '-s 100 --mechanism tcpv4 -a 113.1.1.3', '-s 100 --mechanism tcpv4 -a 113.1.1.3', '--unknown-command', 200), - # UDP - ('--mechanism udpv4', '-s 20 --mechanism udpv4', '-s 20 --mechanism udpv4', '--mechanism udpv4', 50), - ('--mechanism udpv4', '-s 20 --mechanism udpv4', '-s 20 --mechanism udpv4', '--mechanism udpv4 --ignore-local-endpoints', 50), -] - -@pytest.mark.parametrize("pub_args, sub_args, isub_args, pubsub_args, repetitions", isolated_delivery_test_cases) -def test_delivery_mechanisms_isolated(pub_args, sub_args, isub_args, pubsub_args, repetitions): - """.""" - ret = False - out = '' - - command_prerequisites = 'PUB_ARGS="' + pub_args + '" SUB_ARGS="' + sub_args + '" ISUB_ARGS="' + isub_args + '" PUBSUB_ARGS="' + pubsub_args + '" ' - try: - out = subprocess.check_output(command_prerequisites + '/usr/bin/docker compose -f delivery_mechanisms_isolated.compose.yml up', - stderr=subprocess.STDOUT, - shell=True, - timeout=30 - ).decode().split('\n') - - sent = 0 - received = 0 - for line in out: - if 'SENT' in line: - sent += 1 - - if 'RECEIVED' in line: - received += 1 - - if sent != 0 and received != 0 and repetitions == received: - ret = True - else: - print('ERROR: sent: ' + str(sent) + ', but received: ' + str(received) + - ' (expected: ' + str(repetitions) + ')') - raise subprocess.CalledProcessError(1, '') - - except subprocess.CalledProcessError: - for l in out: - print(l) - except subprocess.TimeoutExpired: - print('TIMEOUT') - print(out) - - assert(ret) - -isolated_timeout_test_cases = [ - # Shared memory and data-sharing isolated subscriber timeout test cases - ('--mechanism shm', '--unknown-command', '--mechanism shm', '--mechanism shm -i'), - ('--mechanism data-sharing', '--unknown-command', '--mechanism data-sharing', '--mechanism data-sharing -i'), - # Incompatible mechanisms timeout test cases - ('--mechanism tcpv4', '--mechanism udpv4', '--mechanism udpv6', '--mechanism tcpv6 -i'), - ('--mechanism shm', '--mechanism data-sharing', '--mechanism large-data', '--mechanism intra-process -i') -] - -@pytest.mark.parametrize("pub_args, sub_args, isub_args, pubsub_args", isolated_timeout_test_cases) -def test_delivery_mechanisms_isolated_timeout(pub_args, sub_args, isub_args, pubsub_args): - """.""" - ret = False - out = '' - - command_prerequisites = 'PUB_ARGS="' + pub_args + '" SUB_ARGS="' + sub_args + '" ISUB_ARGS="' + isub_args + '" PUBSUB_ARGS="' + pubsub_args + '" ' - try: - out = subprocess.check_output(command_prerequisites + '/usr/bin/docker compose -f delivery_mechanisms_isolated.compose.yml up', - stderr=subprocess.STDOUT, - shell=True, - timeout=10 - ) - except subprocess.CalledProcessError as e: - print (e.output) - except subprocess.TimeoutExpired: - ret = True - subprocess.check_output('/usr/bin/docker compose -f delivery_mechanisms_isolated.compose.yml down', - stderr=subprocess.STDOUT, - shell=True, - timeout=15 - ) - - assert(ret) - -# Unsupported delivery mechanisms corner case test -isolated_expected_output_test_cases = [ - ('--unknown-argument', '--unknown-argument', '--mechanism tcp', 'Unsupported', 1) -] - -@pytest.mark.parametrize("pub_args, sub_args, pubsub_args, expected_message, n_messages", isolated_expected_output_test_cases) -def test_delivery_mechanisms_isolated_expected_output(pub_args, sub_args, pubsub_args, expected_message, n_messages): - """.""" - ret = False - out = '' - render_out = '' - - command_prerequisites = 'PUB_ARGS="' + pub_args + '" SUB_ARGS="' + sub_args + '" ISUB_ARGS="' + sub_args + '" PUBSUB_ARGS="' + pubsub_args + '" ' - try: - out = subprocess.check_output(command_prerequisites + '/usr/bin/docker compose -f delivery_mechanisms_isolated.compose.yml up', - stderr=subprocess.STDOUT, - shell=True, - timeout=20 - ) - render_out = out.decode().split('\n') - - count = 0 - for line in render_out: - if expected_message in line: - count += 1 - - if count >= int(n_messages): - ret = True - else: - print ('ERROR: expected at least: ' + n_messages +' "' + expected_message + '" messages, but received ' + str(count)) - raise subprocess.CalledProcessError(1, render_out) - - except subprocess.CalledProcessError as e: - print (render_out) - except subprocess.TimeoutExpired: - print('TIMEOUT') - print(out) - - assert(ret) diff --git a/test/examples/topic_instances.compose.yml b/test/examples/topic_instances.compose.yml index c18b85ea48c..8a4622318d4 100644 --- a/test/examples/topic_instances.compose.yml +++ b/test/examples/topic_instances.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/topic_instances SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${SUB_ARGS} + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "sleep 5 && $${EXAMPLE_DIR}/topic_instances@FILE_EXTENSION@ subscriber --samples 10 $${SUBSCRIBER_ADDITIONAL_ARGUMENTS}" publisher-subscriber: @@ -39,4 +41,6 @@ services: EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/topic_instances PUBLISHER_ADDITIONAL_ARGUMENTS: ${PUB_ARGS} SUBSCRIBER_ADDITIONAL_ARGUMENTS: ${SUB_ARGS} + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/topic_instances@FILE_EXTENSION@ subscriber --samples 10 $${SUBSCRIBER_ADDITIONAL_ARGUMENTS} & $${EXAMPLE_DIR}/topic_instances@FILE_EXTENSION@ publisher --samples 10 $${PUBLISHER_ADDITIONAL_ARGUMENTS}" diff --git a/test/examples/xtypes_complete.compose.yml b/test/examples/xtypes_complete.compose.yml index 6f8ec00de66..ba4f25fed32 100644 --- a/test/examples/xtypes_complete.compose.yml +++ b/test/examples/xtypes_complete.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_complete_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30" xtypes-subscriber-publisher: @@ -38,6 +40,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_complete_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30 & $${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10" depends_on: - xtypes-subscriber @@ -54,6 +58,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 30" helloworld-publisher: @@ -67,6 +73,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10" depends_on: - xtypes-subscriber @@ -83,6 +91,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_complete_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10 --xml-type" depends_on: - xtypes-subscriber diff --git a/test/examples/xtypes_minimal.compose.yml b/test/examples/xtypes_minimal.compose.yml index c141f768a0a..a7e29dbbb17 100644 --- a/test/examples/xtypes_minimal.compose.yml +++ b/test/examples/xtypes_minimal.compose.yml @@ -25,6 +25,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_minimal_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30" xtypes-subscriber-publisher: @@ -38,6 +40,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_minimal_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30 & $${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10" depends_on: - xtypes-subscriber @@ -54,6 +58,8 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + network_mode: host + ipc: host command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 30" helloworld-publisher: @@ -67,6 +73,7 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml + command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10" depends_on: - xtypes-subscriber diff --git a/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h b/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.hpp similarity index 91% rename from test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h rename to test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.hpp index fae7800f8e1..c57c7162c03 100644 --- a/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h +++ b/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H -#define FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H +#ifndef FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP +#define FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP #include #include @@ -90,6 +90,12 @@ class NetworkFactory return true; } + bool is_locator_reachable( + const Locator_t&) + { + return true; + } + uint32_t get_min_send_buffer_size() { return 65536; @@ -117,4 +123,4 @@ class NetworkFactory } // namespace fastdds } // namespace eprosima -#endif // FASTDDS_RTPS_NETWORK__NETWORKFACTORY_H +#endif // FASTDDS_RTPS_NETWORK__NETWORKFACTORY_HPP diff --git a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h index 90f5ac80ce0..5bf03ed9132 100644 --- a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h +++ b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #if HAVE_SECURITY diff --git a/test/mock/rtps/ReaderProxyData/rtps/builtin/data/ReaderProxyData.hpp b/test/mock/rtps/ReaderProxyData/rtps/builtin/data/ReaderProxyData.hpp index f2565882519..554adccbddf 100644 --- a/test/mock/rtps/ReaderProxyData/rtps/builtin/data/ReaderProxyData.hpp +++ b/test/mock/rtps/ReaderProxyData/rtps/builtin/data/ReaderProxyData.hpp @@ -141,8 +141,7 @@ class ReaderProxyData bool readFromCDRMessage( CDRMessage_t* /*msg*/, - const NetworkFactory& /*network*/, - bool /*is_shm_transport_possible*/, + NetworkFactory& /*network*/, fastdds::rtps::VendorId_t /*source_vendor_id*/) { return true; diff --git a/test/unittest/dds/collections/CMakeLists.txt b/test/unittest/dds/collections/CMakeLists.txt index dc02374062f..9b1be315651 100644 --- a/test/unittest/dds/collections/CMakeLists.txt +++ b/test/unittest/dds/collections/CMakeLists.txt @@ -27,6 +27,7 @@ set(LOANABLE_SEQUENCE_TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp LoanableSequenceTests.cpp) diff --git a/test/unittest/dds/core/condition/CMakeLists.txt b/test/unittest/dds/core/condition/CMakeLists.txt index ee706bc6843..38af3609869 100644 --- a/test/unittest/dds/core/condition/CMakeLists.txt +++ b/test/unittest/dds/core/condition/CMakeLists.txt @@ -13,6 +13,7 @@ # limitations under the License. set(LOG_SOURCES + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/dds/core/entity/CMakeLists.txt b/test/unittest/dds/core/entity/CMakeLists.txt index c1b0ccde1d7..4e38013da8f 100644 --- a/test/unittest/dds/core/entity/CMakeLists.txt +++ b/test/unittest/dds/core/entity/CMakeLists.txt @@ -33,6 +33,7 @@ set(ENTITY_TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp EntityTests.cpp) diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index 4c789efab33..a73806bbc24 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -187,6 +187,7 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/StringMatching.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/TimedConditionVariable.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/UnitsParser.cpp diff --git a/test/unittest/dds/subscriber/CMakeLists.txt b/test/unittest/dds/subscriber/CMakeLists.txt index 657bb10ea5c..067f77794be 100644 --- a/test/unittest/dds/subscriber/CMakeLists.txt +++ b/test/unittest/dds/subscriber/CMakeLists.txt @@ -39,6 +39,7 @@ set(DATAREADERHISTORYTESTS_SOURCE DataReaderHistoryTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/logging/CMakeLists.txt b/test/unittest/logging/CMakeLists.txt index b1b25cc5a1e..468b24bfbe1 100644 --- a/test/unittest/logging/CMakeLists.txt +++ b/test/unittest/logging/CMakeLists.txt @@ -29,6 +29,7 @@ set(LOG_COMMON_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/logging/log_macros/CMakeLists.txt b/test/unittest/logging/log_macros/CMakeLists.txt index e3db7631f3a..5112d58fb1a 100644 --- a/test/unittest/logging/log_macros/CMakeLists.txt +++ b/test/unittest/logging/log_macros/CMakeLists.txt @@ -27,6 +27,7 @@ set(LOG_COMMON_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp index 706c955a72e..61d6dbb8e86 100644 --- a/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp +++ b/test/unittest/rtps/builtin/BuiltinDataSerializationTests.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace eprosima { namespace fastdds { @@ -118,7 +118,7 @@ TEST(BuiltinDataSerializationTests, ok_with_defaults) // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); // EXPECT_EQ(in, out); } @@ -137,7 +137,7 @@ TEST(BuiltinDataSerializationTests, ok_with_defaults) // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); } } @@ -150,7 +150,7 @@ TEST(BuiltinDataSerializationTests, msg_with_product_version) msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, c_VendorId_eProsima))); }; @@ -210,7 +210,7 @@ TEST(BuiltinDataSerializationTests, msg_without_datasharing) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - out.readFromCDRMessage(&msg, network, false, true); + out.readFromCDRMessage(&msg, network, true); ASSERT_EQ(out.m_qos.data_sharing.kind(), dds::OFF); } @@ -227,7 +227,7 @@ TEST(BuiltinDataSerializationTests, msg_without_datasharing) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - out.readFromCDRMessage(&msg, network, false, true); + out.readFromCDRMessage(&msg, network, true); ASSERT_EQ(out.m_qos.data_sharing.kind(), dds::OFF); } } @@ -250,7 +250,7 @@ TEST(BuiltinDataSerializationTests, msg_with_datasharing) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - out.readFromCDRMessage(&msg, network, false, true); + out.readFromCDRMessage(&msg, network, true); ASSERT_EQ(out.m_qos.data_sharing.kind(), dds::ON); } @@ -270,7 +270,7 @@ TEST(BuiltinDataSerializationTests, msg_with_datasharing) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - out.readFromCDRMessage(&msg, network, false, true); + out.readFromCDRMessage(&msg, network, true); ASSERT_EQ(out.m_qos.data_sharing.kind(), dds::ON); } } @@ -339,7 +339,7 @@ TEST(BuiltinDataSerializationTests, interoperability_with_opendds_3_27) msg.length = msg.max_size; WriterProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true))); } // DATA(r) @@ -401,7 +401,7 @@ TEST(BuiltinDataSerializationTests, interoperability_with_opendds_3_27) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true))); } } @@ -516,7 +516,7 @@ TEST(BuiltinDataSerializationTests, ignore_unsupported_type_object) msg.length = msg.max_size; WriterProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true))); } } @@ -594,7 +594,7 @@ TEST(BuiltinDataSerializationTests, property_list_with_binary_properties) msg.length = msg.max_size; ParticipantProxyData out(RTPSParticipantAllocationAttributes{}); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, true))); + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, true))); } // Regression test for redmine tickets 20306 and 20307 @@ -607,7 +607,7 @@ TEST(BuiltinDataSerializationTests, other_vendor_parameter_list_with_custom_pids msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, fastdds::rtps::VendorId_t({2, 0})))); }; @@ -617,7 +617,7 @@ TEST(BuiltinDataSerializationTests, other_vendor_parameter_list_with_custom_pids msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, fastdds::rtps::VendorId_t({2, 0})))); }; @@ -627,7 +627,7 @@ TEST(BuiltinDataSerializationTests, other_vendor_parameter_list_with_custom_pids msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, fastdds::rtps::VendorId_t({2, 0})))); }; @@ -869,7 +869,7 @@ TEST(BuiltinDataSerializationTests, rti_parameter_list_with_custom_pids) msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, true, network, false, fastdds::rtps::c_VendorId_rti_connext))); }; @@ -879,7 +879,7 @@ TEST(BuiltinDataSerializationTests, rti_parameter_list_with_custom_pids) msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, fastdds::rtps::c_VendorId_rti_connext))); }; @@ -889,7 +889,7 @@ TEST(BuiltinDataSerializationTests, rti_parameter_list_with_custom_pids) msg.init(buffer, buffer_length); msg.length = msg.max_size; - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, false, + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, fastdds::rtps::c_VendorId_rti_connext))); }; @@ -1099,7 +1099,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_without_parameters) // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); ASSERT_EQ(in.content_filter().content_filtered_topic_name, out.content_filter().content_filtered_topic_name); ASSERT_EQ(in.content_filter().related_topic_name, out.content_filter().related_topic_name); @@ -1140,7 +1140,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_with_parameters) // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); ASSERT_EQ(in.content_filter().content_filtered_topic_name, out.content_filter().content_filtered_topic_name); ASSERT_EQ(in.content_filter().related_topic_name, out.content_filter().related_topic_name); @@ -1232,7 +1232,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_topic_name_deser EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1281,7 +1281,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_topic_name_deser EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1366,7 +1366,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_related_topic_na EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1415,7 +1415,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_related_topic_na EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1449,7 +1449,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_empty_filter_class) // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1504,7 +1504,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_filter_class_des EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1553,7 +1553,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_filter_class_des EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1587,7 +1587,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_empty_filter_expressio // Perform deserialization msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1642,7 +1642,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_wrong_filter_expressio EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); assert_is_empty_content_filter(out.content_filter()); } @@ -1829,7 +1829,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_interoperability) msg.length = msg.max_size; ReaderProxyData out(max_unicast_locators, max_multicast_locators); - EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, false, true))); + EXPECT_NO_THROW(EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true))); ASSERT_EQ("ContentFilter_0", out.content_filter().content_filtered_topic_name.to_string()); ASSERT_EQ("Square", out.content_filter().related_topic_name.to_string()); @@ -1898,7 +1898,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_max_parameter_check) EXPECT_TRUE(fastdds::dds::ParameterSerializer::add_parameter_sentinel(&msg)); msg.pos = 0; - EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true, true)); + EXPECT_TRUE(out.readFromCDRMessage(&msg, network, true)); ASSERT_EQ(100, out.content_filter().expression_parameters.size()); @@ -1942,7 +1942,7 @@ TEST(BuiltinDataSerializationTests, contentfilterproperty_max_parameter_check) msg_fault.pos = 0; // Deserialization of messages with more than 100 parameters should fail - ASSERT_FALSE(out.readFromCDRMessage(&msg_fault, network, true, true)); + ASSERT_FALSE(out.readFromCDRMessage(&msg_fault, network, true)); } } diff --git a/test/unittest/rtps/common/CMakeLists.txt b/test/unittest/rtps/common/CMakeLists.txt index f048ff687ec..9dece0c7097 100644 --- a/test/unittest/rtps/common/CMakeLists.txt +++ b/test/unittest/rtps/common/CMakeLists.txt @@ -56,6 +56,7 @@ set(PORTPARAMETERSTESTS_SOURCE PortParametersTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(TIMETESTS_SOURCE TimeTests.cpp diff --git a/test/unittest/rtps/flowcontrol/CMakeLists.txt b/test/unittest/rtps/flowcontrol/CMakeLists.txt index 9a4e66b82ef..96c3c001c3b 100644 --- a/test/unittest/rtps/flowcontrol/CMakeLists.txt +++ b/test/unittest/rtps/flowcontrol/CMakeLists.txt @@ -31,6 +31,7 @@ set(FLOWCONTROLLER_COMMON_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/writer/LocatorSelectorSender.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/rtps/history/CMakeLists.txt b/test/unittest/rtps/history/CMakeLists.txt index c5f8fb1401b..a1bd7a9ab89 100644 --- a/test/unittest/rtps/history/CMakeLists.txt +++ b/test/unittest/rtps/history/CMakeLists.txt @@ -27,6 +27,7 @@ set(READERHISTORYTESTS_SOURCE ReaderHistoryTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(BASICPOOLSTESTS_SOURCE BasicPoolsTests.cpp @@ -42,6 +43,7 @@ set(BASICPOOLSTESTS_SOURCE BasicPoolsTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(CACHECHANGEPOOLTESTS_SOURCE CacheChangePoolTests.cpp @@ -57,6 +59,7 @@ set(CACHECHANGEPOOLTESTS_SOURCE CacheChangePoolTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(TOPICPAYLOADPOOLTESTS_SOURCE @@ -74,6 +77,7 @@ set(TOPICPAYLOADPOOLTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) if(WIN32) diff --git a/test/unittest/rtps/network/NetworkFactoryTests.cpp b/test/unittest/rtps/network/NetworkFactoryTests.cpp index b8dd570d480..5b073d52a2f 100644 --- a/test/unittest/rtps/network/NetworkFactoryTests.cpp +++ b/test/unittest/rtps/network/NetworkFactoryTests.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include using namespace eprosima::fastdds; using namespace eprosima::fastdds::rtps; diff --git a/test/unittest/rtps/network/mock/MockTransport.cpp b/test/unittest/rtps/network/mock/MockTransport.cpp index 4bcb4cc94f1..8867715e617 100644 --- a/test/unittest/rtps/network/mock/MockTransport.cpp +++ b/test/unittest/rtps/network/mock/MockTransport.cpp @@ -73,6 +73,12 @@ bool MockTransport::is_locator_allowed( return true; } +bool MockTransport::is_locator_reachable( + const Locator_t& /*locator*/) +{ + return true; +} + bool MockTransport::OpenOutputChannel( fastdds::rtps::SendResourceList& send_resource_list, const Locator_t& locator) diff --git a/test/unittest/rtps/network/mock/MockTransport.h b/test/unittest/rtps/network/mock/MockTransport.h index 2955afa8a1e..5dc6cf49f16 100644 --- a/test/unittest/rtps/network/mock/MockTransport.h +++ b/test/unittest/rtps/network/mock/MockTransport.h @@ -86,8 +86,13 @@ class MockTransport : public fastdds::rtps::TransportInterface bool IsLocatorSupported( const Locator_t&) const override; + bool is_locator_allowed( const Locator_t& locator) const override; + + bool is_locator_reachable( + const Locator_t&) override; + bool DoInputLocatorsMatch( const Locator_t&, const Locator_t&) const override; diff --git a/test/unittest/rtps/persistence/CMakeLists.txt b/test/unittest/rtps/persistence/CMakeLists.txt index 879f919d4bf..ee90d1efb70 100644 --- a/test/unittest/rtps/persistence/CMakeLists.txt +++ b/test/unittest/rtps/persistence/CMakeLists.txt @@ -34,7 +34,8 @@ if(SQLITE3_SUPPORT) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) add_executable(PersistenceTests ${PERSISTENCETESTS_SOURCE}) diff --git a/test/unittest/rtps/reader/CMakeLists.txt b/test/unittest/rtps/reader/CMakeLists.txt index c3fdc14045c..095e2af203c 100644 --- a/test/unittest/rtps/reader/CMakeLists.txt +++ b/test/unittest/rtps/reader/CMakeLists.txt @@ -32,6 +32,7 @@ set(WRITERPROXYTESTS_SOURCE WriterProxyTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) @@ -85,6 +86,7 @@ set(WRITERPROXYSTOPTEST_SOURCE WriterProxyStopTest.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/TimedConditionVariable.cpp ) @@ -136,6 +138,7 @@ set(WRITERPROXYACKNACKTESTS_SOURCE WriterProxyAcknackTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/rtps/resources/timedevent/CMakeLists.txt b/test/unittest/rtps/resources/timedevent/CMakeLists.txt index ad5f0ccf35b..8ec2a1d91f6 100644 --- a/test/unittest/rtps/resources/timedevent/CMakeLists.txt +++ b/test/unittest/rtps/resources/timedevent/CMakeLists.txt @@ -27,6 +27,7 @@ set(TIMEDEVENTTESTS_SOURCE mock/MockEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/TimedConditionVariable.cpp) diff --git a/test/unittest/rtps/security/CMakeLists.txt b/test/unittest/rtps/security/CMakeLists.txt index f9d624847b6..80d876b565c 100644 --- a/test/unittest/rtps/security/CMakeLists.txt +++ b/test/unittest/rtps/security/CMakeLists.txt @@ -48,6 +48,7 @@ set(SOURCES_SECURITY_TEST_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/security/cryptography/AESGCMGMAC_Types.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/TimedConditionVariable.cpp ${PROJECT_SOURCE_DIR}/test/mock/rtps/SecurityPluginFactory/rtps/security/SecurityPluginFactory.cpp diff --git a/test/unittest/rtps/writer/CMakeLists.txt b/test/unittest/rtps/writer/CMakeLists.txt index 3e83e12a8e1..74930428c1d 100644 --- a/test/unittest/rtps/writer/CMakeLists.txt +++ b/test/unittest/rtps/writer/CMakeLists.txt @@ -29,6 +29,7 @@ set(WRITERPROXYTESTS_SOURCE ReaderProxyTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/writer/ReaderProxy.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) if(WIN32) @@ -86,6 +87,7 @@ set(LIVELINESSMANAGERTESTS_SOURCE LivelinessManagerTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/TimedConditionVariable.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) add_executable(LivelinessManagerTests ${LIVELINESSMANAGERTESTS_SOURCE}) diff --git a/test/unittest/security/accesscontrol/CMakeLists.txt b/test/unittest/security/accesscontrol/CMakeLists.txt index c984cf476b7..8e05c7947c5 100644 --- a/test/unittest/security/accesscontrol/CMakeLists.txt +++ b/test/unittest/security/accesscontrol/CMakeLists.txt @@ -142,6 +142,7 @@ add_executable( ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp # Log related files + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp # test files diff --git a/test/unittest/security/authentication/CMakeLists.txt b/test/unittest/security/authentication/CMakeLists.txt index b7dfe3fee1d..fd0b2d11138 100644 --- a/test/unittest/security/authentication/CMakeLists.txt +++ b/test/unittest/security/authentication/CMakeLists.txt @@ -54,9 +54,9 @@ add_executable(BuiltinPKIDH ${COMMON_SOURCES_AUTH_PLUGIN_TEST_SOURCE} ${PROJECT_SOURCE_DIR}/src/cpp/security/authentication/PKIHandshakeHandle.cpp ${PROJECT_SOURCE_DIR}/src/cpp/security/artifact_providers/FileProvider.cpp ${PROJECT_SOURCE_DIR}/src/cpp/security/artifact_providers/Pkcs11Provider.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/BuiltinPKIDHTests.cpp) target_compile_definitions(BuiltinPKIDH PRIVATE diff --git a/test/unittest/security/cryptography/CMakeLists.txt b/test/unittest/security/cryptography/CMakeLists.txt index 5a077833d3e..6cf60ccaea2 100644 --- a/test/unittest/security/cryptography/CMakeLists.txt +++ b/test/unittest/security/cryptography/CMakeLists.txt @@ -38,6 +38,7 @@ set(COMMON_SOURCES_CRYPTO_PLUGIN_TEST_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/security/cryptography/AESGCMGMAC.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/security/logging/CMakeLists.txt b/test/unittest/security/logging/CMakeLists.txt index 6cb05fbca7f..97ec464c57a 100644 --- a/test/unittest/security/logging/CMakeLists.txt +++ b/test/unittest/security/logging/CMakeLists.txt @@ -31,6 +31,7 @@ set(COMMON_SOURCES_LOGGING_PLUGIN_TEST_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp ) diff --git a/test/unittest/transport/TCPv6Tests.cpp b/test/unittest/transport/TCPv6Tests.cpp index f87aed21774..11e8faf1696 100644 --- a/test/unittest/transport/TCPv6Tests.cpp +++ b/test/unittest/transport/TCPv6Tests.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/test/unittest/utils/CMakeLists.txt b/test/unittest/utils/CMakeLists.txt index d9848256f0c..754161b55e2 100644 --- a/test/unittest/utils/CMakeLists.txt +++ b/test/unittest/utils/CMakeLists.txt @@ -29,6 +29,7 @@ set(STRINGMATCHINGTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/StringMatching.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(BITMAPRANGETESTS_SOURCE @@ -49,6 +50,7 @@ set(LOCATORTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(FIXEDSIZEQUEUETESTS_SOURCE @@ -66,6 +68,7 @@ set(SYSTEMINFOTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterfaceWithFilter.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPFinder.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/IPLocator.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/utils/md5.cpp ${PROJECT_SOURCE_DIR}/src/cpp/utils/SystemInfo.cpp) set(TREETESTS_SOURCE