18.3.2.2. ChainingTransport

class ChainingTransport : public eprosima::fastdds::rtps::TransportInterface

This is the base class for chaining adapter transports.

  • Directly proxies all operations except Send and Receive

  • Has a pointer to the low level transport

Public Functions

inline ChainingTransport(const ChainingTransportDescriptor &t)

Constructor.

virtual ~ChainingTransport() = default

Destructor.

inline virtual bool init(const fastdds::rtps::PropertyPolicy *properties = nullptr, const uint32_t &max_msg_size_no_frag = 0) override

Initialize the low-level transport.

This method will prepare all the internals of the transport.

Parameters:
  • properties – Optional policy to specify additional parameters of the created transport.

  • max_msg_size_no_frag – Optional maximum message size to avoid 65500 KB fragmentation limit.

Returns:

True when the transport was correctly initialized.

inline virtual bool IsInputChannelOpen(const fastdds::rtps::Locator_t &loc) const override

Call the low-level transport IsInputChannelOpen().

Must report whether the input channel associated to this locator is open. Channels must either be fully closed or fully open, so that “open” and “close” operations are whole and definitive.

inline virtual bool IsLocatorSupported(const fastdds::rtps::Locator_t &loc) const override

Call the low-level transport IsLocatorSupported().

Must report whether the given locator is supported by this transport (typically inspecting its “kind” value).

inline virtual fastdds::rtps::Locator_t RemoteToMainLocal(const fastdds::rtps::Locator_t &loc) const override

Call the low-level transport RemoteToMainLocal().

Returns the locator describing the main (most general) channel that can write to the provided remote locator.

virtual bool OpenInputChannel(const fastdds::rtps::Locator_t &loc, TransportReceiverInterface *receiver_interface, uint32_t max_message_size) override

Call the low-level transport OpenInputChannel().

Opens an input channel to receive incoming connections. If there is an existing channel it registers the receiver interface.

virtual bool OpenOutputChannel(SendResourceList &sender_resource_list, const fastdds::rtps::Locator_t &loc) override

Call the low-level transport OpenOutputChannel().

Must open the channel that maps to/from the given locator. This method must allocate, reserve and mark any resources that are needed for said channel.

inline virtual bool CloseInputChannel(const fastdds::rtps::Locator_t &loc) override

Call the low-level transport CloseInputChannel().

Must close the channel that maps to/from the given locator. IMPORTANT: It MUST be safe to call this method even during a Receive operation on another thread. You must implement any necessary mutual exclusion and timeout mechanisms to make sure the channel can be closed without damage.

inline virtual fastdds::rtps::LocatorList_t NormalizeLocator(const fastdds::rtps::Locator_t &locator) override

Call the low-level transport NormalizeLocator().

Performs locator normalization (assign valid IP if not defined by user)

inline virtual bool is_local_locator(const fastdds::rtps::Locator_t &locator) const override

Call the low-level transport is_local_locator().

Must report whether the given locator is from the local host

inline virtual bool is_localhost_allowed() const override

Call the low-level transport is_localhost_allowed().

Must report whether localhost locator is allowed

inline virtual NetmaskFilterInfo netmask_filter_info() const override

Call the low-level transport netmask_filter_info().

Returns netmask filter information (transport’s netmask filter kind and allowlist)

inline virtual bool DoInputLocatorsMatch(const fastdds::rtps::Locator_t &locator_1, const fastdds::rtps::Locator_t &locator_2) const override

Call the low-level transport DoInputLocatorsMatch().

Must report whether two locators map to the same internal channel.

inline virtual void select_locators(fastdds::rtps::LocatorSelector &selector) const override

Call the low-level transport select_locators().

Performs the locator selection algorithm for this transport.

inline virtual void AddDefaultOutputLocator(fastdds::rtps::LocatorList_t &defaultList) override

Call the low-level transport AddDefaultOutputLocator().

Add default output locator to the locator list

inline virtual bool getDefaultMetatrafficMulticastLocators(fastdds::rtps::LocatorList_t &locators, uint32_t metatraffic_multicast_port) const override

Call the low-level transport getDefaultMetatrafficMulticastLocators().

Add metatraffic multicast locator with the given port

inline virtual bool getDefaultMetatrafficUnicastLocators(fastdds::rtps::LocatorList_t &locators, uint32_t metatraffic_unicast_port) const override

Call the low-level transport getDefaultMetatrafficUnicastLocators().

Add metatraffic unicast locator with the given port

inline virtual bool getDefaultUnicastLocators(fastdds::rtps::LocatorList_t &locators, uint32_t unicast_port) const override

Call the low-level transport getDefaultUnicastLocators().

Add unicast locator with the given port

inline virtual bool fillMetatrafficMulticastLocator(fastdds::rtps::Locator_t &locator, uint32_t metatraffic_multicast_port) const override

Call the low-level transport fillMetatrafficMulticastLocator().

Assign port to the given metatraffic multicast locator if not already defined

inline virtual bool fillMetatrafficUnicastLocator(fastdds::rtps::Locator_t &locator, uint32_t metatraffic_unicast_port) const override

Call the low-level transport fillMetatrafficUnicastLocator().

Assign port to the given metatraffic unicast locator if not already defined

inline virtual bool configureInitialPeerLocator(fastdds::rtps::Locator_t &locator, const fastdds::rtps::PortParameters &port_params, uint32_t domainId, fastdds::rtps::LocatorList_t &list) const override

Call the low-level transport configureInitialPeerLocator().

Configure the initial peer locators list

inline virtual bool fillUnicastLocator(fastdds::rtps::Locator_t &locator, uint32_t well_known_port) const override

Call the low-level transport fillUnicastLocator().

Assign port to the given unicast locator if not already defined

inline virtual bool transform_remote_locator(const fastdds::rtps::Locator_t &remote_locator, fastdds::rtps::Locator_t &result_locator) const override

Call the low-level transport transform_remote_locator(). Transforms a remote locator into a locator optimized for local communications.

inline virtual uint32_t max_recv_buffer_size() const override

Call the low-level transport max_recv_buffer_size().

Returns:

The maximum datagram size for reception supported by the transport

virtual bool send(fastdds::rtps::SenderResource *low_sender_resource, const std::vector<NetworkBuffer> &buffers, uint32_t total_bytes, fastdds::rtps::LocatorsIterator *destination_locators_begin, fastdds::rtps::LocatorsIterator *destination_locators_end, const std::chrono::steady_clock::time_point &timeout) = 0

Blocking Send through the specified channel. It may perform operations on the output buffer. At the end the function must call to the low-level transport’s send() function.

// Example of calling the low-level transport `send()` function.
return low_sender_resource->send(buffers, total_bytes, destination_locators_begin,
            destination_locators_end, timeout);

Parameters:
  • low_sender_resource – SenderResource generated by the lower transport.

  • buffers – Vector of buffers to send.

  • total_bytes – Length of all buffers to be sent. Will be used as a boundary for the previous parameter. It must not exceed the sendBufferSize fed to this class during construction.

  • destination_locators_begin – First iterator of the list of Locators describing the remote destinations we’re sending to.

  • destination_locators_end – End iterator of the list of Locators describing the remote destinations we’re sending to.

  • timeout – Maximum blocking time.

virtual void receive(TransportReceiverInterface *next_receiver, const fastdds::rtps::octet *receive_buffer, uint32_t receive_buffer_size, const fastdds::rtps::Locator_t &local_locator, const fastdds::rtps::Locator_t &remote_locator) = 0

Blocking Receive from the specified channel.

It may perform operations on the input buffer. At the end the function must call to the next_receiver’s OnDataReceived function.

// Example of calling the `next_receiver`'s `OnDataReceived` function.
next_receiver->OnDataReceived(receive_buffer, receive_buffer_size, local_locator, remote_locator);

Parameters:
  • next_receiver – Next resource receiver to be called.

  • receive_buffer – vector with enough capacity (not size) to accommodate a full receive buffer. That capacity must not be less than the receiveBufferSize supplied to this class during construction.

  • receive_buffer_size – Size of the raw data. It will be used as bounds check for the previous argument. It must not exceed the receiveBufferSize fed to this class during construction.

  • local_locator – Locator mapping to the local channel we’re listening to.

  • remote_locator[out] Locator describing the remote destination we received a packet from.

inline virtual void update_network_interfaces() override

Update network interfaces.

inline virtual bool transform_remote_locator(const fastdds::rtps::Locator_t &remote_locator, fastdds::rtps::Locator_t &result_locator, bool allowed_remote_localhost, bool allowed_local_localhost) const override

Call the low-level transport transform_remote_locator(). Transforms a remote locator into a locator optimized for local communications, if allowed by both local and remote transports.

inline virtual bool is_locator_allowed(const fastdds::rtps::Locator_t &locator) const override

Call the low-level transport is_locator_allowed().

Must report whether the given locator is allowed by this transport.