Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'addresses' tag from Discovery Server connection-addresses #131

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <ddspipe_participants/library/library_dll.h>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>
#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>
#include <ddspipe_core/types/dds/DomainId.hpp>
#include <ddspipe_core/types/dds/GuidPrefix.hpp>

Expand Down Expand Up @@ -56,7 +55,7 @@ struct DiscoveryServerParticipantConfiguration : public SimpleParticipantConfigu

std::set<types::Address> listening_addresses {};

std::set<types::DiscoveryServerConnectionAddress> connection_addresses {};
std::set<types::Address> connection_addresses {};

types::TlsConfiguration tls_configuration {};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <ddspipe_participants/library/library_dll.h>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>
#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>
#include <ddspipe_core/types/dds/DomainId.hpp>
#include <ddspipe_core/types/dds/GuidPrefix.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <ddspipe_participants/library/library_dll.h>
#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>

namespace eprosima {
namespace ddspipe {
Expand All @@ -27,11 +26,6 @@ DDSPIPE_PARTICIPANTS_DllAPI
types::Address random_address(
unsigned int seed = 0);

DDSPIPE_PARTICIPANTS_DllAPI
types::DiscoveryServerConnectionAddress random_connection_address(
unsigned int seed = 0,
unsigned int size = 1);

} /* namespace testing */
} /* namespace participants */
} /* namespace ddspipe */
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <ddspipe_participants/configuration/DiscoveryServerParticipantConfiguration.hpp>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>
#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>

namespace eprosima {
namespace ddspipe {
Expand All @@ -44,7 +43,7 @@ bool DiscoveryServerParticipantConfiguration::is_valid(
}

// Check connection addresses
for (types::DiscoveryServerConnectionAddress address : connection_addresses)
for (types::Address address : connection_addresses)
{
if (!address.is_valid())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const

/////
// Set connection addresses
for (types::DiscoveryServerConnectionAddress connection_address :
for (types::Address address :
discovery_server_configuration->connection_addresses)
{
if (!connection_address.is_valid())
if (!address.is_valid())
{
// Invalid connection address, continue with next one
EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT,
Expand All @@ -220,59 +220,46 @@ DiscoveryServerParticipant::reckon_participant_attributes_() const
continue;
}

for (types::Address address : connection_address.addresses())
{
if (!address.is_valid())
{
// Invalid ip address, continue with next one
EPROSIMA_LOG_WARNING(DDSPIPE_DISCOVERYSERVER_PARTICIPANT,
"Discard connection address with remote server due to invalid ip address " <<
address.ip() << " in Participant " << discovery_server_configuration->id <<
" initialization.");
continue;
}

has_connection_addresses = true;
has_connection_addresses = true;

eprosima::fastdds::rtps::Locator_t locator;
eprosima::fastdds::rtps::Locator_t locator;

// KIND
locator.kind = address.get_locator_kind();
// KIND
locator.kind = address.get_locator_kind();

// In case it is TCP mark has_connection_tcp as true
if (address.is_tcp())
{
has_connection_tcp_ipv4 = address.is_ipv4();
has_connection_tcp_ipv6 = !address.is_ipv4();
}
else
{
has_udp_ipv4 = address.is_ipv4();
has_udp_ipv6 = !address.is_ipv4();
}
// In case it is TCP mark has_connection_tcp as true
if (address.is_tcp())
{
has_connection_tcp_ipv4 = address.is_ipv4();
has_connection_tcp_ipv6 = !address.is_ipv4();
}
else
{
has_udp_ipv4 = address.is_ipv4();
has_udp_ipv6 = !address.is_ipv4();
}

// IP
if (address.is_ipv4())
{
eprosima::fastdds::rtps::IPLocator::setIPv4(locator, address.ip());
}
else
{
eprosima::fastdds::rtps::IPLocator::setIPv6(locator, address.ip());
}
// IP
if (address.is_ipv4())
{
eprosima::fastdds::rtps::IPLocator::setIPv4(locator, address.ip());
}
else
{
eprosima::fastdds::rtps::IPLocator::setIPv6(locator, address.ip());
}

// PORT
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.port());
eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, address.port());
// Warning: Logical port is not needed unless domain could change
// PORT
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(locator, address.port());
eprosima::fastdds::rtps::IPLocator::setLogicalPort(locator, address.port());
// Warning: Logical port is not needed unless domain could change

// Add as remote server and add it to builtin
params.builtin.discovery_config.m_DiscoveryServers.push_back(locator);
// Add as remote server and add it to builtin
params.builtin.discovery_config.m_DiscoveryServers.push_back(locator);

logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT,
"Add connection address " << address << " to Server Participant " <<
discovery_server_configuration->id << ".");
}
logDebug(DDSPIPE_DISCOVERYSERVER_PARTICIPANT,
"Add connection address " << address << " to Server Participant " <<
discovery_server_configuration->id << ".");
}

/////
Expand Down
16 changes: 0 additions & 16 deletions ddspipe_participants/src/cpp/testing/random_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@ Address random_address(
return Address("127.0.0.1", 10000 + seed, 10000 + seed, TransportProtocol::udp);
}

DiscoveryServerConnectionAddress random_connection_address(
unsigned int seed /* = 0 */,
unsigned int size /* = 1 */)
{
std::set<Address> addresses;
for (unsigned int i = 0; i < size; ++i)
{
addresses.insert(
random_address((seed + i)));
}

return DiscoveryServerConnectionAddress(
addresses
);
}

} /* namespace testing */
} /* namespace participants */
} /* namespace ddspipe */
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions ddspipe_yaml/include/ddspipe_yaml/YamlReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ enum YamlReaderVersion
*
* - Make discovery server's guid prefix optional.
* - Remove server's guid prefix from discovery server clients' connection addresses.
* - Remove 'addresses' tag from discovery server clients' connection addresses (now it's just a list of addresses).
*/
V_5_0,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <ddspipe_core/testing/random_values.hpp>

#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>
#include <ddspipe_participants/testing/random_values.hpp>

#include <ddspipe_yaml/Yaml.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ constexpr const char* DOMAIN_ID_TAG("domain"); //! Domain Id of the participant
constexpr const char* DISCOVERY_SERVER_GUID_PREFIX_TAG("discovery-server-guid"); //! TODO: add comment
constexpr const char* LISTENING_ADDRESSES_TAG("listening-addresses"); //! TODO: add comment
constexpr const char* CONNECTION_ADDRESSES_TAG("connection-addresses"); //! TODO: add comment
constexpr const char* COLLECTION_ADDRESSES_TAG("addresses"); //! TODO: add comment

// TLS related tags
constexpr const char* TLS_TAG("tls"); //! TLS configuration tag
Expand Down
1 change: 0 additions & 1 deletion ddspipe_yaml/src/cpp/YamlReader_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>

#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>

#include <ddspipe_participants/configuration/DiscoveryServerParticipantConfiguration.hpp>
Expand Down
3 changes: 1 addition & 2 deletions ddspipe_yaml/src/cpp/YamlReader_participants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <ddspipe_core/types/participant/ParticipantId.hpp>

#include <ddspipe_participants/types/address/Address.hpp>
#include <ddspipe_participants/types/address/DiscoveryServerConnectionAddress.hpp>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>

#include <ddspipe_participants/configuration/DiscoveryServerParticipantConfiguration.hpp>
Expand Down Expand Up @@ -208,7 +207,7 @@ void YamlReader::fill(
// Optional connection addresses
if (YamlReader::is_tag_present(yml, CONNECTION_ADDRESSES_TAG))
{
object.connection_addresses = YamlReader::get_set<DiscoveryServerConnectionAddress>(
object.connection_addresses = YamlReader::get_set<Address>(
yml,
CONNECTION_ADDRESSES_TAG,
version);
Expand Down
Loading
Loading