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

[20629] GUIDLess Discovery Server #4716

Merged
merged 51 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7831871
Refs #20629: Spelling
cferreiragonz Mar 22, 2024
496f3ac
Refs #20629: Random GUID function
cferreiragonz Mar 22, 2024
9f4c58b
Refs #20629: Update CLI for GUID_LESS DS when no server_id is provided
cferreiragonz Mar 21, 2024
f292f1b
Refs #20629: Improve CLI
cferreiragonz Apr 4, 2024
f18377c
Refs #20629: GUID less env.var.
cferreiragonz Apr 4, 2024
c15f0a6
Refs #20629: Turn servers_ into vector so it is modifyable
cferreiragonz Mar 26, 2024
d6690a0
Refs #20629: Check participant type from ParameterPropertyList
cferreiragonz Apr 1, 2024
8ce59b3
Refs #20629: Refactor PDPClient
cferreiragonz Apr 5, 2024
cb08aba
Refs #20629: Refactor PDPServer
cferreiragonz Apr 5, 2024
1675e01
Refs #20629: Send Data(p) of servers to create a mesh topology
cferreiragonz Apr 5, 2024
2daf24e
Refs #20629: Do not send Data(p) of remote clients
cferreiragonz Apr 5, 2024
b5dcd4a
Refs #20629: Update Servers' ping routine
cferreiragonz Apr 8, 2024
c9daac5
Refs #20629: Refactor update_attributes
cferreiragonz Apr 8, 2024
b79ce66
Refs #20629: Avoid trying to create extra resources
cferreiragonz Apr 8, 2024
9f82421
Refs #20629: Support match with security
cferreiragonz Apr 8, 2024
476f29d
Refs #20629: Modify DS example to work wo/ GUID
cferreiragonz Apr 9, 2024
b1419ea
Refs #20629: Use LocatorList for remote servers
cferreiragonz Apr 10, 2024
2acdc9b
Refs #20629: Use LocatorList for remote servers - XML
cferreiragonz Apr 10, 2024
98348e1
Refs #20629: Use LocatorList for remote servers - TESTS
cferreiragonz Apr 10, 2024
bf2d9df
Refs #20629: Avoid deleting direct servers senders resources
cferreiragonz Apr 10, 2024
007df1c
Refs #20629: Fix tsan
cferreiragonz Apr 12, 2024
9fe3e9b
Refs #20629: Add server pdp to queue on client match
cferreiragonz Apr 12, 2024
cac1ddb
Refs #20629: Avoid sending non-direct client Data(Uw|Ur)
cferreiragonz Apr 17, 2024
235bf94
Refs #20629: Change Warning into Info
cferreiragonz Apr 22, 2024
d69e2e6
Refs #20629: Protect assign during backup
cferreiragonz Apr 18, 2024
4026780
Refs #20629: Use Participant Type in PDPServerListener
cferreiragonz Apr 18, 2024
257bb64
Refs #20629: Match EDP of SUPERCLIENTS too
cferreiragonz Apr 18, 2024
80d0ca6
Refs #20629: Avoid Warning when using dns with env_var
cferreiragonz Apr 18, 2024
e371215
Refs #20629: Uncrustify
cferreiragonz Apr 23, 2024
405c391
Refs #20629: Ping always Remote_servers and initial ping after list u…
cferreiragonz Apr 23, 2024
a5a9f53
Refs #20629: Avoid SC matching with remote servers
cferreiragonz Apr 26, 2024
a536341
Refs #20629: Fix windows build
cferreiragonz Apr 26, 2024
65fbb51
Refs #20629: Fix Mac test and improve Inconsistent test
cferreiragonz Apr 29, 2024
89f1bb3
Refs #20629: Match EDP with virtual EDP of SC
cferreiragonz May 6, 2024
a18d03b
Refs #20629: Protect servers list
cferreiragonz May 6, 2024
073775c
Refs #20629: Protect pdp_to_send
cferreiragonz May 9, 2024
fe27066
Refs #20629: Refactor RTPSParticipantImpl constructor.
MiguelCompany Jun 13, 2024
a58b88e
Refs #20629: Revision - Doxygen and comments
cferreiragonz Jun 14, 2024
ef4805d
Refs #20629: Revision - major changes
cferreiragonz Jun 14, 2024
169f889
Refs #20629: Rebase
cferreiragonz Jun 20, 2024
26d3908
Refs #20629: Review - Make ServerAttributes private
cferreiragonz Jun 20, 2024
76df1d1
Refs #20629: Minor fix after rebase
cferreiragonz Jun 21, 2024
c929f0e
Refs #20629: Fix security DS
cferreiragonz Jun 21, 2024
dbce053
Refs #20629: Review 2 - Minor fixes
cferreiragonz Jun 26, 2024
b1a3907
Refs #20629: Use new locator_entry method
cferreiragonz Jun 26, 2024
212f2ea
Refs #20629: Move ServerAttributes implementation
cferreiragonz Jun 27, 2024
2ff4ac6
Refs #20629: Move ServerClientEnvironment tests to unittests & fix di…
cferreiragonz Jun 27, 2024
688cd0f
Refs #20629: Fix mac & windows builds
cferreiragonz Jun 28, 2024
8b47631
Refs #20629: Review 3
cferreiragonz Jul 1, 2024
54fea8d
Refs #20629: Add server only in assignRemoteEndpoints
cferreiragonz Jul 2, 2024
e05645b
Refs #20629: Add versions.md
cferreiragonz Jul 3, 2024
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 @@ -62,7 +62,6 @@ bool HelloWorldPublisher::init(
const std::string& topic_name,
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport)
{
hello_.index(0);
Expand Down Expand Up @@ -142,7 +141,14 @@ bool HelloWorldPublisher::init(

server_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
if (eprosima::fastdds::rtps::IPLocator::isIPv6(ip_server_address))
{
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
}
else
{
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, "::1");
}
break;
}

Expand All @@ -154,15 +160,8 @@ bool HelloWorldPublisher::init(
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastdds::rtps::DiscoveryProtocol::CLIENT;

// Set SERVER's GUID prefix
RemoteServerAttributes remote_server_att;
remote_server_att.guidPrefix = get_discovery_server_guid_from_id(server_id);

// Set SERVER's listening locator for PDP
remote_server_att.metatrafficUnicastLocatorList.push_back(server_locator);

// Add remote SERVER to CLIENT's list of SERVERs
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(remote_server_att);
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(server_locator);

// Add descriptor
pqos.transport().user_transports.push_back(descriptor);
Expand All @@ -179,7 +178,6 @@ bool HelloWorldPublisher::init(
"Publisher Participant " << pqos.name() <<
" created with GUID " << participant_->guid() <<
" connecting to server <" << server_locator << "> " <<
" with Guid: <" << remote_server_att.guidPrefix << "> " <<
std::endl;

// REGISTER THE TYPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class HelloWorldPublisher
const std::string& topic_name,
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport);

//! Publish a sample
Expand Down
28 changes: 11 additions & 17 deletions examples/cpp/dds/DiscoveryServerExample/DiscoveryServerServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ void DiscoveryServer::stop()
bool DiscoveryServer::init(
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport,
bool has_connection_server,
const std::string& connection_server_address,
unsigned short connection_server_port,
unsigned short connection_server_id)
unsigned short connection_server_port)
{
DomainParticipantQos pqos;
pqos.name("DS-Server");
Expand Down Expand Up @@ -163,7 +161,14 @@ bool DiscoveryServer::init(

listening_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastdds::rtps::IPLocator::setLogicalPort(listening_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
if (eprosima::fastdds::rtps::IPLocator::isIPv6(ip_listening_address))
{
eprosima::fastdds::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
}
else
{
eprosima::fastdds::rtps::IPLocator::setIPv6(listening_locator, "::1");
}
connection_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastdds::rtps::IPLocator::setIPv6(connection_locator, ip_connection_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(connection_locator, connection_server_port);
Expand All @@ -181,27 +186,17 @@ bool DiscoveryServer::init(
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastdds::rtps::DiscoveryProtocol::SERVER;

// Set SERVER's GUID prefix
pqos.wire_protocol().prefix = get_discovery_server_guid_from_id(server_id);

// Set SERVER's listening locator for PDP
pqos.wire_protocol().builtin.metatrafficUnicastLocatorList.push_back(listening_locator);

///////////////////////////////
// Configure Connection address
///////////////////////////////

RemoteServerAttributes remote_server_att;
if (has_connection_server)
{
// Set SERVER's GUID prefix
remote_server_att.guidPrefix = get_discovery_server_guid_from_id(connection_server_id);

// Set SERVER's listening locator for PDP
remote_server_att.metatrafficUnicastLocatorList.push_back(connection_locator);

// Add remote SERVER to CLIENT's list of SERVERs
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(remote_server_att);
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(connection_locator);
}


Expand All @@ -224,8 +219,7 @@ bool DiscoveryServer::init(
"Server Participant " << pqos.name() <<
" created with GUID " << participant_->guid() <<
" listening in address <" << listening_locator << "> " <<
" connecting with Discovery Server <" << remote_server_att.guidPrefix << "> "
" with address <" << connection_locator << "> " <<
" connecting with Discovery Server <" << connection_locator << "> " <<
std::endl;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ class DiscoveryServer
bool init(
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport,
bool has_connection_server,
const std::string& connection_server_address,
unsigned short connection_server_port,
unsigned short connection_server_id);
unsigned short connection_server_port);

//! Run
void run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ bool HelloWorldSubscriber::init(
uint32_t max_messages,
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport)
{
DomainParticipantQos pqos;
Expand Down Expand Up @@ -145,7 +144,14 @@ bool HelloWorldSubscriber::init(

server_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
if (eprosima::fastdds::rtps::IPLocator::isIPv6(ip_server_address))
{
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
}
else
{
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, "::1");
}
break;
}

Expand All @@ -157,15 +163,8 @@ bool HelloWorldSubscriber::init(
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastdds::rtps::DiscoveryProtocol::CLIENT;

// Set SERVER's GUID prefix
RemoteServerAttributes remote_server_att;
remote_server_att.guidPrefix = get_discovery_server_guid_from_id(server_id);

// Set SERVER's listening locator for PDP
remote_server_att.metatrafficUnicastLocatorList.push_back(server_locator);

// Add remote SERVER to CLIENT's list of SERVERs
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(remote_server_att);
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(server_locator);

// Add descriptor
pqos.transport().user_transports.push_back(descriptor);
Expand All @@ -183,7 +182,6 @@ bool HelloWorldSubscriber::init(
"Subscriber Participant " << pqos.name() <<
" created with GUID " << participant_->guid() <<
" connecting to server <" << server_locator << "> " <<
" with Guid: <" << remote_server_att.guidPrefix << "> " <<
std::endl;

// REGISTER THE TYPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HelloWorldSubscriber
uint32_t max_messages,
const std::string& server_address,
unsigned short server_port,
unsigned short server_id,
TransportKind transport);

//! RUN the subscriber until number samples are received
Expand Down
33 changes: 3 additions & 30 deletions examples/cpp/dds/DiscoveryServerExample/DiscoveryServer_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ int main(
// Discovery Server connection
std::string connection_address = "127.0.0.1"; // default ip address
uint16_t connection_port = 16166; // default physical port
uint16_t connection_ds_id = 0; // default DS id
bool id_ds_set = false;

// Discovery Server listening
std::string listening_address = "127.0.0.1"; // default ip address
uint16_t listening_port = 16166; // default physical port
uint16_t listening_ds_id = 0; // default DS id
uint32_t timeout = 0; // default DS id

if (argc > 1)
Expand Down Expand Up @@ -190,16 +188,13 @@ int main(
}

case optionIndex::CONNECTION_PORT:
id_ds_set = true;
connection_port = static_cast<uint16_t>(strtol(opt.arg, nullptr, 10));
break;

case optionIndex::CONNECTION_ADDRESS:
connection_address = opt.arg;
break;

case optionIndex::CONNECTION_DISCOVERY_SERVER_ID:
id_ds_set = true;
connection_ds_id = static_cast<uint16_t>(strtol(opt.arg, nullptr, 10));
connection_address = opt.arg;
break;

case optionIndex::LISTENING_PORT:
Expand All @@ -221,15 +216,6 @@ int main(

break;

case optionIndex::LISTENING_DISCOVERY_SERVER_ID:
if (type != EntityKind::SERVER)
{
print_warning("server", opt.name);
break;
}
listening_ds_id = static_cast<uint16_t>(strtol(opt.arg, nullptr, 10));
break;

case optionIndex::TIMEOUT:
if (type != EntityKind::SERVER)
{
Expand Down Expand Up @@ -268,15 +254,6 @@ int main(
// return 1;
// }

// Check that a DS has not same id itself and connection
if (id_ds_set && type == EntityKind::SERVER && listening_ds_id == connection_ds_id)
{
std::cerr << "ERROR: Discovery Servers ids must be different, "
<< " cannot connect to a server with same id " << listening_ds_id << std::endl;
option::printUsage(fwrite, stdout, usage, columns);
return 1;
}

// Check that a DS has not same ip and port in listening and connection
if (id_ds_set &&
type == EntityKind::SERVER &&
Expand All @@ -299,7 +276,6 @@ int main(
topic_name,
connection_address,
connection_port,
connection_ds_id,
transport))
{
mypub.run(static_cast<uint32_t>(count), static_cast<uint32_t>(sleep));
Expand All @@ -319,7 +295,6 @@ int main(
static_cast<uint32_t>(count),
connection_address,
connection_port,
connection_ds_id,
transport))
{
mysub.run(static_cast<uint32_t>(count));
Expand All @@ -337,12 +312,10 @@ int main(
if (myserver.init(
listening_address,
listening_port,
listening_ds_id,
transport,
id_ds_set,
connection_address,
connection_port,
connection_ds_id))
connection_port))
{
myserver.run(timeout);
}
Expand Down
13 changes: 0 additions & 13 deletions examples/cpp/dds/DiscoveryServerExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ Publisher options:
Server listening port (Default port: 16166).
--transport=<udpv4|udpv6|tcpv4|tcpv6>
Use Transport Protocol [udpv4|udpv6|tcpv4|tcpv6] (Default: udpv4).
-d <num> --connection-discovery-server-id <num>
Id of the Discovery Server to connect with. GUID will be
calculated from id (Default: 0).

Subscriber options:
-t <topic_name> --topic=<topic_name>
Expand All @@ -51,16 +48,10 @@ Subscriber options:
Server listening port (Default port: 16166).
--transport=<udpv4|udpv6|tcpv4|tcpv6>
Use Transport Protocol [udpv4|udpv6|tcpv4|tcpv6] (Default: udpv4).
-d <num> --connection-discovery-server-id <num>
Id of the Discovery Server to connect with. GUID will be
calculated from id (Default: 0).

DiscoveryServer options:
--listening-address=<IPaddress>
Server address (Default address: 127.0.0.1).
--id=<num>
Id of this Discovery Server.
GUID will be calculated from id (Default: 0).
--listening-port=<num>
Server listening port (Default port: 16166).
--transport=<udpv4|udpv6|tcpv4|tcpv6>
Expand All @@ -69,10 +60,6 @@ DiscoveryServer options:
Server address (Default address: 127.0.0.1).
-p <num> --connection-port=<num>
Server listening port (Default port: 16166).
-d <num> --connection-discovery-server-id <num>
Id of the Discovery Server to connect with. GUID will be
calculated from id (if not set, this DS will not connect
to other server).
-z <num> --timeout <num>
Number of seconds before finish the process (Default: 0 = till ^C).
```
Loading
Loading