Line data Source code
1 : /*
2 : *
3 : *
4 : * Distributed under the OpenDDS License.
5 : * See: http://www.opendds.org/license.html
6 : */
7 :
8 : #include "ParameterListConverter.h"
9 :
10 : #include "MessageUtils.h"
11 :
12 : #include <dds/DCPS/DCPS_Utils.h>
13 : #include <dds/DCPS/GuidUtils.h>
14 : #include <dds/DCPS/Qos_Helper.h>
15 : #include <dds/DCPS/DCPS_Utils.h>
16 : #include <dds/DCPS/Service_Participant.h>
17 : #include <dds/DCPS/NetworkResource.h>
18 :
19 : #include <cstring>
20 :
21 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
22 :
23 : namespace OpenDDS {
24 : namespace RTPS {
25 :
26 : #ifndef OPENDDS_SAFETY_PROFILE
27 : using DCPS::operator!=;
28 : #endif
29 :
30 : namespace {
31 :
32 39 : void extract_type_info_param(const Parameter& param, XTypes::TypeInformation& type_info)
33 : {
34 39 : if (!XTypes::deserialize_type_info(type_info, param.type_information())) {
35 0 : type_info.minimal.typeid_with_size.type_id = XTypes::TypeIdentifier();
36 0 : type_info.complete.typeid_with_size.type_id = XTypes::TypeIdentifier();
37 : }
38 39 : }
39 :
40 81 : void add_type_info_param(ParameterList& param_list, const XTypes::TypeInformation& type_info)
41 : {
42 81 : Parameter param;
43 81 : DDS::OctetSeq seq;
44 81 : if (TheServiceParticipant->type_object_encoding() == DCPS::Service_Participant::Encoding_WriteOldFormat) {
45 0 : DCPS::Encoding encoding = XTypes::get_typeobject_encoding();
46 0 : encoding.skip_sequence_dheader(true);
47 0 : XTypes::serialize_type_info(type_info, seq, &encoding);
48 :
49 : } else {
50 81 : XTypes::serialize_type_info(type_info, seq);
51 : }
52 :
53 81 : param.type_information(seq);
54 81 : DCPS::push_back(param_list, param);
55 81 : }
56 :
57 124 : void push_back_locator_seq(ParameterList& param_list,
58 : const DCPS::LocatorSeq& locator_seq,
59 : const ParameterId_t pid)
60 : {
61 124 : const CORBA::ULong length = locator_seq.length();
62 150 : for (CORBA::ULong i = 0; i < length; ++i) {
63 26 : Parameter param;
64 26 : param.locator(locator_seq[i]);
65 26 : param._d(pid);
66 26 : DCPS::push_back(param_list, param);
67 26 : }
68 124 : }
69 :
70 8 : void push_back_rtps_locator(ParameterList& param_list,
71 : const DCPS::TransportLocator& dcps_locator,
72 : bool map /*map IPV4 to IPV6 addr*/)
73 : {
74 : // Convert the tls blob to an RTPS locator seq
75 8 : DCPS::LocatorSeq locators;
76 8 : const DDS::ReturnCode_t result = blob_to_locators(dcps_locator.data, locators);
77 8 : if (result == DDS::RETCODE_OK) {
78 8 : const CORBA::ULong locators_len = locators.length();
79 24 : for (CORBA::ULong i = 0; i < locators_len; ++i) {
80 16 : DCPS::Locator_t& rtps_locator = locators[i];
81 16 : ACE_INET_Addr address;
82 16 : if (locator_to_address(address, rtps_locator, map) == 0) {
83 10 : Parameter param;
84 10 : param.locator(rtps_locator);
85 10 : if (address.is_multicast()) {
86 5 : param._d(PID_MULTICAST_LOCATOR);
87 : } else {
88 5 : param._d(PID_UNICAST_LOCATOR);
89 : }
90 10 : DCPS::push_back(param_list, param);
91 10 : }
92 16 : }
93 : } else {
94 0 : ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: push_back_rtps_locator - ")
95 : ACE_TEXT("Unable to convert dcps_rtps ")
96 : ACE_TEXT("TransportLocator blob to LocatorSeq\n")));
97 : }
98 8 : }
99 :
100 0 : void push_back_dcps_locator(ParameterList& param_list,
101 : const DCPS::TransportLocator& dcps_locator)
102 : {
103 0 : Parameter param;
104 0 : param.opendds_locator(dcps_locator);
105 0 : param._d(PID_OPENDDS_LOCATOR);
106 0 : DCPS::push_back(param_list, param);
107 0 : }
108 :
109 57 : void append_locators_if_present(DCPS::TransportLocatorSeq& list,
110 : const DCPS::LocatorSeq& rtps_udp_locators)
111 : {
112 57 : if (rtps_udp_locators.length()) {
113 4 : DCPS::TransportLocator& tl = list[DCPS::grow(list) - 1];
114 4 : tl.transport_type = "rtps_udp";
115 4 : locators_to_blob(rtps_udp_locators, tl.data);
116 : }
117 57 : }
118 :
119 : enum LocatorState {
120 : locator_undefined,
121 : locator_complete,
122 : locator_address_only,
123 : locator_port_only
124 : };
125 :
126 112 : bool not_default(const DDS::UserDataQosPolicy& qos)
127 : {
128 : DDS::UserDataQosPolicy def_qos =
129 112 : TheServiceParticipant->initial_UserDataQosPolicy();
130 224 : return qos != def_qos;
131 112 : }
132 :
133 81 : bool not_default(const DDS::GroupDataQosPolicy& qos)
134 : {
135 : DDS::GroupDataQosPolicy def_qos =
136 81 : TheServiceParticipant->initial_GroupDataQosPolicy();
137 162 : return qos != def_qos;
138 81 : }
139 :
140 81 : bool not_default(const DDS::TopicDataQosPolicy& qos)
141 : {
142 : DDS::TopicDataQosPolicy def_qos =
143 81 : TheServiceParticipant->initial_TopicDataQosPolicy();
144 162 : return qos != def_qos;
145 81 : }
146 :
147 81 : bool not_default(const DDS::DurabilityQosPolicy& qos)
148 : {
149 : DDS::DurabilityQosPolicy def_qos =
150 81 : TheServiceParticipant->initial_DurabilityQosPolicy();
151 162 : return qos != def_qos;
152 : }
153 :
154 42 : bool not_default(const DDS::DurabilityServiceQosPolicy& qos)
155 : {
156 : DDS::DurabilityServiceQosPolicy def_qos =
157 42 : TheServiceParticipant->initial_DurabilityServiceQosPolicy();
158 84 : return qos != def_qos;
159 : }
160 :
161 42 : bool not_default(const DDS::LifespanQosPolicy& qos)
162 : {
163 : DDS::LifespanQosPolicy def_qos =
164 42 : TheServiceParticipant->initial_LifespanQosPolicy();
165 84 : return qos != def_qos;
166 : }
167 :
168 81 : bool not_default(const DDS::DeadlineQosPolicy& qos)
169 : {
170 : DDS::DeadlineQosPolicy def_qos =
171 81 : TheServiceParticipant->initial_DeadlineQosPolicy();
172 162 : return qos != def_qos;
173 : }
174 :
175 81 : bool not_default(const DDS::LatencyBudgetQosPolicy& qos)
176 : {
177 : DDS::LatencyBudgetQosPolicy def_qos =
178 81 : TheServiceParticipant->initial_LatencyBudgetQosPolicy();
179 162 : return qos != def_qos;
180 : }
181 :
182 81 : bool not_default(const DDS::LivelinessQosPolicy& qos)
183 : {
184 : DDS::LivelinessQosPolicy def_qos =
185 81 : TheServiceParticipant->initial_LivelinessQosPolicy();
186 162 : return qos != def_qos;
187 : }
188 :
189 81 : bool not_default(const DDS::OwnershipQosPolicy& qos)
190 : {
191 : DDS::OwnershipQosPolicy def_qos =
192 81 : TheServiceParticipant->initial_OwnershipQosPolicy();
193 162 : return qos != def_qos;
194 : }
195 :
196 42 : bool not_default(const DDS::OwnershipStrengthQosPolicy& qos)
197 : {
198 : #ifdef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
199 : ACE_UNUSED_ARG(qos);
200 : return false;
201 : #else
202 : DDS::OwnershipStrengthQosPolicy def_qos =
203 42 : TheServiceParticipant->initial_OwnershipStrengthQosPolicy();
204 84 : return qos != def_qos;
205 : #endif
206 : }
207 :
208 81 : bool not_default(const DDS::DestinationOrderQosPolicy& qos)
209 : {
210 : DDS::DestinationOrderQosPolicy def_qos =
211 81 : TheServiceParticipant->initial_DestinationOrderQosPolicy();
212 162 : return qos != def_qos;
213 : }
214 :
215 81 : bool not_default(const DDS::PresentationQosPolicy& qos)
216 : {
217 : DDS::PresentationQosPolicy def_qos =
218 81 : TheServiceParticipant->initial_PresentationQosPolicy();
219 162 : return qos != def_qos;
220 : }
221 :
222 81 : bool not_default(const DDS::PartitionQosPolicy& qos)
223 : {
224 : DDS::PartitionQosPolicy def_qos =
225 81 : TheServiceParticipant->initial_PartitionQosPolicy();
226 162 : return qos != def_qos;
227 81 : }
228 :
229 39 : bool not_default(const DDS::TypeConsistencyEnforcementQosPolicy& qos)
230 : {
231 : DDS::TypeConsistencyEnforcementQosPolicy def_qos =
232 39 : TheServiceParticipant->initial_TypeConsistencyEnforcementQosPolicy();
233 78 : return qos != def_qos;
234 : }
235 :
236 32 : bool not_default(const DDS::PropertyQosPolicy& qos)
237 : {
238 32 : for (unsigned int i = 0; i < qos.value.length(); ++i) {
239 0 : if (qos.value[i].propagate) {
240 0 : return true;
241 : }
242 : }
243 : // binary_value is not sent in the parameter list (DDSSEC12-37)
244 32 : return false;
245 : }
246 :
247 39 : bool not_default(const DDS::TimeBasedFilterQosPolicy& qos)
248 : {
249 : DDS::TimeBasedFilterQosPolicy def_qos =
250 39 : TheServiceParticipant->initial_TimeBasedFilterQosPolicy();
251 78 : return qos != def_qos;
252 : }
253 :
254 39 : bool not_default(const DCPS::ContentFilterProperty_t& cfprop)
255 : {
256 39 : return std::strlen(cfprop.filterExpression);
257 : }
258 :
259 31 : bool not_default(const OpenDDSParticipantFlags_t& flags)
260 : {
261 31 : return flags.bits != PFLAGS_EMPTY;
262 : }
263 :
264 136 : void normalize(DDS::Duration_t& dur)
265 : {
266 : // Interoperability note:
267 : // Some other DDS implementations were observed sending
268 : // "infinite" durations using 0xffffffff nanoseconds
269 136 : if (dur.sec == DDS::DURATION_INFINITE_SEC &&
270 0 : dur.nanosec == DDS::TIME_INVALID_NSEC) {
271 0 : dur.nanosec = DDS::DURATION_INFINITE_NSEC;
272 : }
273 136 : }
274 :
275 : #ifdef OPENDDS_SECURITY
276 1 : OpenDDS::Security::DiscoveredParticipantDataKind find_data_kind(const ParameterList& param_list)
277 : {
278 : enum FieldMaskNames {
279 : ID_TOKEN_FIELD = 0x01,
280 : PERM_TOKEN_FIELD = 0x02,
281 : PROPERTY_LIST_FIELD = 0x04,
282 : PARTICIPANT_SECURITY_INFO_FIELD = 0x08,
283 : IDENTITY_STATUS_TOKEN_FIELD = 0x10,
284 : EXTENDED_BUILTIN_ENDPOINTS = 0x20
285 : };
286 :
287 1 : unsigned char field_mask = 0x00;
288 :
289 1 : const CORBA::ULong length = param_list.length();
290 16 : for (CORBA::ULong i = 0; i < length; ++i) {
291 15 : const Parameter& param = param_list[i];
292 15 : switch (param._d()) {
293 1 : case DDS::Security::PID_IDENTITY_TOKEN:
294 1 : field_mask |= ID_TOKEN_FIELD;
295 1 : break;
296 1 : case DDS::Security::PID_PERMISSIONS_TOKEN:
297 1 : field_mask |= PERM_TOKEN_FIELD;
298 1 : break;
299 0 : case PID_PROPERTY_LIST:
300 0 : field_mask |= PROPERTY_LIST_FIELD;
301 0 : break;
302 1 : case DDS::Security::PID_PARTICIPANT_SECURITY_INFO:
303 1 : field_mask |= PARTICIPANT_SECURITY_INFO_FIELD;
304 1 : break;
305 1 : case DDS::Security::PID_IDENTITY_STATUS_TOKEN:
306 1 : field_mask |= IDENTITY_STATUS_TOKEN_FIELD;
307 1 : break;
308 2 : case DDS::Security::PID_EXTENDED_BUILTIN_ENDPOINTS:
309 2 : field_mask |= EXTENDED_BUILTIN_ENDPOINTS;
310 2 : break;
311 : }
312 : }
313 :
314 1 : if ((field_mask & (ID_TOKEN_FIELD | PERM_TOKEN_FIELD)) == (ID_TOKEN_FIELD | PERM_TOKEN_FIELD)) {
315 1 : if ((field_mask & IDENTITY_STATUS_TOKEN_FIELD) == IDENTITY_STATUS_TOKEN_FIELD) {
316 1 : return OpenDDS::Security::DPDK_SECURE;
317 : } else {
318 0 : return OpenDDS::Security::DPDK_ENHANCED;
319 : }
320 : }
321 :
322 0 : return OpenDDS::Security::DPDK_ORIGINAL;
323 : }
324 : #endif
325 :
326 : };
327 :
328 : namespace ParameterListConverter {
329 :
330 : // DDS::ParticipantBuiltinTopicData
331 :
332 31 : bool to_param_list(const DDS::ParticipantBuiltinTopicData& pbtd,
333 : ParameterList& param_list)
334 : {
335 31 : if (not_default(pbtd.user_data)) {
336 3 : Parameter param_ud;
337 3 : param_ud.user_data(pbtd.user_data);
338 3 : DCPS::push_back(param_list, param_ud);
339 3 : }
340 :
341 31 : return true;
342 : }
343 :
344 24 : bool from_param_list(const ParameterList& param_list,
345 : DDS::ParticipantBuiltinTopicData& pbtd)
346 : {
347 24 : pbtd.user_data.value.length(0);
348 :
349 24 : const CORBA::ULong length = param_list.length();
350 183 : for (CORBA::ULong i = 0; i < length; ++i) {
351 160 : const Parameter& param = param_list[i];
352 160 : switch (param._d()) {
353 2 : case PID_USER_DATA:
354 2 : pbtd.user_data = param.user_data();
355 2 : break;
356 158 : default:
357 158 : if (param._d() & PIDMASK_INCOMPATIBLE) {
358 1 : return false;
359 : }
360 : }
361 : }
362 :
363 23 : return true;
364 : }
365 :
366 : #ifdef OPENDDS_SECURITY
367 1 : bool to_param_list(const DDS::Security::ParticipantBuiltinTopicData& pbtd,
368 : ParameterList& param_list)
369 : {
370 1 : to_param_list(pbtd.base, param_list);
371 :
372 1 : Parameter param_it;
373 1 : param_it.identity_token(pbtd.identity_token);
374 1 : DCPS::push_back(param_list, param_it);
375 :
376 1 : Parameter param_pt;
377 1 : param_pt.permissions_token(pbtd.permissions_token);
378 1 : DCPS::push_back(param_list, param_pt);
379 :
380 1 : if (not_default(pbtd.property)) {
381 0 : Parameter param_p;
382 0 : param_p.property(pbtd.property);
383 0 : DCPS::push_back(param_list, param_p);
384 0 : }
385 :
386 1 : Parameter param_psi;
387 1 : param_psi.participant_security_info(pbtd.security_info);
388 1 : DCPS::push_back(param_list, param_psi);
389 :
390 1 : Parameter param_ebe;
391 1 : param_ebe.extended_builtin_endpoints(pbtd.extended_builtin_endpoints);
392 1 : DCPS::push_back(param_list, param_ebe);
393 :
394 1 : return true;
395 1 : }
396 :
397 1 : bool from_param_list(const ParameterList& param_list,
398 : DDS::Security::ParticipantBuiltinTopicData& pbtd)
399 : {
400 1 : if (!from_param_list(param_list, pbtd.base))
401 0 : return false;
402 :
403 1 : pbtd.security_info.participant_security_attributes = 0;
404 1 : pbtd.security_info.plugin_participant_security_attributes = 0;
405 :
406 1 : const CORBA::ULong length = param_list.length();
407 16 : for (CORBA::ULong i = 0; i < length; ++i) {
408 15 : const Parameter& param = param_list[i];
409 15 : switch (param._d()) {
410 1 : case DDS::Security::PID_IDENTITY_TOKEN:
411 1 : pbtd.identity_token = param.identity_token();
412 1 : break;
413 1 : case DDS::Security::PID_PERMISSIONS_TOKEN:
414 1 : pbtd.permissions_token = param.permissions_token();
415 1 : break;
416 0 : case PID_PROPERTY_LIST:
417 0 : pbtd.property = param.property();
418 0 : break;
419 1 : case DDS::Security::PID_PARTICIPANT_SECURITY_INFO:
420 1 : pbtd.security_info = param.participant_security_info();
421 1 : break;
422 2 : case DDS::Security::PID_EXTENDED_BUILTIN_ENDPOINTS:
423 2 : pbtd.extended_builtin_endpoints = param.extended_builtin_endpoints();
424 2 : break;
425 10 : default:
426 10 : if (param._d() & PIDMASK_INCOMPATIBLE) {
427 0 : return false;
428 : }
429 : }
430 : }
431 :
432 1 : return true;
433 : }
434 :
435 1 : bool to_param_list(const DDS::Security::ParticipantBuiltinTopicDataSecure& pbtds,
436 : ParameterList& param_list)
437 : {
438 1 : to_param_list(pbtds.base, param_list);
439 :
440 1 : Parameter param_ist;
441 1 : param_ist.identity_status_token(pbtds.identity_status_token);
442 1 : DCPS::push_back(param_list, param_ist);
443 :
444 1 : return true;
445 1 : }
446 :
447 1 : bool from_param_list(const ParameterList& param_list,
448 : DDS::Security::ParticipantBuiltinTopicDataSecure& pbtds)
449 : {
450 1 : if (!from_param_list(param_list, pbtds.base))
451 0 : return false;
452 :
453 1 : const CORBA::ULong length = param_list.length();
454 16 : for (CORBA::ULong i = 0; i < length; ++i) {
455 15 : const Parameter& param = param_list[i];
456 15 : switch (param._d()) {
457 1 : case DDS::Security::PID_IDENTITY_STATUS_TOKEN:
458 1 : pbtds.identity_status_token = param.identity_status_token();
459 1 : break;
460 14 : default:
461 14 : if (param._d() & PIDMASK_INCOMPATIBLE) {
462 0 : return false;
463 : }
464 : }
465 : }
466 :
467 1 : return true;
468 : }
469 : #endif
470 :
471 : OpenDDS_Rtps_Export
472 31 : bool to_param_list(const ParticipantProxy_t& proxy,
473 : ParameterList& param_list)
474 : {
475 31 : Parameter beq_param;
476 31 : beq_param.builtinEndpointQos(proxy.builtinEndpointQos);
477 31 : DCPS::push_back(param_list, beq_param);
478 :
479 31 : Parameter pd_param;
480 31 : pd_param.domainId(proxy.domainId);
481 31 : DCPS::push_back(param_list, pd_param);
482 :
483 31 : Parameter pv_param;
484 31 : pv_param.version(proxy.protocolVersion);
485 31 : DCPS::push_back(param_list, pv_param);
486 :
487 31 : Parameter gp_param;
488 31 : gp_param.guid(DCPS::make_part_guid(proxy.guidPrefix));
489 31 : gp_param._d(PID_PARTICIPANT_GUID);
490 31 : DCPS::push_back(param_list, gp_param);
491 :
492 31 : Parameter vid_param;
493 31 : vid_param.vendor(proxy.vendorId);
494 31 : DCPS::push_back(param_list, vid_param);
495 :
496 31 : if (proxy.expectsInlineQos) {
497 2 : Parameter eiq_param; // Default is false
498 2 : eiq_param.expects_inline_qos(proxy.expectsInlineQos);
499 2 : DCPS::push_back(param_list, eiq_param);
500 2 : }
501 :
502 31 : Parameter abe_param;
503 31 : abe_param.participant_builtin_endpoints(
504 31 : proxy.availableBuiltinEndpoints);
505 31 : DCPS::push_back(param_list, abe_param);
506 :
507 : // Interoperability note:
508 : // For interoperability with other DDS implemenations, we'll encode the
509 : // availableBuiltinEndpoints as PID_BUILTIN_ENDPOINT_SET in addition to
510 : // PID_PARTICIPANT_BUILTIN_ENDPOINTS (above).
511 31 : Parameter be_param;
512 31 : be_param.builtin_endpoints(
513 31 : proxy.availableBuiltinEndpoints);
514 31 : DCPS::push_back(param_list, be_param);
515 :
516 : #ifdef OPENDDS_SECURITY
517 31 : Parameter ebe_param;
518 31 : ebe_param.extended_builtin_endpoints(
519 31 : proxy.availableExtendedBuiltinEndpoints);
520 31 : DCPS::push_back(param_list, ebe_param);
521 : #endif
522 :
523 : // Each locator
524 31 : push_back_locator_seq(
525 : param_list,
526 31 : proxy.metatrafficUnicastLocatorList,
527 : PID_METATRAFFIC_UNICAST_LOCATOR);
528 :
529 31 : push_back_locator_seq(
530 : param_list,
531 31 : proxy.metatrafficMulticastLocatorList,
532 : PID_METATRAFFIC_MULTICAST_LOCATOR);
533 :
534 31 : push_back_locator_seq(
535 : param_list,
536 31 : proxy.defaultUnicastLocatorList,
537 : PID_DEFAULT_UNICAST_LOCATOR);
538 :
539 31 : push_back_locator_seq(
540 : param_list,
541 31 : proxy.defaultMulticastLocatorList,
542 : PID_DEFAULT_MULTICAST_LOCATOR);
543 :
544 31 : Parameter ml_param;
545 31 : ml_param.count(proxy.manualLivelinessCount);
546 31 : DCPS::push_back(param_list, ml_param);
547 :
548 31 : if (not_default(proxy.property)) {
549 0 : Parameter param_p;
550 0 : param_p.property(proxy.property);
551 0 : DCPS::push_back(param_list, param_p);
552 0 : }
553 :
554 31 : if (not_default(proxy.opendds_participant_flags)) {
555 0 : Parameter param_opf;
556 0 : param_opf.participant_flags(proxy.opendds_participant_flags);
557 0 : DCPS::push_back(param_list, param_opf);
558 0 : }
559 :
560 31 : if (proxy.opendds_rtps_relay_application_participant) {
561 0 : Parameter param;
562 0 : param.opendds_rtps_relay_application_participant(proxy.opendds_rtps_relay_application_participant);
563 0 : DCPS::push_back(param_list, param);
564 0 : }
565 :
566 31 : return true;
567 31 : }
568 :
569 23 : bool from_param_list(const ParameterList& param_list,
570 : ParticipantProxy_t& proxy)
571 : {
572 : // Start by setting defaults
573 23 : proxy.availableBuiltinEndpoints = 0;
574 : #ifdef OPENDDS_SECURITY
575 23 : proxy.availableExtendedBuiltinEndpoints = 0;
576 : #endif
577 23 : proxy.expectsInlineQos = false;
578 23 : proxy.opendds_participant_flags.bits = 0;
579 23 : proxy.opendds_rtps_relay_application_participant = false;
580 :
581 23 : const CORBA::ULong length = param_list.length();
582 182 : for (CORBA::ULong i = 0; i < length; ++i) {
583 159 : const Parameter& param = param_list[i];
584 159 : switch (param._d()) {
585 15 : case PID_BUILTIN_ENDPOINT_QOS:
586 15 : proxy.builtinEndpointQos = param.builtinEndpointQos();
587 15 : break;
588 15 : case PID_DOMAIN_ID:
589 15 : proxy.domainId = param.domainId();
590 15 : break;
591 15 : case PID_PROTOCOL_VERSION:
592 15 : proxy.protocolVersion = param.version();
593 15 : break;
594 15 : case PID_PARTICIPANT_GUID:
595 15 : ACE_OS::memcpy(proxy.guidPrefix,
596 15 : param.guid().guidPrefix, sizeof(GuidPrefix_t));
597 15 : break;
598 15 : case PID_VENDORID:
599 15 : ACE_OS::memcpy(proxy.vendorId.vendorId,
600 15 : param.vendor().vendorId, sizeof(OctetArray2));
601 15 : break;
602 1 : case PID_EXPECTS_INLINE_QOS:
603 1 : proxy.expectsInlineQos =
604 1 : param.expects_inline_qos();
605 1 : break;
606 15 : case PID_PARTICIPANT_BUILTIN_ENDPOINTS:
607 15 : proxy.availableBuiltinEndpoints =
608 15 : param.participant_builtin_endpoints();
609 15 : break;
610 16 : case PID_BUILTIN_ENDPOINT_SET:
611 : // Interoperability note:
612 : // OpenSplice uses this in place of PID_PARTICIPANT_BUILTIN_ENDPOINTS
613 : // Table 9.13 indicates that PID_PARTICIPANT_BUILTIN_ENDPOINTS should be
614 : // used to represent ParticipantProxy::availableBuiltinEndpoints
615 16 : proxy.availableBuiltinEndpoints =
616 16 : param.builtin_endpoints();
617 16 : break;
618 : #ifdef OPENDDS_SECURITY
619 16 : case DDS::Security::PID_EXTENDED_BUILTIN_ENDPOINTS:
620 16 : proxy.availableExtendedBuiltinEndpoints =
621 16 : param.extended_builtin_endpoints();
622 16 : break;
623 : #endif
624 2 : case PID_METATRAFFIC_UNICAST_LOCATOR:
625 2 : DCPS::push_back(
626 2 : proxy.metatrafficUnicastLocatorList,
627 2 : param.locator());
628 2 : break;
629 4 : case PID_METATRAFFIC_MULTICAST_LOCATOR:
630 4 : DCPS::push_back(
631 4 : proxy.metatrafficMulticastLocatorList,
632 4 : param.locator());
633 4 : break;
634 2 : case PID_DEFAULT_UNICAST_LOCATOR:
635 2 : DCPS::push_back(
636 2 : proxy.defaultUnicastLocatorList,
637 2 : param.locator());
638 2 : break;
639 2 : case PID_DEFAULT_MULTICAST_LOCATOR:
640 2 : DCPS::push_back(
641 2 : proxy.defaultMulticastLocatorList,
642 2 : param.locator());
643 2 : break;
644 15 : case PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT:
645 15 : proxy.manualLivelinessCount.value =
646 15 : param.count().value;
647 15 : break;
648 0 : case PID_PROPERTY_LIST:
649 0 : proxy.property = param.property();
650 0 : break;
651 0 : case PID_OPENDDS_PARTICIPANT_FLAGS:
652 0 : proxy.opendds_participant_flags = param.participant_flags();
653 0 : break;
654 0 : case PID_OPENDDS_RTPS_RELAY_APPLICATION_PARTICIPANT:
655 0 : proxy.opendds_rtps_relay_application_participant = param.opendds_rtps_relay_application_participant();
656 0 : break;
657 2 : case PID_SENTINEL:
658 : case PID_PAD:
659 : // ignore
660 2 : break;
661 9 : default:
662 9 : if (param._d() & PIDMASK_INCOMPATIBLE) {
663 0 : return false;
664 : }
665 : }
666 : }
667 :
668 23 : return true;
669 : }
670 :
671 : // OpenDDS::RTPS::Duration_t
672 :
673 : OpenDDS_Rtps_Export
674 31 : bool to_param_list(const Duration_t& duration,
675 : ParameterList& param_list)
676 : {
677 31 : if ((duration.seconds != 100) ||
678 29 : (duration.fraction != 0)) {
679 2 : Parameter ld_param;
680 2 : ld_param.duration(duration);
681 2 : DCPS::push_back(param_list, ld_param);
682 2 : }
683 :
684 31 : return true;
685 : }
686 :
687 : OpenDDS_Rtps_Export
688 23 : bool from_param_list(const ParameterList& param_list,
689 : Duration_t& duration)
690 : {
691 23 : duration.seconds = 100;
692 23 : duration.fraction = 0;
693 :
694 23 : const CORBA::ULong length = param_list.length();
695 182 : for (CORBA::ULong i = 0; i < length; ++i) {
696 159 : const Parameter& param = param_list[i];
697 159 : switch (param._d()) {
698 1 : case PID_PARTICIPANT_LEASE_DURATION:
699 1 : duration = param.duration();
700 1 : break;
701 158 : default:
702 158 : if (param._d() & PIDMASK_INCOMPATIBLE) {
703 0 : return false;
704 : }
705 : }
706 : }
707 23 : return true;
708 : }
709 :
710 : // OpenDDS::RTPS::SPDPdiscoveredParticipantData
711 :
712 : OpenDDS_Rtps_Export
713 30 : bool to_param_list(const SPDPdiscoveredParticipantData& participant_data,
714 : ParameterList& param_list)
715 : {
716 30 : to_param_list(participant_data.ddsParticipantData, param_list);
717 30 : to_param_list(participant_data.participantProxy, param_list);
718 30 : to_param_list(participant_data.leaseDuration, param_list);
719 :
720 30 : return true;
721 : }
722 :
723 23 : bool from_param_list(const ParameterList& param_list,
724 : SPDPdiscoveredParticipantData& participant_data)
725 : {
726 23 : bool result = from_param_list(param_list, participant_data.ddsParticipantData);
727 23 : if (result) {
728 22 : result = from_param_list(param_list, participant_data.participantProxy);
729 22 : if (result) {
730 22 : result = from_param_list(param_list, participant_data.leaseDuration);
731 : }
732 : }
733 :
734 23 : return result;
735 : }
736 :
737 : #ifdef OPENDDS_SECURITY
738 1 : bool to_param_list(const OpenDDS::Security::SPDPdiscoveredParticipantData& participant_data,
739 : ParameterList& param_list)
740 : {
741 1 : if (participant_data.dataKind == OpenDDS::Security::DPDK_SECURE) {
742 1 : to_param_list(participant_data.ddsParticipantDataSecure, param_list);
743 0 : } else if (participant_data.dataKind == OpenDDS::Security::DPDK_ENHANCED) {
744 0 : to_param_list(participant_data.ddsParticipantDataSecure.base, param_list);
745 : } else {
746 0 : to_param_list(participant_data.ddsParticipantDataSecure.base.base, param_list);
747 : }
748 :
749 1 : to_param_list(participant_data.participantProxy, param_list);
750 1 : to_param_list(participant_data.leaseDuration, param_list);
751 :
752 1 : return true;
753 : }
754 :
755 1 : bool from_param_list(const ParameterList& param_list,
756 : OpenDDS::Security::SPDPdiscoveredParticipantData& participant_data)
757 : {
758 1 : bool result = false;
759 :
760 1 : participant_data.dataKind = find_data_kind(param_list);
761 1 : switch (participant_data.dataKind) {
762 1 : case OpenDDS::Security::DPDK_SECURE: {
763 1 : result = from_param_list(param_list, participant_data.ddsParticipantDataSecure);
764 1 : break;
765 : }
766 0 : case OpenDDS::Security::DPDK_ENHANCED: {
767 0 : result = from_param_list(param_list, participant_data.ddsParticipantDataSecure.base);
768 0 : break;
769 : }
770 0 : default: {
771 0 : result = from_param_list(param_list, participant_data.ddsParticipantDataSecure.base.base);
772 0 : break;
773 : }
774 : }
775 :
776 1 : if (result) {
777 1 : result = from_param_list(param_list, participant_data.participantProxy);
778 1 : if (result) {
779 1 : result = from_param_list(param_list, participant_data.leaseDuration);
780 : }
781 : }
782 :
783 1 : return result;
784 : }
785 : #endif
786 :
787 : // OpenDDS::DCPS::DiscoveredWriterData
788 :
789 81 : void add_DataRepresentationQos(ParameterList& param_list, const DDS::DataRepresentationIdSeq& ids)
790 : {
791 81 : DDS::DataRepresentationQosPolicy dr_qos;
792 81 : dr_qos.value = ids;
793 81 : DCPS::set_reader_effective_data_rep_qos(dr_qos.value);
794 81 : if (dr_qos.value.length() != 1 || dr_qos.value[0] != DDS::XCDR_DATA_REPRESENTATION) {
795 81 : Parameter param;
796 81 : param.representation(dr_qos);
797 81 : DCPS::push_back(param_list, param);
798 81 : }
799 81 : }
800 :
801 42 : bool to_param_list(const DCPS::DiscoveredWriterData& writer_data,
802 : ParameterList& param_list,
803 : bool use_xtypes,
804 : const XTypes::TypeInformation& type_info,
805 : bool map)
806 : {
807 : // Ignore builtin topic key
808 :
809 : {
810 42 : Parameter param;
811 42 : param.string_data(writer_data.ddsPublicationData.topic_name);
812 42 : param._d(PID_TOPIC_NAME);
813 42 : DCPS::push_back(param_list, param);
814 42 : }
815 :
816 : {
817 42 : Parameter param;
818 42 : param.string_data(writer_data.ddsPublicationData.type_name);
819 42 : param._d(PID_TYPE_NAME);
820 42 : DCPS::push_back(param_list, param);
821 42 : }
822 :
823 42 : if (use_xtypes) {
824 42 : add_type_info_param(param_list, type_info);
825 : }
826 :
827 42 : if (not_default(writer_data.ddsPublicationData.durability)) {
828 4 : Parameter param;
829 4 : param.durability(writer_data.ddsPublicationData.durability);
830 4 : DCPS::push_back(param_list, param);
831 4 : }
832 :
833 42 : if (not_default(writer_data.ddsPublicationData.durability_service)) {
834 39 : Parameter param;
835 39 : param.durability_service(writer_data.ddsPublicationData.durability_service);
836 39 : DCPS::push_back(param_list, param);
837 39 : }
838 :
839 42 : if (not_default(writer_data.ddsPublicationData.deadline)) {
840 39 : Parameter param;
841 39 : param.deadline(writer_data.ddsPublicationData.deadline);
842 39 : DCPS::push_back(param_list, param);
843 39 : }
844 :
845 42 : if (not_default(writer_data.ddsPublicationData.latency_budget)) {
846 2 : Parameter param;
847 2 : param.latency_budget(writer_data.ddsPublicationData.latency_budget);
848 2 : DCPS::push_back(param_list, param);
849 2 : }
850 :
851 42 : if (not_default(writer_data.ddsPublicationData.liveliness)) {
852 39 : Parameter param;
853 39 : param.liveliness(writer_data.ddsPublicationData.liveliness);
854 39 : DCPS::push_back(param_list, param);
855 39 : }
856 :
857 : // Interoperability note:
858 : // For interoperability, always write the reliability info
859 : {
860 42 : Parameter param;
861 : ReliabilityQosPolicyRtps reliability;
862 42 : reliability.max_blocking_time = writer_data.ddsPublicationData.reliability.max_blocking_time;
863 :
864 42 : if (writer_data.ddsPublicationData.reliability.kind == DDS::BEST_EFFORT_RELIABILITY_QOS) {
865 37 : reliability.kind.value = RTPS::BEST_EFFORT;
866 : } else { // default to RELIABLE for writers
867 5 : reliability.kind.value = RTPS::RELIABLE;
868 : }
869 :
870 42 : param.reliability(reliability);
871 42 : DCPS::push_back(param_list, param);
872 42 : }
873 :
874 42 : if (not_default(writer_data.ddsPublicationData.lifespan)) {
875 39 : Parameter param;
876 39 : param.lifespan(writer_data.ddsPublicationData.lifespan);
877 39 : DCPS::push_back(param_list, param);
878 39 : }
879 :
880 42 : if (not_default(writer_data.ddsPublicationData.user_data)) {
881 2 : Parameter param;
882 2 : param.user_data(writer_data.ddsPublicationData.user_data);
883 2 : DCPS::push_back(param_list, param);
884 2 : }
885 :
886 42 : if (not_default(writer_data.ddsPublicationData.ownership)) {
887 2 : Parameter param;
888 2 : param.ownership(writer_data.ddsPublicationData.ownership);
889 2 : DCPS::push_back(param_list, param);
890 2 : }
891 :
892 42 : if (not_default(writer_data.ddsPublicationData.ownership_strength)) {
893 2 : Parameter param;
894 2 : param.ownership_strength(writer_data.ddsPublicationData.ownership_strength);
895 2 : DCPS::push_back(param_list, param);
896 2 : }
897 :
898 42 : if (not_default(writer_data.ddsPublicationData.destination_order)) {
899 15 : Parameter param;
900 15 : param.destination_order(writer_data.ddsPublicationData.destination_order);
901 15 : DCPS::push_back(param_list, param);
902 15 : }
903 :
904 42 : if (not_default(writer_data.ddsPublicationData.presentation)) {
905 2 : Parameter param;
906 2 : param.presentation(writer_data.ddsPublicationData.presentation);
907 2 : DCPS::push_back(param_list, param);
908 2 : }
909 :
910 42 : if (not_default(writer_data.ddsPublicationData.partition)) {
911 2 : Parameter param;
912 2 : param.partition(writer_data.ddsPublicationData.partition);
913 2 : DCPS::push_back(param_list, param);
914 2 : }
915 :
916 42 : if (not_default(writer_data.ddsPublicationData.topic_data)) {
917 2 : Parameter param;
918 2 : param.topic_data(writer_data.ddsPublicationData.topic_data);
919 2 : DCPS::push_back(param_list, param);
920 2 : }
921 :
922 42 : if (not_default(writer_data.ddsPublicationData.group_data)) {
923 2 : Parameter param;
924 2 : param.group_data(writer_data.ddsPublicationData.group_data);
925 2 : DCPS::push_back(param_list, param);
926 2 : }
927 :
928 42 : add_DataRepresentationQos(param_list, writer_data.ddsPublicationData.representation.value);
929 :
930 : {
931 42 : Parameter param;
932 42 : param.guid(writer_data.writerProxy.remoteWriterGuid);
933 42 : param._d(PID_ENDPOINT_GUID);
934 42 : DCPS::push_back(param_list, param);
935 42 : }
936 42 : const CORBA::ULong locator_len = writer_data.writerProxy.allLocators.length();
937 :
938 : // Serialize from allLocators, rather than the unicastLocatorList
939 : // and multicastLocatorList. This allows OpenDDS transports to be
940 : // serialized in the proper order using custom PIDs.
941 46 : for (CORBA::ULong i = 0; i < locator_len; ++i) {
942 : // Each locator has a blob of interest
943 4 : const DCPS::TransportLocator& tl = writer_data.writerProxy.allLocators[i];
944 : // If this is an rtps udp transport
945 4 : if (!std::strcmp(tl.transport_type, "rtps_udp")) {
946 : // Append the locator's deserialized locator and an RTPS PID
947 4 : push_back_rtps_locator(param_list, tl, map);
948 : // Otherwise, this is an OpenDDS, custom transport
949 : } else {
950 : // Append the blob and a custom PID
951 0 : push_back_dcps_locator(param_list, tl);
952 0 : if (!std::strcmp(tl.transport_type, "multicast")
953 0 : && DCPS::log_level >= DCPS::LogLevel::Warning) {
954 0 : ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: ParameterListConverter::to_param_list(dwd): "
955 : "Multicast transport with RTPS discovery has known issues\n"));
956 : }
957 : }
958 : }
959 :
960 42 : return true;
961 : }
962 :
963 37 : bool from_param_list(const ParameterList& param_list,
964 : DCPS::DiscoveredWriterData& writer_data,
965 : bool use_xtypes,
966 : XTypes::TypeInformation& type_info)
967 : {
968 : // Collect the rtps_udp locators before appending them to allLocators
969 37 : DCPS::LocatorSeq rtps_udp_locators;
970 :
971 : // Start by setting defaults
972 37 : writer_data.ddsPublicationData.topic_name = "";
973 37 : writer_data.ddsPublicationData.type_name = "";
974 37 : writer_data.ddsPublicationData.durability =
975 37 : TheServiceParticipant->initial_DurabilityQosPolicy();
976 37 : writer_data.ddsPublicationData.durability_service =
977 37 : TheServiceParticipant->initial_DurabilityServiceQosPolicy();
978 37 : writer_data.ddsPublicationData.deadline =
979 37 : TheServiceParticipant->initial_DeadlineQosPolicy();
980 37 : writer_data.ddsPublicationData.latency_budget =
981 37 : TheServiceParticipant->initial_LatencyBudgetQosPolicy();
982 37 : writer_data.ddsPublicationData.liveliness =
983 37 : TheServiceParticipant->initial_LivelinessQosPolicy();
984 37 : writer_data.ddsPublicationData.reliability =
985 37 : TheServiceParticipant->initial_DataWriterQos().reliability;
986 37 : writer_data.ddsPublicationData.lifespan =
987 37 : TheServiceParticipant->initial_LifespanQosPolicy();
988 : writer_data.ddsPublicationData.user_data =
989 37 : TheServiceParticipant->initial_UserDataQosPolicy();
990 37 : writer_data.ddsPublicationData.ownership =
991 37 : TheServiceParticipant->initial_OwnershipQosPolicy();
992 : #ifdef OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE
993 : writer_data.ddsPublicationData.ownership_strength.value = 0;
994 : #else
995 37 : writer_data.ddsPublicationData.ownership_strength =
996 37 : TheServiceParticipant->initial_OwnershipStrengthQosPolicy();
997 : #endif
998 37 : writer_data.ddsPublicationData.destination_order =
999 37 : TheServiceParticipant->initial_DestinationOrderQosPolicy();
1000 37 : writer_data.ddsPublicationData.presentation =
1001 37 : TheServiceParticipant->initial_PresentationQosPolicy();
1002 : writer_data.ddsPublicationData.partition =
1003 37 : TheServiceParticipant->initial_PartitionQosPolicy();
1004 : writer_data.ddsPublicationData.topic_data =
1005 37 : TheServiceParticipant->initial_TopicDataQosPolicy();
1006 : writer_data.ddsPublicationData.group_data =
1007 37 : TheServiceParticipant->initial_GroupDataQosPolicy();
1008 37 : writer_data.ddsPublicationData.representation.value.length(1);
1009 37 : writer_data.ddsPublicationData.representation.value[0] = DDS::XCDR_DATA_REPRESENTATION;
1010 :
1011 37 : const CORBA::ULong length = param_list.length();
1012 252 : for (CORBA::ULong i = 0; i < length; ++i) {
1013 215 : const Parameter& param = param_list[i];
1014 215 : switch (param._d()) {
1015 20 : case PID_TOPIC_NAME:
1016 20 : writer_data.ddsPublicationData.topic_name = param.string_data();
1017 20 : break;
1018 20 : case PID_TYPE_NAME:
1019 20 : writer_data.ddsPublicationData.type_name = param.string_data();
1020 20 : break;
1021 2 : case PID_DURABILITY:
1022 2 : writer_data.ddsPublicationData.durability = param.durability();
1023 2 : break;
1024 19 : case PID_DURABILITY_SERVICE:
1025 19 : writer_data.ddsPublicationData.durability_service =
1026 19 : param.durability_service();
1027 : // Interoperability note: calling normalize() shouldn't be required
1028 19 : normalize(writer_data.ddsPublicationData.durability_service.service_cleanup_delay);
1029 19 : break;
1030 19 : case PID_DEADLINE:
1031 19 : writer_data.ddsPublicationData.deadline = param.deadline();
1032 : // Interoperability note: calling normalize() shouldn't be required
1033 19 : normalize(writer_data.ddsPublicationData.deadline.period);
1034 19 : break;
1035 1 : case PID_LATENCY_BUDGET:
1036 1 : writer_data.ddsPublicationData.latency_budget = param.latency_budget();
1037 : // Interoperability note: calling normalize() shouldn't be required
1038 1 : normalize(writer_data.ddsPublicationData.latency_budget.duration);
1039 1 : break;
1040 19 : case PID_LIVELINESS:
1041 19 : writer_data.ddsPublicationData.liveliness = param.liveliness();
1042 : // Interoperability note: calling normalize() shouldn't be required
1043 19 : normalize(writer_data.ddsPublicationData.liveliness.lease_duration);
1044 19 : break;
1045 20 : case PID_RELIABILITY:
1046 20 : writer_data.ddsPublicationData.reliability.max_blocking_time = param.reliability().max_blocking_time;
1047 : // Interoperability note:
1048 : // Spec creators for RTPS have reliability indexed at 1
1049 : {
1050 20 : if (param.reliability().kind.value == RTPS::BEST_EFFORT) {
1051 18 : writer_data.ddsPublicationData.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
1052 : } else { // default to RELIABLE for writers
1053 2 : writer_data.ddsPublicationData.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
1054 : }
1055 : }
1056 20 : normalize(writer_data.ddsPublicationData.reliability.max_blocking_time);
1057 20 : break;
1058 19 : case PID_LIFESPAN:
1059 19 : writer_data.ddsPublicationData.lifespan = param.lifespan();
1060 : // Interoperability note: calling normalize() shouldn't be required
1061 19 : normalize(writer_data.ddsPublicationData.lifespan.duration);
1062 19 : break;
1063 1 : case PID_USER_DATA:
1064 1 : writer_data.ddsPublicationData.user_data = param.user_data();
1065 1 : break;
1066 1 : case PID_OWNERSHIP:
1067 1 : writer_data.ddsPublicationData.ownership = param.ownership();
1068 1 : break;
1069 1 : case PID_OWNERSHIP_STRENGTH:
1070 1 : writer_data.ddsPublicationData.ownership_strength = param.ownership_strength();
1071 1 : break;
1072 7 : case PID_DESTINATION_ORDER:
1073 7 : writer_data.ddsPublicationData.destination_order = param.destination_order();
1074 7 : break;
1075 1 : case PID_PRESENTATION:
1076 1 : writer_data.ddsPublicationData.presentation = param.presentation();
1077 1 : break;
1078 1 : case PID_PARTITION:
1079 1 : writer_data.ddsPublicationData.partition = param.partition();
1080 1 : break;
1081 1 : case PID_TOPIC_DATA:
1082 1 : writer_data.ddsPublicationData.topic_data = param.topic_data();
1083 1 : break;
1084 1 : case PID_GROUP_DATA:
1085 1 : writer_data.ddsPublicationData.group_data = param.group_data();
1086 1 : break;
1087 20 : case PID_DATA_REPRESENTATION:
1088 20 : if (param.representation().value.length() != 0) {
1089 20 : writer_data.ddsPublicationData.representation = param.representation();
1090 : }
1091 20 : break;
1092 20 : case PID_ENDPOINT_GUID:
1093 20 : writer_data.writerProxy.remoteWriterGuid = param.guid();
1094 20 : break;
1095 2 : case PID_UNICAST_LOCATOR:
1096 2 : DCPS::push_back(rtps_udp_locators, param.locator());
1097 2 : break;
1098 0 : case PID_MULTICAST_LOCATOR:
1099 0 : DCPS::push_back(rtps_udp_locators, param.locator());
1100 0 : break;
1101 0 : case PID_OPENDDS_LOCATOR:
1102 : // Append the rtps_udp_locators, if any, first, to preserve order
1103 0 : append_locators_if_present(writer_data.writerProxy.allLocators,
1104 : rtps_udp_locators);
1105 0 : rtps_udp_locators.length(0);
1106 0 : DCPS::push_back(writer_data.writerProxy.allLocators,
1107 0 : param.opendds_locator());
1108 0 : break;
1109 0 : case PID_SENTINEL:
1110 : case PID_PAD:
1111 : // ignore
1112 0 : break;
1113 20 : case PID_XTYPES_TYPE_INFORMATION:
1114 20 : if (use_xtypes) {
1115 20 : extract_type_info_param(param, type_info);
1116 : }
1117 20 : break;
1118 0 : default:
1119 0 : if (param._d() & PIDMASK_INCOMPATIBLE) {
1120 0 : return false;
1121 : }
1122 : }
1123 : }
1124 : // Append additional rtps_udp_locators, if any
1125 37 : append_locators_if_present(writer_data.writerProxy.allLocators,
1126 : rtps_udp_locators);
1127 37 : rtps_udp_locators.length(0);
1128 37 : return true;
1129 37 : }
1130 :
1131 : // OpenDDS::DCPS::DiscoveredReaderData
1132 :
1133 39 : bool to_param_list(const DCPS::DiscoveredReaderData& reader_data,
1134 : ParameterList& param_list,
1135 : bool use_xtypes,
1136 : const XTypes::TypeInformation& type_info,
1137 : bool map)
1138 : {
1139 : // Ignore builtin topic key
1140 : {
1141 39 : Parameter param;
1142 39 : param.string_data(reader_data.ddsSubscriptionData.topic_name);
1143 39 : param._d(PID_TOPIC_NAME);
1144 39 : DCPS::push_back(param_list, param);
1145 39 : }
1146 :
1147 39 : if (use_xtypes) {
1148 39 : add_type_info_param(param_list, type_info);
1149 : }
1150 :
1151 : {
1152 39 : Parameter param;
1153 39 : param.string_data(reader_data.ddsSubscriptionData.type_name);
1154 39 : param._d(PID_TYPE_NAME);
1155 39 : DCPS::push_back(param_list, param);
1156 39 : }
1157 :
1158 39 : if (not_default(reader_data.ddsSubscriptionData.durability)) {
1159 2 : Parameter param;
1160 2 : param.durability(reader_data.ddsSubscriptionData.durability);
1161 2 : DCPS::push_back(param_list, param);
1162 2 : }
1163 :
1164 39 : if (not_default(reader_data.ddsSubscriptionData.deadline)) {
1165 37 : Parameter param;
1166 37 : param.deadline(reader_data.ddsSubscriptionData.deadline);
1167 37 : DCPS::push_back(param_list, param);
1168 37 : }
1169 :
1170 39 : if (not_default(reader_data.ddsSubscriptionData.latency_budget)) {
1171 2 : Parameter param;
1172 2 : param.latency_budget(reader_data.ddsSubscriptionData.latency_budget);
1173 2 : DCPS::push_back(param_list, param);
1174 2 : }
1175 :
1176 39 : if (not_default(reader_data.ddsSubscriptionData.liveliness)) {
1177 37 : Parameter param;
1178 37 : param.liveliness(reader_data.ddsSubscriptionData.liveliness);
1179 37 : DCPS::push_back(param_list, param);
1180 37 : }
1181 :
1182 : // Interoperability note:
1183 : // For interoperability, always write the reliability info
1184 : // if (not_default(reader_data.ddsSubscriptionData.reliability, false))
1185 : {
1186 39 : Parameter param;
1187 : ReliabilityQosPolicyRtps reliability;
1188 39 : reliability.max_blocking_time = reader_data.ddsSubscriptionData.reliability.max_blocking_time;
1189 :
1190 39 : if (reader_data.ddsSubscriptionData.reliability.kind == DDS::RELIABLE_RELIABILITY_QOS) {
1191 2 : reliability.kind.value = RTPS::RELIABLE;
1192 : } else { // default to BEST_EFFORT for readers
1193 37 : reliability.kind.value = RTPS::BEST_EFFORT;
1194 : }
1195 :
1196 39 : param.reliability(reliability);
1197 39 : DCPS::push_back(param_list, param);
1198 39 : }
1199 :
1200 39 : if (not_default(reader_data.ddsSubscriptionData.ownership)) {
1201 2 : Parameter param;
1202 2 : param.ownership(reader_data.ddsSubscriptionData.ownership);
1203 2 : DCPS::push_back(param_list, param);
1204 2 : }
1205 :
1206 39 : if (not_default(reader_data.ddsSubscriptionData.destination_order)) {
1207 18 : Parameter param;
1208 18 : param.destination_order(reader_data.ddsSubscriptionData.destination_order);
1209 18 : DCPS::push_back(param_list, param);
1210 18 : }
1211 :
1212 39 : if (not_default(reader_data.ddsSubscriptionData.user_data)) {
1213 2 : Parameter param;
1214 2 : param.user_data(reader_data.ddsSubscriptionData.user_data);
1215 2 : DCPS::push_back(param_list, param);
1216 2 : }
1217 :
1218 39 : if (not_default(reader_data.ddsSubscriptionData.time_based_filter)) {
1219 0 : Parameter param;
1220 0 : param.time_based_filter(reader_data.ddsSubscriptionData.time_based_filter);
1221 0 : DCPS::push_back(param_list, param);
1222 0 : }
1223 :
1224 39 : if (not_default(reader_data.ddsSubscriptionData.presentation)) {
1225 2 : Parameter param;
1226 2 : param.presentation(reader_data.ddsSubscriptionData.presentation);
1227 2 : DCPS::push_back(param_list, param);
1228 2 : }
1229 :
1230 39 : if (not_default(reader_data.ddsSubscriptionData.partition)) {
1231 2 : Parameter param;
1232 2 : param.partition(reader_data.ddsSubscriptionData.partition);
1233 2 : DCPS::push_back(param_list, param);
1234 2 : }
1235 :
1236 39 : if (not_default(reader_data.ddsSubscriptionData.topic_data)) {
1237 2 : Parameter param;
1238 2 : param.topic_data(reader_data.ddsSubscriptionData.topic_data);
1239 2 : DCPS::push_back(param_list, param);
1240 2 : }
1241 :
1242 39 : if (not_default(reader_data.ddsSubscriptionData.group_data)) {
1243 2 : Parameter param;
1244 2 : param.group_data(reader_data.ddsSubscriptionData.group_data);
1245 2 : DCPS::push_back(param_list, param);
1246 2 : }
1247 :
1248 39 : add_DataRepresentationQos(param_list, reader_data.ddsSubscriptionData.representation.value);
1249 :
1250 39 : if (not_default(reader_data.ddsSubscriptionData.type_consistency)) {
1251 39 : Parameter param;
1252 39 : param.type_consistency(reader_data.ddsSubscriptionData.type_consistency);
1253 39 : DCPS::push_back(param_list, param);
1254 39 : }
1255 :
1256 : {
1257 39 : Parameter param;
1258 39 : param.guid(reader_data.readerProxy.remoteReaderGuid);
1259 39 : param._d(PID_ENDPOINT_GUID);
1260 39 : DCPS::push_back(param_list, param);
1261 39 : }
1262 :
1263 39 : if (not_default(reader_data.contentFilterProperty)) {
1264 2 : Parameter param;
1265 2 : DCPS::ContentFilterProperty_t cfprop_copy = reader_data.contentFilterProperty;
1266 2 : if (!std::strlen(cfprop_copy.filterClassName)) {
1267 1 : cfprop_copy.filterClassName = "DDSSQL";
1268 : }
1269 2 : param.content_filter_property(cfprop_copy);
1270 2 : DCPS::push_back(param_list, param);
1271 2 : }
1272 :
1273 : CORBA::ULong i;
1274 39 : const CORBA::ULong locator_len = reader_data.readerProxy.allLocators.length();
1275 : // Serialize from allLocators, rather than the unicastLocatorList
1276 : // and multicastLocatorList. This allows OpenDDS transports to be
1277 : // serialized in the proper order using custom PIDs.
1278 43 : for (i = 0; i < locator_len; ++i) {
1279 : // Each locator has a blob of interest
1280 4 : const DCPS::TransportLocator& tl = reader_data.readerProxy.allLocators[i];
1281 : // If this is an rtps udp transport
1282 4 : if (!std::strcmp(tl.transport_type, "rtps_udp")) {
1283 : // Append the locator's deserialized locator and an RTPS PID
1284 4 : push_back_rtps_locator(param_list, tl, map);
1285 : // Otherwise, this is an OpenDDS, custom transport
1286 : } else {
1287 : // Append the blob and a custom PID
1288 0 : push_back_dcps_locator(param_list, tl);
1289 0 : if (!std::strcmp(tl.transport_type, "multicast")
1290 0 : && DCPS::log_level >= DCPS::LogLevel::Warning) {
1291 0 : ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: ParameterListConverter::to_param_list(drd): "
1292 : "Multicast transport with RTPS discovery has known issues\n"));
1293 : }
1294 : }
1295 : }
1296 :
1297 39 : const CORBA::ULong num_associations = reader_data.readerProxy.associatedWriters.length();
1298 41 : for (i = 0; i < num_associations; ++i) {
1299 2 : Parameter param;
1300 2 : param.guid(reader_data.readerProxy.associatedWriters[i]);
1301 2 : param._d(PID_OPENDDS_ASSOCIATED_WRITER);
1302 2 : DCPS::push_back(param_list, param);
1303 2 : }
1304 39 : return true;
1305 : }
1306 :
1307 20 : bool from_param_list(const ParameterList& param_list,
1308 : DCPS::DiscoveredReaderData& reader_data,
1309 : bool use_xtypes,
1310 : XTypes::TypeInformation& type_info)
1311 : {
1312 : // Collect the rtps_udp locators before appending them to allLocators
1313 :
1314 20 : DCPS::LocatorSeq rtps_udp_locators;
1315 : // Start by setting defaults
1316 20 : reader_data.ddsSubscriptionData.topic_name = "";
1317 20 : reader_data.ddsSubscriptionData.type_name = "";
1318 20 : reader_data.ddsSubscriptionData.durability =
1319 20 : TheServiceParticipant->initial_DurabilityQosPolicy();
1320 20 : reader_data.ddsSubscriptionData.deadline =
1321 20 : TheServiceParticipant->initial_DeadlineQosPolicy();
1322 20 : reader_data.ddsSubscriptionData.latency_budget =
1323 20 : TheServiceParticipant->initial_LatencyBudgetQosPolicy();
1324 20 : reader_data.ddsSubscriptionData.liveliness =
1325 20 : TheServiceParticipant->initial_LivelinessQosPolicy();
1326 20 : reader_data.ddsSubscriptionData.reliability =
1327 20 : TheServiceParticipant->initial_DataReaderQos().reliability;
1328 20 : reader_data.ddsSubscriptionData.ownership =
1329 20 : TheServiceParticipant->initial_OwnershipQosPolicy();
1330 20 : reader_data.ddsSubscriptionData.destination_order =
1331 20 : TheServiceParticipant->initial_DestinationOrderQosPolicy();
1332 : reader_data.ddsSubscriptionData.user_data =
1333 20 : TheServiceParticipant->initial_UserDataQosPolicy();
1334 20 : reader_data.ddsSubscriptionData.time_based_filter =
1335 20 : TheServiceParticipant->initial_TimeBasedFilterQosPolicy();
1336 20 : reader_data.ddsSubscriptionData.presentation =
1337 20 : TheServiceParticipant->initial_PresentationQosPolicy();
1338 : reader_data.ddsSubscriptionData.partition =
1339 20 : TheServiceParticipant->initial_PartitionQosPolicy();
1340 : reader_data.ddsSubscriptionData.topic_data =
1341 20 : TheServiceParticipant->initial_TopicDataQosPolicy();
1342 : reader_data.ddsSubscriptionData.group_data =
1343 20 : TheServiceParticipant->initial_GroupDataQosPolicy();
1344 20 : reader_data.ddsSubscriptionData.representation.value.length(1);
1345 20 : reader_data.ddsSubscriptionData.representation.value[0] = DDS::XCDR_DATA_REPRESENTATION;
1346 20 : reader_data.ddsSubscriptionData.type_consistency =
1347 20 : TheServiceParticipant->initial_TypeConsistencyEnforcementQosPolicy();
1348 20 : reader_data.readerProxy.expectsInlineQos = false;
1349 20 : reader_data.contentFilterProperty.contentFilteredTopicName = "";
1350 20 : reader_data.contentFilterProperty.relatedTopicName = "";
1351 20 : reader_data.contentFilterProperty.filterClassName = "";
1352 20 : reader_data.contentFilterProperty.filterExpression = "";
1353 20 : reader_data.contentFilterProperty.expressionParameters.length(0);
1354 :
1355 20 : const CORBA::ULong length = param_list.length();
1356 213 : for (CORBA::ULong i = 0; i < length; ++i) {
1357 193 : const Parameter& param = param_list[i];
1358 193 : switch (param._d()) {
1359 19 : case PID_TOPIC_NAME:
1360 19 : reader_data.ddsSubscriptionData.topic_name = param.string_data();
1361 19 : break;
1362 19 : case PID_TYPE_NAME:
1363 19 : reader_data.ddsSubscriptionData.type_name = param.string_data();
1364 19 : break;
1365 1 : case PID_DURABILITY:
1366 1 : reader_data.ddsSubscriptionData.durability = param.durability();
1367 1 : break;
1368 19 : case PID_DEADLINE:
1369 19 : reader_data.ddsSubscriptionData.deadline = param.deadline();
1370 : // Interoperability note: calling normalize() shouldn't be required
1371 19 : normalize(reader_data.ddsSubscriptionData.deadline.period);
1372 19 : break;
1373 1 : case PID_LATENCY_BUDGET:
1374 1 : reader_data.ddsSubscriptionData.latency_budget = param.latency_budget();
1375 : // Interoperability note: calling normalize() shouldn't be required
1376 1 : normalize(reader_data.ddsSubscriptionData.latency_budget.duration);
1377 1 : break;
1378 19 : case PID_LIVELINESS:
1379 19 : reader_data.ddsSubscriptionData.liveliness = param.liveliness();
1380 : // Interoperability note: calling normalize() shouldn't be required
1381 19 : normalize(reader_data.ddsSubscriptionData.liveliness.lease_duration);
1382 19 : break;
1383 19 : case PID_RELIABILITY:
1384 19 : reader_data.ddsSubscriptionData.reliability.max_blocking_time = param.reliability().max_blocking_time;
1385 : // Interoperability note:
1386 : // Spec creators for RTPS have reliability indexed at 1
1387 : {
1388 19 : const CORBA::Short rtpsKind = param.reliability().kind.value;
1389 19 : const CORBA::Short OLD_RELIABLE_VALUE = 3;
1390 19 : if (rtpsKind == RTPS::RELIABLE || rtpsKind == OLD_RELIABLE_VALUE) {
1391 1 : reader_data.ddsSubscriptionData.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
1392 : } else { // default to BEST_EFFORT for readers
1393 18 : reader_data.ddsSubscriptionData.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
1394 : }
1395 : }
1396 19 : break;
1397 1 : case PID_USER_DATA:
1398 1 : reader_data.ddsSubscriptionData.user_data = param.user_data();
1399 1 : break;
1400 1 : case PID_OWNERSHIP:
1401 1 : reader_data.ddsSubscriptionData.ownership = param.ownership();
1402 1 : break;
1403 9 : case PID_DESTINATION_ORDER:
1404 9 : reader_data.ddsSubscriptionData.destination_order = param.destination_order();
1405 9 : break;
1406 0 : case PID_TIME_BASED_FILTER:
1407 0 : reader_data.ddsSubscriptionData.time_based_filter = param.time_based_filter();
1408 : // Interoperability note: calling normalize() shouldn't be required
1409 0 : normalize(reader_data.ddsSubscriptionData.time_based_filter.minimum_separation);
1410 0 : break;
1411 1 : case PID_PRESENTATION:
1412 1 : reader_data.ddsSubscriptionData.presentation = param.presentation();
1413 1 : break;
1414 1 : case PID_PARTITION:
1415 1 : reader_data.ddsSubscriptionData.partition = param.partition();
1416 1 : break;
1417 1 : case PID_TOPIC_DATA:
1418 1 : reader_data.ddsSubscriptionData.topic_data = param.topic_data();
1419 1 : break;
1420 1 : case PID_GROUP_DATA:
1421 1 : reader_data.ddsSubscriptionData.group_data = param.group_data();
1422 1 : break;
1423 19 : case PID_DATA_REPRESENTATION:
1424 19 : if (param.representation().value.length() != 0) {
1425 19 : reader_data.ddsSubscriptionData.representation = param.representation();
1426 : }
1427 19 : break;
1428 19 : case PID_XTYPES_TYPE_CONSISTENCY:
1429 19 : reader_data.ddsSubscriptionData.type_consistency = param.type_consistency();
1430 19 : break;
1431 19 : case PID_ENDPOINT_GUID:
1432 19 : reader_data.readerProxy.remoteReaderGuid = param.guid();
1433 19 : break;
1434 1 : case PID_UNICAST_LOCATOR:
1435 1 : DCPS::push_back(rtps_udp_locators, param.locator());
1436 1 : break;
1437 1 : case PID_MULTICAST_LOCATOR:
1438 1 : DCPS::push_back(rtps_udp_locators, param.locator());
1439 1 : break;
1440 1 : case PID_CONTENT_FILTER_PROPERTY:
1441 1 : reader_data.contentFilterProperty = param.content_filter_property();
1442 1 : break;
1443 0 : case PID_OPENDDS_LOCATOR:
1444 : // Append the rtps_udp_locators, if any, first, to preserve order
1445 0 : append_locators_if_present(reader_data.readerProxy.allLocators,
1446 : rtps_udp_locators);
1447 0 : rtps_udp_locators.length(0);
1448 0 : DCPS::push_back(reader_data.readerProxy.allLocators,
1449 0 : param.opendds_locator());
1450 0 : break;
1451 2 : case PID_OPENDDS_ASSOCIATED_WRITER:
1452 2 : DCPS::push_back(reader_data.readerProxy.associatedWriters, param.guid());
1453 2 : break;
1454 0 : case PID_SENTINEL:
1455 : case PID_PAD:
1456 : // ignore
1457 0 : break;
1458 19 : case PID_XTYPES_TYPE_INFORMATION:
1459 19 : if (use_xtypes) {
1460 19 : extract_type_info_param(param, type_info);
1461 : }
1462 19 : break;
1463 0 : default:
1464 0 : if (param._d() & PIDMASK_INCOMPATIBLE) {
1465 0 : return false;
1466 : }
1467 : }
1468 : }
1469 : // Append additional rtps_udp_locators, if any
1470 20 : append_locators_if_present(reader_data.readerProxy.allLocators,
1471 : rtps_udp_locators);
1472 20 : rtps_udp_locators.length(0);
1473 20 : return true;
1474 20 : }
1475 :
1476 : #ifdef OPENDDS_SECURITY
1477 0 : bool to_param_list(const DDS::Security::EndpointSecurityInfo& info,
1478 : ParameterList& param_list)
1479 : {
1480 0 : Parameter param;
1481 0 : param.endpoint_security_info(info);
1482 0 : DCPS::push_back(param_list, param);
1483 0 : return true;
1484 0 : }
1485 :
1486 0 : bool from_param_list(const ParameterList& param_list,
1487 : DDS::Security::EndpointSecurityInfo& info)
1488 : {
1489 0 : info.endpoint_security_attributes = 0;
1490 0 : info.plugin_endpoint_security_attributes = 0;
1491 :
1492 0 : const unsigned int len = param_list.length();
1493 0 : for (unsigned int i = 0; i < len; ++i) {
1494 0 : const Parameter& p = param_list[i];
1495 0 : switch (p._d()) {
1496 0 : case DDS::Security::PID_ENDPOINT_SECURITY_INFO:
1497 0 : info = p.endpoint_security_info();
1498 0 : break;
1499 0 : default:
1500 0 : if (p._d() & PIDMASK_INCOMPATIBLE) {
1501 0 : return false;
1502 : }
1503 : }
1504 : }
1505 :
1506 0 : return true;
1507 : }
1508 :
1509 0 : bool to_param_list(const DDS::Security::DataTags& tags,
1510 : ParameterList& param_list)
1511 : {
1512 0 : Parameter param;
1513 0 : param.data_tags(tags);
1514 0 : DCPS::push_back(param_list, param);
1515 0 : return true;
1516 0 : }
1517 :
1518 0 : bool from_param_list(const ParameterList& param_list,
1519 : DDS::Security::DataTags& tags)
1520 : {
1521 0 : tags.tags.length(0);
1522 :
1523 0 : const unsigned int len = param_list.length();
1524 0 : for (unsigned int i = 0; i < len; ++i) {
1525 0 : const Parameter& p = param_list[i];
1526 0 : switch (p._d()) {
1527 0 : case DDS::Security::PID_DATA_TAGS:
1528 0 : tags = p.data_tags();
1529 0 : break;
1530 0 : default:
1531 0 : if (p._d() & PIDMASK_INCOMPATIBLE) {
1532 0 : return false;
1533 : }
1534 : }
1535 : }
1536 :
1537 0 : return true;
1538 : }
1539 :
1540 0 : bool to_param_list(const DiscoveredPublication_SecurityWrapper& wrapper,
1541 : ParameterList& param_list,
1542 : bool use_xtypes,
1543 : const XTypes::TypeInformation& type_info,
1544 : bool map)
1545 : {
1546 0 : bool result = to_param_list(wrapper.data, param_list, use_xtypes, type_info, map);
1547 :
1548 0 : to_param_list(wrapper.security_info, param_list);
1549 0 : to_param_list(wrapper.data_tags, param_list);
1550 :
1551 0 : return result;
1552 : }
1553 :
1554 0 : bool from_param_list(const ParameterList& param_list,
1555 : DiscoveredPublication_SecurityWrapper& wrapper,
1556 : bool use_xtypes,
1557 : XTypes::TypeInformation& type_info)
1558 : {
1559 0 : bool result = from_param_list(param_list, wrapper.data, use_xtypes, type_info) &&
1560 0 : from_param_list(param_list, wrapper.security_info) &&
1561 0 : from_param_list(param_list, wrapper.data_tags);
1562 :
1563 0 : return result;
1564 : }
1565 :
1566 0 : bool to_param_list(const DiscoveredSubscription_SecurityWrapper& wrapper,
1567 : ParameterList& param_list,
1568 : bool use_xtypes,
1569 : const XTypes::TypeInformation& type_info,
1570 : bool map)
1571 : {
1572 0 : bool result = to_param_list(wrapper.data, param_list, use_xtypes, type_info, map);
1573 :
1574 0 : to_param_list(wrapper.security_info, param_list);
1575 0 : to_param_list(wrapper.data_tags, param_list);
1576 :
1577 0 : return result;
1578 : }
1579 :
1580 0 : bool from_param_list(const ParameterList& param_list,
1581 : DiscoveredSubscription_SecurityWrapper& wrapper,
1582 : bool use_xtypes,
1583 : XTypes::TypeInformation& type_info)
1584 : {
1585 0 : bool result = from_param_list(param_list, wrapper.data, use_xtypes, type_info) &&
1586 0 : from_param_list(param_list, wrapper.security_info) &&
1587 0 : from_param_list(param_list, wrapper.data_tags);
1588 :
1589 0 : return result;
1590 : }
1591 :
1592 0 : bool to_param_list(const ICE::AgentInfoMap& ai_map,
1593 : ParameterList& param_list)
1594 : {
1595 0 : for (ICE::AgentInfoMap::const_iterator map_pos = ai_map.begin(), limit = ai_map.end(); map_pos != limit; ++map_pos) {
1596 0 : const ICE::AgentInfo& agent_info = map_pos->second;
1597 0 : IceGeneral_t ice_general;
1598 0 : ice_general.key = map_pos->first.c_str();
1599 0 : ice_general.agent_type = agent_info.type;
1600 0 : ice_general.username = agent_info.username.c_str();
1601 0 : ice_general.password = agent_info.password.c_str();
1602 :
1603 0 : Parameter param_general;
1604 0 : param_general.ice_general(ice_general);
1605 0 : DCPS::push_back(param_list, param_general);
1606 :
1607 0 : for (ICE::AgentInfo::CandidatesType::const_iterator pos = agent_info.candidates.begin(),
1608 0 : limit = agent_info.candidates.end(); pos != limit; ++pos) {
1609 0 : IceCandidate_t ice_candidate;
1610 0 : ice_candidate.key = map_pos->first.c_str();
1611 0 : address_to_locator(ice_candidate.locator, pos->address);
1612 0 : ice_candidate.foundation = pos->foundation.c_str();
1613 0 : ice_candidate.priority = pos->priority;
1614 0 : ice_candidate.type = pos->type;
1615 :
1616 0 : Parameter param;
1617 0 : param.ice_candidate(ice_candidate);
1618 0 : DCPS::push_back(param_list, param);
1619 0 : }
1620 0 : }
1621 :
1622 0 : return true;
1623 : }
1624 :
1625 0 : bool from_param_list(const ParameterList& param_list,
1626 : ICE::AgentInfoMap& ai_map)
1627 : {
1628 0 : for (CORBA::ULong idx = 0, count = param_list.length(); idx != count; ++idx) {
1629 0 : const Parameter& parameter = param_list[idx];
1630 0 : switch (parameter._d()) {
1631 0 : case PID_OPENDDS_ICE_GENERAL: {
1632 0 : const IceGeneral_t& ice_general = parameter.ice_general();
1633 0 : ICE::AgentInfo& agent_info = ai_map[OPENDDS_STRING(ice_general.key.in())];
1634 0 : agent_info.type = static_cast<ICE::AgentType>(ice_general.agent_type);
1635 0 : agent_info.username = ice_general.username;
1636 0 : agent_info.password = ice_general.password;
1637 0 : break;
1638 : }
1639 0 : case PID_OPENDDS_ICE_CANDIDATE: {
1640 0 : const IceCandidate_t& ice_candidate = parameter.ice_candidate();
1641 0 : ICE::Candidate candidate;
1642 : #if IPV6_V6ONLY
1643 : // https://tools.ietf.org/html/rfc8445
1644 :
1645 : // IPv4-mapped IPv6 addresses SHOULD NOT be included in the
1646 : // address candidates unless the application using ICE does not
1647 : // support IPv4 (i.e., it is an IPv6-only application
1648 : // [RFC4038]).
1649 0 : const bool map_ipv4_to_ipv6 = true;
1650 : #else
1651 : const bool map_ipv4_to_ipv6 = false;
1652 : #endif
1653 0 : if (locator_to_address(candidate.address, ice_candidate.locator, map_ipv4_to_ipv6) != 0) {
1654 0 : return false;
1655 : }
1656 0 : candidate.foundation = ice_candidate.foundation;
1657 0 : candidate.priority = ice_candidate.priority;
1658 0 : candidate.type = static_cast<ICE::CandidateType>(ice_candidate.type);
1659 0 : ai_map[OPENDDS_STRING(ice_candidate.key.in())].candidates.push_back(candidate);
1660 0 : break;
1661 0 : }
1662 0 : default:
1663 : // Do nothing.
1664 0 : break;
1665 : }
1666 : }
1667 0 : return true;
1668 : }
1669 : #endif
1670 :
1671 : } // ParameterListConverter
1672 : } // RTPS
1673 : } // OpenDDS
1674 :
1675 : OPENDDS_END_VERSIONED_NAMESPACE_DECL
|