/src/Fast-DDS/include/fastdds/rtps/attributes/RTPSParticipantAttributes.hpp
Line | Count | Source |
1 | | // Copyright 2016 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 | | |
15 | | /** |
16 | | * @file RTPSParticipantAttributes.hpp |
17 | | */ |
18 | | |
19 | | #ifndef FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTATTRIBUTES_HPP |
20 | | #define FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTATTRIBUTES_HPP |
21 | | |
22 | | #include <memory> |
23 | | #include <sstream> |
24 | | |
25 | | #include <fastcdr/cdr/fixed_size_string.hpp> |
26 | | |
27 | | #include <fastdds/rtps/attributes/BuiltinTransports.hpp> |
28 | | #include <fastdds/rtps/attributes/ExternalLocators.hpp> |
29 | | #include <fastdds/rtps/attributes/PropertyPolicy.hpp> |
30 | | #include <fastdds/rtps/attributes/ResourceManagement.hpp> |
31 | | #include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp> |
32 | | #include <fastdds/rtps/attributes/ThreadSettings.hpp> |
33 | | #include <fastdds/rtps/common/Locator.hpp> |
34 | | #include <fastdds/rtps/common/PortParameters.hpp> |
35 | | #include <fastdds/rtps/common/Time_t.hpp> |
36 | | #include <fastdds/rtps/common/Types.hpp> |
37 | | #include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp> |
38 | | #include <fastdds/rtps/transport/network/NetmaskFilterKind.hpp> |
39 | | #include <fastdds/rtps/transport/TransportInterface.hpp> |
40 | | #include <fastdds/fastdds_dll.hpp> |
41 | | |
42 | | namespace eprosima { |
43 | | namespace fastdds { |
44 | | namespace rtps { |
45 | | |
46 | | /** |
47 | | * Struct to define participant types to set participant type parameter property |
48 | | */ |
49 | | struct ParticipantType |
50 | | { |
51 | | static constexpr const char* SIMPLE = "SIMPLE"; |
52 | | static constexpr const char* SERVER = "SERVER"; |
53 | | static constexpr const char* CLIENT = "CLIENT"; |
54 | | static constexpr const char* SUPER_CLIENT = "SUPER_CLIENT"; |
55 | | static constexpr const char* BACKUP = "BACKUP"; |
56 | | static constexpr const char* NONE = "NONE"; |
57 | | static constexpr const char* EXTERNAL = "EXTERNAL"; |
58 | | static constexpr const char* UNKNOWN = "UNKNOWN"; |
59 | | }; |
60 | | |
61 | | } // namespace rtps |
62 | | } // namespace fastdds |
63 | | |
64 | | namespace fastdds { |
65 | | namespace rtps { |
66 | | |
67 | | //! PDP subclass choice |
68 | | enum class DiscoveryProtocol |
69 | | { |
70 | | NONE, |
71 | | /*!< |
72 | | NO discovery whatsoever would be used. |
73 | | Publisher and Subscriber defined with the same topic name would NOT be linked. |
74 | | All matching must be done manually through the addReaderLocator, addReaderProxy, addWriterProxy methods. |
75 | | */ |
76 | | SIMPLE, |
77 | | /*!< |
78 | | Discovery works according to 'The Real-time Publish-Subscribe Protocol(RTPS) DDS |
79 | | Interoperability Wire Protocol Specification' |
80 | | */ |
81 | | EXTERNAL, |
82 | | /*!< |
83 | | A user defined PDP subclass object must be provided in the attributes that deals with the discovery. |
84 | | Framework is not responsible of this object lifetime. |
85 | | */ |
86 | | CLIENT, /*!< The participant will behave as a client concerning discovery operation. |
87 | | Server locators should be specified as attributes. */ |
88 | | SERVER, /*!< The participant will behave as a server concerning discovery operation. |
89 | | Discovery operation is volatile (discovery handshake must take place if shutdown). */ |
90 | | BACKUP, /*!< The participant will behave as a server concerning discovery operation. |
91 | | Discovery operation persist on a file (discovery handshake wouldn't repeat if shutdown). */ |
92 | | SUPER_CLIENT /*!< The participant will behave as a client concerning all internal behaviour. |
93 | | Remote servers will treat it as a server and will share every discovery information. */ |
94 | | |
95 | | }; |
96 | | |
97 | | inline std::ostream& operator <<( |
98 | | std::ostream& output, |
99 | | const DiscoveryProtocol& discovery_protocol) |
100 | 0 | { |
101 | 0 | switch (discovery_protocol) |
102 | 0 | { |
103 | 0 | case DiscoveryProtocol::NONE: |
104 | 0 | output << fastdds::rtps::ParticipantType::NONE; |
105 | 0 | break; |
106 | 0 | case DiscoveryProtocol::SIMPLE: |
107 | 0 | output << fastdds::rtps::ParticipantType::SIMPLE; |
108 | 0 | break; |
109 | 0 | case DiscoveryProtocol::EXTERNAL: |
110 | 0 | output << fastdds::rtps::ParticipantType::EXTERNAL; |
111 | 0 | break; |
112 | 0 | case DiscoveryProtocol::CLIENT: |
113 | 0 | output << fastdds::rtps::ParticipantType::CLIENT; |
114 | 0 | break; |
115 | 0 | case DiscoveryProtocol::SUPER_CLIENT: |
116 | 0 | output << fastdds::rtps::ParticipantType::SUPER_CLIENT; |
117 | 0 | break; |
118 | 0 | case DiscoveryProtocol::SERVER: |
119 | 0 | output << fastdds::rtps::ParticipantType::SERVER; |
120 | 0 | break; |
121 | 0 | case DiscoveryProtocol::BACKUP: |
122 | 0 | output << fastdds::rtps::ParticipantType::BACKUP; |
123 | 0 | break; |
124 | 0 | default: |
125 | 0 | output << fastdds::rtps::ParticipantType::UNKNOWN; |
126 | 0 | } |
127 | 0 | return output; |
128 | 0 | } |
129 | | |
130 | | /** |
131 | | * Returns the guidPrefix associated to the given server id |
132 | | * @param [in] id of the default server whose guidPrefix we want to retrieve |
133 | | * @param [out] guid reference to the guidPrefix to modify |
134 | | * @return true if the server guid can be delivered |
135 | | */ |
136 | | FASTDDS_EXPORTED_API bool get_server_client_default_guidPrefix( |
137 | | int id, |
138 | | fastdds::rtps::GuidPrefix_t& guid); |
139 | | |
140 | | // Port used if the ros environment variable doesn't specify one |
141 | | constexpr uint16_t DEFAULT_ROS2_SERVER_PORT = 11811; |
142 | | // Port used by default for tcp transport |
143 | | constexpr uint16_t DEFAULT_TCP_SERVER_PORT = 42100; |
144 | | |
145 | | //! Filtering flags when discovering participants |
146 | | FASTDDS_TODO_BEFORE(4, 0, "Change it to uint8_t (implies also changing [de]serializations)"); |
147 | | enum ParticipantFilteringFlags : uint32_t |
148 | | { |
149 | | NO_FILTER = 0, |
150 | | FILTER_DIFFERENT_HOST = 0x1, |
151 | | FILTER_DIFFERENT_PROCESS = 0x2, |
152 | | FILTER_SAME_PROCESS = 0x4 |
153 | | }; |
154 | | |
155 | 0 | #define BUILTIN_DATA_MAX_SIZE 512 |
156 | | |
157 | | //! PDP factory for EXTERNAL type |
158 | | class PDP; |
159 | | class BuiltinProtocols; |
160 | | |
161 | | typedef struct PDPFactory |
162 | | { |
163 | | // Pointer to the PDP creator |
164 | | PDP* (*CreatePDPInstance)( |
165 | | BuiltinProtocols*); |
166 | | // Pointer to the PDP destructor |
167 | | void (* ReleasePDPInstance)( |
168 | | PDP*); |
169 | | |
170 | | bool operator ==( |
171 | | const struct PDPFactory& e) const |
172 | 0 | { |
173 | 0 | return (CreatePDPInstance == e.CreatePDPInstance) |
174 | 0 | && (ReleasePDPInstance == e.ReleasePDPInstance); |
175 | 0 | } |
176 | | |
177 | | } PDPFactory; |
178 | | |
179 | | /** |
180 | | * Class SimpleEDPAttributes, to define the attributes of the Simple Endpoint Discovery Protocol. |
181 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
182 | | */ |
183 | | class SimpleEDPAttributes |
184 | | { |
185 | | public: |
186 | | |
187 | | //!Default value true. |
188 | | bool use_PublicationWriterANDSubscriptionReader; |
189 | | |
190 | | //!Default value true. |
191 | | bool use_PublicationReaderANDSubscriptionWriter; |
192 | | |
193 | | #if HAVE_SECURITY |
194 | | bool enable_builtin_secure_publications_writer_and_subscriptions_reader; |
195 | | |
196 | | bool enable_builtin_secure_subscriptions_writer_and_publications_reader; |
197 | | #endif // if HAVE_SECURITY |
198 | | |
199 | | SimpleEDPAttributes() |
200 | 6 | : use_PublicationWriterANDSubscriptionReader(true) |
201 | 6 | , use_PublicationReaderANDSubscriptionWriter(true) |
202 | | #if HAVE_SECURITY |
203 | | , enable_builtin_secure_publications_writer_and_subscriptions_reader(true) |
204 | | , enable_builtin_secure_subscriptions_writer_and_publications_reader(true) |
205 | | #endif // if HAVE_SECURITY |
206 | 6 | { |
207 | 6 | } |
208 | | |
209 | | bool operator ==( |
210 | | const SimpleEDPAttributes& b) const |
211 | 0 | { |
212 | 0 | return (this->use_PublicationWriterANDSubscriptionReader == b.use_PublicationWriterANDSubscriptionReader) && |
213 | | #if HAVE_SECURITY |
214 | | (this->enable_builtin_secure_publications_writer_and_subscriptions_reader == |
215 | | b.enable_builtin_secure_publications_writer_and_subscriptions_reader) && |
216 | | (this->enable_builtin_secure_subscriptions_writer_and_publications_reader == |
217 | | b.enable_builtin_secure_subscriptions_writer_and_publications_reader) && |
218 | | #endif // if HAVE_SECURITY |
219 | 0 | (this->use_PublicationReaderANDSubscriptionWriter == b.use_PublicationReaderANDSubscriptionWriter); |
220 | 0 | } |
221 | | |
222 | | }; |
223 | | |
224 | | /** |
225 | | * Struct InitialAnnouncementConfig defines the behavior of the RTPSParticipant initial announcements. |
226 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
227 | | */ |
228 | | struct InitialAnnouncementConfig |
229 | | { |
230 | | /// Number of initial announcements with specific period (default 5) |
231 | | uint32_t count = 5u; |
232 | | |
233 | | /// Specific period for initial announcements (default 100ms) |
234 | | dds::Duration_t period = { 0, 100000000u }; |
235 | | |
236 | | bool operator ==( |
237 | | const InitialAnnouncementConfig& b) const |
238 | 0 | { |
239 | 0 | return (count == b.count) && (period == b.period); |
240 | 0 | } |
241 | | |
242 | | }; |
243 | | |
244 | | /** |
245 | | * Class DiscoverySettings, to define the attributes of the several discovery protocols available |
246 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
247 | | */ |
248 | | |
249 | | class DiscoverySettings |
250 | | { |
251 | | public: |
252 | | |
253 | | //! Chosen discovery protocol |
254 | | DiscoveryProtocol discoveryProtocol = DiscoveryProtocol::SIMPLE; |
255 | | |
256 | | /** |
257 | | * If set to true, SimpleEDP would be used. |
258 | | */ |
259 | | bool use_SIMPLE_EndpointDiscoveryProtocol = true; |
260 | | |
261 | | /** |
262 | | * If set to true, StaticEDP based on an XML file would be implemented. |
263 | | * The XML filename must be provided. |
264 | | */ |
265 | | bool use_STATIC_EndpointDiscoveryProtocol = false; |
266 | | |
267 | | /** |
268 | | * Lease Duration of the RTPSParticipant, |
269 | | * indicating how much time remote RTPSParticipants should consider this RTPSParticipant alive. |
270 | | */ |
271 | | dds::Duration_t leaseDuration = { 20, 0 }; |
272 | | |
273 | | /** |
274 | | * The period for the RTPSParticipant to send its Discovery Message to all other discovered RTPSParticipants |
275 | | * as well as to all Multicast ports. |
276 | | */ |
277 | | dds::Duration_t leaseDuration_announcementperiod = { 3, 0 }; |
278 | | |
279 | | //!Initial announcements configuration |
280 | | InitialAnnouncementConfig initial_announcements; |
281 | | |
282 | | //!Attributes of the SimpleEDP protocol |
283 | | SimpleEDPAttributes m_simpleEDP; |
284 | | |
285 | | //! function that returns a PDP object (only if EXTERNAL selected) |
286 | | PDPFactory m_PDPfactory{}; |
287 | | /** |
288 | | * The period for the RTPSParticipant to: |
289 | | * send its Discovery Message to its servers |
290 | | * check for EDP endpoints matching |
291 | | */ |
292 | | dds::Duration_t discoveryServer_client_syncperiod = { 0, 450 * 1000000}; // 450 milliseconds |
293 | | |
294 | | //! Discovery Server initial connections, needed if `discoveryProtocol` = CLIENT | SUPER_CLIENT | SERVER | BACKUP |
295 | | eprosima::fastdds::rtps::LocatorList m_DiscoveryServers; |
296 | | |
297 | | //! Filtering participants out depending on location |
298 | | ParticipantFilteringFlags ignoreParticipantFlags = ParticipantFilteringFlags::NO_FILTER; |
299 | | |
300 | 6 | DiscoverySettings() = default; |
301 | | |
302 | | bool operator ==( |
303 | | const DiscoverySettings& b) const |
304 | 0 | { |
305 | 0 | return (this->discoveryProtocol == b.discoveryProtocol) && |
306 | 0 | (this->use_SIMPLE_EndpointDiscoveryProtocol == b.use_SIMPLE_EndpointDiscoveryProtocol) && |
307 | 0 | (this->use_STATIC_EndpointDiscoveryProtocol == b.use_STATIC_EndpointDiscoveryProtocol) && |
308 | 0 | (this->discoveryServer_client_syncperiod == b.discoveryServer_client_syncperiod) && |
309 | 0 | (this->m_PDPfactory == b.m_PDPfactory) && |
310 | 0 | (this->leaseDuration == b.leaseDuration) && |
311 | 0 | (this->leaseDuration_announcementperiod == b.leaseDuration_announcementperiod) && |
312 | 0 | (this->initial_announcements == b.initial_announcements) && |
313 | 0 | (this->m_simpleEDP == b.m_simpleEDP) && |
314 | 0 | (this->static_edp_xml_config_ == b.static_edp_xml_config_) && |
315 | 0 | (this->m_DiscoveryServers == b.m_DiscoveryServers) && |
316 | 0 | (this->ignoreParticipantFlags == b.ignoreParticipantFlags); |
317 | 0 | } |
318 | | |
319 | | /** |
320 | | * Set the static endpoint XML configuration. |
321 | | * @param str URI specifying the static endpoint XML configuration. |
322 | | * The string could contain a filename (file://) or the XML content directly (data://). |
323 | | */ |
324 | | void static_edp_xml_config( |
325 | | const char* str) |
326 | 0 | { |
327 | 0 | static_edp_xml_config_ = str; |
328 | 0 | } |
329 | | |
330 | | /** |
331 | | * Get the static endpoint XML configuration. |
332 | | * @return URI specifying the static endpoint XML configuration. |
333 | | * The string could contain a filename (file://) or the XML content directly (data://). |
334 | | */ |
335 | | const char* static_edp_xml_config() const |
336 | 0 | { |
337 | 0 | return static_edp_xml_config_.c_str(); |
338 | 0 | } |
339 | | |
340 | | private: |
341 | | |
342 | | //! URI specifying the static EDP XML configuration, only necessary if use_STATIC_EndpointDiscoveryProtocol=true |
343 | | //! This string could contain a filename or the XML content directly. |
344 | | std::string static_edp_xml_config_ = ""; |
345 | | }; |
346 | | |
347 | | /** |
348 | | * Class MutableDiscoverySettings, to define the mutable attributes of the several discovery protocols available |
349 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
350 | | */ |
351 | | class MutableDiscoverySettings |
352 | | { |
353 | | public: |
354 | | |
355 | | //! Discovery Server initial connections, needed if `discoveryProtocol` = CLIENT | SUPER_CLIENT | SERVER | BACKUP |
356 | | eprosima::fastdds::rtps::LocatorList m_DiscoveryServers; |
357 | | |
358 | | MutableDiscoverySettings() = default; |
359 | | |
360 | | MutableDiscoverySettings( |
361 | | const DiscoverySettings& discovery_settings) |
362 | 0 | : m_DiscoveryServers(discovery_settings.m_DiscoveryServers) |
363 | 0 | { |
364 | 0 | } |
365 | | |
366 | | bool operator ==( |
367 | | const MutableDiscoverySettings& b) const |
368 | 0 | { |
369 | 0 | return (this->m_DiscoveryServers == b.m_DiscoveryServers); |
370 | 0 | } |
371 | | |
372 | | }; |
373 | | |
374 | | /** |
375 | | * Class ConstantDiscoverySettings, to define the constant attributes of the several discovery protocols available |
376 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
377 | | */ |
378 | | class ConstantDiscoverySettings |
379 | | { |
380 | | public: |
381 | | |
382 | | //! Chosen discovery protocol |
383 | | DiscoveryProtocol discoveryProtocol = DiscoveryProtocol::SIMPLE; |
384 | | |
385 | | /** |
386 | | * If set to true, SimpleEDP would be used. |
387 | | */ |
388 | | bool use_SIMPLE_EndpointDiscoveryProtocol = true; |
389 | | |
390 | | /** |
391 | | * If set to true, StaticEDP based on an XML file would be implemented. |
392 | | * The XML filename must be provided. |
393 | | */ |
394 | | bool use_STATIC_EndpointDiscoveryProtocol = false; |
395 | | |
396 | | /** |
397 | | * Lease Duration of the RTPSParticipant, |
398 | | * indicating how much time remote RTPSParticipants should consider this RTPSParticipant alive. |
399 | | */ |
400 | | dds::Duration_t leaseDuration = { 20, 0 }; |
401 | | |
402 | | /** |
403 | | * The period for the RTPSParticipant to send its Discovery Message to all other discovered RTPSParticipants |
404 | | * as well as to all Multicast ports. |
405 | | */ |
406 | | dds::Duration_t leaseDuration_announcementperiod = { 3, 0 }; |
407 | | |
408 | | //!Initial announcements configuration |
409 | | InitialAnnouncementConfig initial_announcements; |
410 | | |
411 | | //!Attributes of the SimpleEDP protocol |
412 | | SimpleEDPAttributes m_simpleEDP; |
413 | | |
414 | | //! function that returns a PDP object (only if EXTERNAL selected) |
415 | | PDPFactory m_PDPfactory{}; |
416 | | /** |
417 | | * The period for the RTPSParticipant to: |
418 | | * send its Discovery Message to its servers |
419 | | * check for EDP endpoints matching |
420 | | */ |
421 | | dds::Duration_t discoveryServer_client_syncperiod = { 0, 450 * 1000000}; // 450 milliseconds |
422 | | |
423 | | //! Filtering participants out depending on location |
424 | | ParticipantFilteringFlags ignoreParticipantFlags = ParticipantFilteringFlags::NO_FILTER; |
425 | | |
426 | | ConstantDiscoverySettings() = default; |
427 | | |
428 | | ConstantDiscoverySettings( |
429 | | const DiscoverySettings& discovery_settings) |
430 | 0 | : discoveryProtocol(discovery_settings.discoveryProtocol) |
431 | 0 | , use_SIMPLE_EndpointDiscoveryProtocol(discovery_settings.use_SIMPLE_EndpointDiscoveryProtocol) |
432 | 0 | , use_STATIC_EndpointDiscoveryProtocol(discovery_settings.use_STATIC_EndpointDiscoveryProtocol) |
433 | 0 | , leaseDuration(discovery_settings.leaseDuration) |
434 | 0 | , leaseDuration_announcementperiod(discovery_settings.leaseDuration_announcementperiod) |
435 | 0 | , initial_announcements(discovery_settings.initial_announcements) |
436 | 0 | , m_simpleEDP(discovery_settings.m_simpleEDP) |
437 | 0 | , m_PDPfactory(discovery_settings.m_PDPfactory) |
438 | 0 | , discoveryServer_client_syncperiod(discovery_settings.discoveryServer_client_syncperiod) |
439 | 0 | , ignoreParticipantFlags(discovery_settings.ignoreParticipantFlags) |
440 | 0 | , static_edp_xml_config_(discovery_settings.static_edp_xml_config()) |
441 | 0 | { |
442 | 0 | } |
443 | | |
444 | | bool operator ==( |
445 | | const ConstantDiscoverySettings& b) const |
446 | 0 | { |
447 | 0 | return (this->discoveryProtocol == b.discoveryProtocol) && |
448 | 0 | (this->use_SIMPLE_EndpointDiscoveryProtocol == b.use_SIMPLE_EndpointDiscoveryProtocol) && |
449 | 0 | (this->use_STATIC_EndpointDiscoveryProtocol == b.use_STATIC_EndpointDiscoveryProtocol) && |
450 | 0 | (this->discoveryServer_client_syncperiod == b.discoveryServer_client_syncperiod) && |
451 | 0 | (this->m_PDPfactory == b.m_PDPfactory) && |
452 | 0 | (this->leaseDuration == b.leaseDuration) && |
453 | 0 | (this->leaseDuration_announcementperiod == b.leaseDuration_announcementperiod) && |
454 | 0 | (this->initial_announcements == b.initial_announcements) && |
455 | 0 | (this->m_simpleEDP == b.m_simpleEDP) && |
456 | 0 | (this->static_edp_xml_config_ == b.static_edp_xml_config_) && |
457 | 0 | (this->ignoreParticipantFlags == b.ignoreParticipantFlags); |
458 | 0 | } |
459 | | |
460 | | /** |
461 | | * Get the static endpoint XML configuration. |
462 | | * @return URI specifying the static endpoint XML configuration. |
463 | | * The string could contain a filename (file://) or the XML content directly (data://). |
464 | | */ |
465 | | const char* static_edp_xml_config() const |
466 | 0 | { |
467 | 0 | return static_edp_xml_config_.c_str(); |
468 | 0 | } |
469 | | |
470 | | private: |
471 | | |
472 | | //! URI specifying the static EDP XML configuration, only necessary if use_STATIC_EndpointDiscoveryProtocol=true |
473 | | //! This string could contain a filename or the XML content directly. |
474 | | std::string static_edp_xml_config_ = ""; |
475 | | |
476 | | }; |
477 | | |
478 | | // Forward declaration to allow assignment from Constant and Mutable attributes. |
479 | | class BuiltinConstantAttributes; |
480 | | class BuiltinMutableAttributes; |
481 | | |
482 | | /** |
483 | | * Class BuiltinAttributes, to define the behavior of the RTPSParticipant builtin protocols. |
484 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
485 | | */ |
486 | | class BuiltinAttributes |
487 | | { |
488 | | public: |
489 | | |
490 | | //! Discovery protocol related attributes |
491 | | DiscoverySettings discovery_config; |
492 | | |
493 | | //! Indicates to use the WriterLiveliness protocol. |
494 | | bool use_WriterLivelinessProtocol = true; |
495 | | |
496 | | //! Network Configuration |
497 | | NetworkConfigSet_t network_configuration = 0; |
498 | | |
499 | | //! Metatraffic Unicast Locator List |
500 | | LocatorList_t metatrafficUnicastLocatorList; |
501 | | |
502 | | //! Metatraffic Multicast Locator List. |
503 | | LocatorList_t metatrafficMulticastLocatorList; |
504 | | |
505 | | //! The collection of external locators to use for communication on metatraffic topics. |
506 | | fastdds::rtps::ExternalLocators metatraffic_external_unicast_locators; |
507 | | |
508 | | //! Initial peers. |
509 | | LocatorList_t initialPeersList; |
510 | | |
511 | | //! Memory policy for builtin readers |
512 | | MemoryManagementPolicy_t readerHistoryMemoryPolicy = |
513 | | MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; |
514 | | |
515 | | //! Maximum payload size for builtin readers |
516 | | uint32_t readerPayloadSize = BUILTIN_DATA_MAX_SIZE; |
517 | | |
518 | | //! Memory policy for builtin writers |
519 | | MemoryManagementPolicy_t writerHistoryMemoryPolicy = |
520 | | MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; |
521 | | |
522 | | //! Maximum payload size for builtin writers |
523 | | uint32_t writerPayloadSize = BUILTIN_DATA_MAX_SIZE; |
524 | | |
525 | | //! Mutation tries if the port is being used. |
526 | | uint32_t mutation_tries = 100u; |
527 | | |
528 | | //! Set to true to avoid multicast traffic on builtin endpoints |
529 | | bool avoid_builtin_multicast = true; |
530 | | |
531 | | //! Flow controller name to use for the builtin writers |
532 | | std::string flow_controller_name = ""; |
533 | | |
534 | 6 | BuiltinAttributes() = default; |
535 | | |
536 | 0 | virtual ~BuiltinAttributes() = default; |
537 | | |
538 | | /** |
539 | | * Composes this object from a BuiltinConstantAttributes and a BuiltinMutableAttributes. |
540 | | * Every field is assigned: constant fields are taken from @c builtin_const, mutable fields |
541 | | * are taken from @c builtin_mutable. |
542 | | * @param builtin_const Constant builtin attributes to copy from. |
543 | | * @param builtin_mutable Mutable builtin attributes to copy from. |
544 | | */ |
545 | | void compose( |
546 | | const BuiltinConstantAttributes& builtin_const, |
547 | | const BuiltinMutableAttributes& builtin_mutable); |
548 | | |
549 | | bool operator ==( |
550 | | const BuiltinAttributes& b) const |
551 | 0 | { |
552 | 0 | return (this->discovery_config == b.discovery_config) && |
553 | 0 | (this->use_WriterLivelinessProtocol == b.use_WriterLivelinessProtocol) && |
554 | 0 | (this->network_configuration == b.network_configuration) && |
555 | 0 | (this->metatrafficUnicastLocatorList == b.metatrafficUnicastLocatorList) && |
556 | 0 | (this->metatrafficMulticastLocatorList == b.metatrafficMulticastLocatorList) && |
557 | 0 | (this->metatraffic_external_unicast_locators == b.metatraffic_external_unicast_locators) && |
558 | 0 | (this->initialPeersList == b.initialPeersList) && |
559 | 0 | (this->readerHistoryMemoryPolicy == b.readerHistoryMemoryPolicy) && |
560 | 0 | (this->readerPayloadSize == b.readerPayloadSize) && |
561 | 0 | (this->writerHistoryMemoryPolicy == b.writerHistoryMemoryPolicy) && |
562 | 0 | (this->writerPayloadSize == b.writerPayloadSize) && |
563 | 0 | (this->mutation_tries == b.mutation_tries) && |
564 | 0 | (this->flow_controller_name == b.flow_controller_name) && |
565 | 0 | (this->avoid_builtin_multicast == b.avoid_builtin_multicast); |
566 | 0 | } |
567 | | |
568 | | }; |
569 | | |
570 | | /** |
571 | | * Class BuiltinMutableAttributes, to define the behavior of the mutable RTPSParticipant builtin protocols. |
572 | | * This class is a subset of BuiltinAttributes. It is separated to keep the logic of constant and mutable attributes separated. |
573 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
574 | | */ |
575 | | class BuiltinMutableAttributes |
576 | | { |
577 | | public: |
578 | | |
579 | | //! Discovery protocol related attributes |
580 | | MutableDiscoverySettings discovery_config; |
581 | | |
582 | | //! Metatraffic Unicast Locator List |
583 | | LocatorList_t metatrafficUnicastLocatorList; |
584 | | |
585 | | //! The collection of external locators to use for communication on metatraffic topics. |
586 | | fastdds::rtps::ExternalLocators metatraffic_external_unicast_locators; |
587 | | |
588 | | BuiltinMutableAttributes() = default; |
589 | | |
590 | | BuiltinMutableAttributes( |
591 | | const BuiltinAttributes& builtin) |
592 | 0 | : discovery_config(builtin.discovery_config) |
593 | 0 | , metatrafficUnicastLocatorList(builtin.metatrafficUnicastLocatorList) |
594 | 0 | , metatraffic_external_unicast_locators(builtin.metatraffic_external_unicast_locators) |
595 | 0 | { |
596 | 0 | } |
597 | | |
598 | 0 | ~BuiltinMutableAttributes() = default; |
599 | | |
600 | | bool operator ==( |
601 | | const BuiltinMutableAttributes& b) const |
602 | 0 | { |
603 | 0 | return (this->discovery_config == b.discovery_config) && |
604 | 0 | (this->metatrafficUnicastLocatorList == b.metatrafficUnicastLocatorList) && |
605 | 0 | (this->metatraffic_external_unicast_locators == b.metatraffic_external_unicast_locators); |
606 | 0 | } |
607 | | |
608 | | }; |
609 | | |
610 | | /** |
611 | | * Class BuiltinConstantAttributes, to define the behavior of the constant RTPSParticipant builtin protocols. |
612 | | * This class is a subset of BuiltinAttributes. It is separated to keep the logic of constant and mutable attributes separated. |
613 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
614 | | */ |
615 | | class BuiltinConstantAttributes |
616 | | { |
617 | | public: |
618 | | |
619 | | /** |
620 | | * Discovery protocol related constant attributes. Only the discovery server list is mutable, which must be |
621 | | * accessed through the BuiltinMutableAttributes class. Its value in this class is only used as initial value. |
622 | | */ |
623 | | ConstantDiscoverySettings discovery_config; |
624 | | |
625 | | //! Indicates to use the WriterLiveliness protocol. |
626 | | bool use_WriterLivelinessProtocol = true; |
627 | | |
628 | | //! Network Configuration |
629 | | NetworkConfigSet_t network_configuration = 0; |
630 | | |
631 | | //! Metatraffic Multicast Locator List |
632 | | LocatorList_t metatrafficMulticastLocatorList; |
633 | | |
634 | | //! Initial peers. |
635 | | LocatorList_t initialPeersList; |
636 | | |
637 | | //! Memory policy for builtin readers |
638 | | MemoryManagementPolicy_t readerHistoryMemoryPolicy = |
639 | | MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; |
640 | | |
641 | | //! Maximum payload size for builtin readers |
642 | | uint32_t readerPayloadSize = BUILTIN_DATA_MAX_SIZE; |
643 | | |
644 | | //! Memory policy for builtin writers |
645 | | MemoryManagementPolicy_t writerHistoryMemoryPolicy = |
646 | | MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; |
647 | | |
648 | | //! Maximum payload size for builtin writers |
649 | | uint32_t writerPayloadSize = BUILTIN_DATA_MAX_SIZE; |
650 | | |
651 | | //! Mutation tries if the port is being used. |
652 | | uint32_t mutation_tries = 100u; |
653 | | |
654 | | //! Set to true to avoid multicast traffic on builtin endpoints |
655 | | bool avoid_builtin_multicast = true; |
656 | | |
657 | | //! Flow controller name to use for the builtin writers |
658 | | std::string flow_controller_name = ""; |
659 | | |
660 | | BuiltinConstantAttributes() = default; |
661 | | |
662 | | BuiltinConstantAttributes( |
663 | | const BuiltinAttributes& builtin) |
664 | 0 | : discovery_config(builtin.discovery_config) |
665 | 0 | , use_WriterLivelinessProtocol(builtin.use_WriterLivelinessProtocol) |
666 | 0 | , network_configuration(builtin.network_configuration) |
667 | 0 | , metatrafficMulticastLocatorList(builtin.metatrafficMulticastLocatorList) |
668 | 0 | , initialPeersList(builtin.initialPeersList) |
669 | 0 | , readerHistoryMemoryPolicy(builtin.readerHistoryMemoryPolicy) |
670 | 0 | , readerPayloadSize(builtin.readerPayloadSize) |
671 | 0 | , writerHistoryMemoryPolicy(builtin.writerHistoryMemoryPolicy) |
672 | 0 | , writerPayloadSize(builtin.writerPayloadSize) |
673 | 0 | , mutation_tries(builtin.mutation_tries) |
674 | 0 | , avoid_builtin_multicast(builtin.avoid_builtin_multicast) |
675 | 0 | , flow_controller_name(builtin.flow_controller_name) |
676 | 0 | { |
677 | 0 | } |
678 | | |
679 | 0 | ~BuiltinConstantAttributes() = default; |
680 | | |
681 | | bool operator ==( |
682 | | const BuiltinConstantAttributes& b) const |
683 | 0 | { |
684 | 0 | return (this->discovery_config == b.discovery_config) && |
685 | 0 | (this->use_WriterLivelinessProtocol == b.use_WriterLivelinessProtocol) && |
686 | 0 | (this->network_configuration == b.network_configuration) && |
687 | 0 | (this->metatrafficMulticastLocatorList == b.metatrafficMulticastLocatorList) && |
688 | 0 | (this->initialPeersList == b.initialPeersList) && |
689 | 0 | (this->readerHistoryMemoryPolicy == b.readerHistoryMemoryPolicy) && |
690 | 0 | (this->readerPayloadSize == b.readerPayloadSize) && |
691 | 0 | (this->writerHistoryMemoryPolicy == b.writerHistoryMemoryPolicy) && |
692 | 0 | (this->writerPayloadSize == b.writerPayloadSize) && |
693 | 0 | (this->mutation_tries == b.mutation_tries) && |
694 | 0 | (this->flow_controller_name == b.flow_controller_name) && |
695 | 0 | (this->avoid_builtin_multicast == b.avoid_builtin_multicast); |
696 | 0 | } |
697 | | |
698 | | }; |
699 | | |
700 | | inline void BuiltinAttributes::compose( |
701 | | const BuiltinConstantAttributes& builtin_const, |
702 | | const BuiltinMutableAttributes& builtin_mutable) |
703 | 0 | { |
704 | | // Constant Discovery settings |
705 | 0 | discovery_config.discoveryProtocol = builtin_const.discovery_config.discoveryProtocol; |
706 | 0 | discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = |
707 | 0 | builtin_const.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol; |
708 | 0 | discovery_config.use_STATIC_EndpointDiscoveryProtocol = |
709 | 0 | builtin_const.discovery_config.use_STATIC_EndpointDiscoveryProtocol; |
710 | 0 | discovery_config.leaseDuration = builtin_const.discovery_config.leaseDuration; |
711 | 0 | discovery_config.leaseDuration_announcementperiod = builtin_const.discovery_config.leaseDuration_announcementperiod; |
712 | 0 | discovery_config.initial_announcements = builtin_const.discovery_config.initial_announcements; |
713 | 0 | discovery_config.m_simpleEDP = builtin_const.discovery_config.m_simpleEDP; |
714 | 0 | discovery_config.m_PDPfactory = builtin_const.discovery_config.m_PDPfactory; |
715 | 0 | discovery_config.discoveryServer_client_syncperiod = |
716 | 0 | builtin_const.discovery_config.discoveryServer_client_syncperiod; |
717 | 0 | discovery_config.ignoreParticipantFlags = builtin_const.discovery_config.ignoreParticipantFlags; |
718 | | // Mutable Discovery settings |
719 | 0 | discovery_config.m_DiscoveryServers = builtin_mutable.discovery_config.m_DiscoveryServers; |
720 | | // Constant settings |
721 | 0 | use_WriterLivelinessProtocol = builtin_const.use_WriterLivelinessProtocol; |
722 | 0 | network_configuration = builtin_const.network_configuration; |
723 | 0 | metatrafficMulticastLocatorList = builtin_const.metatrafficMulticastLocatorList; |
724 | 0 | initialPeersList = builtin_const.initialPeersList; |
725 | 0 | readerHistoryMemoryPolicy = builtin_const.readerHistoryMemoryPolicy; |
726 | 0 | readerPayloadSize = builtin_const.readerPayloadSize; |
727 | 0 | writerHistoryMemoryPolicy = builtin_const.writerHistoryMemoryPolicy; |
728 | 0 | writerPayloadSize = builtin_const.writerPayloadSize; |
729 | 0 | mutation_tries = builtin_const.mutation_tries; |
730 | 0 | avoid_builtin_multicast = builtin_const.avoid_builtin_multicast; |
731 | 0 | flow_controller_name = builtin_const.flow_controller_name; |
732 | | // Mutable settings |
733 | 0 | metatrafficUnicastLocatorList = builtin_mutable.metatrafficUnicastLocatorList; |
734 | 0 | metatraffic_external_unicast_locators = builtin_mutable.metatraffic_external_unicast_locators; |
735 | 0 | } |
736 | | |
737 | | /** |
738 | | * Class RTPSParticipantAttributes used to define different aspects of a RTPSParticipant. |
739 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
740 | | */ |
741 | | class RTPSParticipantAttributes |
742 | | { |
743 | | public: |
744 | | |
745 | | using FlowControllerDescriptorList = std::vector<std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>>; |
746 | | |
747 | 3 | RTPSParticipantAttributes() = default; |
748 | | |
749 | 0 | virtual ~RTPSParticipantAttributes() = default; |
750 | | |
751 | | bool operator ==( |
752 | | const RTPSParticipantAttributes& b) const |
753 | 0 | { |
754 | 0 | return (this->name == b.name) && |
755 | 0 | (this->defaultUnicastLocatorList == b.defaultUnicastLocatorList) && |
756 | 0 | (this->defaultMulticastLocatorList == b.defaultMulticastLocatorList) && |
757 | 0 | (this->default_external_unicast_locators == b.default_external_unicast_locators) && |
758 | 0 | (this->ignore_non_matching_locators == b.ignore_non_matching_locators) && |
759 | 0 | (this->sendSocketBufferSize == b.sendSocketBufferSize) && |
760 | 0 | (this->listenSocketBufferSize == b.listenSocketBufferSize) && |
761 | 0 | (this->netmaskFilter == b.netmaskFilter) && |
762 | 0 | (this->builtin == b.builtin) && |
763 | 0 | (this->port == b.port) && |
764 | 0 | (this->userData == b.userData) && |
765 | 0 | (this->participantID == b.participantID) && |
766 | 0 | (this->easy_mode_ip == b.easy_mode_ip) && |
767 | 0 | (this->useBuiltinTransports == b.useBuiltinTransports) && |
768 | 0 | (this->properties == b.properties) && |
769 | 0 | (this->prefix == b.prefix) && |
770 | 0 | (this->flow_controllers == b.flow_controllers) && |
771 | 0 | (this->builtin_controllers_sender_thread == b.builtin_controllers_sender_thread) && |
772 | 0 | (this->timed_events_thread == b.timed_events_thread) && |
773 | 0 | #if HAVE_SECURITY |
774 | 0 | (this->security_log_thread == b.security_log_thread) && |
775 | 0 | #endif // if HAVE_SECURITY |
776 | 0 | (this->discovery_server_thread == b.discovery_server_thread) && |
777 | 0 | (this->typelookup_service_thread == b.typelookup_service_thread) && |
778 | 0 | (this->builtin_transports_reception_threads == b.builtin_transports_reception_threads); |
779 | 0 |
|
780 | 0 | } |
781 | | |
782 | | /** |
783 | | * Provides a way of easily configuring transport related configuration on certain pre-defined scenarios with |
784 | | * certain options. |
785 | | * |
786 | | * @param transports Defines the transport configuration scenario to setup. |
787 | | * @param options Defines the options to be used in the transport configuration. |
788 | | */ |
789 | | FASTDDS_EXPORTED_API void setup_transports( |
790 | | fastdds::rtps::BuiltinTransports transports, |
791 | | const fastdds::rtps::BuiltinTransportsOptions& options = fastdds::rtps::BuiltinTransportsOptions()); |
792 | | |
793 | | /** |
794 | | * Default list of Unicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the case |
795 | | * that it was defined with NO UnicastLocators. At least ONE locator should be included in this list. |
796 | | */ |
797 | | LocatorList_t defaultUnicastLocatorList; |
798 | | |
799 | | /** |
800 | | * Default list of Multicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the |
801 | | * case that it was defined with NO MulticastLocators. This is usually left empty. |
802 | | */ |
803 | | LocatorList_t defaultMulticastLocatorList; |
804 | | |
805 | | /** |
806 | | * The collection of external locators to use for communication on user created topics. |
807 | | */ |
808 | | fastdds::rtps::ExternalLocators default_external_unicast_locators; |
809 | | |
810 | | /** |
811 | | * Whether locators that don't match with the announced locators should be kept. |
812 | | */ |
813 | | bool ignore_non_matching_locators = false; |
814 | | |
815 | | /*! |
816 | | * @brief Send socket buffer size for the send resource. Zero value indicates to use default system buffer size. |
817 | | * Default value: 0. |
818 | | */ |
819 | | uint32_t sendSocketBufferSize = 0; |
820 | | |
821 | | /*! Listen socket buffer for all listen resources. Zero value indicates to use default system buffer size. |
822 | | * Default value: 0. |
823 | | */ |
824 | | uint32_t listenSocketBufferSize = 0; |
825 | | |
826 | | //! Netmask filter configuration |
827 | | fastdds::rtps::NetmaskFilterKind netmaskFilter = fastdds::rtps::NetmaskFilterKind::AUTO; |
828 | | |
829 | | //! Optionally allows user to define the GuidPrefix_t |
830 | | GuidPrefix_t prefix; |
831 | | |
832 | | FASTDDS_EXPORTED_API inline bool ReadguidPrefix( |
833 | | const char* pfx) |
834 | 0 | { |
835 | 0 | return bool(std::istringstream(pfx) >> prefix); |
836 | 0 | } |
837 | | |
838 | | //! Builtin parameters. |
839 | | BuiltinAttributes builtin; |
840 | | |
841 | | //! Port Parameters |
842 | | PortParameters port; |
843 | | |
844 | | //! User Data of the participant |
845 | | std::vector<octet> userData; |
846 | | |
847 | | //! Participant ID |
848 | | int32_t participantID = -1; |
849 | | |
850 | | //! IP of the Host where master Server is located (EASY_MODE context) |
851 | | std::string easy_mode_ip = ""; |
852 | | |
853 | | //! User defined transports to use alongside or in place of builtins. |
854 | | std::vector<std::shared_ptr<fastdds::rtps::TransportDescriptorInterface>> userTransports; |
855 | | |
856 | | //! Set as false to disable the creation of the default transports. |
857 | | bool useBuiltinTransports = true; |
858 | | |
859 | | //! Holds allocation limits affecting collections managed by a participant. |
860 | | RTPSParticipantAllocationAttributes allocation; |
861 | | |
862 | | //! Property policies |
863 | | PropertyPolicy properties; |
864 | | |
865 | | //! Set the name of the participant. |
866 | | inline void setName( |
867 | | const char* nam) |
868 | 0 | { |
869 | 0 | name = nam; |
870 | 0 | } |
871 | | |
872 | | //! Get the name of the participant. |
873 | | inline const char* getName() const |
874 | 0 | { |
875 | 0 | return name.c_str(); |
876 | 0 | } |
877 | | |
878 | | //! Flow controllers. |
879 | | FlowControllerDescriptorList flow_controllers; |
880 | | |
881 | | //! Thread settings for the builtin flow controllers sender threads |
882 | | fastdds::rtps::ThreadSettings builtin_controllers_sender_thread; |
883 | | |
884 | | //! Thread settings for the timed events thread |
885 | | fastdds::rtps::ThreadSettings timed_events_thread; |
886 | | |
887 | | //! Thread settings for the discovery server thread |
888 | | fastdds::rtps::ThreadSettings discovery_server_thread; |
889 | | |
890 | | //! Thread settings for the builtin TypeLookup service requests and replies threads |
891 | | fastdds::rtps::ThreadSettings typelookup_service_thread; |
892 | | |
893 | | //! Thread settings for the builtin transports reception threads |
894 | | fastdds::rtps::ThreadSettings builtin_transports_reception_threads; |
895 | | |
896 | | #if HAVE_SECURITY |
897 | | //! Thread settings for the security log thread |
898 | | fastdds::rtps::ThreadSettings security_log_thread; |
899 | | #endif // if HAVE_SECURITY |
900 | | |
901 | | /*! Maximum message size used to avoid fragmentation, set ONLY in LARGE_DATA. If this value is |
902 | | * not zero, the network factory will allow the initialization of UDP transports with maxMessageSize |
903 | | * higher than 65500K. |
904 | | */ |
905 | | uint32_t max_msg_size_no_frag = 0; |
906 | | |
907 | | private: |
908 | | |
909 | | //! Name of the participant. |
910 | | fastcdr::string_255 name{"RTPSParticipant"}; |
911 | | }; |
912 | | |
913 | | /** |
914 | | * Class RTPSParticipantMutableAttributes used to define mutable aspects of a RTPSParticipant. |
915 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
916 | | */ |
917 | | class RTPSParticipantMutableAttributes |
918 | | { |
919 | | public: |
920 | | |
921 | | RTPSParticipantMutableAttributes() = default; |
922 | | |
923 | | RTPSParticipantMutableAttributes( |
924 | | const RTPSParticipantAttributes& attrs) |
925 | 0 | : defaultUnicastLocatorList(attrs.defaultUnicastLocatorList) |
926 | 0 | , default_external_unicast_locators(attrs.default_external_unicast_locators) |
927 | 0 | , userData(attrs.userData) |
928 | 0 | , builtin(attrs.builtin) |
929 | 0 | { |
930 | 0 | } |
931 | | |
932 | 0 | ~RTPSParticipantMutableAttributes() = default; |
933 | | |
934 | | bool operator ==( |
935 | | const RTPSParticipantMutableAttributes& b) const |
936 | 0 | { |
937 | 0 | return (this->defaultUnicastLocatorList == b.defaultUnicastLocatorList) && |
938 | 0 | (this->default_external_unicast_locators == b.default_external_unicast_locators) && |
939 | 0 | (this->userData == b.userData) && |
940 | 0 | (this->builtin == b.builtin); |
941 | 0 | } |
942 | | |
943 | | /** |
944 | | * Default list of Unicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the case |
945 | | * that it was defined with NO UnicastLocators. At least ONE locator should be included in this list. |
946 | | */ |
947 | | LocatorList_t defaultUnicastLocatorList; |
948 | | |
949 | | /** |
950 | | * The collection of external locators to use for communication on user created topics. |
951 | | */ |
952 | | fastdds::rtps::ExternalLocators default_external_unicast_locators; |
953 | | |
954 | | //! User Data of the participant |
955 | | std::vector<octet> userData; |
956 | | |
957 | | //! Builtin parameters. |
958 | | BuiltinMutableAttributes builtin; |
959 | | }; |
960 | | |
961 | | /** |
962 | | * Class RTPSParticipantConstantAttributes used to define constant aspects of a RTPSParticipant. |
963 | | * @ingroup RTPS_ATTRIBUTES_MODULE |
964 | | */ |
965 | | class RTPSParticipantConstantAttributes |
966 | | { |
967 | | public: |
968 | | |
969 | | using FlowControllerDescriptorList = std::vector<std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>>; |
970 | | |
971 | | RTPSParticipantConstantAttributes() = default; |
972 | | |
973 | | RTPSParticipantConstantAttributes( |
974 | | const RTPSParticipantAttributes& attrs) |
975 | 0 | : defaultMulticastLocatorList(attrs.defaultMulticastLocatorList) |
976 | 0 | , ignore_non_matching_locators(attrs.ignore_non_matching_locators) |
977 | 0 | , sendSocketBufferSize(attrs.sendSocketBufferSize) |
978 | 0 | , listenSocketBufferSize(attrs.listenSocketBufferSize) |
979 | 0 | , netmaskFilter(attrs.netmaskFilter) |
980 | 0 | , prefix(attrs.prefix) |
981 | 0 | , builtin(attrs.builtin) |
982 | 0 | , port(attrs.port) |
983 | 0 | , participantID(attrs.participantID) |
984 | 0 | , easy_mode_ip(attrs.easy_mode_ip) |
985 | 0 | , userTransports(attrs.userTransports) |
986 | 0 | , useBuiltinTransports(attrs.useBuiltinTransports) |
987 | 0 | , allocation(attrs.allocation) |
988 | 0 | , properties(attrs.properties) |
989 | 0 | , flow_controllers(attrs.flow_controllers) |
990 | 0 | , builtin_controllers_sender_thread(attrs.builtin_controllers_sender_thread) |
991 | 0 | , timed_events_thread(attrs.timed_events_thread) |
992 | 0 | , discovery_server_thread(attrs.discovery_server_thread) |
993 | 0 | , typelookup_service_thread(attrs.typelookup_service_thread) |
994 | 0 | , builtin_transports_reception_threads(attrs.builtin_transports_reception_threads) |
995 | | #if HAVE_SECURITY |
996 | | , security_log_thread(attrs.security_log_thread) |
997 | | #endif // if HAVE_SECURITY |
998 | 0 | , max_msg_size_no_frag(attrs.max_msg_size_no_frag) |
999 | 0 | , name(attrs.getName()) |
1000 | 0 | { |
1001 | 0 | } |
1002 | | |
1003 | 0 | ~RTPSParticipantConstantAttributes() = default; |
1004 | | |
1005 | | bool operator ==( |
1006 | | const RTPSParticipantConstantAttributes& b) const |
1007 | 0 | { |
1008 | 0 | return (this->defaultMulticastLocatorList == b.defaultMulticastLocatorList) && |
1009 | 0 | (this->ignore_non_matching_locators == b.ignore_non_matching_locators) && |
1010 | 0 | (this->sendSocketBufferSize == b.sendSocketBufferSize) && |
1011 | 0 | (this->listenSocketBufferSize == b.listenSocketBufferSize) && |
1012 | 0 | (this->netmaskFilter == b.netmaskFilter) && |
1013 | 0 | (this->builtin == b.builtin) && |
1014 | 0 | (this->port == b.port) && |
1015 | 0 | (this->participantID == b.participantID) && |
1016 | 0 | (this->easy_mode_ip == b.easy_mode_ip) && |
1017 | 0 | (this->useBuiltinTransports == b.useBuiltinTransports) && |
1018 | 0 | (this->allocation == b.allocation) && |
1019 | 0 | (this->properties == b.properties) && |
1020 | 0 | (this->prefix == b.prefix) && |
1021 | 0 | (this->flow_controllers == b.flow_controllers) && |
1022 | 0 | (this->builtin_controllers_sender_thread == b.builtin_controllers_sender_thread) && |
1023 | 0 | (this->timed_events_thread == b.timed_events_thread) && |
1024 | 0 | #if HAVE_SECURITY |
1025 | 0 | (this->security_log_thread == b.security_log_thread) && |
1026 | 0 | #endif // if HAVE_SECURITY |
1027 | 0 | (this->discovery_server_thread == b.discovery_server_thread) && |
1028 | 0 | (this->typelookup_service_thread == b.typelookup_service_thread) && |
1029 | 0 | (this->builtin_transports_reception_threads == b.builtin_transports_reception_threads); |
1030 | 0 | } |
1031 | | |
1032 | | /** |
1033 | | * Default list of Multicast Locators to be used for any Endpoint defined inside this RTPSParticipant in the |
1034 | | * case that it was defined with NO MulticastLocators. This is usually left empty. |
1035 | | */ |
1036 | | LocatorList_t defaultMulticastLocatorList; |
1037 | | |
1038 | | /** |
1039 | | * Whether locators that don't match with the announced locators should be kept. |
1040 | | */ |
1041 | | bool ignore_non_matching_locators = false; |
1042 | | |
1043 | | /*! |
1044 | | * @brief Send socket buffer size for the send resource. Zero value indicates to use default system buffer size. |
1045 | | * Default value: 0. |
1046 | | */ |
1047 | | uint32_t sendSocketBufferSize = 0; |
1048 | | |
1049 | | /*! Listen socket buffer for all listen resources. Zero value indicates to use default system buffer size. |
1050 | | * Default value: 0. |
1051 | | */ |
1052 | | uint32_t listenSocketBufferSize = 0; |
1053 | | |
1054 | | //! Netmask filter configuration |
1055 | | fastdds::rtps::NetmaskFilterKind netmaskFilter = fastdds::rtps::NetmaskFilterKind::AUTO; |
1056 | | |
1057 | | //! Optionally allows user to define the GuidPrefix_t |
1058 | | GuidPrefix_t prefix; |
1059 | | |
1060 | | inline bool ReadguidPrefix( |
1061 | | const char* pfx) |
1062 | 0 | { |
1063 | 0 | return bool(std::istringstream(pfx) >> prefix); |
1064 | 0 | } |
1065 | | |
1066 | | //! Builtin parameters. |
1067 | | BuiltinConstantAttributes builtin; |
1068 | | |
1069 | | //! Port Parameters |
1070 | | PortParameters port; |
1071 | | |
1072 | | //! Participant ID |
1073 | | int32_t participantID = -1; |
1074 | | |
1075 | | //! IP of the Host where master Server is located (EASY_MODE context) |
1076 | | std::string easy_mode_ip = ""; |
1077 | | |
1078 | | //! User defined transports to use alongside or in place of builtins. |
1079 | | std::vector<std::shared_ptr<fastdds::rtps::TransportDescriptorInterface>> userTransports; |
1080 | | |
1081 | | //! Set as false to disable the creation of the default transports. |
1082 | | bool useBuiltinTransports = true; |
1083 | | |
1084 | | //! Holds allocation limits affecting collections managed by a participant. |
1085 | | RTPSParticipantAllocationAttributes allocation; |
1086 | | |
1087 | | //! Property policies |
1088 | | PropertyPolicy properties; |
1089 | | |
1090 | | //! Get the name of the participant. |
1091 | | inline const char* getName() const |
1092 | 0 | { |
1093 | 0 | return name.c_str(); |
1094 | 0 | } |
1095 | | |
1096 | | //! Flow controllers. |
1097 | | FlowControllerDescriptorList flow_controllers; |
1098 | | |
1099 | | //! Thread settings for the builtin flow controllers sender threads |
1100 | | fastdds::rtps::ThreadSettings builtin_controllers_sender_thread; |
1101 | | |
1102 | | //! Thread settings for the timed events thread |
1103 | | fastdds::rtps::ThreadSettings timed_events_thread; |
1104 | | |
1105 | | //! Thread settings for the discovery server thread |
1106 | | fastdds::rtps::ThreadSettings discovery_server_thread; |
1107 | | |
1108 | | //! Thread settings for the builtin TypeLookup service requests and replies threads |
1109 | | fastdds::rtps::ThreadSettings typelookup_service_thread; |
1110 | | |
1111 | | //! Thread settings for the builtin transports reception threads |
1112 | | fastdds::rtps::ThreadSettings builtin_transports_reception_threads; |
1113 | | |
1114 | | #if HAVE_SECURITY |
1115 | | //! Thread settings for the security log thread |
1116 | | fastdds::rtps::ThreadSettings security_log_thread; |
1117 | | #endif // if HAVE_SECURITY |
1118 | | |
1119 | | /*! Maximum message size used to avoid fragmentation, set ONLY in LARGE_DATA. If this value is |
1120 | | * not zero, the network factory will allow the initialization of UDP transports with maxMessageSize |
1121 | | * higher than 65500K. |
1122 | | */ |
1123 | | uint32_t max_msg_size_no_frag = 0; |
1124 | | |
1125 | | private: |
1126 | | |
1127 | | //! Name of the participant. |
1128 | | fastcdr::string_255 name{"RTPSParticipant"}; |
1129 | | |
1130 | | }; |
1131 | | |
1132 | | |
1133 | | } // namespace rtps |
1134 | | } // namespace fastdds |
1135 | | } // namespace eprosima |
1136 | | |
1137 | | #endif // FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTATTRIBUTES_HPP |