Skip to content

Commit 2c49682

Browse files
authored
Repeater Implementation (#249)
* Refs #15188: Implement Initial peers in core Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15188: Add blackbox tests to initial peers Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15188: Add initial peers to yaml Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15188: Update Yaml schema Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15191: Add it to tool tests Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15191: Add example resources Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #15191: Correct and tie up loose ends Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Move payload Pool to subfolder Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Implement Repeater Participant Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Add documentation Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Add release notes Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Allow only one Participant if repeater Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Update yaml schema configuration Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Implement generic limitless Pool Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Add code comments and refactor LimitlessPool Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Apply suggestions (except name changes) Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Apply docs documentation Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Change classes names Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Rebase over initial peers Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: fix repeater configuration test Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: Refactor Participant Kind names Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: fix rebase Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: apply code suggestions Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: change Participant classes names Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: apply documentation changes Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: apply docs suggestions Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: remove number_of_participants test Signed-off-by: jparisu <javierparis@eprosima.com> * Refs #14951: uncrustify Signed-off-by: jparisu <javierparis@eprosima.com>
1 parent df44e10 commit 2c49682

135 files changed

Lines changed: 4024 additions & 532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ddsrouter_core/include/ddsrouter_core/configuration/DDSRouterConfiguration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct DDSRouterConfiguration : public DDSRouterReloadConfiguration
6969
// VARIABLES
7070
/////////////////////////
7171

72-
std::set<std::shared_ptr<ParticipantConfiguration>> participants_configurations_ = {};
72+
std::set<std::shared_ptr<ParticipantConfiguration>> participants_configurations = {};
7373

7474
unsigned int number_of_threads = 12;
7575

ddsrouter_core/include/ddsrouter_core/configuration/participant/DiscoveryServerParticipantConfiguration.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct DiscoveryServerParticipantConfiguration : public SimpleParticipantConfigu
4848
DDSROUTER_CORE_DllAPI DiscoveryServerParticipantConfiguration(
4949
const types::ParticipantId& id,
5050
const types::ParticipantKind& kind,
51+
const bool is_repeater,
5152
const types::DomainId& domain_id,
5253
const types::GuidPrefix& discovery_server_guid_prefix,
5354
const std::set<types::Address>& listening_addresses,
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* @file InitialPeersParticipantConfiguration.hpp
17+
*/
18+
19+
#ifndef _DDSROUTERCORE_CONFIGURATION_PARTICIPANT_INITIALPEERSPARTICIPANTCONFIGURATION_HPP_
20+
#define _DDSROUTERCORE_CONFIGURATION_PARTICIPANT_INITIALPEERSPARTICIPANTCONFIGURATION_HPP_
21+
22+
#include <ddsrouter_core/configuration/participant/SimpleParticipantConfiguration.hpp>
23+
#include <ddsrouter_core/library/library_dll.h>
24+
#include <ddsrouter_core/types/security/tls/TlsConfiguration.hpp>
25+
#include <ddsrouter_core/types/address/Address.hpp>
26+
#include <ddsrouter_core/types/address/DiscoveryServerConnectionAddress.hpp>
27+
#include <ddsrouter_core/types/dds/DomainId.hpp>
28+
#include <ddsrouter_core/types/dds/GuidPrefix.hpp>
29+
#include <ddsrouter_core/types/participant/ParticipantKind.hpp>
30+
31+
namespace eprosima {
32+
namespace ddsrouter {
33+
namespace core {
34+
namespace configuration {
35+
36+
/**
37+
* This data struct joins Initial Peers Participant Configuration features
38+
*/
39+
struct InitialPeersParticipantConfiguration : public SimpleParticipantConfiguration
40+
{
41+
42+
/////////////////////////
43+
// CONSTRUCTORS
44+
/////////////////////////
45+
46+
DDSROUTER_CORE_DllAPI InitialPeersParticipantConfiguration() = default;
47+
48+
DDSROUTER_CORE_DllAPI InitialPeersParticipantConfiguration(
49+
const types::ParticipantId& id,
50+
const types::ParticipantKind& kind,
51+
const bool is_repeater,
52+
const types::DomainId& domain_id,
53+
const std::set<types::Address>& listening_addresses,
54+
const std::set<types::Address>& connection_addresses,
55+
const types::security::TlsConfiguration tls_configuration);
56+
57+
/////////////////////////
58+
// METHODS
59+
/////////////////////////
60+
61+
DDSROUTER_CORE_DllAPI virtual bool is_valid(
62+
utils::Formatter& error_msg) const noexcept override;
63+
64+
DDSROUTER_CORE_DllAPI bool operator ==(
65+
const InitialPeersParticipantConfiguration& other) const noexcept;
66+
67+
/////////////////////////
68+
// VARIABLES
69+
/////////////////////////
70+
71+
std::set<types::Address> listening_addresses = {};
72+
73+
std::set<types::Address> connection_addresses = {};
74+
75+
types::security::TlsConfiguration tls_configuration = types::security::TlsConfiguration();
76+
};
77+
78+
} /* namespace configuration */
79+
} /* namespace core */
80+
} /* namespace ddsrouter */
81+
} /* namespace eprosima */
82+
83+
#endif /* _DDSROUTERCORE_CONFIGURATION_PARTICIPANT_INITIALPEERSPARTICIPANTCONFIGURATION_HPP_ */

ddsrouter_core/include/ddsrouter_core/configuration/participant/ParticipantConfiguration.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ struct ParticipantConfiguration : public BaseConfiguration
4040

4141
DDSROUTER_CORE_DllAPI ParticipantConfiguration(
4242
const types::ParticipantId& id,
43-
const types::ParticipantKind& kind) noexcept;
43+
const types::ParticipantKind& kind,
44+
const bool is_repeater) noexcept;
4445

4546
/////////////////////////
4647
// METHODS
@@ -58,15 +59,14 @@ struct ParticipantConfiguration : public BaseConfiguration
5859
DDSROUTER_CORE_DllAPI virtual bool is_valid(
5960
utils::Formatter& error_msg) const noexcept override;
6061

61-
/////////////////////////
62-
// VARIABLES
63-
/////////////////////////
64-
6562
//! Participant Id associated with this configuration
6663
types::ParticipantId id;
6764

6865
//! Participant Kind of the Participant that this configuration refers.
6966
types::ParticipantKind kind;
67+
68+
//! Whether this Participant should connect its readers with its writers.
69+
bool is_repeater = false;
7070
};
7171

7272
} /* namespace configuration */

ddsrouter_core/include/ddsrouter_core/configuration/participant/SimpleParticipantConfiguration.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct SimpleParticipantConfiguration : public ParticipantConfiguration
4343
DDSROUTER_CORE_DllAPI SimpleParticipantConfiguration(
4444
const types::ParticipantId& id,
4545
const types::ParticipantKind& kind,
46+
const bool is_repeater,
4647
const types::DomainId& domain_id) noexcept;
4748

4849
/////////////////////////

ddsrouter_core/include/ddsrouter_core/types/address/Address.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class Address
140140
DDSROUTER_CORE_DllAPI bool is_ipv6() const noexcept;
141141

142142
//! Get FastDDS Locator kind
143-
DDSROUTER_CORE_DllAPI LocatorType get_locator_kind() noexcept;
143+
DDSROUTER_CORE_DllAPI LocatorType get_locator_kind() const noexcept;
144144

145145
/**
146146
* @brief Whether the address is correct

ddsrouter_core/include/ddsrouter_core/types/participant/ParticipantKind.hpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ enum class ParticipantKind : ParticipantKindType
3838
echo, //! Echo Participant Kind
3939
dummy, //! Dummy Participant Kind
4040
simple_rtps, //! Simple RTPS Participant Kind
41-
local_discovery_server, //! Discovery Server RTPS UDP Participant Kind
42-
wan, //! Discovery Server RTPS TCP Participant Kind
41+
local_discovery_server, //! Discovery Server RTPS Participant Kind
42+
wan_discovery_server, //! Discovery Server Inter Router Participant Kind
43+
wan_initial_peers, //! Initial Peers Inter Router Participant Kind
4344
};
4445

45-
static constexpr unsigned PARTICIPANT_KIND_COUNT = 7;
46+
static constexpr unsigned PARTICIPANT_KIND_COUNT = 8;
4647

4748
/**
4849
* @brief All ParticipantKind enum values as a std::array.
@@ -54,7 +55,8 @@ constexpr std::array<ParticipantKind, PARTICIPANT_KIND_COUNT> ALL_PARTICIPANT_KI
5455
ParticipantKind::dummy,
5556
ParticipantKind::simple_rtps,
5657
ParticipantKind::local_discovery_server,
57-
ParticipantKind::wan
58+
ParticipantKind::wan_discovery_server,
59+
ParticipantKind::wan_initial_peers,
5860
};
5961

6062
/**
@@ -67,17 +69,19 @@ constexpr std::array<ParticipantKind, PARTICIPANT_KIND_COUNT - 1> ALL_VALID_PART
6769
ParticipantKind::dummy,
6870
ParticipantKind::simple_rtps,
6971
ParticipantKind::local_discovery_server,
70-
ParticipantKind::wan
72+
ParticipantKind::wan_discovery_server,
73+
ParticipantKind::wan_initial_peers,
7174
};
7275

7376
constexpr std::array<const char*, PARTICIPANT_KIND_COUNT> PARTICIPANT_KIND_STRINGS = {
7477
"invalid",
7578
"blank",
7679
"echo",
7780
"dummy",
78-
"simple_rtps",
79-
"local_discovery_server",
80-
"wan",
81+
"simple-rtps",
82+
"local-discovery-server",
83+
"wan-ds",
84+
"wan-initial-peers",
8185
};
8286

8387
static constexpr unsigned MAX_PARTICIPANT_KIND_ALIASES = 4;
@@ -94,7 +98,8 @@ constexpr std::array<ParticipantKindAliasesType, PARTICIPANT_KIND_COUNT> PARTICI
9498
ParticipantKindAliasesType({"dummy", "", "", ""}),
9599
ParticipantKindAliasesType({"local", "simple", "", ""}),
96100
ParticipantKindAliasesType({"discovery-server", "ds", "local-ds", "local-discovery-server"}),
97-
ParticipantKindAliasesType({"wan", "router", "", ""}),
101+
ParticipantKindAliasesType({"wan-ds", "wan-discovery-server", "", ""}),
102+
ParticipantKindAliasesType({"wan", "router", "initial-peers", ""}),
98103
};
99104

100105
DDSROUTER_CORE_DllAPI std::ostream& operator <<(

ddsrouter_core/include/ddsrouter_core/types/security/tls/TlsConfiguration.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#define _DDSROUTERCORE_SECURITY_TLS_TLSCONFIGURATION_HPP_
2121

2222
#include <string>
23+
#include <memory>
24+
25+
#include <fastdds/rtps/transport/TCPTransportDescriptor.h>
2326

2427
#include <ddsrouter_core/library/library_dll.h>
2528

@@ -152,6 +155,20 @@ class TlsConfiguration
152155
*/
153156
DDSROUTER_CORE_DllAPI const std::string& dh_params_file() const;
154157

158+
//! Activate TLS configuration in a TCP transport descriptor
159+
DDSROUTER_CORE_DllAPI void enable_tls(
160+
std::shared_ptr<eprosima::fastdds::rtps::TCPTransportDescriptor> descriptor,
161+
bool client = false) const;
162+
163+
//! Activate TLS client configuration in a TCP transport descriptor
164+
DDSROUTER_CORE_DllAPI void enable_tls_client(
165+
std::shared_ptr<eprosima::fastdds::rtps::TCPTransportDescriptor> descriptor,
166+
bool only_client) const;
167+
168+
//! Activate TLS server configuration in a TCP transport descriptor
169+
DDSROUTER_CORE_DllAPI void enable_tls_server(
170+
std::shared_ptr<eprosima::fastdds::rtps::TCPTransportDescriptor> descriptor) const;
171+
155172
private:
156173

157174
//! Internal throwing check

ddsrouter_core/src/cpp/communication/Bridge.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ Bridge::Bridge(
5757
std::map<ParticipantId, std::shared_ptr<IWriter>> writers_except_one =
5858
writers_; // Create a copy of the map
5959

60-
// Get this Track source participant before removing it from map
61-
writers_except_one.erase(id); // TODO: check if this element is removed in erase or if source is still valid
60+
if (!participants_->get_participant(id)->is_repeater())
61+
{
62+
// Remove this Track source participant because it is not repeater
63+
writers_except_one.erase(id);
64+
65+
logDebug(
66+
DDSROUTER_BRIDGE,
67+
"Not adding own Writer to Track in " << *this << " in Participant " << id << ".");
68+
}
6269

6370
// This insert is required as there is no copy method for Track
6471
// Tracks are always created disabled and then enabled with Bridge enable() method

ddsrouter_core/src/cpp/communication/Track.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ void Track::transmit_() noexcept
220220
// Send data through writers
221221
for (auto& writer_it : writers_)
222222
{
223+
logDebug(
224+
DDSROUTER_TRACK,
225+
"Forwarding data to writer " << writer_it.first << ".");
226+
223227
ret = writer_it.second->write(data);
224228

225229
if (!ret)

0 commit comments

Comments
 (0)