123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- #ifndef _FASTDDS_TRANSPORT_INTERFACE_H
- #define _FASTDDS_TRANSPORT_INTERFACE_H
- #include <memory>
- #include <vector>
- #include <fastdds/rtps/common/Locator.h>
- #include <fastdds/rtps/common/LocatorSelector.hpp>
- #include <fastdds/rtps/common/PortParameters.h>
- #include <fastdds/rtps/transport/TransportDescriptorInterface.h>
- #include <fastdds/rtps/transport/TransportReceiverInterface.h>
- #include <fastdds/rtps/network/SenderResource.h>
- namespace eprosima{
- namespace fastdds{
- namespace rtps{
- static const uint32_t s_maximumMessageSize = 65500;
- static const uint32_t s_maximumInitialPeersRange = 4;
- static const uint32_t s_minimumSocketBuffer = 65536;
- static const std::string s_IPv4AddressAny = "0.0.0.0";
- static const std::string s_IPv6AddressAny = "::";
- using SendResourceList = std::vector<std::unique_ptr<fastrtps::rtps::SenderResource>>;
- class ChannelResource;
- class TransportInterface
- {
- public:
-
- virtual ~TransportInterface() = default;
-
- virtual bool init() = 0;
-
- virtual bool IsInputChannelOpen(const fastrtps::rtps::Locator_t&) const = 0;
-
- virtual bool IsLocatorSupported(const fastrtps::rtps::Locator_t&) const = 0;
-
- virtual bool is_locator_allowed(const fastrtps::rtps::Locator_t&) const = 0;
-
- virtual fastrtps::rtps::Locator_t RemoteToMainLocal(const fastrtps::rtps::Locator_t& remote) const = 0;
-
- virtual bool transform_remote_locator(
- const fastrtps::rtps::Locator_t& remote_locator,
- fastrtps::rtps::Locator_t& result_locator) const
- {
- (void)remote_locator;
- (void)result_locator;
- return false;
- }
-
-
- virtual bool OpenOutputChannel(
- SendResourceList& sender_resource_list,
- const fastrtps::rtps::Locator_t&) = 0;
- virtual bool OpenInputChannel(
- const fastrtps::rtps::Locator_t&,
- TransportReceiverInterface*, uint32_t) = 0;
-
- virtual bool CloseInputChannel(const fastrtps::rtps::Locator_t&) = 0;
-
- virtual bool DoInputLocatorsMatch(const fastrtps::rtps::Locator_t&, const fastrtps::rtps::Locator_t&) const = 0;
- virtual fastrtps::rtps::LocatorList_t NormalizeLocator(const fastrtps::rtps::Locator_t& locator) = 0;
-
- virtual void select_locators(fastrtps::rtps::LocatorSelector& selector) const = 0;
- virtual bool is_local_locator(const fastrtps::rtps::Locator_t& locator) const = 0;
- virtual TransportDescriptorInterface* get_configuration() = 0;
- virtual void AddDefaultOutputLocator(fastrtps::rtps::LocatorList_t &defaultList) = 0;
- virtual bool getDefaultMetatrafficMulticastLocators(
- fastrtps::rtps::LocatorList_t& locators,
- uint32_t metatraffic_multicast_port) const = 0;
- virtual bool getDefaultMetatrafficUnicastLocators(
- fastrtps::rtps::LocatorList_t& locators,
- uint32_t metatraffic_unicast_port) const = 0;
- virtual bool getDefaultUnicastLocators(
- fastrtps::rtps::LocatorList_t& locators,
- uint32_t unicast_port) const = 0;
- virtual bool fillMetatrafficMulticastLocator(
- fastrtps::rtps::Locator_t& locator,
- uint32_t metatraffic_multicast_port) const = 0;
- virtual bool fillMetatrafficUnicastLocator(
- fastrtps::rtps::Locator_t& locator,
- uint32_t metatraffic_unicast_port) const = 0;
- virtual bool configureInitialPeerLocator(
- fastrtps::rtps::Locator_t& locator,
- const fastrtps::rtps::PortParameters &port_params,
- uint32_t domainId,
- fastrtps::rtps::LocatorList_t& list) const = 0;
- virtual bool fillUnicastLocator(
- fastrtps::rtps::Locator_t& locator,
- uint32_t well_known_port) const = 0;
-
- virtual uint32_t max_recv_buffer_size() const = 0;
-
- virtual void shutdown() {};
- int32_t kind() const { return transport_kind_; }
- protected:
- TransportInterface(int32_t transport_kind)
- : transport_kind_(transport_kind) {}
- int32_t transport_kind_;
- };
- }
- }
- }
- #endif
|