| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
TransportInterface Class Referenceabstract
eProsima Fast DDS API Reference » RTPS » Common Module. » Transport Module.

Interface against which to implement a transport layer, decoupled from Fast DDS internals. More...

`#include <TransportInterface.hpp>`

Inheritance diagram for TransportInterface:
[legend]

## Public Member Functions

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.
TransportInterface & | operator= (const TransportInterface &t)=delete
| Copy assignment.
| TransportInterface (TransportInterface &&t)=delete
| Move constructor.
TransportInterface & | operator= (TransportInterface &&t)=delete
| Move assignment.
virtual bool | init (const fastdds::rtps::PropertyPolicy *properties=nullptr, const uint32_t &max_msg_size_no_frag=0)=0
| Initialize this transport.
virtual bool | IsInputChannelOpen (const Locator &) const =0
| Must report whether the input channel associated to this locator is open.
virtual bool | IsLocatorSupported (const Locator &) const =0
| Must report whether the given locator is supported by this transport (typically inspecting its "kind" value).
virtual bool | is_locator_allowed (const Locator &) const =0
| Must report whether the given locator is allowed by this transport.
virtual bool | is_locator_reachable (const Locator_t &locator)=0
| Must report whether the given locator is reachable by this transport.
virtual Locator | RemoteToMainLocal (const Locator &remote) const =0
| Returns the locator describing the main (most general) channel that can write to the provided remote locator.
virtual bool | transform_remote_locator (const Locator &remote_locator, Locator &result_locator) const
| Transforms a remote locator into a locator optimized for local communications.
virtual bool | OpenOutputChannel (SendResourceList &sender_resource_list, const Locator &)=0
| Must open the channel that maps to/from the given locator.
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 bool | OpenInputChannel (const Locator &, TransportReceiverInterface *, uint32_t)=0
| Opens an input channel to receive incoming connections.
virtual bool | CloseInputChannel (const Locator &)=0
| Must close the channel that maps to/from the given locator.
virtual bool | DoInputLocatorsMatch (const Locator &, const Locator &) const =0
| Must report whether two locators map to the same internal channel.
virtual LocatorList | NormalizeLocator (const Locator &locator)=0
| Performs locator normalization (assign valid IP if not defined by user).
virtual void | select_locators (fastdds::rtps::LocatorSelector &selector) const =0
| Performs the locator selection algorithm for this transport.
virtual bool | is_local_locator (const Locator &locator) const =0
| Must report whether the given locator is from the local host.
virtual TransportDescriptorInterface * | get_configuration ()=0
| Return the transport configuration (Transport Descriptor).
virtual void | AddDefaultOutputLocator (LocatorList &defaultList)=0
| Add default output locator to the locator list.
virtual bool | getDefaultMetatrafficMulticastLocators (LocatorList &locators, uint32_t metatraffic_multicast_port) const =0
| Add metatraffic multicast locator with the given port.
virtual bool | getDefaultMetatrafficUnicastLocators (LocatorList &locators, uint32_t metatraffic_unicast_port) const =0
| Add metatraffic unicast locator with the given port.
virtual bool | getDefaultUnicastLocators (LocatorList &locators, uint32_t unicast_port) const =0
| Add unicast locator with the given port.
virtual bool | fillMetatrafficMulticastLocator (Locator &locator, uint32_t metatraffic_multicast_port) const =0
| Assign port to the given metatraffic multicast locator if not already defined.
virtual bool | fillMetatrafficUnicastLocator (Locator &locator, uint32_t metatraffic_unicast_port) const =0
| Assign port to the given metatraffic unicast locator if not already defined.
virtual bool | configureInitialPeerLocator (Locator &locator, const fastdds::rtps::PortParameters &port_params, uint32_t domainId, LocatorList &list) const =0
| Configure the initial peer locators list.
virtual bool | fillUnicastLocator (Locator &locator, uint32_t well_known_port) const =0
| Assign port to the given unicast locator if not already defined.
virtual uint32_t | max_recv_buffer_size () const =0
virtual void | shutdown ()
| Shutdown method to close the connections of the transports.
virtual void | update_network_interfaces ()
| Update network interfaces.
int32_t | kind () const
| Return the transport kind.
virtual bool | transform_remote_locator (const Locator &remote_locator, Locator &result_locator, bool allowed_remote_localhost, bool allowed_local_localhost) const
| Transforms a remote locator into a locator optimized for local communications.
virtual bool | is_localhost_allowed () const
| Must report whether localhost locator is allowed.
virtual NetmaskFilterInfo | netmask_filter_info () const
| Returns netmask filter information (transport's netmask filter kind and allowlist).

## Protected Member Functions

| TransportInterface (int32_t transport_kind)

## Protected Attributes

int32_t | transport_kind_

## Detailed Description

Interface against which to implement a transport layer, decoupled from Fast DDS internals.

TransportInterface expects the user to implement a logical equivalence between Locators and protocol-specific "channels". This equivalence can be narrowing: For instance in UDP/IP, a port would take the role of channel, and several different locators can map to the same port, and hence the same channel.

## Constructor & Destructor Documentation

## ◆ ~TransportInterface()

virtual ~TransportInterface | ( |  | ) |

virtual 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.

e.g:

class MyTransport: public: typedef struct { ... } MyTransportDescriptor; MyTransport(const MyTransportDescriptor&); ...

## ◆ TransportInterface() [1/3]

TransportInterface | ( | const TransportInterface & | t | ) |

delete

Copy constructor.

## ◆ TransportInterface() [2/3]

TransportInterface | ( | TransportInterface && | t | ) |

delete

Move constructor.

## ◆ TransportInterface() [3/3]

TransportInterface | ( | int32_t | transport_kind | ) |

inline protected

## Member Function Documentation

## ◆ AddDefaultOutputLocator()

virtual void AddDefaultOutputLocator | ( | LocatorList & | defaultList | ) |

pure virtual

Add default output locator to the locator list.

Implemented in ChainingTransport.

## ◆ CloseInputChannel()

virtual bool CloseInputChannel | ( | const Locator & |  | ) |

pure virtual

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.

Implemented in ChainingTransport.

## ◆ CloseOutputChannels()

virtual void CloseOutputChannels | ( | SendResourceList & | sender_resource_list,
|  | const fastdds::rtps::LocatorSelectorEntry & | locator_selector_entry )

virtual

Close the channel that maps to/from the given locator selector entry.

Parameters

  sender_resource_list | Participant's send resource list.
  locator_selector_entry | Locator selector entry with the remote entity locators.

## ◆ configureInitialPeerLocator()

virtual bool configureInitialPeerLocator | ( | Locator & | locator,
|  | const fastdds::rtps::PortParameters & | port_params,
|  | uint32_t | domainId,
|  | LocatorList & | list ) const

pure virtual

Configure the initial peer locators list.

Implemented in ChainingTransport.

## ◆ DoInputLocatorsMatch()

virtual bool DoInputLocatorsMatch | ( | const Locator & | ,
|  | const Locator & | ) const

pure virtual

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

Implemented in ChainingTransport.

## ◆ fillMetatrafficMulticastLocator()

virtual bool fillMetatrafficMulticastLocator | ( | Locator & | locator,
|  | uint32_t | metatraffic_multicast_port ) const

pure virtual

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

Implemented in ChainingTransport.

## ◆ fillMetatrafficUnicastLocator()

virtual bool fillMetatrafficUnicastLocator | ( | Locator & | locator,
|  | uint32_t | metatraffic_unicast_port ) const

pure virtual

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

Implemented in ChainingTransport.

## ◆ fillUnicastLocator()

virtual bool fillUnicastLocator | ( | Locator & | locator,
|  | uint32_t | well_known_port ) const

pure virtual

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

Implemented in ChainingTransport.

## ◆ get_configuration()

virtual TransportDescriptorInterface * get_configuration | ( |  | ) |

pure virtual

Return the transport configuration (Transport Descriptor).

## ◆ getDefaultMetatrafficMulticastLocators()

virtual bool getDefaultMetatrafficMulticastLocators | ( | LocatorList & | locators,
|  | uint32_t | metatraffic_multicast_port ) const

pure virtual

Add metatraffic multicast locator with the given port.

Implemented in ChainingTransport.

## ◆ getDefaultMetatrafficUnicastLocators()

virtual bool getDefaultMetatrafficUnicastLocators | ( | LocatorList & | locators,
|  | uint32_t | metatraffic_unicast_port ) const

pure virtual

Add metatraffic unicast locator with the given port.

Implemented in ChainingTransport.

## ◆ getDefaultUnicastLocators()

virtual bool getDefaultUnicastLocators | ( | LocatorList & | locators,
|  | uint32_t | unicast_port ) const

pure virtual

Add unicast locator with the given port.

Implemented in ChainingTransport.

## ◆ init()

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

pure virtual

Initialize this 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.

Implemented in ChainingTransport.

## ◆ is_local_locator()

virtual bool is_local_locator | ( | const Locator & | locator | ) | const

pure virtual

Must report whether the given locator is from the local host.

Implemented in ChainingTransport.

## ◆ is_localhost_allowed()

virtual bool is_localhost_allowed | ( |  | ) | const

inline virtual

Must report whether localhost locator is allowed.

Reimplemented in ChainingTransport.

## ◆ is_locator_allowed()

virtual bool is_locator_allowed | ( | const Locator & |  | ) | const

pure virtual

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

Implemented in ChainingTransport.

## ◆ is_locator_reachable()

virtual bool is_locator_reachable | ( | const Locator_t & | locator | ) |

pure virtual

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

Parameters

  [in] | locator | Locator for which the reachability is checked.

Returns
  true if the input locator is reachable by this transport, false otherwise.

Implemented in ChainingTransport.

## ◆ IsInputChannelOpen()

virtual bool IsInputChannelOpen | ( | const Locator & |  | ) | const

pure virtual

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.

Implemented in ChainingTransport.

## ◆ IsLocatorSupported()

virtual bool IsLocatorSupported | ( | const Locator & |  | ) | const

pure virtual

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

Implemented in ChainingTransport.

## ◆ kind()

int32_t kind | ( |  | ) | const

inline

Return the transport kind.

## ◆ max_recv_buffer_size()

virtual uint32_t max_recv_buffer_size | ( |  | ) | const

pure virtual

Returns
  The maximum datagram size for reception supported by the transport

Implemented in ChainingTransport.

## ◆ netmask_filter_info()

virtual NetmaskFilterInfo netmask_filter_info | ( |  | ) | const

inline virtual

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

Reimplemented in ChainingTransport.

## ◆ NormalizeLocator()

virtual LocatorList NormalizeLocator | ( | const Locator & | locator | ) |

pure virtual

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

Implemented in ChainingTransport.

## ◆ OpenInputChannel()

virtual bool OpenInputChannel | ( | const Locator & | ,
|  | TransportReceiverInterface * | ,
|  | uint32_t | )

pure virtual

Opens an input channel to receive incoming connections.

If there is an existing channel it registers the receiver interface.

Implemented in ChainingTransport.

## ◆ OpenOutputChannel()

virtual bool OpenOutputChannel | ( | SendResourceList & | sender_resource_list,
|  | const Locator & | )

pure virtual

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.

Implemented in ChainingTransport.

## ◆ OpenOutputChannels()

virtual bool OpenOutputChannels | ( | SendResourceList & | sender_resource_list,
|  | const fastdds::rtps::LocatorSelectorEntry & | locator_selector_entry )

virtual

Must open the channel that maps to/from the given locator selector entry.

This method must allocate, reserve and mark any resources that are needed for said channel.

Parameters

  sender_resource_list | Participant's send resource list.
  locator_selector_entry | Locator selector entry with the remote entity locators.

Returns
  true if the channel was correctly opened or if finding an already opened one.

## ◆ operator=() [1/2]

TransportInterface & operator= | ( | const TransportInterface & | t | ) |

delete

Copy assignment.

## ◆ operator=() [2/2]

TransportInterface & operator= | ( | TransportInterface && | t | ) |

delete

Move assignment.

## ◆ RemoteToMainLocal()

virtual Locator RemoteToMainLocal | ( | const Locator & | remote | ) | const

pure virtual

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

Implemented in ChainingTransport.

## ◆ select_locators()

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

pure virtual

Performs the locator selection algorithm for this transport.

It basically consists of the following steps

- selector.transport_starts is called
- transport handles the selection state of each locator
- if a locator from an entry is selected, selector.select is called for that entry

Parameters

  [in,out] | selector | Locator selector.

Implemented in ChainingTransport.

## ◆ shutdown()

virtual void shutdown | ( |  | ) |

inline virtual

Shutdown method to close the connections of the transports.

## ◆ transform_remote_locator() [1/2]

virtual bool transform_remote_locator | ( | const Locator & | remote_locator,
|  | Locator & | result_locator ) const

inline virtual

Transforms 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

  [in] | remote_locator | Locator to be converted.
  [out] | result_locator | Converted locator.

Returns
  false if the input locator is not supported/allowed by this transport, true otherwise.

Reimplemented in ChainingTransport.

## ◆ transform_remote_locator() [2/2]

virtual bool transform_remote_locator | ( | const Locator & | remote_locator,
|  | Locator & | result_locator,
|  | bool | allowed_remote_localhost,
|  | bool | allowed_local_localhost ) const

inline virtual

Transforms 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 if allowed by both local and remote transports.

Parameters

  [in] | remote_locator | Locator to be converted.
  [out] | result_locator | Converted locator.
  [in] | allowed_remote_localhost | Whether localhost is allowed (and hence used) in the remote transport.
  [in] | allowed_local_localhost | Whether localhost is allowed locally (by this or other transport).

Returns
  false if the input locator is not supported/allowed by this transport, true otherwise.

Reimplemented in ChainingTransport.

## ◆ update_network_interfaces()

virtual void update_network_interfaces | ( |  | ) |

inline virtual

Update network interfaces.

Reimplemented in ChainingTransport.

## Member Data Documentation

## ◆ transport_kind_

int32_t transport_kind_

protected

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

- include/fastdds/rtps/transport/TransportInterface.hpp