Class NetworkFactory

Class Documentation

class NetworkFactory

Provides the FastRTPS library with abstract resources, which in turn manage the SEND and RECEIVE operations over some transport. Once a transport is registered, it becomes invisible to the library and is abstracted away for good.

Public Functions

NetworkFactory()
template<class T, class D>
inline void RegisterTransport(const D &descriptor)

Allow registration of a transport statically, by specifying the transport type and its associated descriptor type. This is particularly useful for user-defined transports.

bool RegisterTransport(const fastdds::rtps::TransportDescriptorInterface *descriptor, const fastrtps::rtps::PropertyPolicy *properties = nullptr)

Allow registration of a transport dynamically.

Parameters
  • descriptor – Structure that defines all initial configuration for a given transport.

  • properties – Optional policy to specify additional parameters for the created transport.

bool build_send_resources(fastdds::rtps::SendResourceList&, const Locator_t &locator)

Walk over the list of transports, opening every possible channel that can send through the given locator and returning a vector of Sender Resources associated with it.

Parameters

locator – Locator through which to send.

bool BuildReceiverResources(Locator_t &local, std::vector<std::shared_ptr<ReceiverResource>> &returned_resources_list, uint32_t receiver_max_message_size)

Walk over the list of transports, opening every possible channel that we can listen to from the given locator, and returns a vector of Receiver Resources for this goal.

Parameters
  • local – Locator from which to listen.

  • returned_resources_list – List that will be filled with the created ReceiverResources.

  • receiver_max_message_size – Max message size allowed by the message receiver.

void NormalizeLocators(LocatorList_t &locators)
bool transform_remote_locator(const Locator_t &remote_locator, Locator_t &result_locator) const

Transform a remote locator into a locator optimized for local communications.

If the remote locator corresponds to one of the local interfaces, it is converted to the corresponding local address.

Parameters
  • remote_locator[in] Locator to be converted.

  • result_locator[out] Converted locator.

Returns

false if the input locator is not supported/allowed by any of the registered transports, true otherwise.

void select_locators(LocatorSelector &selector) const

Perform the locator selection algorithm.

It basically consists of the following steps

  • selector.selection_start is called

  • the transport selection algorithm is called for each registered transport

Parameters

selector[inout] Locator selector.

bool is_local_locator(const Locator_t &locator) const
size_t numberOfRegisteredTransports() const
inline uint32_t get_max_message_size_between_transports() const
inline uint32_t get_min_send_buffer_size()
bool generate_locators(uint16_t physical_port, int locator_kind, LocatorList_t &ret_locators)

Fill ret_locators with the list of all possible locators in the local machine at the given physical_port of the locator_kind. Return if found any.

void GetDefaultOutputLocators(LocatorList_t &defaultLocators)

For each transport, ask for their default output locators.

bool getDefaultMetatrafficMulticastLocators(LocatorList_t &locators, uint32_t metatraffic_multicast_port) const

Add locators to the metatraffic multicast list.

bool getDefaultMetatrafficUnicastLocators(LocatorList_t &locators, uint32_t metatraffic_unicast_port) const

Add locators to the metatraffic unicast list.

bool fillMetatrafficMulticastLocator(Locator_t &locator, uint32_t metatraffic_multicast_port) const

Fill the locator with the metatraffic multicast configuration.

bool fillMetatrafficUnicastLocator(Locator_t &locator, uint32_t metatraffic_unicast_port) const

Fill the locator with the metatraffic unicast configuration.

bool configureInitialPeerLocator(uint32_t domain_id, Locator_t &locator, RTPSParticipantAttributes &m_att) const

Configure the locator with the initial peer configuration.

bool getDefaultUnicastLocators(uint32_t domain_id, LocatorList_t &locators, const RTPSParticipantAttributes &m_att) const

Add locators to the default unicast configuration.

bool fill_default_locator_port(uint32_t domain_id, Locator_t &locator, const RTPSParticipantAttributes &m_att, bool is_multicast) const

Fill the locator with the default unicast configuration.

void Shutdown()

Shutdown method to close the connections of the transports.

void update_network_interfaces()

Re-scan network interfaces