| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
TransportDescriptorInterface.hpp
1// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
19
20#ifndef FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
21#define FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
22
23#include <cstdint>
24#include <mutex>
25#include <vector>
26
27#include <fastdds/fastdds_dll.hpp>
28
29 namespace eprosima {
30 namespace fastdds {
31 namespace rtps {
32
33 class TransportInterface;
34
47 struct TransportDescriptorInterface
48{
50 FASTDDS_EXPORTED_API TransportDescriptorInterface(
51 uint32_t maximumMessageSize,
52 uint32_t maximumInitialPeersRange)
53 : maxMessageSize(maximumMessageSize)
54 , maxInitialPeersRange(maximumInitialPeersRange)
55 {
56 }
57
59 FASTDDS_EXPORTED_API TransportDescriptorInterface(
60 const TransportDescriptorInterface& t)
61 : maxMessageSize(t.maxMessageSize)
62 , maxInitialPeersRange(t.maxInitialPeersRange)
63 {
64 }
65
67 FASTDDS_EXPORTED_API TransportDescriptorInterface& operator =(
68 const TransportDescriptorInterface& t)
69 {
70 maxMessageSize = t.maxMessageSize;
71 maxInitialPeersRange = t.maxInitialPeersRange;
72 return *this;
73 }
74
76 virtual FASTDDS_EXPORTED_API ~TransportDescriptorInterface() = default;
77
83 virtual FASTDDS_EXPORTED_API TransportInterface* create_transport() const = 0;
84
86 virtual FASTDDS_EXPORTED_API uint32_t min_send_buffer_size() const = 0;
87
89 virtual FASTDDS_EXPORTED_API uint32_t max_message_size() const
90 {
91 return maxMessageSize;
92 }
93
97 virtual FASTDDS_EXPORTED_API uint32_t max_initial_peers_range() const
98 {
99 return maxInitialPeersRange;
100 }
101
103 FASTDDS_EXPORTED_API bool operator ==(
104 const TransportDescriptorInterface& t) const
105 {
106 return (this->maxMessageSize == t.max_message_size() &&
107 this->maxInitialPeersRange == t.max_initial_peers_range());
108 }
109
111 FASTDDS_EXPORTED_API void lock()
112 {
113 mtx_.lock();
114 }
115
117 FASTDDS_EXPORTED_API void unlock()
118 {
119 mtx_.unlock();
120 }
121
123 uint32_t maxMessageSize;
124
126 uint32_t maxInitialPeersRange;
127
128 private:
129
130 mutable std::mutex mtx_;
131};
132
133} // namespace rtps
134} // namespace fastdds
135} // namespace eprosima
136
137#endif // FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
eprosima::fastdds::rtps::TransportInterface
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition TransportInterface.hpp:64
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::TransportDescriptorInterface::~TransportDescriptorInterface
virtual FASTDDS_EXPORTED_API ~TransportDescriptorInterface()=default
Destructor.
eprosima::fastdds::rtps::TransportDescriptorInterface::unlock
FASTDDS_EXPORTED_API void unlock()
Unlock internal mutex (for Fast-DDS internal use).
Definition TransportDescriptorInterface.hpp:117
eprosima::fastdds::rtps::TransportDescriptorInterface::operator=
FASTDDS_EXPORTED_API TransportDescriptorInterface & operator=(const TransportDescriptorInterface &t)
Copy assignment.
Definition TransportDescriptorInterface.hpp:67
eprosima::fastdds::rtps::TransportDescriptorInterface::max_message_size
virtual FASTDDS_EXPORTED_API uint32_t max_message_size() const
Returns the maximum size expected for received messages.
Definition TransportDescriptorInterface.hpp:89
eprosima::fastdds::rtps::TransportDescriptorInterface::maxMessageSize
uint32_t maxMessageSize
Maximum size of a single message in the transport.
Definition TransportDescriptorInterface.hpp:123
eprosima::fastdds::rtps::TransportDescriptorInterface::TransportDescriptorInterface
FASTDDS_EXPORTED_API TransportDescriptorInterface(const TransportDescriptorInterface &t)
Copy constructor.
Definition TransportDescriptorInterface.hpp:59
eprosima::fastdds::rtps::TransportDescriptorInterface::create_transport
virtual FASTDDS_EXPORTED_API TransportInterface * create_transport() const =0
Factory method pattern.
eprosima::fastdds::rtps::TransportDescriptorInterface::min_send_buffer_size
virtual FASTDDS_EXPORTED_API uint32_t min_send_buffer_size() const =0
Returns the minimum size required for a send operation.
eprosima::fastdds::rtps::TransportDescriptorInterface::lock
FASTDDS_EXPORTED_API void lock()
Lock internal mutex (for Fast-DDS internal use).
Definition TransportDescriptorInterface.hpp:111
eprosima::fastdds::rtps::TransportDescriptorInterface::max_initial_peers_range
virtual FASTDDS_EXPORTED_API uint32_t max_initial_peers_range() const
Returns the maximum number of opened channels for each initial remote peer (maximum number of guessed...
Definition TransportDescriptorInterface.hpp:97
eprosima::fastdds::rtps::TransportDescriptorInterface::TransportDescriptorInterface
FASTDDS_EXPORTED_API TransportDescriptorInterface(uint32_t maximumMessageSize, uint32_t maximumInitialPeersRange)
Constructor.
Definition TransportDescriptorInterface.hpp:50
eprosima::fastdds::rtps::TransportDescriptorInterface::maxInitialPeersRange
uint32_t maxInitialPeersRange
Number of channels opened with each initial remote peer.
Definition TransportDescriptorInterface.hpp:126
eprosima::fastdds::rtps::TransportDescriptorInterface::operator==
FASTDDS_EXPORTED_API bool operator==(const TransportDescriptorInterface &t) const
Comparison operator.
Definition TransportDescriptorInterface.hpp:103