20#ifndef FASTDDS_RTPS_TRANSPORT__TRANSPORTINTERFACE_HPP
21#define FASTDDS_RTPS_TRANSPORT__TRANSPORTINTERFACE_HPP
26#include <fastdds/rtps/attributes/PropertyPolicy.hpp>
27#include <fastdds/rtps/common/Locator.hpp>
28#include <fastdds/rtps/common/LocatorList.hpp>
29#include <fastdds/rtps/common/LocatorSelector.hpp>
30#include <fastdds/rtps/common/LocatorSelectorEntry.hpp>
31#include <fastdds/rtps/common/LocatorWithMask.hpp>
32#include <fastdds/rtps/common/PortParameters.hpp>
33#include <fastdds/rtps/transport/network/AllowedNetworkInterface.hpp>
34#include <fastdds/rtps/transport/network/NetmaskFilterKind.hpp>
35#include <fastdds/rtps/transport/SenderResource.hpp>
36#include <fastdds/rtps/transport/TransportDescriptorInterface.hpp>
37#include <fastdds/rtps/transport/TransportReceiverInterface.hpp>
53using NetmaskFilterInfo = std::pair<NetmaskFilterKind, std::vector<AllowedNetworkInterface>>;
103 const uint32_t& max_msg_size_no_frag = 0) = 0;
133 const Locator& remote)
const = 0;
150 (void)remote_locator;
151 (void)result_locator;
224 const Locator& locator)
const = 0;
236 uint32_t metatraffic_multicast_port)
const = 0;
241 uint32_t metatraffic_unicast_port)
const = 0;
246 uint32_t unicast_port)
const = 0;
251 uint32_t metatraffic_multicast_port)
const = 0;
256 uint32_t metatraffic_unicast_port)
const = 0;
268 uint32_t well_known_port)
const = 0;
292 return transport_kind_;
311 bool allowed_remote_localhost,
312 bool allowed_local_localhost)
const
314 static_cast<void>(allowed_remote_localhost);
315 static_cast<void>(allowed_local_localhost);
316 return transform_remote_locator(remote_locator, result_locator);
328 return {NetmaskFilterKind::AUTO, {}};
334 int32_t transport_kind)
335 : transport_kind_(transport_kind)
Class Locator_t, uniquely identifies a communication channel for a particular transport.
Definition Locator.hpp:71
Class LocatorList, a Locator vector that doesn't allow duplicates.
Definition LocatorList.hpp:97
A class used for the efficient selection of locators when sending data to multiple entities.
Definition LocatorSelector.hpp:55
Class PortParameters, to define the port parameters and gains related with the RTPS protocol.
Definition PortParameters.hpp:35
Definition PropertyPolicy.hpp:30
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition TransportInterface.hpp:64
virtual void shutdown()
Shutdown method to close the connections of the transports.
Definition TransportInterface.hpp:278
virtual bool is_local_locator(const Locator &locator) const =0
Must report whether the given locator is from the local host.
virtual bool is_locator_allowed(const Locator &) const =0
Must report whether the given locator is allowed by this transport.
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.
int32_t transport_kind_
Definition TransportInterface.hpp:339
virtual bool init(const fastdds::rtps::PropertyPolicy *properties=nullptr, const uint32_t &max_msg_size_no_frag=0)=0
Initialize 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 ...
virtual bool DoInputLocatorsMatch(const Locator &, const Locator &) const =0
Must report whether two locators map to the same internal channel.
virtual bool getDefaultMetatrafficUnicastLocators(LocatorList &locators, uint32_t metatraffic_unicast_port) const =0
Add metatraffic unicast locator with the given port.
virtual void AddDefaultOutputLocator(LocatorList &defaultList)=0
Add default output locator to the locator list.
virtual LocatorList NormalizeLocator(const Locator &locator)=0
Performs locator normalization (assign valid IP if not defined by user)
virtual bool IsInputChannelOpen(const Locator &) const =0
Must report whether the input channel associated to this locator is open.
virtual bool getDefaultUnicastLocators(LocatorList &locators, uint32_t unicast_port) const =0
Add unicast locator with the given port.
virtual bool is_localhost_allowed() const
Must report whether localhost locator is allowed.
Definition TransportInterface.hpp:320
TransportInterface(const TransportInterface &t)=delete
Copy constructor.
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 NetmaskFilterInfo netmask_filter_info() const
Returns netmask filter information (transport's netmask filter kind and allowlist)
Definition TransportInterface.hpp:326
virtual bool CloseInputChannel(const Locator &)=0
Must close the channel that maps to/from the given locator.
virtual bool OpenOutputChannel(SendResourceList &sender_resource_list, const Locator &)=0
Must open the channel that maps to/from the given locator.
virtual bool getDefaultMetatrafficMulticastLocators(LocatorList &locators, uint32_t metatraffic_multicast_port) const =0
Add metatraffic multicast locator with the given port.
TransportInterface(TransportInterface &&t)=delete
Move constructor.
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.
int32_t kind() const
Return the transport kind.
Definition TransportInterface.hpp:290
virtual bool fillUnicastLocator(Locator &locator, uint32_t well_known_port) const =0
Assign port to the given unicast locator if not already defined.
virtual ~TransportInterface()=default
Aside from the API defined here, an user-defined Transport must define a descriptor data type and a c...
virtual bool transform_remote_locator(const Locator &remote_locator, Locator &result_locator) const
Transforms a remote locator into a locator optimized for local communications.
Definition TransportInterface.hpp:146
virtual bool IsLocatorSupported(const Locator &) const =0
Must report whether the given locator is supported by this transport (typically inspecting its "kind"...
virtual bool OpenInputChannel(const Locator &, TransportReceiverInterface *, uint32_t)=0
Opens an input channel to receive incoming connections.
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 void update_network_interfaces()
Update network interfaces.
Definition TransportInterface.hpp:285
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.
Definition TransportInterface.hpp:308
virtual bool is_locator_reachable(const Locator_t &locator)=0
Must report whether the given locator is reachable by this transport.
TransportInterface(int32_t transport_kind)
Definition TransportInterface.hpp:333
virtual TransportDescriptorInterface * get_configuration()=0
Return the transport configuration (Transport Descriptor)
virtual uint32_t max_recv_buffer_size() const =0
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 void select_locators(fastdds::rtps::LocatorSelector &selector) const =0
Performs the locator selection algorithm for this transport.
Interface against which to implement a data receiver, decoupled from transport internals.
Definition TransportReceiverInterface.hpp:34
std::vector< std::unique_ptr< fastdds::rtps::SenderResource > > SendResourceList
Definition TransportInterface.hpp:52
std::pair< int32_t, NetmaskFilterInfo > TransportNetmaskFilterInfo
Definition TransportInterface.hpp:54
constexpr uint32_t s_maximumMessageSize
Default maximum message size.
Definition TransportInterface.hpp:44
static const std::string s_IPv6AddressAny
Default IPv6 address.
Definition TransportInterface.hpp:50
constexpr uint32_t s_maximumInitialPeersRange
Default maximum initial peers range.
Definition TransportInterface.hpp:46
static const std::string s_IPv4AddressAny
Default IPv4 address.
Definition TransportInterface.hpp:48
std::pair< NetmaskFilterKind, std::vector< AllowedNetworkInterface > > NetmaskFilterInfo
Definition TransportInterface.hpp:53
An entry for the LocatorSelector.
Definition LocatorSelectorEntry.hpp:39
Virtual base class for the data type used to define transport configuration.
Definition TransportDescriptorInterface.hpp:48