Program Listing for File NetworkFactory.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/network/NetworkFactory.h
)
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _FASTDDS_RTPS_NETWORK_FACTORY_HPP
#define _FASTDDS_RTPS_NETWORK_FACTORY_HPP
#include <vector>
#include <memory>
#include <fastdds/rtps/common/Locator.h>
#include <fastdds/rtps/common/LocatorSelector.hpp>
#include <fastdds/rtps/messages/MessageReceiver.h>
#include <fastdds/rtps/network/ReceiverResource.h>
#include <fastdds/rtps/network/SenderResource.h>
#include <fastdds/rtps/transport/TransportInterface.h>
namespace eprosima {
namespace fastrtps {
namespace rtps {
class RTPSParticipantAttributes;
class NetworkFactory
{
public:
NetworkFactory();
template<class T, class D>
void RegisterTransport(
const D& descriptor)
{
std::unique_ptr<T> transport(new T(descriptor));
if (transport->init())
{
mRegisteredTransports.emplace_back(std::move(transport));
}
}
bool RegisterTransport(
const fastdds::rtps::TransportDescriptorInterface* descriptor,
const fastrtps::rtps::PropertyPolicy* properties = nullptr);
bool build_send_resources(
fastdds::rtps::SendResourceList&,
const Locator_t& locator);
bool BuildReceiverResources(
Locator_t& local,
std::vector<std::shared_ptr<ReceiverResource>>& returned_resources_list,
uint32_t receiver_max_message_size);
void NormalizeLocators(
LocatorList_t& locators);
bool transform_remote_locator(
const Locator_t& remote_locator,
Locator_t& result_locator) const;
void select_locators(
LocatorSelector& selector) const;
bool is_local_locator(
const Locator_t& locator) const;
size_t numberOfRegisteredTransports() const;
uint32_t get_max_message_size_between_transports() const
{
return maxMessageSizeBetweenTransports_;
}
uint32_t get_min_send_buffer_size()
{
return minSendBufferSize_;
}
bool generate_locators(
uint16_t physical_port,
int locator_kind,
LocatorList_t& ret_locators);
void GetDefaultOutputLocators(
LocatorList_t& defaultLocators);
bool getDefaultMetatrafficMulticastLocators(
LocatorList_t& locators,
uint32_t metatraffic_multicast_port) const;
bool getDefaultMetatrafficUnicastLocators(
LocatorList_t& locators,
uint32_t metatraffic_unicast_port) const;
bool fillMetatrafficMulticastLocator(
Locator_t& locator,
uint32_t metatraffic_multicast_port) const;
bool fillMetatrafficUnicastLocator(
Locator_t& locator,
uint32_t metatraffic_unicast_port) const;
bool configureInitialPeerLocator(
uint32_t domain_id,
Locator_t& locator,
RTPSParticipantAttributes& m_att) const;
bool getDefaultUnicastLocators(
uint32_t domain_id,
LocatorList_t& locators,
const RTPSParticipantAttributes& m_att) const;
bool fill_default_locator_port(
uint32_t domain_id,
Locator_t& locator,
const RTPSParticipantAttributes& m_att,
bool is_multicast) const;
void Shutdown();
void update_network_interfaces();
private:
std::vector<std::unique_ptr<fastdds::rtps::TransportInterface>> mRegisteredTransports;
uint32_t maxMessageSizeBetweenTransports_;
uint32_t minSendBufferSize_;
uint16_t calculate_well_known_port(
uint32_t domain_id,
const RTPSParticipantAttributes& att,
bool is_multicast) const;
};
} // namespace rtps
} // namespace fastrtps
} // namespace eprosima
#endif /* _FASTDDS_RTPS_NETWORK_FACTORY_HPP */