Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
ChainingTransport Class Referenceabstract

This is the base class for chaining adapter transports. More...

#include <ChainingTransport.hpp>

Inheritance diagram for ChainingTransport:

Public Member Functions

FASTDDS_EXPORTED_API ChainingTransport (const ChainingTransportDescriptor &t)
 Constructor.
 
virtual FASTDDS_EXPORTED_API ~ChainingTransport ()=default
 Destructor.
 
FASTDDS_EXPORTED_API bool init (const fastdds::rtps::PropertyPolicy *properties=nullptr, const uint32_t &max_msg_size_no_frag=0) override
 Initialize the low-level transport.
 
FASTDDS_EXPORTED_API bool IsInputChannelOpen (const fastdds::rtps::Locator_t &loc) const override
 Call the low-level transport IsInputChannelOpen().
 
FASTDDS_EXPORTED_API bool IsLocatorSupported (const fastdds::rtps::Locator_t &loc) const override
 Call the low-level transport IsLocatorSupported().
 
FASTDDS_EXPORTED_API fastdds::rtps::Locator_t RemoteToMainLocal (const fastdds::rtps::Locator_t &loc) const override
 Call the low-level transport RemoteToMainLocal().
 
FASTDDS_EXPORTED_API bool OpenInputChannel (const fastdds::rtps::Locator_t &loc, TransportReceiverInterface *receiver_interface, uint32_t max_message_size) override
 Call the low-level transport OpenInputChannel().
 
FASTDDS_EXPORTED_API bool OpenOutputChannel (SendResourceList &sender_resource_list, const fastdds::rtps::Locator_t &loc) override
 Call the low-level transport OpenOutputChannel().
 
FASTDDS_EXPORTED_API bool CloseInputChannel (const fastdds::rtps::Locator_t &loc) override
 Call the low-level transport CloseInputChannel().
 
FASTDDS_EXPORTED_API fastdds::rtps::LocatorList_t NormalizeLocator (const fastdds::rtps::Locator_t &locator) override
 Call the low-level transport NormalizeLocator().
 
FASTDDS_EXPORTED_API bool is_local_locator (const fastdds::rtps::Locator_t &locator) const override
 Call the low-level transport is_local_locator().
 
FASTDDS_EXPORTED_API bool is_localhost_allowed () const override
 Call the low-level transport is_localhost_allowed().
 
FASTDDS_EXPORTED_API NetmaskFilterInfo netmask_filter_info () const override
 Call the low-level transport netmask_filter_info().
 
FASTDDS_EXPORTED_API bool DoInputLocatorsMatch (const fastdds::rtps::Locator_t &locator_1, const fastdds::rtps::Locator_t &locator_2) const override
 Call the low-level transport DoInputLocatorsMatch().
 
FASTDDS_EXPORTED_API void select_locators (fastdds::rtps::LocatorSelector &selector) const override
 Call the low-level transport select_locators().
 
FASTDDS_EXPORTED_API void AddDefaultOutputLocator (fastdds::rtps::LocatorList_t &defaultList) override
 Call the low-level transport AddDefaultOutputLocator().
 
FASTDDS_EXPORTED_API bool getDefaultMetatrafficMulticastLocators (fastdds::rtps::LocatorList_t &locators, uint32_t metatraffic_multicast_port) const override
 Call the low-level transport getDefaultMetatrafficMulticastLocators().
 
FASTDDS_EXPORTED_API bool getDefaultMetatrafficUnicastLocators (fastdds::rtps::LocatorList_t &locators, uint32_t metatraffic_unicast_port) const override
 Call the low-level transport getDefaultMetatrafficUnicastLocators().
 
FASTDDS_EXPORTED_API bool getDefaultUnicastLocators (fastdds::rtps::LocatorList_t &locators, uint32_t unicast_port) const override
 Call the low-level transport getDefaultUnicastLocators().
 
FASTDDS_EXPORTED_API bool fillMetatrafficMulticastLocator (fastdds::rtps::Locator_t &locator, uint32_t metatraffic_multicast_port) const override
 Call the low-level transport fillMetatrafficMulticastLocator().
 
FASTDDS_EXPORTED_API bool fillMetatrafficUnicastLocator (fastdds::rtps::Locator_t &locator, uint32_t metatraffic_unicast_port) const override
 Call the low-level transport fillMetatrafficUnicastLocator().
 
FASTDDS_EXPORTED_API 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().
 
FASTDDS_EXPORTED_API bool fillUnicastLocator (fastdds::rtps::Locator_t &locator, uint32_t well_known_port) const override
 Call the low-level transport fillUnicastLocator().
 
FASTDDS_EXPORTED_API 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().
 
FASTDDS_EXPORTED_API uint32_t max_recv_buffer_size () const override
 Call the low-level transport max_recv_buffer_size().
 
virtual FASTDDS_EXPORTED_API 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.
 
virtual FASTDDS_EXPORTED_API 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.
 
FASTDDS_EXPORTED_API void update_network_interfaces () override
 Update network interfaces.
 
FASTDDS_EXPORTED_API 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().
 
FASTDDS_EXPORTED_API bool is_locator_allowed (const fastdds::rtps::Locator_t &locator) const override
 Call the low-level transport is_locator_allowed().
 
FASTDDS_EXPORTED_API bool is_locator_reachable (const fastdds::rtps::Locator_t &locator) override
 Call the low-level transport is_locator_reachable().
 
- Public Member Functions inherited from TransportInterface
virtual ~TransportInterface ()=default
 Aside from the API defined here, an user-defined Transport must define a descriptor data type and a constructor that expects a constant reference to such descriptor.
 
 TransportInterface (const TransportInterface &t)=delete
 Copy constructor.
 
TransportInterfaceoperator= (const TransportInterface &t)=delete
 Copy assignment.
 
 TransportInterface (TransportInterface &&t)=delete
 Move constructor.
 
TransportInterfaceoperator= (TransportInterface &&t)=delete
 Move assignment.
 
virtual bool OpenOutputChannels (SendResourceList &sender_resource_list, const fastdds::rtps::LocatorSelectorEntry &locator_selector_entry)
 Must open the channel that maps to/from the given locator selector entry.
 
virtual void CloseOutputChannels (SendResourceList &sender_resource_list, const fastdds::rtps::LocatorSelectorEntry &locator_selector_entry)
 Close the channel that maps to/from the given locator selector entry.
 
virtual TransportDescriptorInterfaceget_configuration ()=0
 Return the transport configuration (Transport Descriptor)
 
virtual void shutdown ()
 Shutdown method to close the connections of the transports.
 
int32_t kind () const
 Return the transport kind.
 

Protected Attributes

std::unique_ptr< TransportInterfacelow_level_transport_
 
- Protected Attributes inherited from TransportInterface
int32_t transport_kind_
 

Additional Inherited Members

- Protected Member Functions inherited from TransportInterface
 TransportInterface (int32_t transport_kind)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ChainingTransport()

FASTDDS_EXPORTED_API ChainingTransport ( const ChainingTransportDescriptor t)
inline

Constructor.

◆ ~ChainingTransport()

virtual FASTDDS_EXPORTED_API ~ChainingTransport ( )
virtualdefault

Destructor.

Member Function Documentation

◆ AddDefaultOutputLocator()

FASTDDS_EXPORTED_API void AddDefaultOutputLocator ( fastdds::rtps::LocatorList_t defaultList)
inlineoverridevirtual

Call the low-level transport AddDefaultOutputLocator().

Add default output locator to the locator list

Implements TransportInterface.

◆ CloseInputChannel()

FASTDDS_EXPORTED_API bool CloseInputChannel ( const fastdds::rtps::Locator_t loc)
inlineoverridevirtual

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.

Implements TransportInterface.

◆ configureInitialPeerLocator()

FASTDDS_EXPORTED_API bool configureInitialPeerLocator ( fastdds::rtps::Locator_t locator,
const fastdds::rtps::PortParameters port_params,
uint32_t  domainId,
fastdds::rtps::LocatorList_t list 
) const
inlineoverridevirtual

Call the low-level transport configureInitialPeerLocator().

Configure the initial peer locators list

Implements TransportInterface.

◆ DoInputLocatorsMatch()

FASTDDS_EXPORTED_API bool DoInputLocatorsMatch ( const fastdds::rtps::Locator_t locator_1,
const fastdds::rtps::Locator_t locator_2 
) const
inlineoverridevirtual

Call the low-level transport DoInputLocatorsMatch().

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

Implements TransportInterface.

◆ fillMetatrafficMulticastLocator()

FASTDDS_EXPORTED_API bool fillMetatrafficMulticastLocator ( fastdds::rtps::Locator_t locator,
uint32_t  metatraffic_multicast_port 
) const
inlineoverridevirtual

Call the low-level transport fillMetatrafficMulticastLocator().

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

Implements TransportInterface.

◆ fillMetatrafficUnicastLocator()

FASTDDS_EXPORTED_API bool fillMetatrafficUnicastLocator ( fastdds::rtps::Locator_t locator,
uint32_t  metatraffic_unicast_port 
) const
inlineoverridevirtual

Call the low-level transport fillMetatrafficUnicastLocator().

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

Implements TransportInterface.

◆ fillUnicastLocator()

FASTDDS_EXPORTED_API bool fillUnicastLocator ( fastdds::rtps::Locator_t locator,
uint32_t  well_known_port 
) const
inlineoverridevirtual

Call the low-level transport fillUnicastLocator().

Assign port to the given unicast locator if not already defined

Implements TransportInterface.

◆ getDefaultMetatrafficMulticastLocators()

FASTDDS_EXPORTED_API bool getDefaultMetatrafficMulticastLocators ( fastdds::rtps::LocatorList_t locators,
uint32_t  metatraffic_multicast_port 
) const
inlineoverridevirtual

Call the low-level transport getDefaultMetatrafficMulticastLocators().

Add metatraffic multicast locator with the given port

Implements TransportInterface.

◆ getDefaultMetatrafficUnicastLocators()

FASTDDS_EXPORTED_API bool getDefaultMetatrafficUnicastLocators ( fastdds::rtps::LocatorList_t locators,
uint32_t  metatraffic_unicast_port 
) const
inlineoverridevirtual

Call the low-level transport getDefaultMetatrafficUnicastLocators().

Add metatraffic unicast locator with the given port

Implements TransportInterface.

◆ getDefaultUnicastLocators()

FASTDDS_EXPORTED_API bool getDefaultUnicastLocators ( fastdds::rtps::LocatorList_t locators,
uint32_t  unicast_port 
) const
inlineoverridevirtual

Call the low-level transport getDefaultUnicastLocators().

Add unicast locator with the given port

Implements TransportInterface.

◆ init()

FASTDDS_EXPORTED_API bool init ( const fastdds::rtps::PropertyPolicy properties = nullptr,
const uint32_t &  max_msg_size_no_frag = 0 
)
inlineoverridevirtual

Initialize the low-level transport.

This method will prepare all the internals of the transport.

Parameters
propertiesOptional policy to specify additional parameters of the created transport.
max_msg_size_no_fragOptional maximum message size to avoid 65500 KB fragmentation limit.
Returns
True when the transport was correctly initialized.

Implements TransportInterface.

◆ is_local_locator()

FASTDDS_EXPORTED_API bool is_local_locator ( const fastdds::rtps::Locator_t locator) const
inlineoverridevirtual

Call the low-level transport is_local_locator().

Must report whether the given locator is from the local host

Implements TransportInterface.

◆ is_localhost_allowed()

FASTDDS_EXPORTED_API bool is_localhost_allowed ( ) const
inlineoverridevirtual

Call the low-level transport is_localhost_allowed().

Must report whether localhost locator is allowed

Reimplemented from TransportInterface.

◆ is_locator_allowed()

FASTDDS_EXPORTED_API bool is_locator_allowed ( const fastdds::rtps::Locator_t locator) const
inlineoverridevirtual

Call the low-level transport is_locator_allowed().

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

Implements TransportInterface.

◆ is_locator_reachable()

FASTDDS_EXPORTED_API bool is_locator_reachable ( const fastdds::rtps::Locator_t locator)
inlineoverridevirtual

Call the low-level transport is_locator_reachable().

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

Implements TransportInterface.

◆ IsInputChannelOpen()

FASTDDS_EXPORTED_API bool IsInputChannelOpen ( const fastdds::rtps::Locator_t loc) const
inlineoverridevirtual

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.

Implements TransportInterface.

◆ IsLocatorSupported()

FASTDDS_EXPORTED_API bool IsLocatorSupported ( const fastdds::rtps::Locator_t loc) const
inlineoverridevirtual

Call the low-level transport IsLocatorSupported().

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

Implements TransportInterface.

◆ max_recv_buffer_size()

FASTDDS_EXPORTED_API uint32_t max_recv_buffer_size ( ) const
inlineoverridevirtual

Call the low-level transport max_recv_buffer_size().

Returns
The maximum datagram size for reception supported by the transport

Implements TransportInterface.

◆ netmask_filter_info()

FASTDDS_EXPORTED_API NetmaskFilterInfo netmask_filter_info ( ) const
inlineoverridevirtual

Call the low-level transport netmask_filter_info().

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

Reimplemented from TransportInterface.

◆ NormalizeLocator()

FASTDDS_EXPORTED_API fastdds::rtps::LocatorList_t NormalizeLocator ( const fastdds::rtps::Locator_t locator)
inlineoverridevirtual

Call the low-level transport NormalizeLocator().

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

Implements TransportInterface.

◆ OpenInputChannel()

FASTDDS_EXPORTED_API bool OpenInputChannel ( const fastdds::rtps::Locator_t loc,
TransportReceiverInterface receiver_interface,
uint32_t  max_message_size 
)
overridevirtual

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.

Implements TransportInterface.

◆ OpenOutputChannel()

FASTDDS_EXPORTED_API bool OpenOutputChannel ( SendResourceList sender_resource_list,
const fastdds::rtps::Locator_t loc 
)
overridevirtual

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.

Implements TransportInterface.

◆ receive()

virtual FASTDDS_EXPORTED_API 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 
)
pure virtual

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_receiverNext resource receiver to be called.
receive_buffervector 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_sizeSize 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_locatorLocator mapping to the local channel we're listening to.
[out]remote_locatorLocator describing the remote destination we received a packet from.

◆ RemoteToMainLocal()

FASTDDS_EXPORTED_API fastdds::rtps::Locator_t RemoteToMainLocal ( const fastdds::rtps::Locator_t loc) const
inlineoverridevirtual

Call the low-level transport RemoteToMainLocal().

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

Implements TransportInterface.

◆ select_locators()

FASTDDS_EXPORTED_API void select_locators ( fastdds::rtps::LocatorSelector selector) const
inlineoverridevirtual

Call the low-level transport select_locators().

Performs the locator selection algorithm for this transport.

Implements TransportInterface.

◆ send()

virtual FASTDDS_EXPORTED_API 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 
)
pure virtual

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_resourceSenderResource generated by the lower transport.
buffersVector of buffers to send.
total_bytesLength 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_beginFirst iterator of the list of Locators describing the remote destinations we're sending to.
destination_locators_endEnd iterator of the list of Locators describing the remote destinations we're sending to.
timeoutMaximum blocking time.

◆ transform_remote_locator() [1/2]

FASTDDS_EXPORTED_API bool transform_remote_locator ( const fastdds::rtps::Locator_t remote_locator,
fastdds::rtps::Locator_t result_locator 
) const
inlineoverridevirtual

Call the low-level transport transform_remote_locator().

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

Reimplemented from TransportInterface.

◆ transform_remote_locator() [2/2]

FASTDDS_EXPORTED_API 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
inlineoverridevirtual

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.

Reimplemented from TransportInterface.

◆ update_network_interfaces()

FASTDDS_EXPORTED_API void update_network_interfaces ( )
inlineoverridevirtual

Update network interfaces.

Reimplemented from TransportInterface.

Member Data Documentation

◆ low_level_transport_

std::unique_ptr<TransportInterface> low_level_transport_
protected

The documentation for this class was generated from the following file: