15.11. Dynamic network interfaces
DDS Simple Discovery relies on well-known multicast addresses and ports to relay the Participant announcement messages (see Discovery phases). Such Participant announcement includes information about the unicast address-port pairs (a.k.a locators) where the Participant is expecting to receive incoming metatraffic data. The list with these unicast locators is automatically initialized taking into account the network interfaces that are available when the Fast DDS DomainParticipant is enabled. Consequently, any network interface that is added after enabling the DomainParticipant should be notified to Fast DDS in order to initialize an unicast locator in said network, so communication can be established over that new interface.
15.11.1. Dynamic network interface addition at run-time
In case that the user wants to include new network interfaces at run-time, some prerequisites have to be fulfilled. Then, once the interfaces are available, the user may notify Fast DDS so these interfaces are also used in the communication.
15.11.1.1. Prerequisites
This feature is intended to be used when Fast DDS automatically sets the listening unicast locators.
Consequently, both metatrafficUnicastLocatorList
and
metatrafficMulticastLocatorList
lists must be empty.
These attributes are set within the builtin member of wire_protocol()
contained in the
DomainParticipantQos
(please refer to DomainParticipantQos).
Note
Be aware of the remote locators’ collections limits set within the DomainParticipantQos (please refer to RemoteLocatorsAllocationAttributes). It is recommended to use the highest number of local addresses found on all the systems belonging to the same domain.
15.11.1.2. Notify Fast DDS
Once a new network interface has been enabled, Fast DDS has to be manually notified.
This is done calling DomainParticipant::set_qos()
.
The DomainParticipantQoS that is passed to the method can either change one of the mutable DomainParticipant QoS or
it can simply be the current DomainParticipant QoS (obtained with DomainParticipant::get_qos()
).
Using DomainParticipant::set_qos()
is the reason for the previous prerequisites: once the DomainParticipant is
enabled, there are several QoS policies that are immutable and cannot be changed at run-time.
WireProtocolConfigQos where the aforementioned lists are defined is among these immutable policies.
Find below a brief snippet of how to use this feature:
// Create the DomainParticipant
DomainParticipant* participant =
DomainParticipantFactory::get_instance()->create_participant(0, PARTICIPANT_QOS_DEFAULT);
if (nullptr == participant)
{
// Error
return;
}
// User application
// Notify Fast DDS a new network interface is available
participant->set_qos(PARTICIPANT_QOS_DEFAULT);
Important
This feature is still under development and only officially supported for UDPv4 Transport without whitelisting.