| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
BuiltinTransports.hpp
1// Copyright 2023 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
18
19#ifndef FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP
20#define FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP
21
22#include <ostream>
23#include <cstdint>
24
25#include <fastdds/fastdds_dll.hpp>
26#include <fastdds/rtps/transport/TransportInterface.hpp>
27
28 namespace eprosima {
29 namespace fastdds {
30 namespace rtps {
31
32
36 struct FASTDDS_EXPORTED_API BuiltinTransportsOptions
37{
39 bool non_blocking_send = false;
40
48 uint32_t maxMessageSize = fastdds::rtps::s_maximumMessageSize;
49
58 uint32_t sockets_buffer_size = 0;
59
68 uint32_t tcp_negotiation_timeout = 0;
69};
70
79 inline bool operator ==(
80 const BuiltinTransportsOptions& bto1,
81 const BuiltinTransportsOptions& bto2)
82{
83 if (bto1.non_blocking_send != bto2.non_blocking_send)
84 {
85 return false;
86 }
87 if (bto1.maxMessageSize != bto2.maxMessageSize)
88 {
89 return false;
90 }
91 if (bto1.sockets_buffer_size != bto2.sockets_buffer_size)
92 {
93 return false;
94 }
95 if (bto1.tcp_negotiation_timeout != bto2.tcp_negotiation_timeout)
96 {
97 return false;
98 }
99 return true;
100}
101
105 enum class BuiltinTransports : uint16_t
106{
107 NONE = 0, //< No transport will be instantiated
108 DEFAULT = 1, //< Default value that will instantiate UDPv4 and SHM transports
109 DEFAULTv6 = 2, //< Instantiate UDPv6 and SHM transports
110 SHM = 3, //< Instantiate SHM transport only
111 UDPv4 = 4, //< Instantiate UDPv4 transport only
112 UDPv6 = 5, //< Instantiate UDPv6 transport only
113 LARGE_DATA = 6, //< Instantiate SHM, UDPv4 and TCPv4 transports, but UDPv4 is only used for bootstrapping discovery
114 LARGE_DATAv6 = 7, //< Instantiate SHM, UDPv6 and TCPv6 transports, but UDPv6 is only used for bootstrapping discovery
115 P2P = 8 //< Instantiate SHM, UDPv4 (unicast) and TCPv4 transports, shall only be used along with ROS2_EASY_MODE=<ip>
116};
117
118 inline std::ostream& operator <<(
119 std::ostream& output,
120 BuiltinTransports transports)
121{
122 switch (transports)
123 {
124 case BuiltinTransports::NONE:
125 output << "NONE";
126 break;
127 case BuiltinTransports::DEFAULT:
128 output << "DEFAULT";
129 break;
130 case BuiltinTransports::DEFAULTv6:
131 output << "DEFAULTv6";
132 break;
133 case BuiltinTransports::SHM:
134 output << "SHM";
135 break;
136 case BuiltinTransports::UDPv4:
137 output << "UDPv4";
138 break;
139 case BuiltinTransports::UDPv6:
140 output << "UDPv6";
141 break;
142 case BuiltinTransports::LARGE_DATA:
143 output << "LARGE_DATA";
144 break;
145 case BuiltinTransports::LARGE_DATAv6:
146 output << "LARGE_DATAv6";
147 break;
148 case BuiltinTransports::P2P:
149 output << "P2P";
150 break;
151 default:
152 output << "UNKNOWN";
153 break;
154 }
155 return output;
156}
157
158} // namespace rtps
159} // namespace fastdds
160} // namespace eprosima
161
162#endif // FASTDDS_RTPS_ATTRIBUTES__BUILTINTRANSPORTS_HPP
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds::rtps::operator==
bool operator==(const BuiltinTransportsOptions &bto1, const BuiltinTransportsOptions &bto2)
Equal to operator.
Definition BuiltinTransports.hpp:79
eprosima::fastdds::rtps::operator<<
std::ostream & operator<<(std::ostream &output, BuiltinTransports transports)
Definition BuiltinTransports.hpp:118
eprosima::fastdds::rtps::BuiltinTransports
BuiltinTransports
Defines the kind of transports automatically instantiated upon the creation of a participant.
Definition BuiltinTransports.hpp:106
eprosima::fastdds::rtps::BuiltinTransports::P2P
@ P2P
Definition BuiltinTransports.hpp:115
eprosima::fastdds::rtps::BuiltinTransports::DEFAULT
@ DEFAULT
Definition BuiltinTransports.hpp:108
eprosima::fastdds::rtps::BuiltinTransports::DEFAULTv6
@ DEFAULTv6
Definition BuiltinTransports.hpp:109
eprosima::fastdds::rtps::BuiltinTransports::UDPv6
@ UDPv6
Definition BuiltinTransports.hpp:112
eprosima::fastdds::rtps::BuiltinTransports::SHM
@ SHM
Definition BuiltinTransports.hpp:110
eprosima::fastdds::rtps::BuiltinTransports::LARGE_DATA
@ LARGE_DATA
Definition BuiltinTransports.hpp:113
eprosima::fastdds::rtps::BuiltinTransports::UDPv4
@ UDPv4
Definition BuiltinTransports.hpp:111
eprosima::fastdds::rtps::BuiltinTransports::NONE
@ NONE
Definition BuiltinTransports.hpp:107
eprosima::fastdds::rtps::BuiltinTransports::LARGE_DATAv6
@ LARGE_DATAv6
Definition BuiltinTransports.hpp:114
eprosima::fastdds::rtps::s_maximumMessageSize
constexpr uint32_t s_maximumMessageSize
Default maximum message size.
Definition TransportInterface.hpp:44
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::BuiltinTransportsOptions
Options for configuring the built-in transports when using LARGE_DATA mode.
Definition BuiltinTransports.hpp:37
eprosima::fastdds::rtps::BuiltinTransportsOptions::sockets_buffer_size
uint32_t sockets_buffer_size
The value used to configure the send and receive fuffer sizes of the sockets.
Definition BuiltinTransports.hpp:58
eprosima::fastdds::rtps::BuiltinTransportsOptions::non_blocking_send
bool non_blocking_send
Whether to use non-blocking send operation.
Definition BuiltinTransports.hpp:39
eprosima::fastdds::rtps::BuiltinTransportsOptions::maxMessageSize
uint32_t maxMessageSize
The maximum message size to be used.
Definition BuiltinTransports.hpp:48
eprosima::fastdds::rtps::BuiltinTransportsOptions::tcp_negotiation_timeout
uint32_t tcp_negotiation_timeout
Time to wait for logical port negotiation (ms).
Definition BuiltinTransports.hpp:68