OpenDDS  Snapshot(2023/04/28-20:55)
Sedp.cpp
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 
6 #include "Sedp.h"
7 
8 #include "MessageTypes.h"
10 #include "RtpsDiscovery.h"
11 #include "Spdp.h"
12 
13 #include <dds/DCPS/Serializer.h>
14 #include <dds/DCPS/Definitions.h>
15 #include <dds/DCPS/GuidConverter.h>
18 #include <dds/DCPS/Qos_Helper.h>
25 #include <dds/DCPS/DCPS_Utils.h>
26 #include <dds/DCPS/Logging.h>
27 #include <dds/DCPS/RecorderImpl.h>
29 #include <dds/DCPS/DcpsUpcalls.h>
30 #include <dds/DCPS/Util.h>
37 #ifdef OPENDDS_SECURITY
39 #endif
40 
41 #include <dds/DdsDcpsGuidTypeSupportImpl.h>
42 #ifdef OPENDDS_SECURITY
43 # include <dds/DdsSecurityCoreTypeSupportImpl.h>
44 #endif
45 
46 #include <cstring>
47 
48 namespace {
49 
50 const OpenDDS::DCPS::MonotonicTime_t MTZERO = { 0, 0 };
51 
52 bool checkAndAssignQos(DDS::PublicationBuiltinTopicData& dest,
54 {
55 #ifndef OPENDDS_SAFETY_PROFILE
56  using OpenDDS::DCPS::operator!=;
57 #endif
58  bool changed = false;
59 
60  // check each Changeable QoS policy value in Publication BIT Data
61 
62  if (dest.deadline != src.deadline) {
63  changed = true;
64  dest.deadline = src.deadline;
65  }
66 
67  if (dest.latency_budget != src.latency_budget) {
68  changed = true;
69  dest.latency_budget = src.latency_budget;
70  }
71 
72  if (dest.lifespan != src.lifespan) {
73  changed = true;
74  dest.lifespan = src.lifespan;
75  }
76 
77  if (dest.user_data != src.user_data) {
78  changed = true;
79  dest.user_data = src.user_data;
80  }
81 
82  if (dest.ownership_strength != src.ownership_strength) {
83  changed = true;
84  dest.ownership_strength = src.ownership_strength;
85  }
86 
87  if (dest.partition != src.partition) {
88  changed = true;
89  dest.partition = src.partition;
90  }
91 
92  if (dest.topic_data != src.topic_data) {
93  changed = true;
94  dest.topic_data = src.topic_data;
95  }
96 
97  if (dest.group_data != src.group_data) {
98  changed = true;
99  dest.group_data = src.group_data;
100  }
101 
102  return changed;
103 }
104 
105 bool checkAndAssignQos(DDS::SubscriptionBuiltinTopicData& dest,
107 {
108 #ifndef OPENDDS_SAFETY_PROFILE
109  using OpenDDS::DCPS::operator!=;
110 #endif
111  bool changed = false;
112 
113  // check each Changeable QoS policy value in Subscription BIT Data
114 
115  if (dest.deadline != src.deadline) {
116  changed = true;
117  dest.deadline = src.deadline;
118  }
119 
120  if (dest.latency_budget != src.latency_budget) {
121  changed = true;
122  dest.latency_budget = src.latency_budget;
123  }
124 
125  if (dest.user_data != src.user_data) {
126  changed = true;
127  dest.user_data = src.user_data;
128  }
129 
130  if (dest.time_based_filter != src.time_based_filter) {
131  changed = true;
132  dest.time_based_filter = src.time_based_filter;
133  }
134 
135  if (dest.partition != src.partition) {
136  changed = true;
137  dest.partition = src.partition;
138  }
139 
140  if (dest.topic_data != src.topic_data) {
141  changed = true;
142  dest.topic_data = src.topic_data;
143  }
144 
145  if (dest.group_data != src.group_data) {
146  changed = true;
147  dest.group_data = src.group_data;
148  }
149 
150  return changed;
151 }
152 
153 bool checkAndAssignParams(OpenDDS::DCPS::ContentFilterProperty_t& dest,
155 {
156  if (dest.expressionParameters.length() != src.expressionParameters.length()) {
158  return true;
159  }
160  for (CORBA::ULong i = 0; i < src.expressionParameters.length(); ++i) {
161  if (0 != std::strcmp(dest.expressionParameters[i],
162  src.expressionParameters[i])) {
164  return true;
165  }
166  }
167  return false;
168 }
169 
170 #ifndef OPENDDS_SAFETY_PROFILE
172  const OpenDDS::DCPS::Locator_t& y)
173 {
174  return x.kind == y.kind && x.port == y.port && std::memcmp(x.address, y.address, sizeof(x.address)) == 0;
175 }
176 
179 {
180  return x.transport_type == y.transport_type && x.data == y.data;
181 }
182 #endif
183 
184 template<typename T>
185 bool sequence_equal(const T& x,
186  const T& y)
187 {
188  if (x.length() != y.length()) {
189  return false;
190  }
191 
192  for (unsigned int idx = 0; idx != x.length(); ++idx) {
193  if (!(x[idx] == y[idx])) {
194  return false;
195  }
196  }
197 
198  return true;
199 }
200 
202  const OpenDDS::DCPS::LocatorSeq& y)
203 {
204  return sequence_equal(x, y);
205 }
206 
209 {
210  return sequence_equal(x, y);
211 }
212 
213 bool locatorsChanged(const OpenDDS::RTPS::ParticipantProxy_t& x,
215 {
220 }
221 
222 bool checkAndAssignLocators(OpenDDS::DCPS::WriterProxy_t& x,
224 {
225  if (!(x.allLocators == y.allLocators)) {
226  x.allLocators = y.allLocators;
227  return true;
228  }
229 
230  return false;
231 }
232 
233 bool checkAndAssignLocators(OpenDDS::DCPS::ReaderProxy_t& x,
235 {
236  if (!(x.allLocators == y.allLocators)) {
237  x.allLocators = y.allLocators;
238  return true;
239  }
240 
241  return false;
242 }
243 
244 #ifdef OPENDDS_SECURITY
245 bool is_stateless(const OpenDDS::DCPS::GUID_t& guid)
246 {
249 }
250 
251 bool is_volatile(const OpenDDS::DCPS::GUID_t& guid)
252 {
255 }
256 
257 bool is_stateless_or_volatile(const OpenDDS::DCPS::GUID_t& guid)
258 {
259  return is_stateless(guid) || is_volatile(guid);
260 }
261 #endif
262 
263 }
264 
266 
267 namespace OpenDDS {
268 namespace RTPS {
269 using DCPS::GUID_t;
270 using DCPS::make_rch;
271 using DCPS::TimeDuration;
273 using DCPS::Serializer;
274 using DCPS::Encoding;
275 using DCPS::TopicDetails;
276 using DCPS::TopicDetailsMap;
277 
278 namespace {
279  const Encoding sedp_encoding(Encoding::KIND_XCDR1, DCPS::ENDIAN_LITTLE);
280  const Encoding type_lookup_encoding(Encoding::KIND_XCDR2, DCPS::ENDIAN_NATIVE);
281 }
282 
283 Sedp::Sedp(const GUID_t& participant_id, Spdp& owner, ACE_Thread_Mutex& lock)
284  : spdp_(owner)
285  , lock_(lock)
286  , participant_id_(participant_id)
287  , publication_counter_(0)
288  , subscription_counter_(0)
289  , topic_counter_(0)
290  , max_type_lookup_service_reply_period_(0)
291  , type_lookup_service_sequence_number_(0)
292  , use_xtypes_(true)
293  , use_xtypes_complete_(false)
294  , local_participant_automatic_liveliness_sn_(DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN())
295  , local_participant_manual_liveliness_sn_(DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN())
296 #ifdef OPENDDS_SECURITY
297  , local_participant_automatic_liveliness_sn_secure_(DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN())
298  , local_participant_manual_liveliness_sn_secure_(DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN())
299 #endif
300 #ifdef OPENDDS_SECURITY
301  , permissions_handle_(DDS::HANDLE_NIL)
302  , crypto_handle_(DDS::HANDLE_NIL)
303 #endif
304  , publications_writer_(make_rch<DiscoveryWriter>(
305  make_id(participant_id, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER), ref(*this)))
306 #ifdef OPENDDS_SECURITY
307  , publications_secure_writer_(make_rch<DiscoveryWriter>(
309 #endif
310  , subscriptions_writer_(make_rch<DiscoveryWriter>(
311  make_id(participant_id, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER), ref(*this)))
312 #ifdef OPENDDS_SECURITY
313  , subscriptions_secure_writer_(make_rch<DiscoveryWriter>(
315 #endif
316  , participant_message_writer_(make_rch<LivelinessWriter>(
318 #ifdef OPENDDS_SECURITY
319  , participant_message_secure_writer_(make_rch<LivelinessWriter>(
321  , participant_stateless_message_writer_(make_rch<SecurityWriter>(
323  , dcps_participant_secure_writer_(make_rch<DiscoveryWriter>(
325  , participant_volatile_message_secure_writer_(make_rch<SecurityWriter>(
327 #endif
328  , type_lookup_request_writer_(make_rch<TypeLookupRequestWriter>(
329  make_id(participant_id, ENTITYID_TL_SVC_REQ_WRITER), ref(*this)))
330  , type_lookup_reply_writer_(make_rch<TypeLookupReplyWriter>(
331  make_id(participant_id, ENTITYID_TL_SVC_REPLY_WRITER), ref(*this)))
332 #ifdef OPENDDS_SECURITY
333  , type_lookup_request_secure_writer_(make_rch<TypeLookupRequestWriter>(
334  make_id(participant_id, ENTITYID_TL_SVC_REQ_WRITER_SECURE), ref(*this)))
335  , type_lookup_reply_secure_writer_(make_rch<TypeLookupReplyWriter>(
336  make_id(participant_id, ENTITYID_TL_SVC_REPLY_WRITER_SECURE), ref(*this)))
337 #endif
338  , publications_reader_(make_rch<DiscoveryReader>(
339  make_id(participant_id, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER), ref(*this)))
340 #ifdef OPENDDS_SECURITY
341  , publications_secure_reader_(make_rch<DiscoveryReader>(
343 #endif
344  , subscriptions_reader_(make_rch<DiscoveryReader>(
345  make_id(participant_id, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER), ref(*this)))
346 #ifdef OPENDDS_SECURITY
347  , subscriptions_secure_reader_(make_rch<DiscoveryReader>(
349 #endif
350  , participant_message_reader_(make_rch<LivelinessReader>(
352 #ifdef OPENDDS_SECURITY
353  , participant_message_secure_reader_(make_rch<LivelinessReader>(
355  , participant_stateless_message_reader_(make_rch<SecurityReader>(
357  , participant_volatile_message_secure_reader_(make_rch<SecurityReader>(
359  , dcps_participant_secure_reader_(make_rch<DiscoveryReader>(
361 #endif
362  , type_lookup_request_reader_(make_rch<TypeLookupRequestReader>(
363  make_id(participant_id, ENTITYID_TL_SVC_REQ_READER), ref(*this)))
364  , type_lookup_reply_reader_(make_rch<TypeLookupReplyReader>(
365  make_id(participant_id, ENTITYID_TL_SVC_REPLY_READER), ref(*this)))
366 #ifdef OPENDDS_SECURITY
367  , type_lookup_request_secure_reader_(make_rch<TypeLookupRequestReader>(
368  make_id(participant_id, ENTITYID_TL_SVC_REQ_READER_SECURE), ref(*this)))
369  , type_lookup_reply_secure_reader_(make_rch<TypeLookupReplyReader>(
370  make_id(participant_id, ENTITYID_TL_SVC_REPLY_READER_SECURE), ref(*this)))
371  , ice_agent_(ICE::Agent::instance())
372  , publication_agent_info_listener_(DCPS::make_rch<PublicationAgentInfoListener>(ref(*this)))
373  , subscription_agent_info_listener_(DCPS::make_rch<SubscriptionAgentInfoListener>(ref(*this)))
374 #endif // OPENDDS_SECURITY
375 {}
376 
378 Sedp::init(const GUID_t& guid,
379  const RtpsDiscovery& disco,
380  DDS::DomainId_t domainId,
382 {
383  type_lookup_service_ = tls;
384 
385  const OPENDDS_STRING domainStr = DCPS::to_dds_string(domainId);
387 
388  // configure one transport
389  transport_inst_ = TheTransportRegistry->create_inst(
391  OPENDDS_STRING("_SEDPTransportInst_") + key + domainStr,
392  "rtps_udp");
393 
394  // Be careful to not call any function that causes the transport be
395  // to created before the configuration is complete.
396 
397  // Use a static cast to avoid dependency on the RtpsUdp library
398  DCPS::RtpsUdpInst_rch rtps_inst =
400  rtps_inst->max_message_size_ = disco.config()->sedp_max_message_size();
401  rtps_inst->heartbeat_period_ = disco.config()->sedp_heartbeat_period();
402  rtps_inst->nak_response_delay_ = disco.config()->sedp_nak_response_delay();
403  rtps_inst->responsive_mode_ = disco.config()->sedp_responsive_mode();
404  rtps_inst->send_delay_ = disco.config()->sedp_send_delay();
405  rtps_inst->send_buffer_size_ = disco.config()->send_buffer_size();
406  rtps_inst->rcv_buffer_size_ = disco.config()->recv_buffer_size();
407  rtps_inst->receive_preallocated_message_blocks_ = disco.config()->sedp_receive_preallocated_message_blocks();
408  rtps_inst->receive_preallocated_data_blocks_ = disco.config()->sedp_receive_preallocated_data_blocks();
409 
410  if (disco.sedp_multicast()) {
411  // Bind to a specific multicast group
412  const u_short mc_port = disco.pb() + disco.dg() * domainId + disco.dx();
413 
414  ACE_INET_Addr mc_addr = disco.default_multicast_group();
415  mc_addr.set_port_number(mc_port);
416  rtps_inst->multicast_group_address_ = mc_addr;
417 
418  rtps_inst->ttl_ = disco.ttl();
419  rtps_inst->multicast_interface_ = disco.multicast_interface();
420 
421  } else {
422  rtps_inst->use_multicast_ = false;
423  }
424 
425  rtps_inst->local_address_ = disco.config()->sedp_local_address();
426  rtps_inst->advertised_address_ = disco.config()->sedp_advertised_address();
427 #ifdef ACE_HAS_IPV6
428  rtps_inst->ipv6_local_address_ = disco.config()->ipv6_sedp_local_address();
429  rtps_inst->ipv6_advertised_address_ = disco.config()->ipv6_sedp_advertised_address();
430 #endif
431 
432  if (!disco.config()->sedp_fragment_reassembly_timeout().is_zero()) {
433  rtps_inst->fragment_reassembly_timeout_ = disco.config()->sedp_fragment_reassembly_timeout();
434  }
435 
436  {
438  rtps_inst->rtps_relay_address_ = disco.config()->sedp_rtps_relay_address();
439  rtps_inst->use_rtps_relay_ = disco.config()->use_rtps_relay();
440  rtps_inst->rtps_relay_only_ = disco.config()->rtps_relay_only();
441  rtps_inst->stun_server_address_ = disco.config()->sedp_stun_server_address();
442  rtps_inst->use_ice_ = disco.config()->use_ice();
443  }
444 
445  // Create a config
447  OPENDDS_STRING("_SEDP_TransportCfg_") + key +
448  domainStr;
449  transport_cfg_ = TheTransportRegistry->create_config(config_name.c_str());
452  static_cast<unsigned long>(disco.config()->sedp_passive_connect_duration().value().get_msec());
453 
454  rtps_inst->opendds_discovery_default_listener_ = publications_reader_;
455  rtps_inst->opendds_discovery_guid_ = guid;
456 
457  const_cast<bool&>(use_xtypes_) = disco.use_xtypes();
458  const_cast<bool&>(use_xtypes_complete_) = disco.use_xtypes_complete();
459 
461  // One should assume that the transport is configured after this
462  // point. Changes to transport_inst_ or rtps_inst after this line
463  // may not be reflected.
465  job_queue_ = DCPS::make_rch<DCPS::JobQueue>(reactor);
468 
469  // Configure and enable each reader/writer
470  const bool reliable = true;
471  const bool durable = true;
472  const bool nondurable = false;
473 
474 #ifdef OPENDDS_SECURITY
475  const bool besteffort = false;
476 #endif
477 
479 #ifdef OPENDDS_SECURITY
482 #endif
483 
486  }
488 
489 #ifdef OPENDDS_SECURITY
494  }
496 #endif
497 
500  }
502 
503 #ifdef OPENDDS_SECURITY
508  }
510 #endif
511 
514  }
516 
517 #ifdef OPENDDS_SECURITY
522  }
524 
527 
532 
537 #endif
538 
541  }
544  }
545 
548  }
551  }
552 
553 #ifdef OPENDDS_SECURITY
557  }
561  }
562 
566  }
570  }
571 #endif
572 
573  max_type_lookup_service_reply_period_ = disco.config()->max_type_lookup_service_reply_period();
574 
575  return DDS::RETCODE_OK;
576 }
577 
578 #ifdef OPENDDS_SECURITY
582 {
583  using namespace OpenDDS::Security;
584  using namespace DDS::Security;
585 
587 
588  CryptoKeyFactory_var key_factory = spdp_.get_security_config()->get_crypto_key_factory();
589  CryptoKeyExchange_var key_exchange = spdp_.get_security_config()->get_crypto_key_exchange();
590  AccessControl_var acl = spdp_.get_security_config()->get_access_control();
591  Authentication_var auth = spdp_.get_security_config()->get_authentication();
593 
594  set_permissions_handle(perm_handle);
595  set_access_control(acl);
596  set_crypto_key_factory(key_factory);
597  set_crypto_key_exchange(key_exchange);
598  set_handle_registry(handle_registry);
599  crypto_handle_ = crypto_handle;
600 
601  // TODO: Handle all exceptions below once error-codes have been defined, etc.
602  SecurityException ex = {"", 0, 0};
603 
604  bool ok = acl->get_participant_sec_attributes(perm_handle, participant_sec_attr_, ex);
605  if (ok) {
606 
608 
610 
611  const DDS::PartitionQosPolicy& default_part_qos = TheServiceParticipant->initial_PartitionQosPolicy();
612  const DDS::Security::DataTagQosPolicy default_data_tag_qos; // default is empty sequence
613 
614  // Volatile-Message-Secure
615  {
616  PropertySeq writer_props(1), reader_props(1);
617  writer_props.length(1);
618  writer_props[0].name = "dds.sec.builtin_endpoint_name";
619  writer_props[0].value = "BuiltinParticipantVolatileMessageSecureWriter";
620 
621  reader_props.length(1);
622  reader_props[0].name = "dds.sec.builtin_endpoint_name";
623  reader_props[0].value = "BuiltinParticipantVolatileMessageSecureReader";
624 
625  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
626 
627  ok = acl->get_datawriter_sec_attributes(perm_handle, "DCPSParticipantVolatileMessageSecure",
628  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
629  if (!ok) {
630  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
631  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'DCPSParticipantVolatileMessageSecure'. ")
632  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
633  result = DDS::RETCODE_ERROR;
634  }
635 
636  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
637  participant_volatile_message_secure_writer_->set_crypto_handles(crypto_handle, h);
638  const GUID_t pvms_writer = participant_volatile_message_secure_writer_->get_guid();
639  get_handle_registry()->insert_local_datawriter_crypto_handle(pvms_writer, h, dw_sec_attr);
640 
641  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
642  ok = acl->get_datareader_sec_attributes(perm_handle, "DCPSParticipantVolatileMessageSecure",
643  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
644  if (!ok) {
645  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
646  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'DCPSParticipantVolatileMessageSecure'.")
647  ACE_TEXT(" Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
648  result = DDS::RETCODE_ERROR;
649  }
650 
651  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
652  participant_volatile_message_secure_reader_->set_crypto_handles(crypto_handle, h);
653  const GUID_t pvms_reader = participant_volatile_message_secure_reader_->get_guid();
654  get_handle_registry()->insert_local_datareader_crypto_handle(pvms_reader, h, dr_sec_attr);
655  }
656 
657  // DCPS-Participant-Message-Secure
658  {
659  PropertySeq reader_props, writer_props;
660 
661  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
662  ok = acl->get_datawriter_sec_attributes(perm_handle, "DCPSParticipantMessageSecure",
663  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
664  if (!ok) {
665  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
666  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'DCPSParticipantMessageSecure'. ")
667  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
668  result = DDS::RETCODE_ERROR;
669  }
670 
671  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
672  participant_message_secure_writer_->set_crypto_handles(crypto_handle, h);
673  const GUID_t pms_writer = participant_message_secure_writer_->get_guid();
674  get_handle_registry()->insert_local_datawriter_crypto_handle(pms_writer, h, dw_sec_attr);
675 
676  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
677  ok = acl->get_datareader_sec_attributes(perm_handle, "DCPSParticipantMessageSecure",
678  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
679  if (!ok) {
680  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
681  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'DCPSParticipantMessageSecure'. ")
682  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
683  result = DDS::RETCODE_ERROR;
684  }
685 
686  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
687  participant_message_secure_reader_->set_crypto_handles(crypto_handle, h);
688  const GUID_t pms_reader = participant_message_secure_reader_->get_guid();
689  get_handle_registry()->insert_local_datareader_crypto_handle(pms_reader, h, dr_sec_attr);
690  }
691 
692  // DCPS-Publications-Secure
693  {
694  PropertySeq reader_props, writer_props;
695 
696  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
697  ok = acl->get_datawriter_sec_attributes(perm_handle, "DCPSPublicationsSecure",
698  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
699  if (!ok) {
700  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
701  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'DCPSPublicationsSecure'. ")
702  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
703  result = DDS::RETCODE_ERROR;
704  }
705 
706  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
707  publications_secure_writer_->set_crypto_handles(crypto_handle, h);
708  const GUID_t ps_writer = publications_secure_writer_->get_guid();
709  get_handle_registry()->insert_local_datawriter_crypto_handle(ps_writer, h, dw_sec_attr);
710 
711  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
712  ok = acl->get_datareader_sec_attributes(perm_handle, "DCPSPublicationsSecure",
713  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
714  if (!ok) {
715  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
716  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'DCPSPublicationsSecure'. ")
717  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
718  result = DDS::RETCODE_ERROR;
719  }
720 
721  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
722  publications_secure_reader_->set_crypto_handles(crypto_handle, h);
723  const GUID_t ps_reader = publications_secure_reader_->get_guid();
724  get_handle_registry()->insert_local_datareader_crypto_handle(ps_reader, h, dr_sec_attr);
725  }
726 
727  // DCPS-Subscriptions-Secure
728  {
729  PropertySeq reader_props, writer_props;
730 
731  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
732  ok = acl->get_datawriter_sec_attributes(perm_handle, "DCPSSubscriptionsSecure",
733  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
734  if (!ok) {
735  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
736  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'DCPSSubscriptionsSecure'. ")
737  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
738  result = DDS::RETCODE_ERROR;
739  }
740 
741  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
742  subscriptions_secure_writer_->set_crypto_handles(crypto_handle, h);
743  const GUID_t ss_writer = subscriptions_secure_writer_->get_guid();
744  get_handle_registry()->insert_local_datawriter_crypto_handle(ss_writer, h, dw_sec_attr);
745 
746  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
747  ok = acl->get_datareader_sec_attributes(perm_handle, "DCPSSubscriptionsSecure",
748  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
749  if (!ok) {
750  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
751  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'DCPSSubscriptionsSecure'. ")
752  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
753  result = DDS::RETCODE_ERROR;
754  }
755 
756  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
757  subscriptions_secure_reader_->set_crypto_handles(crypto_handle, h);
758  const GUID_t ss_reader = subscriptions_secure_reader_->get_guid();
759  get_handle_registry()->insert_local_datareader_crypto_handle(ss_reader, h, dr_sec_attr);
760  }
761 
762  // DCPS-Participants-Secure
763  {
764  PropertySeq reader_props, writer_props;
765 
766  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
767  ok = acl->get_datawriter_sec_attributes(perm_handle, "DCPSParticipantSecure",
768  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
769  if (!ok) {
770  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
771  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'DCPSParticipantSecure'. ")
772  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
773  result = DDS::RETCODE_ERROR;
774  }
775 
776  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
777  dcps_participant_secure_writer_->set_crypto_handles(crypto_handle, h);
778  const GUID_t dps_writer = dcps_participant_secure_writer_->get_guid();
779  get_handle_registry()->insert_local_datawriter_crypto_handle(dps_writer, h, dw_sec_attr);
780 
781  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
782  ok = acl->get_datareader_sec_attributes(perm_handle, "DCPSParticipantSecure",
783  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
784  if (!ok) {
785  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
786  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'DCPSParticipantSecure'. ")
787  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
788  result = DDS::RETCODE_ERROR;
789  }
790 
791  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
792  dcps_participant_secure_reader_->set_crypto_handles(crypto_handle, h);
793  const GUID_t dps_reader = dcps_participant_secure_reader_->get_guid();
794  get_handle_registry()->insert_local_datareader_crypto_handle(dps_reader, h, dr_sec_attr);
795  }
796 
797  // Type Lookup Service Request
798  {
799  PropertySeq reader_props, writer_props;
800 
801  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
802  ok = acl->get_datawriter_sec_attributes(perm_handle, "TypeLookupServiceRequestSecure",
803  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
804  if (!ok) {
805  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
806  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'TypeLookupServiceRequestSecure'. ")
807  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
808  result = DDS::RETCODE_ERROR;
809  }
810 
811  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
812  type_lookup_request_secure_writer_->set_crypto_handles(crypto_handle, h);
813  const GUID_t ps_writer = type_lookup_request_secure_writer_->get_guid();
814  get_handle_registry()->insert_local_datawriter_crypto_handle(ps_writer, h, dw_sec_attr);
815 
816  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
817  ok = acl->get_datareader_sec_attributes(perm_handle, "TypeLookupServiceRequestSecure",
818  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
819  if (!ok) {
820  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
821  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'TypeLookupServiceRequestSecure'. ")
822  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
823  result = DDS::RETCODE_ERROR;
824  }
825 
826  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
827  type_lookup_request_secure_reader_->set_crypto_handles(crypto_handle, h);
828  const GUID_t ps_reader = type_lookup_request_secure_reader_->get_guid();
829  get_handle_registry()->insert_local_datareader_crypto_handle(ps_reader, h, dr_sec_attr);
830  }
831 
832  // Type Lookup Service Reply
833  {
834  PropertySeq reader_props, writer_props;
835 
836  EndpointSecurityAttributes dw_sec_attr(default_sec_attr);
837  ok = acl->get_datawriter_sec_attributes(perm_handle, "TypeLookupServiceReplySecure",
838  default_part_qos, default_data_tag_qos, dw_sec_attr, ex);
839  if (!ok) {
840  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
841  ACE_TEXT("Failure calling get_datawriter_sec_attributes for topic 'TypeLookupServiceReplySecure'. ")
842  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
843  result = DDS::RETCODE_ERROR;
844  }
845 
846  h = key_factory->register_local_datawriter(crypto_handle, writer_props, dw_sec_attr, ex);
847  type_lookup_reply_secure_writer_->set_crypto_handles(crypto_handle, h);
848  const GUID_t ps_writer = type_lookup_reply_secure_writer_->get_guid();
849  get_handle_registry()->insert_local_datawriter_crypto_handle(ps_writer, h, dw_sec_attr);
850 
851  EndpointSecurityAttributes dr_sec_attr(default_sec_attr);
852  ok = acl->get_datareader_sec_attributes(perm_handle, "TypeLookupServiceReplySecure",
853  default_part_qos, default_data_tag_qos, dr_sec_attr, ex);
854  if (!ok) {
855  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
856  ACE_TEXT("Failure calling get_datareader_sec_attributes for topic 'TypeLookupServiceReplySecure'. ")
857  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
858  result = DDS::RETCODE_ERROR;
859  }
860 
861  h = key_factory->register_local_datareader(crypto_handle, reader_props, dr_sec_attr, ex);
862  type_lookup_reply_secure_reader_->set_crypto_handles(crypto_handle, h);
863  const GUID_t ps_reader = type_lookup_reply_secure_reader_->get_guid();
864  get_handle_registry()->insert_local_datareader_crypto_handle(ps_reader, h, dr_sec_attr);
865  }
866 
867  } else {
868  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::init_security() - ")
869  ACE_TEXT("Failure calling get_participant_sec_attributes. ")
870  ACE_TEXT("Security Exception[%d.%d]: %C\n"), ex.code, ex.minor_code, ex.message.in()));
871  result = DDS::RETCODE_ERROR;
872  }
873  return result;
874 }
875 #endif
876 
878 {
880 
881 #ifdef OPENDDS_SECURITY
882  using namespace OpenDDS::Security;
883  using namespace DDS::Security;
884 
885  SecurityException ex = {"", 0, 0};
886 
897  if (spdp_.get_security_config()) {
899  }
900 #endif
901 
902  job_queue_.reset();
904  DCPS::RtpsUdpInst_rch rtps_inst =
906  rtps_inst->opendds_discovery_default_listener_.reset();
907  TheTransportRegistry->remove_config(transport_cfg_);
909 }
910 
913 {
914  DCPS::TransportLocator trans_info;
916  return transport_locator_to_locator_seq(trans_info);
917 }
918 
921 {
922  DCPS::TransportLocator trans_info;
924  return transport_locator_to_locator_seq(trans_info);
925 }
926 
929 {
930  DCPS::RtpsUdpInst_rch rtps_inst =
932  return rtps_inst->local_address_;
933 }
934 
935 #ifdef ACE_HAS_IPV6
937 Sedp::ipv6_local_address() const
938 {
939  DCPS::RtpsUdpInst_rch rtps_inst =
941  return rtps_inst->ipv6_local_address_;
942 }
943 #endif
944 
947 {
948  DCPS::RtpsUdpInst_rch rtps_inst =
950  return rtps_inst->multicast_group_address_;
951 }
952 
953 void
955 {
957  pub.writer_data_.ddsPublicationData.key = key;
959 }
960 
961 void
963 {
965  sub.reader_data_.ddsSubscriptionData.key = key;
967 }
968 
969 void
971  const ParticipantData_t& pdata)
972 {
973  const DCPS::LocatorSeq& mll =
975  const DCPS::LocatorSeq& ull =
977  const CORBA::ULong locator_count = mll.length() + ull.length();
978 
980  ACE_Message_Block mb_locator(
982  (locator_count * serialized_size(encoding, DCPS::Locator_t())) + DCPS::boolean_cdr_size);
983  Serializer ser_loc(&mb_locator, encoding);
984  ser_loc << locator_count;
985 
986  for (CORBA::ULong i = 0; i < mll.length(); ++i) {
987  ser_loc << mll[i];
988  }
989  for (CORBA::ULong i = 0; i < ull.length(); ++i) {
990  ser_loc << ull[i];
991  }
992  ser_loc << ACE_OutputCDR::from_boolean(false); // requires_inline_qos
993 
994  remote_data.length(1);
995  remote_data[0].transport_type = "rtps_udp";
996  message_block_to_sequence (mb_locator, remote_data[0].data);
997 }
998 
999 void
1001  const ParticipantData_t& pdata) {
1003  proto.remote_reliable_ = true;
1004  proto.remote_durable_ = true;
1008  populate_locators(proto.remote_data_, pdata);
1009 }
1010 
1011 #ifdef OPENDDS_SECURITY
1013 {
1014  if (DCPS::GuidConverter(record.remote_id()).isWriter()) {
1016  } else {
1018  }
1019 }
1020 #endif
1021 
1022 bool Sedp::ready(const DiscoveredParticipant& participant,
1023  const GUID_t& local_id,
1024  const GUID_t& remote_id,
1025  bool local_tokens_sent) const
1026 {
1027 #ifndef OPENDDS_SECURITY
1028  ACE_UNUSED_ARG(participant);
1029  ACE_UNUSED_ARG(local_tokens_sent);
1030 #endif
1031 
1032  return remote_knows_about_local_i(local_id, remote_id)
1033 #ifdef OPENDDS_SECURITY
1034  && remote_is_authenticated_i(local_id, remote_id, participant)
1035  && local_has_remote_participant_token_i(local_id, remote_id)
1036  && remote_has_local_participant_token_i(local_id, remote_id, participant)
1037  && local_has_remote_endpoint_token_i(local_id, remote_id)
1038  && remote_has_local_endpoint_token_i(local_id, local_tokens_sent, remote_id)
1039 #endif
1040  ;
1041 }
1042 
1043 void
1045 #ifdef OPENDDS_SECURITY
1046  , const DDS::Security::ParticipantSecurityAttributes& participant_sec_attr
1047 #endif
1048  )
1049 {
1050  const BuiltinEndpointSet_t local_available = spdp_.available_builtin_endpoints();
1051  const BuiltinEndpointSet_t remote_available = participant.pdata_.participantProxy.availableBuiltinEndpoints;
1052  const BuiltinEndpointQos_t& beq = participant.pdata_.participantProxy.builtinEndpointQos;
1053 
1054  // See RTPS v2.1 section 8.5.5.1
1055  if ((local_available & DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR) &&
1056  (remote_available & DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER)) {
1058  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER),
1060  participant.builtin_pending_records_.push_back(record);
1061  }
1062  if ((local_available & DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR) &&
1063  (remote_available & DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER)) {
1065  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER),
1067  participant.builtin_pending_records_.push_back(record);
1068  }
1069  if ((local_available & BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER) &&
1070  (remote_available & BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER)) {
1072  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER),
1074  participant.builtin_pending_records_.push_back(record);
1075  }
1076 
1077  if ((local_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_READER) &&
1078  (remote_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_WRITER)) {
1080  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REQ_WRITER),
1082  participant.builtin_pending_records_.push_back(record);
1083  }
1084  if ((local_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_WRITER) &&
1085  (remote_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_READER)) {
1087  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REQ_READER),
1089  participant.builtin_pending_records_.push_back(record);
1090  }
1091  if ((local_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_READER) &&
1092  (remote_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_WRITER)) {
1094  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REPLY_WRITER),
1096  participant.builtin_pending_records_.push_back(record);
1097  }
1098  if ((local_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_WRITER) &&
1099  (remote_available & BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_READER)) {
1101  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REPLY_READER),
1103  participant.builtin_pending_records_.push_back(record);
1104  }
1105 
1106  if ((local_available & DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER) &&
1107  (remote_available & DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR)) {
1109  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER),
1111  participant.builtin_pending_records_.push_back(record);
1112  }
1113  if ((local_available & DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER) &&
1114  (remote_available & DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR)) {
1116  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER),
1118  participant.builtin_pending_records_.push_back(record);
1119  }
1120  if ((local_available & BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER) &&
1121  (remote_available & BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER)) {
1123  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER),
1125  participant.builtin_pending_records_.push_back(record);
1126  }
1127 
1128  //FUTURE: if/when topic propagation is supported, add it here
1129 
1130 #ifdef OPENDDS_SECURITY
1131  if (spdp_.is_security_enabled()) {
1132  using namespace DDS::Security;
1133 
1134  const ExtendedBuiltinEndpointSet_t local_available_extended = spdp_.available_extended_builtin_endpoints();
1135  const ExtendedBuiltinEndpointSet_t remote_available_extended = participant.pdata_.participantProxy.availableExtendedBuiltinEndpoints;
1136 
1137  if ((local_available & BUILTIN_PARTICIPANT_STATELESS_MESSAGE_READER) &&
1138  (remote_available & BUILTIN_PARTICIPANT_STATELESS_MESSAGE_WRITER)) {
1140  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_WRITER),
1141  AC_EMPTY);
1142  participant.builtin_pending_records_.push_back(record);
1143  }
1144 
1145  if ((local_available & BUILTIN_PARTICIPANT_STATELESS_MESSAGE_WRITER) &&
1146  (remote_available & BUILTIN_PARTICIPANT_STATELESS_MESSAGE_READER)) {
1148  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_READER),
1149  AC_EMPTY);
1150  participant.builtin_pending_records_.push_back(record);
1151  }
1152 
1153  if ((local_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_READER) &&
1156  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_WRITER),
1158  participant.builtin_pending_records_.push_back(record);
1159  }
1160  if ((local_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_WRITER) &&
1161  (remote_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_READER)) {
1163  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_READER),
1165  participant.builtin_pending_records_.push_back(record);
1166  }
1167 
1168  if ((local_available & BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER) &&
1169  (remote_available & BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER)) {
1171  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER),
1172  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_liveliness_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1173  participant.builtin_pending_records_.push_back(record);
1174  }
1175  if ((local_available & SPDP_BUILTIN_PARTICIPANT_SECURE_READER) &&
1176  (remote_available & SPDP_BUILTIN_PARTICIPANT_SECURE_WRITER)) {
1178  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_WRITER),
1179  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1180  participant.builtin_pending_records_.push_back(record);
1181  }
1182  if ((local_available & SEDP_BUILTIN_PUBLICATIONS_SECURE_READER) &&
1183  (remote_available & SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER)) {
1185  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER),
1186  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1187  participant.builtin_pending_records_.push_back(record);
1188  }
1189  if ((local_available & SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER) &&
1190  (remote_available & SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER)) {
1192  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER),
1193  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1194  participant.builtin_pending_records_.push_back(record);
1195  }
1196 
1197  if ((local_available_extended & TYPE_LOOKUP_SERVICE_REQUEST_READER_SECURE) &&
1198  (remote_available_extended & TYPE_LOOKUP_SERVICE_REQUEST_WRITER_SECURE)) {
1200  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REQ_WRITER_SECURE),
1201  AC_REMOTE_RELIABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1202  participant.builtin_pending_records_.push_back(record);
1203  }
1204  if ((local_available_extended & TYPE_LOOKUP_SERVICE_REQUEST_WRITER_SECURE) &&
1205  (remote_available_extended & TYPE_LOOKUP_SERVICE_REQUEST_READER_SECURE)) {
1207  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REQ_READER_SECURE),
1208  AC_REMOTE_RELIABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1209  participant.builtin_pending_records_.push_back(record);
1210  }
1211  if ((local_available_extended & TYPE_LOOKUP_SERVICE_REPLY_READER_SECURE) &&
1212  (remote_available_extended & TYPE_LOOKUP_SERVICE_REPLY_WRITER_SECURE)) {
1214  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REPLY_WRITER_SECURE),
1215  AC_REMOTE_RELIABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1216  participant.builtin_pending_records_.push_back(record);
1217  }
1218  if ((local_available_extended & TYPE_LOOKUP_SERVICE_REPLY_WRITER_SECURE) &&
1219  (remote_available_extended & TYPE_LOOKUP_SERVICE_REPLY_READER_SECURE)) {
1221  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_TL_SVC_REPLY_READER_SECURE),
1222  AC_REMOTE_RELIABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1223  participant.builtin_pending_records_.push_back(record);
1224  }
1225 
1226  if ((local_available & BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER) &&
1227  (remote_available & BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER)) {
1229  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER),
1231  participant.builtin_pending_records_.push_back(record);
1232  }
1233  if ((local_available & SPDP_BUILTIN_PARTICIPANT_SECURE_WRITER) &&
1234  (remote_available & SPDP_BUILTIN_PARTICIPANT_SECURE_READER)) {
1236  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_READER),
1237  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1238  participant.builtin_pending_records_.push_back(record);
1239  }
1240  if ((local_available & SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER) &&
1241  (remote_available & SEDP_BUILTIN_PUBLICATIONS_SECURE_READER)) {
1243  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_READER),
1244  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1245  participant.builtin_pending_records_.push_back(record);
1246  }
1247  if ((local_available & SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER) &&
1248  (remote_available & SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER)) {
1250  make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER),
1251  AC_REMOTE_RELIABLE | AC_REMOTE_DURABLE | AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE | (participant_sec_attr.is_discovery_protected ? AC_SEND_LOCAL_TOKEN : AC_EMPTY));
1252  participant.builtin_pending_records_.push_back(record);
1253  }
1254  }
1255 #endif
1256 
1257  if (spdp_.shutting_down()) { return; }
1258 
1259  associated_participants_.insert(make_id(participant.pdata_.participantProxy.guidPrefix, ENTITYID_PARTICIPANT));
1260 
1261  process_association_records_i(participant);
1262 }
1263 
1265 {
1266  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = participant.builtin_pending_records_.begin(),
1267  limit = participant.builtin_pending_records_.end(); pos != limit;) {
1268  const BuiltinAssociationRecord& record = *pos;
1269  if (ready(participant, record.local_id(), record.remote_id(), record.local_tokens_sent())) {
1270  if (DCPS::DCPS_debug_level > 3) {
1271  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::process_association_records_i associating built-ins local %C remote %C pending %B done %B\n"),
1272  LogGuid(record.local_id()).c_str(), LogGuid(record.remote_id()).c_str(), participant.builtin_pending_records_.size(), participant.builtin_associated_records_.size()));
1273  }
1274 
1275  DCPS::AssociationData association_data;
1276  create_association_data_proto(association_data, participant.pdata_);
1277  populate_origination_locator(record.remote_id(), association_data.discovery_locator_);
1278  association_data.remote_id_ = record.remote_id();
1279  association_data.remote_reliable_ = record.remote_reliable();
1280  association_data.remote_durable_ = record.remote_durable();
1281  record.transport_client_->associate(association_data, DCPS::GuidConverter(association_data.remote_id_).isReader());
1282 
1283  participant.builtin_associated_records_.push_back(record);
1284  participant.builtin_pending_records_.erase(pos++);
1285 
1286  } else {
1287  if (DCPS::DCPS_debug_level > 6) {
1288  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::process_association_records_i builtin not ready local %C remote %C pending %B done %B\n"),
1289  LogGuid(record.local_id()).c_str(), LogGuid(record.remote_id()).c_str(), participant.builtin_pending_records_.size(), participant.builtin_associated_records_.size()));
1290  }
1291 
1292  ++pos;
1293  }
1294  }
1295 
1296  for (DiscoveredParticipant::WriterAssociationRecords::iterator pos = participant.writer_pending_records_.begin(),
1297  limit = participant.writer_pending_records_.end(); pos != limit;) {
1298  const WriterAssociationRecord& record = **pos;
1299  // The local tokens have already been sent.
1300  if (ready(participant, record.writer_id(), record.reader_id(), true)) {
1301  event_dispatcher_->dispatch(DCPS::make_rch<WriterAddAssociation>(*pos));
1302 
1303  participant.writer_associated_records_.push_back(*pos);
1304  participant.writer_pending_records_.erase(pos++);
1305  } else {
1306  if (DCPS::DCPS_debug_level > 6) {
1307  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::process_association_records_i writer not ready local %C remote %C pending %B done %B\n"),
1308  LogGuid(record.writer_id()).c_str(), LogGuid(record.reader_id()).c_str(), participant.writer_pending_records_.size(), participant.writer_associated_records_.size()));
1309  }
1310  ++pos;
1311  }
1312  }
1313 
1314  for (DiscoveredParticipant::ReaderAssociationRecords::iterator pos = participant.reader_pending_records_.begin(),
1315  limit = participant.reader_pending_records_.end(); pos != limit;) {
1316  const ReaderAssociationRecord& record = **pos;
1317  // The local tokens have already been sent.
1318  if (ready(participant, record.reader_id(), record.writer_id(), true)) {
1319  event_dispatcher_->dispatch(DCPS::make_rch<ReaderAddAssociation>(*pos));
1320 
1321  participant.reader_associated_records_.push_back(*pos);
1322  participant.reader_pending_records_.erase(pos++);
1323  } else {
1324  if (DCPS::DCPS_debug_level > 6) {
1325  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::process_association_records_i reader not ready local %C remote %C pending %B done %B\n"),
1326  LogGuid(record.reader_id()).c_str(), LogGuid(record.writer_id()).c_str(), participant.reader_pending_records_.size(), participant.reader_associated_records_.size()));
1327  }
1328  ++pos;
1329  }
1330  }
1331 }
1332 
1333 #ifdef OPENDDS_SECURITY
1335 {
1336  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = participant.builtin_pending_records_.begin(),
1337  limit = participant.builtin_pending_records_.end(); pos != limit; ++pos) {
1338  const BuiltinAssociationRecord& record = *pos;
1341  }
1342  }
1343 }
1344 
1346 {
1351 
1352  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = participant.builtin_pending_records_.begin(),
1353  limit = participant.builtin_pending_records_.end(); pos != limit;) {
1354  const BuiltinAssociationRecord& record = *pos;
1355  if (record.local_id() == local_writer && record.remote_id() == remote_reader) {
1356  participant.builtin_pending_records_.erase(pos++);
1357  } else if (record.local_id() == local_reader && record.remote_id() == remote_writer) {
1358  participant.builtin_pending_records_.erase(pos++);
1359  } else {
1360  ++pos;
1361  }
1362  }
1363 
1364  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = participant.builtin_associated_records_.begin(),
1365  limit = participant.builtin_associated_records_.end(); pos != limit;) {
1366  const BuiltinAssociationRecord& record = *pos;
1367  if (record.local_id() == local_writer && record.remote_id() == remote_reader) {
1368  record.transport_client_->disassociate(record.remote_id());
1369  participant.builtin_associated_records_.erase(pos++);
1370  } else if (record.local_id() == local_reader && record.remote_id() == remote_writer) {
1371  record.transport_client_->disassociate(record.remote_id());
1372  participant.builtin_associated_records_.erase(pos++);
1373  } else {
1374  ++pos;
1375  }
1376  }
1377 }
1378 
1379 void Sedp::cleanup_volatile_crypto(const DCPS::GUID_t& remote)
1380 {
1383 }
1384 
1386 {
1387  using namespace DDS::Security;
1388 
1389  const BuiltinEndpointSet_t local_available = spdp_.available_builtin_endpoints();
1390  const BuiltinEndpointSet_t remote_available = participant.pdata_.participantProxy.availableBuiltinEndpoints;
1391 
1392  if ((local_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_READER) &&
1397  participant.builtin_pending_records_.push_back(record);
1398  }
1399  if ((local_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_WRITER) &&
1400  (remote_available & BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_READER)) {
1404  participant.builtin_pending_records_.push_back(record);
1405  }
1406 }
1407 #endif // OPENDDS_SECURITY
1408 
1409 #ifdef OPENDDS_SECURITY
1410 
1412  const CORBA::ULong flags, const DCPS::GUID_t& id, const EntityId_t& ent,
1413  DCPS::TransportClient& client)
1414 {
1415  if (extended_associated_endpoints & flags) {
1416  client.disassociate(make_id(id, ent));
1417  extended_associated_endpoints &= ~flags;
1418  }
1419 }
1420 
1421 void Sedp::remove_remote_crypto_handle(const GUID_t& participant, const EntityId_t& entity)
1422 {
1423  using namespace DDS::Security;
1424 
1425  const GUID_t remote = make_id(participant, entity);
1426  SecurityException se = {"", 0, 0};
1427  CryptoKeyFactory_var key_factory = spdp_.get_security_config()->get_crypto_key_factory();
1428 
1429  const DCPS::GuidConverter traits(remote);
1430  if (traits.isReader()) {
1433  if (drch == DDS::HANDLE_NIL) {
1434  return;
1435  }
1436  if (!key_factory->unregister_datareader(drch, se)) {
1437  if (DCPS::security_debug.cleanup_error) {
1438  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) {cleanup_error} Sedp::remove_remote_crypto_handle() - ")
1439  ACE_TEXT("Failure calling unregister_datareader() (ch %d). Security Exception[%d.%d]: %C\n"),
1440  drch, se.code, se.minor_code, se.message.in()));
1441  }
1442  }
1444  } else if (traits.isWriter()) {
1447  if (dwch == DDS::HANDLE_NIL) {
1448  return;
1449  }
1450  if (!key_factory->unregister_datawriter(dwch, se)) {
1451  if (DCPS::security_debug.cleanup_error) {
1452  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) {cleanup_error} Sedp::remove_remote_crypto_handle() - ")
1453  ACE_TEXT("Failure calling unregister_datawriter() (ch %d). Security Exception[%d.%d]: %C\n"),
1454  dwch, se.code, se.minor_code, se.message.in()));
1455  }
1456  }
1458  }
1459 }
1460 
1461 void
1463  const DDS::Security::DatareaderCryptoHandle& drch, const DCPS::GUID_t& local_reader,
1464  const DDS::Security::DatawriterCryptoHandle& dwch, const DCPS::GUID_t& remote_writer)
1465 {
1466  if (DCPS::security_debug.bookkeeping) {
1467  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
1468  ACE_TEXT("Sedp::create_and_send_datareader_crypto_tokens() - ")
1469  ACE_TEXT("sending tokens for local reader %C (ch %d) to remote writer %C (ch %d)\n"),
1470  DCPS::LogGuid(local_reader).c_str(), drch,
1471  DCPS::LogGuid(remote_writer).c_str(), dwch));
1472  }
1473 
1475  create_datareader_crypto_tokens(drch, dwch, drcts);
1476 
1477  send_datareader_crypto_tokens(local_reader, remote_writer, drcts);
1478 }
1479 
1480 void
1482  const DDS::Security::DatawriterCryptoHandle& dwch, const DCPS::GUID_t& local_writer,
1483  const DDS::Security::DatareaderCryptoHandle& drch, const DCPS::GUID_t& remote_reader)
1484 {
1485  if (DCPS::security_debug.bookkeeping) {
1486  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
1487  ACE_TEXT("Sedp::create_and_send_datawriter_crypto_tokens() - ")
1488  ACE_TEXT("sending tokens for local writer %C (ch %d) to remote reader %C (ch %d)\n"),
1489  DCPS::LogGuid(local_writer).c_str(), dwch,
1490  DCPS::LogGuid(remote_reader).c_str(), drch));
1491  }
1492 
1494  create_datawriter_crypto_tokens(dwch, drch, dwcts);
1495 
1496  send_datawriter_crypto_tokens(local_writer, remote_reader, dwcts);
1497 }
1498 
1499 void
1500 Sedp::send_builtin_crypto_tokens(const DCPS::GUID_t& dst, const DCPS::GUID_t& src)
1501 {
1502  if (DCPS::GuidConverter(src).isReader()) {
1503  create_and_send_datareader_crypto_tokens(get_handle_registry()->get_local_datareader_crypto_handle(src), src,
1504  get_handle_registry()->get_remote_datawriter_crypto_handle(dst), dst);
1505  } else {
1506  create_and_send_datawriter_crypto_tokens(get_handle_registry()->get_local_datawriter_crypto_handle(src), src,
1507  get_handle_registry()->get_remote_datareader_crypto_handle(dst), dst);
1508  }
1509 }
1510 
1511 void
1512 Sedp::send_builtin_crypto_tokens(const DCPS::GUID_t& remoteId)
1513 {
1514  const GUID_t remote_part = make_id(remoteId, ENTITYID_PARTICIPANT);
1515  Spdp::DiscoveredParticipantIter iter = spdp_.participants_.find(remote_part);
1516  if (iter == spdp_.participants_.end()) {
1517  if (DCPS::security_debug.bookkeeping) {
1518  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) {bookkeeping} Sedp::send_builtin_crypto_tokens - could not find participant %C\n"), LogGuid(remote_part).c_str()));
1519  }
1520  return;
1521  }
1522 
1523  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = iter->second.builtin_pending_records_.begin(),
1524  limit = iter->second.builtin_pending_records_.end(); pos != limit; ++pos) {
1525  BuiltinAssociationRecord& record = *pos;
1526  if (record.send_local_token()) {
1527  send_builtin_crypto_tokens(record.remote_id(), record.local_id());
1528  record.local_tokens_sent(true);
1529  }
1530  }
1531 
1532  for (DiscoveredParticipant::BuiltinAssociationRecords::iterator pos = iter->second.builtin_associated_records_.begin(),
1533  limit = iter->second.builtin_associated_records_.end(); pos != limit; ++pos) {
1534  BuiltinAssociationRecord& record = *pos;
1535  if (record.send_local_token()) {
1536  send_builtin_crypto_tokens(record.remote_id(), record.local_id());
1537  record.local_tokens_sent(true);
1538  }
1539  }
1540 }
1541 #endif
1542 
1543 void
1545 {
1547 
1548  associated_participants_.erase(part);
1549 
1550  OPENDDS_VECTOR(DiscoveredPublication) pubs_to_remove_from_bit;
1551  OPENDDS_VECTOR(DiscoveredSubscription) subs_to_remove_from_bit;
1552 
1553  remove_entities_belonging_to(discovered_publications_, part, false, pubs_to_remove_from_bit);
1554  remove_entities_belonging_to(discovered_subscriptions_, part, true, subs_to_remove_from_bit);
1555 
1556  for (OPENDDS_VECTOR(DiscoveredPublication)::iterator it = pubs_to_remove_from_bit.begin(); it != pubs_to_remove_from_bit.end(); ++it) {
1557  remove_from_bit_i(*it);
1558  }
1559 
1560  for (OPENDDS_VECTOR(DiscoveredSubscription)::iterator it = subs_to_remove_from_bit.begin(); it != subs_to_remove_from_bit.end(); ++it) {
1561  remove_from_bit_i(*it);
1562  }
1563 
1564  participant.builtin_pending_records_.clear();
1565 
1566  for (DiscoveredParticipant::BuiltinAssociationRecords::const_iterator pos = participant.builtin_associated_records_.begin(), limit = participant.builtin_associated_records_.end(); pos != limit; ++pos) {
1567  const BuiltinAssociationRecord& record = *pos;
1568  record.transport_client_->disassociate(record.remote_id());
1569  }
1570 
1571  participant.builtin_associated_records_.clear();
1572 
1573  //FUTURE: if/when topic propagation is supported, add it here
1574 
1575 #ifdef OPENDDS_SECURITY
1576  // Clean up crypto handles after diassociation because the transport might be using them.
1577  if (spdp_.is_security_enabled()) {
1578  static const EntityId_t secure_entities[] = {
1593  };
1594  for (size_t i = 0; i < DCPS::array_count(secure_entities); ++i) {
1595  remove_remote_crypto_handle(part, secure_entities[i]);
1596  }
1597 
1598  const DDS::Security::CryptoKeyFactory_var key_factory = spdp_.get_security_config()->get_crypto_key_factory();
1600 
1601  typedef Security::HandleRegistry::DatareaderCryptoHandleList DatareaderCryptoHandleList;
1602  typedef Security::HandleRegistry::DatawriterCryptoHandleList DatawriterCryptoHandleList;
1603 
1604  const GUID_t key = make_unknown_guid(part);
1605  const DatareaderCryptoHandleList drlist = get_handle_registry()->get_all_remote_datareaders(key);
1606  for (DatareaderCryptoHandleList::const_iterator pos = drlist.begin(), limit = drlist.end();
1607  pos != limit; ++pos) {
1608  if (!key_factory->unregister_datareader(pos->second, se)) {
1609  if (DCPS::security_debug.cleanup_error) {
1610  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) {cleanup_error} Sedp::disassociate() - ")
1611  ACE_TEXT("Failure calling unregister_datareader() (ch %d). Security Exception[%d.%d]: %C\n"),
1612  pos->second, se.code, se.minor_code, se.message.in()));
1613  }
1614  }
1616  }
1617  const DatawriterCryptoHandleList dwlist = get_handle_registry()->get_all_remote_datawriters(key);
1618  for (DatawriterCryptoHandleList::const_iterator pos = dwlist.begin(), limit = dwlist.end();
1619  pos != limit; ++pos) {
1620  if (!key_factory->unregister_datawriter(pos->second, se)) {
1621  if (DCPS::security_debug.cleanup_error) {
1622  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) {cleanup_error} Sedp::disassociate() - ")
1623  ACE_TEXT("Failure calling unregister_datawriter() (ch %d). Security Exception[%d.%d]: %C\n"),
1624  pos->second, se.code, se.minor_code, se.message.in()));
1625  }
1626  }
1628  }
1629  }
1630 #endif
1631 }
1632 
1633 void
1634 Sedp::replay_durable_data_for(const DCPS::GUID_t& remote_sub_id)
1635 {
1636  DCPS::GuidConverter conv(remote_sub_id);
1637  ACE_DEBUG((LM_DEBUG, "Sedp::replay_durable_data_for %C\n", OPENDDS_STRING(conv).c_str()));
1639  if (remote_sub_id.entityId == ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER) {
1640  write_durable_publication_data(remote_sub_id, false);
1641  } else if (remote_sub_id.entityId == ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER) {
1642  write_durable_subscription_data(remote_sub_id, false);
1643  } else if (remote_sub_id.entityId == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER) {
1645 #ifdef OPENDDS_SECURITY
1646  } else if (remote_sub_id.entityId == ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_READER) {
1647  write_durable_publication_data(remote_sub_id, true);
1648  } else if (remote_sub_id.entityId == ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER) {
1649  write_durable_subscription_data(remote_sub_id, true);
1654 #endif
1655  }
1656 }
1657 
1658 void
1660 {
1661  DCPS::TransportLocatorSeq remote_data;
1662  populate_locators(remote_data, pdata);
1663 
1664  DCPS::GUID_t remote_id = make_id(pdata.participantProxy.guidPrefix, ENTITYID_PARTICIPANT);
1665 
1666  if (DCPS::DCPS_debug_level > 3) {
1667  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::update_locators updating locators for %C\n"), DCPS::LogGuid(remote_id).c_str()));
1668  }
1669 
1670  const BuiltinEndpointSet_t& avail =
1672 
1675  transport_inst_->update_locators(remote_id, remote_data);
1676  }
1679  transport_inst_->update_locators(remote_id, remote_data);
1680  }
1683  transport_inst_->update_locators(remote_id, remote_data);
1684  }
1687  transport_inst_->update_locators(remote_id, remote_data);
1688  }
1691  transport_inst_->update_locators(remote_id, remote_data);
1692  }
1695  transport_inst_->update_locators(remote_id, remote_data);
1696  }
1699  transport_inst_->update_locators(remote_id, remote_data);
1700  }
1703  transport_inst_->update_locators(remote_id, remote_data);
1704  }
1707  transport_inst_->update_locators(remote_id, remote_data);
1708  }
1711  transport_inst_->update_locators(remote_id, remote_data);
1712  }
1715  transport_inst_->update_locators(remote_id, remote_data);
1716  }
1719  transport_inst_->update_locators(remote_id, remote_data);
1720  }
1721 
1722 #ifdef OPENDDS_SECURITY
1725  transport_inst_->update_locators(remote_id, remote_data);
1726  }
1729  transport_inst_->update_locators(remote_id, remote_data);
1730  }
1733  transport_inst_->update_locators(remote_id, remote_data);
1734  }
1737  transport_inst_->update_locators(remote_id, remote_data);
1738  }
1741  transport_inst_->update_locators(remote_id, remote_data);
1742  }
1745  transport_inst_->update_locators(remote_id, remote_data);
1746  }
1749  transport_inst_->update_locators(remote_id, remote_data);
1750  }
1753  transport_inst_->update_locators(remote_id, remote_data);
1754  }
1757  transport_inst_->update_locators(remote_id, remote_data);
1758  }
1761  transport_inst_->update_locators(remote_id, remote_data);
1762  }
1765  transport_inst_->update_locators(remote_id, remote_data);
1766  }
1769  transport_inst_->update_locators(remote_id, remote_data);
1770  }
1771 
1772  const DDS::Security::ExtendedBuiltinEndpointSet_t& extended_avail =
1774 
1777  transport_inst_->update_locators(remote_id, remote_data);
1778  }
1781  transport_inst_->update_locators(remote_id, remote_data);
1782  }
1785  transport_inst_->update_locators(remote_id, remote_data);
1786  }
1789  transport_inst_->update_locators(remote_id, remote_data);
1790  }
1791 #endif
1792 }
1793 
1794 template<typename Map>
1796  Map& m, GUID_t participant, bool subscription, OPENDDS_VECTOR(typename Map::mapped_type)& to_remove_from_bit)
1797 {
1798  participant.entityId = ENTITYID_UNKNOWN;
1799  for (typename Map::iterator i = m.lower_bound(participant);
1800  i != m.end() && 0 == std::memcmp(i->first.guidPrefix,
1801  participant.guidPrefix,
1802  sizeof(GuidPrefix_t));) {
1803  String topic_name = i->second.get_topic_name();
1804  DCPS::TopicDetailsMap::iterator top_it = topics_.find(topic_name);
1805  if (top_it != topics_.end()) {
1806  if (subscription) {
1807  top_it->second.remove_discovered_subscription(i->first);
1808  } else {
1809  top_it->second.remove_discovered_publication(i->first);
1810  }
1811  if (DCPS::DCPS_debug_level > 3) {
1813  ACE_TEXT("(%P|%t) Sedp::remove_entities_belonging_to - ")
1814  ACE_TEXT("calling match_endpoints remove\n")));
1815  }
1816  match_endpoints(i->first, top_it->second, true /*remove*/);
1817  if (spdp_.shutting_down()) { return; }
1818  if (top_it->second.is_dead()) {
1819  purge_dead_topic(topic_name);
1820  }
1821  }
1822  to_remove_from_bit.push_back(i->second);
1823  m.erase(i++);
1824  }
1825 }
1826 
1827 void
1829 {
1830  spdp_.bit_subscriber_->remove_publication(pub.bit_ih_);
1831 }
1832 
1833 void
1835 {
1836  spdp_.bit_subscriber_->remove_subscription(sub.bit_ih_);
1837 }
1838 
1839 bool
1840 Sedp::update_topic_qos(const GUID_t& topicId, const DDS::TopicQos& qos)
1841 {
1844  topic_names_.find(topicId);
1845  if (iter == topic_names_.end()) {
1846  return false;
1847  }
1848  const OPENDDS_STRING& name = iter->second;
1849  TopicDetails& topic = topics_[name];
1850  using namespace DCPS;
1851  // If the TOPIC_DATA QoS changed our local endpoints must be resent
1852  // with new QoS
1853  if (qos.topic_data != topic.local_qos().topic_data) {
1854  topic.update(qos);
1855  // For each endpoint associated on this topic
1856  for (RepoIdSet::const_iterator topic_endpoints = topic.local_publications().begin();
1857  topic_endpoints != topic.local_publications().end(); ++topic_endpoints) {
1858 
1859  const GUID_t& rid = *topic_endpoints;
1861  OPENDDS_ASSERT(lp != local_publications_.end());
1862  write_publication_data(rid, lp->second);
1863  }
1864  for (RepoIdSet::const_iterator topic_endpoints = topic.local_subscriptions().begin();
1865  topic_endpoints != topic.local_subscriptions().end(); ++topic_endpoints) {
1866 
1867  const GUID_t& rid = *topic_endpoints;
1869  OPENDDS_ASSERT(ls != local_subscriptions_.end());
1870  write_subscription_data(rid, ls->second);
1871  }
1872  }
1873 
1874  return true;
1875 }
1876 
1879 {
1880 #ifdef OPENDDS_SECURITY
1882  if (pl) {
1883  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
1884  if (endpoint) {
1885  ice_agent_->remove_local_agent_info_listener(endpoint, publicationId);
1886  }
1887  }
1888 
1890  return publications_secure_writer_->write_unregister_dispose(publicationId);
1891  } else {
1892  return publications_writer_->write_unregister_dispose(publicationId);
1893  }
1894 #else
1895  ACE_UNUSED_ARG(pub);
1896  return publications_writer_->write_unregister_dispose(publicationId);
1897 #endif
1898 }
1899 
1900 bool
1902  const DDS::DataWriterQos& qos,
1903  const DDS::PublisherQos& publisherQos)
1904 {
1906  LocalPublicationIter iter = local_publications_.find(publicationId);
1907  if (iter != local_publications_.end()) {
1908  LocalPublication& pb = iter->second;
1909  pb.qos_ = qos;
1910  pb.publisher_qos_ = publisherQos;
1911 
1912  if (DDS::RETCODE_OK != write_publication_data(publicationId, pb)) {
1913  return false;
1914  }
1915  // Match/unmatch with subscriptions
1916  String topic_name = topic_names_[pb.topic_id_];
1917  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
1918  if (top_it != topics_.end()) {
1919  match_endpoints(publicationId, top_it->second);
1920  }
1921  return true;
1922  }
1923  return false;
1924 }
1925 
1927 Sedp::remove_subscription_i(const GUID_t& subscriptionId,
1928  LocalSubscription& sub)
1929 {
1930 #ifdef OPENDDS_SECURITY
1932  if (sl) {
1933  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
1934  if (endpoint) {
1935  ice_agent_->remove_local_agent_info_listener(endpoint, subscriptionId);
1936  }
1937  }
1938 
1940  return subscriptions_secure_writer_->write_unregister_dispose(subscriptionId);
1941  } else {
1942  return subscriptions_writer_->write_unregister_dispose(subscriptionId);
1943  }
1944 #else
1945  ACE_UNUSED_ARG(sub);
1946  return subscriptions_writer_->write_unregister_dispose(subscriptionId);
1947 #endif
1948 }
1949 
1950 bool
1952  const DDS::DataReaderQos& qos,
1953  const DDS::SubscriberQos& subscriberQos)
1954 {
1956  LocalSubscriptionIter iter = local_subscriptions_.find(subscriptionId);
1957  if (iter != local_subscriptions_.end()) {
1958  LocalSubscription& sb = iter->second;
1959  sb.qos_ = qos;
1960  sb.subscriber_qos_ = subscriberQos;
1961 
1962  if (DDS::RETCODE_OK != write_subscription_data(subscriptionId, sb)) {
1963  return false;
1964  }
1965  // Match/unmatch with subscriptions
1966  String topic_name = topic_names_[sb.topic_id_];
1967  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
1968  if (top_it != topics_.end()) {
1969  match_endpoints(subscriptionId, top_it->second);
1970  }
1971  return true;
1972  }
1973  return false;
1974 }
1975 
1976 bool
1978  const DDS::StringSeq& params)
1979 {
1981  const LocalSubscriptionIter iter = local_subscriptions_.find(subId);
1982  if (iter != local_subscriptions_.end()) {
1983  LocalSubscription& sb = iter->second;
1985 
1986  if (DDS::RETCODE_OK != write_subscription_data(subId, sb)) {
1987  return false;
1988  }
1989 
1990  // Let any associated local publications know about the change
1991  for (DCPS::RepoIdSet::iterator i = iter->second.matched_endpoints_.begin();
1992  i != iter->second.matched_endpoints_.end(); ++i) {
1993  const LocalPublicationIter lpi = local_publications_.find(*i);
1994  if (lpi != local_publications_.end()) {
1995  DCPS::DataWriterCallbacks_rch pl = lpi->second.publication_.lock();
1996  if (pl) {
1997  pl->update_subscription_params(subId, params);
1998  }
1999  }
2000  }
2001 
2002  return true;
2003  }
2004  return false;
2005 }
2006 
2007 void
2009 {
2010  publications_reader_->shutting_down();
2011  subscriptions_reader_->shutting_down();
2012  participant_message_reader_->shutting_down();
2013  type_lookup_request_reader_->shutting_down();
2014  type_lookup_reply_reader_->shutting_down();
2015 #ifdef OPENDDS_SECURITY
2016  publications_secure_reader_->shutting_down();
2017  subscriptions_secure_reader_->shutting_down();
2018  participant_message_secure_reader_->shutting_down();
2019  participant_stateless_message_reader_->shutting_down();
2021  dcps_participant_secure_reader_->shutting_down();
2022  type_lookup_request_secure_reader_->shutting_down();
2023  type_lookup_reply_secure_reader_->shutting_down();
2024 #endif
2025  publications_writer_->shutting_down();
2026  subscriptions_writer_->shutting_down();
2027  participant_message_writer_->shutting_down();
2028  type_lookup_request_writer_->shutting_down();
2029  type_lookup_reply_writer_->shutting_down();
2030 #ifdef OPENDDS_SECURITY
2031  publications_secure_writer_->shutting_down();
2032  subscriptions_secure_writer_->shutting_down();
2033  participant_message_secure_writer_->shutting_down();
2034  participant_stateless_message_writer_->shutting_down();
2036  dcps_participant_secure_writer_->shutting_down();
2037  type_lookup_request_secure_writer_->shutting_down();
2038  type_lookup_reply_secure_writer_->shutting_down();
2039 #endif
2040 }
2041 
2043  const DCPS::DiscoveredWriterData& wdata,
2044  const GUID_t& guid,
2045  const XTypes::TypeInformation& type_info
2046 #ifdef OPENDDS_SECURITY
2047  ,
2048  bool have_ice_agent_info,
2049  const ICE::AgentInfo& ice_agent_info,
2050  const DDS::Security::EndpointSecurityInfo* security_info
2051 #endif
2052  )
2053 {
2054  OPENDDS_STRING topic_name;
2055 
2056  const GUID_t participant_id = make_part_guid(guid);
2057 
2058  // Find the publication - iterator valid only as long as we hold the lock
2060 
2061  if (message_id == DCPS::SAMPLE_DATA) {
2062  DCPS::DiscoveredWriterData wdata_copy;
2063 
2064 #ifdef OPENDDS_SECURITY
2065  if (iter != discovered_publications_.end()) {
2066  DiscoveredPublication& dpub = iter->second;
2067  if (!dpub.have_ice_agent_info_ && have_ice_agent_info) {
2068  dpub.have_ice_agent_info_ = have_ice_agent_info;
2069  dpub.ice_agent_info_ = ice_agent_info;
2070  start_ice(guid, dpub);
2071  } else if (dpub.have_ice_agent_info_ && !have_ice_agent_info) {
2072  dpub.have_ice_agent_info_ = have_ice_agent_info;
2073  dpub.ice_agent_info_ = ice_agent_info;
2074  stop_ice(guid, dpub);
2075  } else if (dpub.ice_agent_info_ != ice_agent_info) {
2076  dpub.ice_agent_info_ = ice_agent_info;
2077  start_ice(guid, dpub);
2078  }
2079  }
2080 #endif
2081 
2082  if (iter == discovered_publications_.end()) { // add new
2083  DiscoveredPublication prepub(wdata);
2085  prepub.transport_context_ = spdp_.get_participant_flags(participant_id);
2086  prepub.type_info_ = type_info;
2087 
2088 #ifdef OPENDDS_SECURITY
2089  prepub.have_ice_agent_info_ = have_ice_agent_info;
2090  prepub.ice_agent_info_ = ice_agent_info;
2091 #endif
2092  topic_name = prepub.get_topic_name();
2093 
2094 #ifdef OPENDDS_SECURITY
2095  if (is_security_enabled()) {
2096 
2097  DDS::Security::SecurityException ex = {"", 0, 0};
2098 
2100  data.key = wdata.ddsPublicationData.key;
2101  data.name = wdata.ddsPublicationData.topic_name;
2102  data.type_name = wdata.ddsPublicationData.type_name;
2103  data.durability = wdata.ddsPublicationData.durability;
2104  data.durability_service = wdata.ddsPublicationData.durability_service;
2105  data.deadline = wdata.ddsPublicationData.deadline;
2106  data.latency_budget = wdata.ddsPublicationData.latency_budget;
2107  data.liveliness = wdata.ddsPublicationData.liveliness;
2108  data.reliability = wdata.ddsPublicationData.reliability;
2109  data.lifespan = wdata.ddsPublicationData.lifespan;
2110  data.destination_order = wdata.ddsPublicationData.destination_order;
2111  data.ownership = wdata.ddsPublicationData.ownership;
2112  data.topic_data = wdata.ddsPublicationData.topic_data;
2113 
2114  AuthState auth_state = spdp_.lookup_participant_auth_state(participant_id);
2115  if (auth_state == AUTH_STATE_AUTHENTICATED) {
2116 
2117  DDS::Security::PermissionsHandle remote_permissions = spdp_.lookup_participant_permissions(participant_id);
2118 
2120  !get_access_control()->check_remote_topic(remote_permissions, spdp_.get_domain_id(), data, ex))
2121  {
2123  ACE_TEXT("(%P|%t) WARNING: ")
2124  ACE_TEXT("Sedp::process_discovered_writer_data - ")
2125  ACE_TEXT("Unable to check remote topic '%C'. SecurityException[%d.%d]: %C\n"),
2126  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2127  return;
2128  }
2129 
2131  if (!get_access_control()->get_topic_sec_attributes(remote_permissions, topic_name.data(), topic_sec_attr, ex))
2132  {
2134  ACE_TEXT("(%P|%t) WARNING: ")
2135  ACE_TEXT("Sedp::process_discovered_writer_data - ")
2136  ACE_TEXT("Unable to get security attributes for remote topic '%C'. SecurityException[%d.%d]: %C\n"),
2137  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2138  return;
2139  }
2140 
2142  pub_data_sec.base.base = wdata.ddsPublicationData;
2143 
2144  if (security_info != NULL) {
2146  security_info->endpoint_security_attributes;
2148  security_info->plugin_endpoint_security_attributes;
2149  }
2150 
2151  if (topic_sec_attr.is_write_protected &&
2152  !get_access_control()->check_remote_datawriter(remote_permissions, spdp_.get_domain_id(), pub_data_sec, ex))
2153  {
2155  ACE_TEXT("(%P|%t) WARNING: ")
2156  ACE_TEXT("Sedp::process_discovered_writer_data - ")
2157  ACE_TEXT("Unable to check remote datawriter '%C'. SecurityException[%d.%d]: %C\n"),
2158  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2159  return;
2160  }
2161  } else if (auth_state != AUTH_STATE_UNAUTHENTICATED) {
2163  ACE_TEXT("(%P|%t) WARNING: ")
2164  ACE_TEXT("Sedp::process_discovered_writer_data - ")
2165  ACE_TEXT("Unsupported remote participant authentication state for discovered datawriter '%C'. ")
2166  ACE_TEXT("SecurityException[%d.%d]: %C\n"),
2167  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2168  return;
2169  }
2170  }
2171 #endif
2172 
2173  DiscoveredPublication& pub = discovered_publications_[guid] = prepub;
2174 
2175  // Create a topic if necessary.
2176  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2177  if (top_it == topics_.end()) {
2178  top_it = topics_.insert(std::make_pair(topic_name, TopicDetails())).first;
2179  DCPS::GUID_t topic_id = make_topic_guid();
2180  top_it->second.init(topic_name, topic_id);
2181  topic_names_[topic_id] = topic_name;
2182  }
2183 
2184  TopicDetails& td = top_it->second;
2185 
2186  // Upsert the remote topic.
2187  td.add_discovered_publication(guid);
2188 
2189  assign_bit_key(pub);
2190  wdata_copy = pub.writer_data_;
2191 
2192  pub.bit_ih_ = spdp_.bit_subscriber_->add_publication(wdata_copy.ddsPublicationData, DDS::NEW_VIEW_STATE);
2193  if (spdp_.shutting_down()) { return; }
2194 
2195  if (DCPS::DCPS_debug_level > 3) {
2196  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_writer_data - ")
2197  ACE_TEXT("calling match_endpoints new\n")));
2198  }
2200  DCPS::log_progress("discovered writer data new", participant_id_, participant_id, spdp_.get_participant_discovered_at(participant_id), guid);
2201  }
2202  match_endpoints(guid, top_it->second);
2203  } else {
2204  if (checkAndAssignQos(iter->second.writer_data_.ddsPublicationData,
2205  wdata.ddsPublicationData)) { // update existing
2206 
2207  spdp_.bit_subscriber_->add_publication(iter->second.writer_data_.ddsPublicationData, DDS::NOT_NEW_VIEW_STATE);
2208  if (spdp_.shutting_down()) { return; }
2209 
2210  // Match/unmatch local subscription(s)
2211  topic_name = iter->second.get_topic_name();
2212  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2213  if (top_it != topics_.end()) {
2214  if (DCPS::DCPS_debug_level > 3) {
2215  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_writer_data - ")
2216  ACE_TEXT("calling match_endpoints update\n")));
2217  }
2219  log_progress("discovered writer data update", participant_id_, participant_id,
2220  spdp_.get_participant_discovered_at(participant_id), guid);
2221  }
2222  match_endpoints(guid, top_it->second);
2223  iter = discovered_publications_.find(guid);
2224  if (iter == discovered_publications_.end()) {
2225  return;
2226  }
2227  }
2228  }
2229 
2230  if (checkAndAssignLocators(iter->second.writer_data_.writerProxy, wdata.writerProxy)) {
2231  topic_name = iter->second.get_topic_name();
2232  TopicDetailsMap::const_iterator top_it = topics_.find(topic_name);
2233  using DCPS::RepoIdSet;
2234  const RepoIdSet& assoc =
2235  (top_it == topics_.end()) ? RepoIdSet() : top_it->second.local_subscriptions();
2236  for (RepoIdSet::const_iterator i = assoc.begin(); i != assoc.end(); ++i) {
2238  if (lsi != local_subscriptions_.end()) {
2239  DCPS::DataReaderCallbacks_rch sl = lsi->second.subscription_.lock();
2240  if (sl) {
2241  sl->update_locators(guid, wdata.writerProxy.allLocators);
2242  }
2243  }
2244  }
2245  }
2246  }
2247 
2248  } else if (message_id == DCPS::UNREGISTER_INSTANCE ||
2249  message_id == DCPS::DISPOSE_INSTANCE ||
2250  message_id == DCPS::DISPOSE_UNREGISTER_INSTANCE) {
2251  if (iter != discovered_publications_.end()) {
2252  // Unmatch local subscription(s)
2253  topic_name = iter->second.get_topic_name();
2254  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2255  if (top_it != topics_.end()) {
2256  top_it->second.remove_discovered_publication(guid);
2257  match_endpoints(guid, top_it->second, true /*remove*/);
2258  if (spdp_.shutting_down()) { return; }
2259  if (top_it->second.is_dead()) {
2260  purge_dead_topic(topic_name);
2261  }
2262  }
2263  DiscoveredPublication p = iter->second;
2264  discovered_publications_.erase(iter);
2265  remove_from_bit(p);
2266  if (DCPS::DCPS_debug_level > 3) {
2267  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_writer_data - ")
2268  ACE_TEXT("calling match_endpoints disp/unreg\n")));
2269  }
2271  log_progress("discovered writer data disposed", participant_id_, participant_id,
2272  spdp_.get_participant_discovered_at(participant_id), guid);
2273  }
2274  }
2275  }
2276 }
2277 
2278 void
2280  const DiscoveredPublication& dpub)
2281 {
2282  if (!spdp_.initialized() || spdp_.shutting_down()) { return; }
2283 
2284  const DCPS::DiscoveredWriterData& wdata = dpub.writer_data_;
2285  const GUID_t& guid = wdata.writerProxy.remoteWriterGuid;
2286  const GUID_t guid_participant = make_part_guid(guid);
2287 
2289 
2290  if (ignoring(guid)
2291  || ignoring(guid_participant)
2292  || ignoring(wdata.ddsPublicationData.topic_name)) {
2293  return;
2294  }
2295 
2296 #ifdef OPENDDS_SECURITY
2297  if (message_id == DCPS::SAMPLE_DATA && should_drop_message(wdata.ddsPublicationData.topic_name)) {
2298  return;
2299  }
2300 #endif
2301 
2302  if (!spdp_.has_discovered_participant(guid_participant)) {
2303  return;
2304  }
2305 
2306  process_discovered_writer_data(message_id, wdata, guid, dpub.type_info_
2307 #ifdef OPENDDS_SECURITY
2309 #endif
2310  );
2311 }
2312 
2313 #ifdef OPENDDS_SECURITY
2316 {
2317  if (!spdp_.initialized() || spdp_.shutting_down()) { return; }
2318 
2319  const GUID_t& guid = wrapper.data.writerProxy.remoteWriterGuid;
2320  const GUID_t guid_participant = make_part_guid(guid);
2321 
2323 
2324  if (ignoring(guid)
2325  || ignoring(guid_participant)
2326  || ignoring(wrapper.data.ddsPublicationData.topic_name)) {
2327  return;
2328  }
2329 
2330  process_discovered_writer_data(message_id, wrapper.data, guid, wrapper.type_info,
2331  wrapper.have_ice_agent_info, wrapper.ice_agent_info,
2332  &wrapper.security_info);
2333 }
2334 #endif
2335 
2337  const DCPS::DiscoveredReaderData& rdata,
2338  const GUID_t& guid,
2339  const XTypes::TypeInformation& type_info
2340 #ifdef OPENDDS_SECURITY
2341  ,
2342  bool have_ice_agent_info,
2343  const ICE::AgentInfo& ice_agent_info,
2344  const DDS::Security::EndpointSecurityInfo* security_info
2345 #endif
2346  )
2347 {
2348  OPENDDS_STRING topic_name;
2349 
2350  GUID_t participant_id = guid;
2351  participant_id.entityId = ENTITYID_PARTICIPANT;
2352 
2353  // Find the subscripion - iterator valid only as long as we hold the lock
2355 
2356  if (message_id == DCPS::SAMPLE_DATA) {
2357  DCPS::DiscoveredReaderData rdata_copy;
2358 
2359 #ifdef OPENDDS_SECURITY
2360  if (iter != discovered_subscriptions_.end()) {
2361  DiscoveredSubscription& dsub = iter->second;
2362  if (!dsub.have_ice_agent_info_ && have_ice_agent_info) {
2363  dsub.have_ice_agent_info_ = have_ice_agent_info;
2364  dsub.ice_agent_info_ = ice_agent_info;
2365  start_ice(guid, dsub);
2366  } else if (dsub.have_ice_agent_info_ && !have_ice_agent_info) {
2367  dsub.have_ice_agent_info_ = have_ice_agent_info;
2368  dsub.ice_agent_info_ = ice_agent_info;
2369  stop_ice(guid, dsub);
2370  } else if (dsub.ice_agent_info_ != ice_agent_info) {
2371  dsub.ice_agent_info_ = ice_agent_info;
2372  start_ice(guid, dsub);
2373  }
2374  }
2375 #endif
2376 
2377  if (iter == discovered_subscriptions_.end()) { // add new
2378  DiscoveredSubscription presub(rdata);
2380  presub.transport_context_ = spdp_.get_participant_flags(participant_id);
2381  presub.type_info_ = type_info;
2382 #ifdef OPENDDS_SECURITY
2383  presub.have_ice_agent_info_ = have_ice_agent_info;
2384  presub.ice_agent_info_ = ice_agent_info;
2385 #endif
2386 
2387  topic_name = presub.get_topic_name();
2388 
2389 #ifdef OPENDDS_SECURITY
2390  if (is_security_enabled()) {
2391 
2392  DDS::Security::SecurityException ex = {"", 0, 0};
2393 
2395  data.key = rdata.ddsSubscriptionData.key;
2396  data.name = rdata.ddsSubscriptionData.topic_name;
2397  data.type_name = rdata.ddsSubscriptionData.type_name;
2398  data.durability = rdata.ddsSubscriptionData.durability;
2399  data.deadline = rdata.ddsSubscriptionData.deadline;
2400  data.latency_budget = rdata.ddsSubscriptionData.latency_budget;
2401  data.liveliness = rdata.ddsSubscriptionData.liveliness;
2402  data.reliability = rdata.ddsSubscriptionData.reliability;
2403  data.destination_order = rdata.ddsSubscriptionData.destination_order;
2404  data.ownership = rdata.ddsSubscriptionData.ownership;
2405  data.topic_data = rdata.ddsSubscriptionData.topic_data;
2406 
2407  AuthState auth_state = spdp_.lookup_participant_auth_state(participant_id);
2408  if (auth_state == AUTH_STATE_AUTHENTICATED) {
2409 
2410  DDS::Security::PermissionsHandle remote_permissions = spdp_.lookup_participant_permissions(participant_id);
2411 
2413  !get_access_control()->check_remote_topic(remote_permissions, spdp_.get_domain_id(), data, ex))
2414  {
2416  ACE_TEXT("(%P|%t) WARNING: ")
2417  ACE_TEXT("Sedp::process_discovered_reader_data - ")
2418  ACE_TEXT("Unable to check remote topic '%C'. SecurityException[%d.%d]: %C\n"),
2419  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2420  return;
2421  }
2422 
2424  if (!get_access_control()->get_topic_sec_attributes(remote_permissions, topic_name.data(), topic_sec_attr, ex))
2425  {
2427  ACE_TEXT("(%P|%t) WARNING: ")
2428  ACE_TEXT("Sedp::process_discovered_reader_data - ")
2429  ACE_TEXT("Unable to get security attributes for remote topic '%C'. SecurityException[%d.%d]: %C\n"),
2430  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2431  return;
2432  }
2433 
2435  sub_data_sec.base.base = rdata.ddsSubscriptionData;
2436 
2437  if (security_info != NULL) {
2439  security_info->endpoint_security_attributes;
2441  security_info->plugin_endpoint_security_attributes;
2442  }
2443 
2444  bool relay_only = false;
2445  if (topic_sec_attr.is_read_protected &&
2446  !get_access_control()->check_remote_datareader(
2447  remote_permissions, spdp_.get_domain_id(), sub_data_sec, relay_only, ex))
2448  {
2450  ACE_TEXT("(%P|%t) WARNING: ")
2451  ACE_TEXT("Sedp::process_discovered_reader_data - ")
2452  ACE_TEXT("Unable to check remote datareader '%C'. SecurityException[%d.%d]: %C\n"),
2453  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2454  return;
2455  }
2456 
2457  if (relay_only) {
2458  relay_only_readers_.insert(guid);
2459  } else {
2460  relay_only_readers_.erase(guid);
2461  }
2462  } else if (auth_state != AUTH_STATE_UNAUTHENTICATED) {
2464  ACE_TEXT("(%P|%t) WARNING: ")
2465  ACE_TEXT("Sedp::process_discovered_reader_data - ")
2466  ACE_TEXT("Unsupported remote participant authentication state for discovered datareader '%C'. ")
2467  ACE_TEXT("SecurityException[%d.%d]: %C\n"),
2468  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
2469  return;
2470  }
2471  }
2472 #endif
2473 
2474  DiscoveredSubscription& sub = discovered_subscriptions_[guid] = presub;
2475 
2476  // Create a topic if necessary.
2477  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2478  if (top_it == topics_.end()) {
2479  top_it = topics_.insert(std::make_pair(topic_name, TopicDetails())).first;
2480  DCPS::GUID_t topic_id = make_topic_guid();
2481  top_it->second.init(topic_name, topic_id);
2482  topic_names_[topic_id] = topic_name;
2483  }
2484 
2485  TopicDetails& td = top_it->second;
2486 
2487  // Upsert the remote topic.
2488  td.add_discovered_subscription(guid);
2489 
2490  assign_bit_key(sub);
2491  rdata_copy = sub.reader_data_;
2492 
2493  sub.bit_ih_ = spdp_.bit_subscriber_->add_subscription(rdata_copy.ddsSubscriptionData, DDS::NEW_VIEW_STATE);
2494  if (spdp_.shutting_down()) { return; }
2495 
2496  if (DCPS::DCPS_debug_level > 3) {
2497  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_reader_data - ")
2498  ACE_TEXT("calling match_endpoints new\n")));
2499  }
2501  DCPS::log_progress("discovered reader data new", participant_id_, participant_id, spdp_.get_participant_discovered_at(participant_id), guid);
2502  }
2503  match_endpoints(guid, top_it->second);
2504  } else { // update existing
2505  if (checkAndAssignQos(iter->second.reader_data_.ddsSubscriptionData,
2506  rdata.ddsSubscriptionData)) {
2507 
2508  spdp_.bit_subscriber_->add_subscription(iter->second.reader_data_.ddsSubscriptionData, DDS::NOT_NEW_VIEW_STATE);
2509  if (spdp_.shutting_down()) { return; }
2510 
2511  // Match/unmatch local publication(s)
2512  topic_name = iter->second.get_topic_name();
2513  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2514  if (top_it != topics_.end()) {
2515  if (DCPS::DCPS_debug_level > 3) {
2516  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_reader_data - ")
2517  ACE_TEXT("calling match_endpoints update\n")));
2518  }
2520  log_progress("discovered reader data update", participant_id_, participant_id,
2521  spdp_.get_participant_discovered_at(participant_id), guid);
2522  }
2523  match_endpoints(guid, top_it->second);
2524  iter = discovered_subscriptions_.find(guid);
2525  if (iter == discovered_subscriptions_.end()) {
2526  return;
2527  }
2528  }
2529  }
2530 
2531  if (checkAndAssignParams(iter->second.reader_data_.contentFilterProperty,
2532  rdata.contentFilterProperty)) {
2533  // Let any associated local publications know about the change
2534  topic_name = iter->second.get_topic_name();
2535  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2536  using DCPS::RepoIdSet;
2537  const RepoIdSet& assoc =
2538  (top_it == topics_.end()) ? RepoIdSet() : top_it->second.local_publications();
2539  for (RepoIdSet::const_iterator i = assoc.begin(); i != assoc.end(); ++i) {
2540  const LocalPublicationIter lpi = local_publications_.find(*i);
2541  if (lpi != local_publications_.end()) {
2542  DCPS::DataWriterCallbacks_rch pl = lpi->second.publication_.lock();
2543  if (pl) {
2544  pl->update_subscription_params(guid, rdata.contentFilterProperty.expressionParameters);
2545  }
2546  }
2547  }
2548  }
2549 
2550  if (checkAndAssignLocators(iter->second.reader_data_.readerProxy, rdata.readerProxy)) {
2551  topic_name = iter->second.get_topic_name();
2552  TopicDetailsMap::const_iterator top_it = topics_.find(topic_name);
2553  using DCPS::RepoIdSet;
2554  const RepoIdSet& assoc =
2555  (top_it == topics_.end()) ? RepoIdSet() : top_it->second.local_publications();
2556  for (RepoIdSet::const_iterator i = assoc.begin(); i != assoc.end(); ++i) {
2558  OPENDDS_ASSERT(lpi != local_publications_.end());
2559  if (lpi != local_publications_.end()) {
2560  DCPS::DataWriterCallbacks_rch pl = lpi->second.publication_.lock();
2561  if (pl) {
2562  pl->update_locators(guid, rdata.readerProxy.allLocators);
2563  }
2564  }
2565  }
2566  }
2567  }
2568 
2569  if (is_expectant_opendds(guid)) {
2570  // For each associated opendds writer to this reader
2571  CORBA::ULong len = rdata.readerProxy.associatedWriters.length();
2572  for (CORBA::ULong writerIndex = 0; writerIndex < len; ++writerIndex) {
2573  GUID_t writerGuid = rdata.readerProxy.associatedWriters[writerIndex];
2574 
2575  // If the associated writer is in this participant
2576  LocalPublicationIter lp = local_publications_.find(writerGuid);
2577  if (lp != local_publications_.end()) {
2578  // If the local writer is not fully associated with the reader
2579  lp->second.remote_expectant_opendds_associations_.insert(guid);
2580  }
2581  }
2582  }
2583 
2584  } else if (message_id == DCPS::UNREGISTER_INSTANCE ||
2585  message_id == DCPS::DISPOSE_INSTANCE ||
2586  message_id == DCPS::DISPOSE_UNREGISTER_INSTANCE) {
2587  if (iter != discovered_subscriptions_.end()) {
2588  // Unmatch local publication(s)
2589  topic_name = iter->second.get_topic_name();
2590  TopicDetailsMap::iterator top_it = topics_.find(topic_name);
2591  if (top_it != topics_.end()) {
2592  top_it->second.remove_discovered_subscription(guid);
2593  if (DCPS::DCPS_debug_level > 3) {
2594  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::process_discovered_reader_data - ")
2595  ACE_TEXT("calling match_endpoints disp/unreg\n")));
2596  }
2598  log_progress("discovered reader data disposed", participant_id_, participant_id,
2599  spdp_.get_participant_discovered_at(participant_id), guid);
2600  }
2601  match_endpoints(guid, top_it->second, true /*remove*/);
2602  if (top_it->second.is_dead()) {
2603  purge_dead_topic(topic_name);
2604  }
2605  if (spdp_.shutting_down()) { return; }
2606  }
2607  DiscoveredSubscription s = iter->second;
2608  discovered_subscriptions_.erase(iter);
2609  remove_from_bit(s);
2610  }
2611  }
2612 }
2613 
2614 void
2616  const DiscoveredSubscription& dsub)
2617 {
2618  if (!spdp_.initialized() || spdp_.shutting_down()) { return; }
2619 
2620  const DCPS::DiscoveredReaderData& rdata = dsub.reader_data_;
2621  const GUID_t& guid = rdata.readerProxy.remoteReaderGuid;
2622  const GUID_t part_guid = make_part_guid(guid);
2623 
2625 
2626  if (ignoring(guid) || ignoring(part_guid)
2627  || ignoring(rdata.ddsSubscriptionData.topic_name)) {
2628  return;
2629  }
2630 
2631 #ifdef OPENDDS_SECURITY
2632  if (message_id == DCPS::SAMPLE_DATA && should_drop_message(rdata.ddsSubscriptionData.topic_name)) {
2633  return;
2634  }
2635 #endif
2636 
2637  if (!spdp_.has_discovered_participant(part_guid)) {
2638  return;
2639  }
2640 
2641  process_discovered_reader_data(message_id, rdata, guid, dsub.type_info_
2642 #ifdef OPENDDS_SECURITY
2644 #endif
2645  );
2646 }
2647 
2648 #ifdef OPENDDS_SECURITY
2651 {
2652  if (!spdp_.initialized() || spdp_.shutting_down()) { return; }
2653 
2654  const GUID_t& guid = wrapper.data.readerProxy.remoteReaderGuid;
2655  GUID_t guid_participant = guid;
2656  guid_participant.entityId = ENTITYID_PARTICIPANT;
2657 
2659 
2660  if (ignoring(guid)
2661  || ignoring(guid_participant)
2662  || ignoring(wrapper.data.ddsSubscriptionData.topic_name)) {
2663  return;
2664  }
2665 
2666  process_discovered_reader_data(message_id, wrapper.data, guid, wrapper.type_info, wrapper.have_ice_agent_info, wrapper.ice_agent_info, &wrapper.security_info);
2667 }
2668 #endif
2669 
2670 void
2672 {
2673  const GUID_t& guid = pmd.participantGuid;
2674  const GUID_t guid_participant = make_part_guid(guid);
2675  // Clear the entityId so lower bound will work.
2676  const GUID_t prefix = make_unknown_guid(pmd.participantGuid);
2678  if (DCPS::DCPS_debug_level >= 8) {
2680  ACE_TEXT("(%P|%t) Sedp::notify_liveliness: Notifying Liveliness, %C\n"),
2681  DCPS::LogGuid(guid).c_str()));
2682  }
2683 
2684  for (LocalSubscriptionMap::const_iterator sub_pos = local_subscriptions_.begin(),
2685  sub_limit = local_subscriptions_.end();
2686  sub_pos != sub_limit; ++sub_pos) {
2687  const DCPS::RepoIdSet::const_iterator pos =
2688  sub_pos->second.matched_endpoints_.lower_bound(prefix);
2689  if (pos != sub_pos->second.matched_endpoints_.end() &&
2690  DCPS::equal_guid_prefixes(*pos, prefix)) {
2691  DCPS::DataReaderCallbacks_rch sl = sub_pos->second.subscription_.lock();
2692  if (sl) {
2693  if (sub_pos->second.qos_.liveliness.kind == ::DDS::AUTOMATIC_LIVELINESS_QOS && is_automatic) {
2694  sl->signal_liveliness(guid_participant);
2695  } else if ((sub_pos->second.qos_.liveliness.kind == ::DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS
2696  || sub_pos->second.qos_.liveliness.kind == ::DDS::AUTOMATIC_LIVELINESS_QOS) && !is_automatic) {
2697  sl->signal_liveliness(guid_participant);
2698  }
2699  }
2700  }
2701  }
2702 }
2703 
2704 void
2706  const ParticipantMessageData& data)
2707 {
2708  if (!spdp_.initialized() || spdp_.shutting_down()) {
2709  return;
2710  }
2711 
2712  const GUID_t& guid = data.participantGuid;
2713  const GUID_t guid_participant = make_part_guid(guid);
2714 
2716 
2717  if (ignoring(guid) || ignoring(guid_participant)) {
2718  return;
2719  }
2720 
2721  if (!spdp_.has_discovered_participant(guid_participant)) {
2722  return;
2723  }
2724  notify_liveliness(data);
2725 }
2726 
2727 #ifdef OPENDDS_SECURITY
2728 void
2730  const ParticipantMessageData& data)
2731 {
2732  if (spdp_.shutting_down()) {
2733  return;
2734  }
2735 
2736  const GUID_t& guid = data.participantGuid;
2737  const GUID_t guid_participant = make_part_guid(guid);
2738 
2740 
2741  if (ignoring(guid) || ignoring(guid_participant)) {
2742  return;
2743  }
2744 
2745  if (!spdp_.has_discovered_participant(guid_participant)) {
2746  return;
2747  }
2748 
2749  notify_liveliness(data);
2750 }
2751 
2753 {
2754  using DCPS::GUID_UNKNOWN;
2755 
2757 
2758  const GUID_t& src_endpoint = msg.source_endpoint_guid;
2759  const GUID_t& dst_endpoint = msg.destination_endpoint_guid;
2760  const GUID_t& this_endpoint = participant_stateless_message_reader_->get_guid();
2761  const GUID_t& dst_participant = msg.destination_participant_guid;
2762  const GUID_t& this_participant = participant_id_;
2763 
2764  if (ignoring(src_endpoint)) {
2765  return true;
2766  }
2767 
2768  if (dst_participant != GUID_UNKNOWN && dst_participant != this_participant) {
2769  return true;
2770  }
2771 
2772  if (dst_endpoint != GUID_UNKNOWN && dst_endpoint != this_endpoint) {
2773  return true;
2774  }
2775 
2776  return false;
2777 }
2778 
2780 {
2781  using DCPS::GUID_UNKNOWN;
2782 
2784 
2785  const GUID_t src_endpoint = msg.source_endpoint_guid;
2786  const GUID_t dst_participant = msg.destination_participant_guid;
2787  const GUID_t this_participant = participant_id_;
2788 
2789  if (ignoring(src_endpoint)) {
2790  if (DCPS::security_debug.auth_debug) {
2791  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {auth_debug} DEBUG: Sedp::should_drop_volatile_message() - ")
2792  ACE_TEXT("ignoring %C -> %C local %C\n"),
2793  DCPS::LogGuid(src_endpoint).c_str(),
2794  DCPS::LogGuid(dst_participant).c_str(),
2795  DCPS::LogGuid(this_participant).c_str()));
2796  }
2797  return true;
2798  }
2799 
2800  if (!msg.message_data.length()) {
2801  if (DCPS::security_debug.auth_debug) {
2802  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {auth_debug} DEBUG: Sedp::should_drop_volatile_message() - ")
2803  ACE_TEXT("no data %C -> %C local %C\n"),
2804  DCPS::LogGuid(src_endpoint).c_str(),
2805  DCPS::LogGuid(dst_participant).c_str(),
2806  DCPS::LogGuid(this_participant).c_str()));
2807  }
2808  return true;
2809  }
2810 
2811  if (dst_participant != GUID_UNKNOWN && dst_participant != this_participant) {
2812  if (DCPS::security_debug.auth_debug) {
2813  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {auth_debug} DEBUG: Sedp::should_drop_volatile_message() - ")
2814  ACE_TEXT("not for us %C -> %C local %C\n"),
2815  DCPS::LogGuid(src_endpoint).c_str(),
2816  DCPS::LogGuid(dst_participant).c_str(),
2817  DCPS::LogGuid(this_participant).c_str()));
2818  }
2819  return true;
2820  }
2821 
2822  return false;
2823 }
2824 
2825 bool Sedp::should_drop_message(const char* unsecure_topic_name)
2826 {
2827  if (is_security_enabled()) {
2829  DDS::Security::SecurityException ex = {"", 0, 0};
2830 
2831  bool ok = get_access_control()->get_topic_sec_attributes(
2833  unsecure_topic_name,
2834  attribs,
2835  ex);
2836 
2837  if (!ok || attribs.is_discovery_protected) {
2838  return true;
2839  }
2840  }
2841 
2842  return false;
2843 }
2844 
2845 void
2848 {
2849  if (spdp_.shutting_down()) {
2850  return;
2851  }
2852 
2853  if (should_drop_stateless_message(msg)) {
2854  if (DCPS::security_debug.auth_debug) {
2855  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {auth_debug} DEBUG: Sedp::received_stateless_message() - ")
2856  ACE_TEXT("dropping\n")));
2857  }
2858  return;
2859  }
2860 
2861  if (0 == std::strcmp(msg.message_class_id,
2864  } else if (0 == std::strcmp(msg.message_class_id,
2867  } else {
2868  if (DCPS::security_debug.auth_debug) {
2869  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {auth_debug} DEBUG: Sedp::received_stateless_message() - ")
2870  ACE_TEXT("Unknown message class id\n")));
2871  }
2872  }
2873 }
2874 
2875 void
2878 {
2879  if (spdp_.shutting_down()) {
2880  return;
2881  }
2882 
2883  if (should_drop_volatile_message(msg)) {
2884  return;
2885  }
2886 
2887  if (0 == std::strcmp(msg.message_class_id,
2890  ACE_DEBUG((LM_DEBUG, "Sedp::received_volatile_message_secure handle_participant_crypto_tokens failed\n"));
2891  return;
2892  }
2893  } else if (0 == std::strcmp(msg.message_class_id,
2895  if (!handle_datawriter_crypto_tokens(msg)) {
2896  ACE_DEBUG((LM_DEBUG, "Sedp::received_volatile_message_secure handle_datawriter_crypto_tokens failed\n"));
2897  return;
2898  }
2899  } else if (0 == std::strcmp(msg.message_class_id,
2901  if (!handle_datareader_crypto_tokens(msg)) {
2902  ACE_DEBUG((LM_DEBUG, "Sedp::received_volatile_message_secure handle_datareader_crypto_tokens failed\n"));
2903  return;
2904  }
2905  } else {
2906  return;
2907  }
2908 }
2909 #endif
2910 
2911 bool
2912 Sedp::is_expectant_opendds(const GUID_t& endpoint) const
2913 {
2914  GUID_t participant = endpoint;
2915  participant.entityId = DCPS::ENTITYID_PARTICIPANT;
2916  return spdp_.is_expectant_opendds(participant);
2917 }
2918 
2919 void
2921  const GUID_t& remoteId)
2922 {
2923  if (DCPS::DCPS_debug_level) {
2925  ACE_TEXT("(%P|%t) DEBUG: Sedp::association_complete_i local %C remote %C\n"),
2926  DCPS::LogGuid(localId).c_str(),
2927  DCPS::LogGuid(remoteId).c_str()));
2928  }
2929 
2930  // If the remote endpoint is an opendds endpoint that expects associated datawriter announcements
2931  if (is_expectant_opendds(remoteId)) {
2932  LocalSubscriptionIter sub = local_subscriptions_.find(localId);
2933  // If the local endpoint is a reader
2934  if (sub != local_subscriptions_.end()) {
2935  std::pair<DCPS::RepoIdSet::iterator, bool> result =
2936  sub->second.remote_expectant_opendds_associations_.insert(remoteId);
2937  // If this is a new association for the local reader
2938  if (result.second) {
2939  // Tell other participants
2940  write_subscription_data(localId, sub->second);
2941  }
2942  }
2943  }
2944 
2945 #ifdef OPENDDS_SECURITY
2947  write_durable_publication_data(remoteId, true);
2949  write_durable_subscription_data(remoteId, true);
2956  send_builtin_crypto_tokens(remoteId);
2957  resend_user_crypto_tokens(remoteId);
2958  } else if (remoteId.entityId == ENTITYID_TL_SVC_REQ_READER_SECURE) {
2959  type_lookup_request_secure_writer_->send_deferred_samples(remoteId);
2960  } else if (remoteId.entityId == ENTITYID_TL_SVC_REPLY_READER_SECURE) {
2961  type_lookup_reply_secure_writer_->send_deferred_samples(remoteId);
2962  } else
2963 #endif
2965  write_durable_publication_data(remoteId, false);
2966  } else if (remoteId.entityId == ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER) {
2967  write_durable_subscription_data(remoteId, false);
2970  } else if (remoteId.entityId == ENTITYID_TL_SVC_REQ_READER) {
2971  type_lookup_request_writer_->send_deferred_samples(remoteId);
2972  } else if (remoteId.entityId == ENTITYID_TL_SVC_REPLY_READER) {
2973  type_lookup_reply_writer_->send_deferred_samples(remoteId);
2974  }
2975 }
2976 
2977 void Sedp::data_acked_i(const DCPS::GUID_t& local_id,
2978  const DCPS::GUID_t& remote_id)
2979 {
2982 #ifdef OPENDDS_SECURITY
2986 #endif
2987  ) {
2988  const GUID_t remote_part = make_id(remote_id, ENTITYID_PARTICIPANT);
2990  Spdp::DiscoveredParticipantIter iter = spdp_.participants_.find(remote_part);
2991  if (iter != spdp_.participants_.end()) {
2992  process_association_records_i(iter->second);
2993  }
2994  }
2995 }
2996 
2998 {
2999 
3000 #ifdef OPENDDS_SECURITY
3001  DDS::Security::SecurityException se = {"", 0, 0};
3003 
3004  if (is_security_enabled()) {
3005  // TODO: Pending issue DDSSEC12-28 Topic security attributes
3006  // may get changed to a different set of security attributes.
3007  bool ok = get_access_control()->get_topic_sec_attributes(
3008  get_permissions_handle(), "DCPSParticipantMessageSecure", attribs, se);
3009 
3010  if (ok) {
3011 
3012  if (attribs.is_liveliness_protected) {
3014 
3015  } else {
3017  }
3018 
3019  } else {
3020  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::signal_liveliness() - ")
3021  ACE_TEXT("Failure calling get_topic_sec_attributes(). Security Exception[%d.%d]: %C\n"),
3022  se.code, se.minor_code, se.message.in()));
3023  }
3024 
3025  } else {
3026 #endif
3027 
3029 
3030 #ifdef OPENDDS_SECURITY
3031  }
3032 #endif
3033 }
3034 
3035 void
3037 {
3039  return;
3040  }
3041 
3042  switch (kind) {
3044  const GUID_t guid = make_id(participant_id_,
3047  break;
3048  }
3049 
3051  const GUID_t guid = make_id(participant_id_,
3054  break;
3055  }
3056 
3058  // Do nothing.
3059  break;
3060  }
3061 }
3062 
3063 
3065  const DCPS::GUID_t& reader,
3066  bool is_discovery_protected,
3067  bool send_get_types,
3068  const SequenceNumber& seq_num)
3069 {
3071  DCPS::GUID_t remote_reader = make_id(reader, ENTITYID_TL_SVC_REQ_READER);
3072 #ifdef OPENDDS_SECURITY
3073  if (is_security_enabled() && is_discovery_protected) {
3075  remote_reader = make_id(reader, ENTITYID_TL_SVC_REQ_READER_SECURE);
3076  }
3077 #else
3078  ACE_UNUSED_ARG(is_discovery_protected);
3079 #endif
3080 
3081  return writer->send_type_lookup_request(
3082  type_ids, remote_reader, seq_num,
3083  send_get_types ?
3085 }
3086 
3087 #ifdef OPENDDS_SECURITY
3088 void
3090 {
3092  return;
3093  }
3094 
3095  switch (kind) {
3097  const GUID_t guid = make_id(participant_id_,
3100  break;
3101  }
3102 
3104  const GUID_t guid = make_id(participant_id_,
3107  break;
3108  }
3109 
3111  // Do nothing.
3112  break;
3113  }
3114 }
3115 #endif
3116 
3119 }
3120 
3122 {
3123  remove_all_msgs();
3124  transport_stop();
3125 }
3126 
3128 {
3129  EntityId_t rv = repo_id_.entityId;
3130  switch (rv.entityKind) {
3133  break;
3134 
3137  break;
3138 
3141  break;
3142 
3145  break;
3146 
3147  default:
3148  if (DCPS::DCPS_debug_level) {
3149  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: Sedp::Endpoint::counterpart_entity_id: "
3150  "Unexpected entityKind: %u\n", rv.entityKind));
3151  }
3153  }
3154  return rv;
3155 }
3156 
3158 {
3159  return make_id(remote_part, counterpart_entity_id());
3160 }
3161 
3163 {
3164  return associated_with(make_counterpart_guid(remote_part));
3165 }
3166 
3168  const DCPS::GUID_t& remote_part) const
3169 {
3170  const GUID_t counterpart = make_counterpart_guid(remote_part);
3171  return associated_with(counterpart) || !pending_association_with(counterpart);
3172 }
3173 
3175 {
3176  return sedp_.spdp_.bit_subscriber_;
3177 }
3178 
3179 //---------------------------------------------------------------
3180 Sedp::Writer::Writer(const GUID_t& pub_id, Sedp& sedp, ACE_INT64 seq_init)
3181  : Endpoint(pub_id, sedp), seq_(seq_init)
3182 {
3183 }
3184 
3186 {
3187 }
3188 
3189 bool
3191 {
3192  return associate(subscription, true);
3193 }
3194 
3195 void Sedp::Writer::transport_assoc_done(int flags, const GUID_t& remote)
3196 {
3197  if (!(flags & ASSOC_OK)) {
3199  ACE_TEXT("(%P|%t) Sedp::Writer::transport_assoc_done: ")
3200  ACE_TEXT("ERROR: transport layer failed to associate %C\n"),
3201  DCPS::LogGuid(remote).c_str()));
3202  return;
3203  }
3204 
3205  if (shutting_down_) {
3206  return;
3207  }
3208 
3210 }
3211 
3212 void
3214 {
3215  delete dsle;
3216 }
3217 
3218 void
3220 {
3221  delete dsle;
3222 }
3223 
3224 void
3226 {
3227  sedp_.data_acked_i(get_guid(), remote);
3228 }
3229 
3230 void
3232 {
3233 }
3234 
3235 void
3237 {
3238 }
3239 
3240 void
3241 Sedp::Writer::replay_durable_data_for(const DCPS::GUID_t& remote_sub_id)
3242 {
3243  // Ideally, we would have the data cached and ready for replay but we do not.
3244  sedp_.replay_durable_data_for(remote_sub_id);
3245 }
3246 
3248  size_t size,
3249  const GUID_t& reader,
3250  DCPS::SequenceNumber& sequence,
3251  bool historic)
3252 {
3253  if (DCPS::DCPS_debug_level >= 8) {
3254  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::Writer::send_sample from %C to %C\n",
3255  DCPS::LogGuid(repo_id_).c_str(),
3256  DCPS::LogGuid(reader).c_str()));
3257  }
3259  set_header_fields(el->get_header(), size, reader, sequence, historic);
3260 
3261  el->set_sample(DCPS::move(payload));
3262  *el->get_sample() << el->get_header();
3263 
3264  if (reader != GUID_UNKNOWN) {
3265  el->set_sub_id(0, reader);
3266  el->set_num_subs(1);
3267 
3268  if (deferrable() && !associated_with_counterpart(reader)) {
3269  if (DCPS::DCPS_debug_level >= 8) {
3270  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::Writer::send_sample: "
3271  "counterpart isn't associated, deferring\n"));
3272  }
3273  DeferredSamples::iterator samples_for_reader = deferred_samples_.insert(
3274  std::make_pair(reader, PerReaderDeferredSamples())).first;
3275  samples_for_reader->second.insert(std::make_pair(sequence, el));
3276  return;
3277  }
3278  }
3279 
3280  send_sample_i(el);
3281 }
3282 
3284 {
3285  DeferredSamples::iterator samples_for_reader = deferred_samples_.find(reader);
3286  if (samples_for_reader != deferred_samples_.end()) {
3287  if (DCPS::DCPS_debug_level >= 8) {
3288  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::Writer::send_deferred_samples to %C\n",
3289  DCPS::LogGuid(reader).c_str()));
3290  }
3291  for (PerReaderDeferredSamples::iterator i = samples_for_reader->second.begin();
3292  i != samples_for_reader->second.end(); ++i) {
3293  send_sample_i(i->second);
3294  }
3295  deferred_samples_.erase(samples_for_reader);
3296  }
3297 }
3298 
3300 {
3302  list.enqueue_tail(el);
3303 
3304  send(list);
3305 }
3306 
3309  const GUID_t& reader,
3310  DCPS::SequenceNumber& sequence)
3311 {
3313 
3314  // Determine message length
3315  size_t size = 0;
3316  DCPS::primitive_serialized_size_ulong(sedp_encoding, size);
3317  DCPS::serialized_size(sedp_encoding, size, plist);
3318 
3319  // Build and send RTPS message
3320  DCPS::Message_Block_Ptr payload(
3321  new ACE_Message_Block(
3324  new ACE_Message_Block(size)));
3325 
3326  if (!payload) {
3328  ACE_TEXT("(%P|%t) ERROR: Sedp::Writer::write_parameter_list")
3329  ACE_TEXT(" - Failed to allocate message block message\n")));
3330  return DDS::RETCODE_ERROR;
3331  }
3332 
3333  Serializer serializer(payload->cont(), sedp_encoding);
3335  if (encap.from_encoding(sedp_encoding, DCPS::MUTABLE) &&
3336  serializer << encap && serializer << plist) {
3337  send_sample(move(payload), size, reader, sequence, reader != GUID_UNKNOWN);
3338  } else {
3339  result = DDS::RETCODE_ERROR;
3340  }
3341 
3342  return result;
3343 }
3344 
3347  const GUID_t& reader,
3348  DCPS::SequenceNumber& sequence)
3349 {
3351 
3352  // Determine message length
3353  size_t size = 0;
3354  DCPS::primitive_serialized_size_ulong(sedp_encoding, size);
3355  DCPS::serialized_size(sedp_encoding, size, pmd);
3356 
3357  // Build and send RTPS message
3358  DCPS::Message_Block_Ptr payload(
3359  new ACE_Message_Block(
3362  new ACE_Message_Block(size)));
3363  Serializer serializer(payload->cont(), sedp_encoding);
3365  if (encap.from_encoding(sedp_encoding, DCPS::FINAL) &&
3366  serializer << encap && serializer << pmd) {
3367  send_sample(move(payload), size, reader, sequence, reader != GUID_UNKNOWN);
3368  } else {
3369  result = DDS::RETCODE_ERROR;
3370  }
3371 
3372  return result;
3373 }
3374 
3375 #ifdef OPENDDS_SECURITY
3378  const GUID_t& reader,
3379  DCPS::SequenceNumber& sequence)
3380 {
3382 
3383  size_t size = 0;
3384  DCPS::primitive_serialized_size_ulong(sedp_encoding, size);
3385  DCPS::serialized_size(sedp_encoding, size, msg);
3386 
3387  DCPS::Message_Block_Ptr payload(
3388  new ACE_Message_Block(
3391  new ACE_Message_Block(size)));
3392  Serializer serializer(payload->cont(), sedp_encoding);
3394  if (encap.from_encoding(sedp_encoding, DCPS::FINAL) &&
3395  serializer << encap && serializer << msg) {
3396  send_sample(move(payload), size, reader, sequence);
3397  } else {
3398  result = DDS::RETCODE_ERROR;
3399  }
3400 
3401  return result;
3402 }
3403 
3406  const GUID_t& reader,
3407  DCPS::SequenceNumber& sequence)
3408 {
3410 
3411  size_t size = 0;
3412  DCPS::primitive_serialized_size_ulong(sedp_encoding, size);
3413  DCPS::serialized_size(sedp_encoding, size, msg);
3414 
3415  DCPS::Message_Block_Ptr payload(
3416  new ACE_Message_Block(
3419  new ACE_Message_Block(size)));
3420  Serializer serializer(payload->cont(), sedp_encoding);
3422  if (encap.from_encoding(sedp_encoding, DCPS::FINAL) &&
3423  serializer << encap && serializer << msg) {
3424  send_sample(move(payload), size, reader, sequence);
3425  } else {
3426  result = DDS::RETCODE_ERROR;
3427  }
3428 
3429  return result;
3430 }
3431 
3434  const GUID_t& reader, DCPS::SequenceNumber& sequence)
3435 {
3436  ParameterList plist;
3437 
3438  if (!ParameterListConverter::to_param_list(msg, plist)) {
3440  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryWriter::write_dcps_participant_secure - ")
3441  ACE_TEXT("Failed to convert SPDPdiscoveredParticipantData ")
3442  ACE_TEXT("to ParameterList\n")));
3443 
3444  return DDS::RETCODE_ERROR;
3445  }
3446 
3447  ICE::AgentInfoMap ai_map;
3449  if (sedp_endpoint) {
3450  ai_map[SEDP_AGENT_INFO_KEY] = sedp_.ice_agent_->get_local_agent_info(sedp_endpoint);
3451  }
3453  if (spdp_endpoint) {
3454  ai_map[SPDP_AGENT_INFO_KEY] = sedp_.ice_agent_->get_local_agent_info(spdp_endpoint);
3455  }
3456  if (!ParameterListConverter::to_param_list(ai_map, plist)) {
3457  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
3458  ACE_TEXT("Sedp::DiscoveryWriter::write_dcps_participant_secure - ")
3459  ACE_TEXT("failed to convert from ICE::AgentInfo ")
3460  ACE_TEXT("to ParameterList\n")));
3461  return DDS::RETCODE_ERROR;
3462  }
3463 
3464  return write_parameter_list(plist, reader, sequence);
3465 }
3466 #endif
3467 
3470 {
3471  // Build param list for message
3472  Parameter param;
3473  param.guid(rid);
3474  param._d(pid);
3475  ParameterList plist;
3476  plist.length(1);
3477  plist[0] = param;
3478 
3479  // Determine message length
3480  size_t size = 0;
3481  DCPS::primitive_serialized_size_ulong(sedp_encoding, size);
3482  DCPS::serialized_size(sedp_encoding, size, plist);
3483 
3484  DCPS::Message_Block_Ptr payload(
3485  new ACE_Message_Block(
3488  new ACE_Message_Block(size)));
3489  if (!payload) {
3491  ACE_TEXT("(%P|%t) ERROR: Sedp::Writer::write_unregister_dispose")
3492  ACE_TEXT(" - Failed to allocate message block message\n")));
3493  return DDS::RETCODE_ERROR;
3494  }
3495 
3496  Serializer serializer(payload->cont(), sedp_encoding);
3498  if (encap.from_encoding(sedp_encoding, DCPS::MUTABLE) &&
3499  serializer << encap && serializer << plist) {
3500  // Send
3502  return DDS::RETCODE_OK;
3503  } else {
3504  // Error
3506  ACE_TEXT("(%P|%t) ERROR: Sedp::Writer::write_unregister_dispose")
3507  ACE_TEXT(" - Failed to serialize RTPS control message\n")));
3508  return DDS::RETCODE_ERROR;
3509  }
3510 }
3511 
3512 void
3514 {
3516  new ACE_Message_Block(
3519  new ACE_Message_Block(
3520  reinterpret_cast<const char*>(&reader),
3521  sizeof(reader))));
3522  if (mb.get()) {
3523  mb->cont()->wr_ptr(sizeof(reader));
3524  // 'mb' would contain the DSHeader, but we skip it. mb.cont() has the data
3525  write_control_msg(move(mb), sizeof(reader), DCPS::END_HISTORIC_SAMPLES,
3527  } else {
3529  ACE_TEXT("(%P|%t) ERROR: Sedp::Writer::end_historic_samples")
3530  ACE_TEXT(" - Failed to allocate message block message\n")));
3531  }
3532 }
3533 
3534 void
3536 {
3538  new ACE_Message_Block(
3541  new ACE_Message_Block(
3542  reinterpret_cast<const char*>(&reader),
3543  sizeof(reader))));
3544  if (mb.get()) {
3545  mb->cont()->wr_ptr(sizeof(reader));
3546  // 'mb' would contain the DSHeader, but we skip it. mb.cont() has the data
3547  write_control_msg(move(mb), sizeof(reader), DCPS::REQUEST_ACK,
3549  } else {
3551  ACE_TEXT("(%P|%t) ERROR: Sedp::Writer::request_ack")
3552  ACE_TEXT(" - Failed to allocate message block message\n")));
3553  }
3554 }
3555 
3556 void
3558  size_t size,
3559  DCPS::MessageId id,
3561 {
3563  Writer::set_header_fields(header, size, GUID_UNKNOWN, seq, false, id);
3564  // no need to serialize header since rtps_udp transport ignores it
3565  send_control(header, DCPS::move(payload));
3566 }
3567 
3568 void
3570  size_t size,
3571  const GUID_t& reader,
3572  DCPS::SequenceNumber& sequence,
3573  bool historic_sample,
3574  DCPS::MessageId id)
3575 {
3576  dsh.message_id_ = id;
3578  dsh.message_length_ = static_cast<ACE_UINT32>(size);
3579  dsh.publication_id_ = repo_id_;
3580 
3581  if (id != DCPS::END_HISTORIC_SAMPLES && id != DCPS::REQUEST_ACK &&
3582  (reader == GUID_UNKNOWN ||
3584  sequence = seq_++;
3585  }
3586 
3587  if (historic_sample && reader != GUID_UNKNOWN) {
3588  // retransmit with same seq# for durability
3589  dsh.historic_sample_ = true;
3590  }
3591 
3592  dsh.sequence_ = sequence;
3593 
3594  const SystemTimePoint now = SystemTimePoint::now();
3595  dsh.source_timestamp_sec_ = static_cast<ACE_INT32>(now.value().sec());
3596  dsh.source_timestamp_nanosec_ = static_cast<ACE_UINT32>(now.value().usec() * 1000);
3597 }
3598 
3600 {
3601 }
3602 
3604 {
3605 }
3606 
3608 {
3609 }
3610 
3612 {
3613 }
3614 
3616 {
3617 }
3618 
3620 {
3621 }
3622 
3624 {
3625 }
3626 
3628  const XTypes::TypeIdentifierSeq& type_ids,
3629  const DCPS::GUID_t& reader,
3630  const DCPS::SequenceNumber& rpc_sequence,
3631  CORBA::Long tl_kind)
3632 {
3633  if (DCPS::DCPS_debug_level >= 8) {
3634  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupRequestWriter::send_type_lookup_request: "
3635  "to %C seq: %q\n", DCPS::LogGuid(reader).c_str(), rpc_sequence.getValue()));
3636  }
3638  log_progress("send type lookup request", get_guid(), reader, sedp_.spdp_.get_participant_discovered_at(reader));
3639  }
3640 
3641  if (tl_kind != XTypes::TypeLookup_getTypes_HashId &&
3643  if (DCPS::DCPS_debug_level) {
3644  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: "
3645  "Sedp::TypeLookupRequestWriter::send_type_lookup_request: tl_kind is %u\n",
3646  tl_kind));
3647  }
3648  return false;
3649  }
3650 
3651  XTypes::TypeLookup_Request type_lookup_request;
3652  type_lookup_request.header.requestId.writer_guid = get_guid();
3653  type_lookup_request.header.requestId.sequence_number = to_rtps_seqnum(rpc_sequence);
3654  type_lookup_request.header.instanceName = get_instance_name(reader).c_str();
3655 
3656  if (tl_kind == XTypes::TypeLookup_getTypes_HashId) {
3657  XTypes::TypeLookup_getTypes_In types;
3658  types.type_ids = type_ids;
3659  type_lookup_request.data.getTypes(types);
3660  } else {
3661  XTypes::TypeLookup_getTypeDependencies_In typeDependencies;
3662  typeDependencies.type_ids = type_ids;
3663  sedp_.type_lookup_reply_reader_->get_continuation_point(reader, type_ids[0],
3664  typeDependencies.continuation_point);
3665  type_lookup_request.data.getTypeDependencies(typeDependencies);
3666  }
3667 
3668  // Determine message length
3669  const size_t size = DCPS::EncapsulationHeader::serialized_size +
3670  DCPS::serialized_size(type_lookup_encoding, type_lookup_request);
3671 
3672  // Build and send type lookup message
3673  DCPS::Message_Block_Ptr payload(
3674  new ACE_Message_Block(
3677  new ACE_Message_Block(size)));
3678  Serializer serializer(payload->cont(), type_lookup_encoding);
3680  bool success = true;
3681  if (encap.from_encoding(serializer.encoding(), DCPS::FINAL) &&
3682  serializer << encap && serializer << type_lookup_request) {
3683  DCPS::SequenceNumber sn(seq_++);
3684  send_sample(move(payload), size, reader, sn);
3685  } else {
3686  if (DCPS::DCPS_debug_level) {
3687  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: "
3688  "Sedp::TypeLookupRequestWriter::send_type_lookup_request: serialization failed\n"));
3689  }
3690  success = false;
3691  }
3692 
3693  return success;
3694 }
3695 
3697  XTypes::TypeLookup_Reply& type_lookup_reply,
3698  const DCPS::GUID_t& reader)
3699 {
3700  if (DCPS::DCPS_debug_level >= 8) {
3701  const DDS::SampleIdentity id = type_lookup_reply.header.relatedRequestId;
3702  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyWriter::send_type_lookup_reply: "
3703  "to %C seq: %q\n", DCPS::LogGuid(reader).c_str(),
3704  to_opendds_seqnum(id.sequence_number).getValue()));
3705  }
3706 
3707  type_lookup_reply.header.remoteEx = DDS::RPC::REMOTE_EX_OK;
3708 
3709  // Determine message length
3710  const size_t size = DCPS::EncapsulationHeader::serialized_size +
3711  DCPS::serialized_size(type_lookup_encoding, type_lookup_reply);
3712 
3713  // Build and send type lookup message
3714  DCPS::Message_Block_Ptr payload(
3715  new ACE_Message_Block(
3718  new ACE_Message_Block(size)));
3719  Serializer serializer(payload->cont(), type_lookup_encoding);
3721  bool success = true;
3722  if (encap.from_encoding(serializer.encoding(), DCPS::FINAL) &&
3723  serializer << encap && serializer << type_lookup_reply) {
3724  DCPS::SequenceNumber sn(seq_++);
3725  send_sample(move(payload), size, reader, sn);
3726  } else {
3727  if (DCPS::DCPS_debug_level) {
3728  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: "
3729  "Sedp::TypeLookupReplyWriter::send_type_lookup_reply: serialization failed\n"));
3730  }
3731  success = false;
3732  }
3733 
3734  return success;
3735 }
3736 
3738  Serializer& ser, XTypes::TypeLookup_Reply& type_lookup_reply)
3739 {
3740  XTypes::TypeLookup_Request type_lookup_request;
3741  if (!(ser >> type_lookup_request)) {
3742  if (DCPS::DCPS_debug_level) {
3743  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupRequestReader::process_type_lookup_request - ")
3744  ACE_TEXT("failed to deserialize type lookup request\n")));
3745  }
3746  return false;
3747  }
3748 
3749  if (DCPS::DCPS_debug_level >= 8) {
3750  const DDS::SampleIdentity& request_id = type_lookup_request.header.requestId;
3751  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyWriter::process_type_lookup_request: "
3752  "from %C seq: %q\n",
3753  DCPS::LogGuid(request_id.writer_guid).c_str(),
3754  to_opendds_seqnum(request_id.sequence_number).getValue()));
3755  }
3756 
3757  if (OPENDDS_STRING(type_lookup_request.header.instanceName) != instance_name_) {
3758  return true;
3759  }
3760 
3761  switch (type_lookup_request.data._d()) {
3763  return process_get_types_request(type_lookup_request, type_lookup_reply);
3765  return process_get_dependencies_request(type_lookup_request, type_lookup_reply);
3766  default:
3767  return false;
3768  }
3769 }
3770 
3772  const XTypes::TypeLookup_Request& type_lookup_request,
3773  XTypes::TypeLookup_Reply& type_lookup_reply)
3774 {
3775  XTypes::TypeLookup_getTypes_Out result;
3776  sedp_.type_lookup_service_->get_type_objects(type_lookup_request.data.getTypes().type_ids,
3777  result.types);
3778  if (result.types.length() > 0) {
3779  result.complete_to_minimal.length(0);
3780 
3782  typeResult.result(result);
3783 
3784  type_lookup_reply._cxx_return.getType(typeResult);
3785 
3786  type_lookup_reply.header.relatedRequestId = type_lookup_request.header.requestId;
3787  return true;
3788  }
3789  if (DCPS::DCPS_debug_level) {
3790  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: Sedp::TypeLookupRequestReader::process_get_types_request: "
3791  "No types received\n"));
3792  }
3793  return false;
3794 }
3795 
3797 {
3798  // We are sending all dependencies of requested types in 1 reply, and thus
3799  // the continuation_point will be "absent" by setting its length to zero.
3800  cont_point.length(0);
3801 }
3802 
3804  const XTypes::TypeLookup_Request& request,
3805  XTypes::TypeLookup_Reply& reply)
3806 {
3807  // Send all dependencies (may be empty) of the requested types
3808  XTypes::TypeLookup_getTypeDependencies_Out result;
3809  sedp_.type_lookup_service_->get_type_dependencies(request.data.getTypeDependencies().type_ids,
3810  result.dependent_typeids);
3811  gen_continuation_point(result.continuation_point);
3812 
3814  typeDependencies.result(result);
3815  reply._cxx_return.getTypeDependencies(typeDependencies);
3816 
3817  reply.header.relatedRequestId = request.header.requestId;
3818  return true;
3819 }
3820 
3822  const XTypes::TypeIdentifier& remote_ti,
3823  XTypes::OctetSeq32& cont_point) const
3824 {
3825  const GUID_t part_guid = DCPS::make_part_guid(guid);
3826  const DependenciesMap::const_iterator it = dependencies_.find(part_guid);
3827  if (it == dependencies_.end() || it->second.find(remote_ti) == it->second.end()) {
3828  cont_point.length(0);
3829  } else {
3830  cont_point = it->second.find(remote_ti)->second.first;
3831  }
3832 }
3833 
3834 void Sedp::TypeLookupReplyReader::cleanup(const DCPS::GUID_t& guid,
3835  const XTypes::TypeIdentifier& type_id)
3836 {
3837  const GUID_t part_guid = DCPS::make_part_guid(guid);
3838  const DependenciesMap::iterator it = dependencies_.find(part_guid);
3839  if (it != dependencies_.end() && it->second.find(type_id) != it->second.end()) {
3840  it->second.erase(type_id);
3841  }
3842 
3843  if (it != dependencies_.end() && it->second.empty()) {
3844  dependencies_.erase(it);
3845  }
3846 }
3847 
3849  const DCPS::ReceivedDataSample& sample, Serializer& ser, bool is_discovery_protected)
3850 {
3851  XTypes::TypeLookup_Reply type_lookup_reply;
3852  if (!(ser >> type_lookup_reply)) {
3853  if (DCPS::DCPS_debug_level) {
3855  ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupReplyReader::process_type_lookup_reply - ")
3856  ACE_TEXT("failed to deserialize type lookup reply\n")));
3857  }
3858  return false;
3859  }
3860 
3861  const DDS::SampleIdentity& request_id = type_lookup_reply.header.relatedRequestId;
3862  const DCPS::SequenceNumber seq_num = to_opendds_seqnum(request_id.sequence_number);
3863  if (DCPS::DCPS_debug_level >= 8) {
3864  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::process_type_lookup_reply - "
3865  "from %C seq %q\n",
3866  DCPS::LogGuid(request_id.writer_guid).c_str(),
3867  seq_num.getValue()));
3868  }
3869 
3873  }
3874  const OrigSeqNumberMap::const_iterator seq_num_it = sedp_.orig_seq_numbers_.find(seq_num);
3875  if (seq_num_it == sedp_.orig_seq_numbers_.end()) {
3877  ACE_TEXT("(%P|%t) WARNING: Sedp::TypeLookupReplyReader::process_type_lookup_reply - ")
3878  ACE_TEXT("could not find request corresponding to the reply from %C seq %q\n"),
3879  DCPS::LogGuid(request_id.writer_guid).c_str(), seq_num.getValue()));
3880  return false;
3881  }
3882 
3883  bool success;
3884  const ACE_CDR::Long kind = type_lookup_reply._cxx_return._d();
3885  switch (kind) {
3887  success = process_get_types_reply(type_lookup_reply);
3888  break;
3890  success = process_get_dependencies_reply(sample, type_lookup_reply, seq_num, is_discovery_protected);
3891  break;
3892  default:
3893  if (DCPS::DCPS_debug_level) {
3894  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: "
3895  "Sedp::TypeLookupReplyReader::process_type_lookup_reply - "
3896  "reply kind is %d\n", kind));
3897  }
3898  return false;
3899  }
3900 
3901  if (kind == XTypes::TypeLookup_getTypes_HashId) {
3902  if (DCPS::DCPS_debug_level > 8) {
3904  "(%P|%t) Sedp::TypeLookupReplyReader::process_type_lookup_reply - "
3905  "got the reply for the final request in the sequence\n"));
3906  }
3907  const DCPS::SequenceNumber key_seq_num = seq_num_it->second.seq_number;
3908 
3909  // Cleanup data
3910  cleanup(sample.header_.publication_id_, seq_num_it->second.type_id);
3911  sedp_.orig_seq_numbers_.erase(seq_num);
3912 
3913  if (success) {
3914  MatchingDataIter it;
3915  for (it = sedp_.matching_data_buffer_.begin(); it != sedp_.matching_data_buffer_.end(); ++it) {
3916  const DCPS::SequenceNumber& seqnum_minimal = it->second.rpc_seqnum_minimal;
3917  const DCPS::SequenceNumber& seqnum_complete = it->second.rpc_seqnum_complete;
3918  if (seqnum_minimal == key_seq_num || seqnum_complete == key_seq_num) {
3919  if (seqnum_minimal == key_seq_num) {
3920  it->second.got_minimal = true;
3921  } else {
3922  it->second.got_complete = true;
3923  }
3924 
3925  if (it->first.type_obj_req_cond) {
3926  it->first.type_obj_req_cond->done(DDS::RETCODE_OK);
3927  sedp_.matching_data_buffer_.erase(it);
3928  return true;
3929  } else if (it->second.got_minimal && it->second.got_complete) {
3930  // All remote type objects are obtained, continue the matching process
3931  const GUID_t writer = it->first.writer();
3932  const GUID_t reader = it->first.reader();
3933  sedp_.matching_data_buffer_.erase(it);
3934  sedp_.match_continue(writer, reader);
3935  return true;
3936  }
3937  break;
3938  }
3939  }
3940 
3941  if (it == sedp_.matching_data_buffer_.end()) {
3943  ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: Sedp::TypeLookupReplyReader::process_type_lookup_reply: "
3944  "RPC sequence number %q: No data found in matching data buffer\n",
3945  key_seq_num.getValue()));
3946  }
3947  }
3948  }
3949  }
3950 
3951  return success;
3952 }
3953 
3955 {
3956  if (DCPS::DCPS_debug_level > 8) {
3957  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::process_get_types_reply\n"));
3958  }
3959 
3960  if (reply._cxx_return.getType()._d() != DDS::RETCODE_OK) {
3961  if (DCPS::DCPS_debug_level) {
3962  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::process_get_types_reply - "
3963  "received reply with return code %C\n",
3964  DCPS::retcode_to_string(reply._cxx_return.getType()._d())));
3965  }
3966  return false;
3967  }
3968 
3969  if (reply._cxx_return.getType().result().types.length() == 0) {
3970  if (DCPS::DCPS_debug_level) {
3971  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: Sedp::TypeLookupReplyReader::process_get_types_reply - "
3972  "received reply with no data\n"));
3973  }
3974  return false;
3975  }
3976 
3977  sedp_.type_lookup_service_->add_type_objects_to_cache(reply._cxx_return.getType().result().types);
3978 
3979  if (reply._cxx_return.getType().result().complete_to_minimal.length() != 0) {
3980  if (DCPS::DCPS_debug_level >= 4) {
3981  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::process_get_types_reply - "
3982  "received reply with non-empty complete to minimal map\n"));
3983  }
3984  sedp_.type_lookup_service_->update_type_identifier_map(reply._cxx_return.getType().result().complete_to_minimal);
3985  }
3986 
3987  return true;
3988 }
3989 
3991  const DCPS::ReceivedDataSample& sample, const XTypes::TypeLookup_Reply& reply,
3992  const DCPS::SequenceNumber& seq_num, bool is_discovery_protected)
3993 {
3994  if (DCPS::DCPS_debug_level > 8) {
3995  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::process_get_dependencies_reply - "
3996  "seq %q\n", seq_num.getValue()));
3997  }
3998 
3999  if (reply._cxx_return.getTypeDependencies().result().continuation_point.length() != 0 &&
4000  reply._cxx_return.getTypeDependencies().result().dependent_typeids.length() == 0) {
4001  if (DCPS::DCPS_debug_level) {
4002  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: "
4003  "Sedp::TypeLookupReplyReader::process_get_dependencies_reply - "
4004  "received reply with no data\n"));
4005  }
4006  return false;
4007  }
4008 
4009  const XTypes::TypeLookup_getTypeDependencies_Out& data = reply._cxx_return.getTypeDependencies().result();
4010  const DCPS::GUID_t remote_id = sample.header_.publication_id_;
4011 
4012  const XTypes::TypeIdentifier remote_ti = sedp_.orig_seq_numbers_[seq_num].type_id;
4013  const GUID_t part_guid = DCPS::make_part_guid(remote_id.guidPrefix);
4014  XTypes::TypeIdentifierSeq& deps = dependencies_[part_guid][remote_ti].second;
4015  for (unsigned i = 0; i < data.dependent_typeids.length(); ++i) {
4016  const XTypes::TypeIdentifier& ti = data.dependent_typeids[i].type_id;
4017  // Optimization - only store TypeIdentifiers for which TypeObjects haven't
4018  // already been in the type objects cache yet
4019  if (!sedp_.type_lookup_service_->type_object_in_cache(ti)) {
4020  deps.append(ti);
4021  }
4022  }
4023  dependencies_[part_guid][remote_ti].first = data.continuation_point;
4024 
4025  // Update internal data
4027  sedp_.orig_seq_numbers_[seq_num]));
4028  sedp_.orig_seq_numbers_.erase(seq_num);
4029 
4030  if (data.continuation_point.length() == 0) { // Get all type objects
4031  deps.append(remote_ti);
4032  if (!sedp_.send_type_lookup_request(deps, remote_id, is_discovery_protected, true, sedp_.type_lookup_service_sequence_number_)) {
4033  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupReplyReader::process_get_dependencies_reply - ")
4034  ACE_TEXT("failed to send getTypes request\n")));
4035  return false;
4036  }
4037  } else { // Get more dependencies
4038  XTypes::TypeIdentifierSeq type_ids;
4039  type_ids.append(remote_ti);
4040  if (!sedp_.send_type_lookup_request(type_ids, remote_id, is_discovery_protected, false, sedp_.type_lookup_service_sequence_number_)) {
4041  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupReplyReader::process_get_dependencies_reply - ")
4042  ACE_TEXT("failed to send getTypeDependencies request\n")));
4043  return false;
4044  }
4045  }
4046 
4047  return true;
4048 }
4049 
4050 void Sedp::cleanup_type_lookup_data(const DCPS::GUID_t& guid,
4051  const XTypes::TypeIdentifier& ti,
4052  bool secure)
4053 {
4054 #ifdef OPENDDS_SECURITY
4055  if (secure) {
4056  type_lookup_reply_secure_reader_->cleanup(guid, ti);
4057  } else {
4058  type_lookup_reply_reader_->cleanup(guid, ti);
4059  }
4060 #else
4061  ACE_UNUSED_ARG(secure);
4062  type_lookup_reply_reader_->cleanup(guid, ti);
4063 #endif
4064 }
4065 
4067 {
4068 }
4069 
4071 {
4072 }
4073 
4075 {
4076 }
4077 
4079 {
4080 }
4081 
4082 bool
4084 {
4085  return associate(publication, false);
4086 }
4087 
4088 // Implementing TransportReceiveListener
4089 
4091  const DCPS::ReceivedDataSample& sample,
4092  Serializer& ser,
4094  ParameterList& data)
4095 {
4096  if (sample.header_.key_fields_only_ && extensibility == DCPS::FINAL) {
4097  GUID_t guid;
4098  if (!(ser >> guid)) return false;
4099  data.length(1);
4100  data[0].guid(guid);
4101  data[0]._d(PID_ENDPOINT_GUID);
4102  } else {
4103  return ser >> data;
4104  }
4105  return true;
4106 }
4107 
4108 void
4110 {
4111  if (shutting_down_) {
4112  return;
4113  }
4114 
4115  if (DCPS::DCPS_debug_level >= 9) {
4116  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::Reader::data_received: from %C\n",
4118  }
4119 
4120  const DCPS::MessageId id =
4121  static_cast<DCPS::MessageId>(sample.header_.message_id_);
4122 
4123  switch (id) {
4124  case DCPS::SAMPLE_DATA:
4128  const DCPS::EntityId_t entity_id = sample.header_.publication_id_.entityId;
4129  const bool full_message = !sample.header_.key_fields_only_;
4130 
4131  // Figure Out Extensibility of Data Based On Entity Id
4132  const bool is_mutable =
4134 #ifdef OPENDDS_SECURITY
4136 #endif
4138 #ifdef OPENDDS_SECURITY
4141 #endif
4142  false;
4143  const bool is_final =
4144  (entity_id == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER && full_message) ||
4145 #ifdef OPENDDS_SECURITY
4146  (entity_id == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER && full_message) ||
4149 #endif
4150  entity_id == ENTITYID_TL_SVC_REQ_WRITER ||
4151  entity_id == ENTITYID_TL_SVC_REPLY_WRITER ||
4152 #ifdef OPENDDS_SECURITY
4153  entity_id == ENTITYID_TL_SVC_REQ_WRITER_SECURE ||
4154  entity_id == ENTITYID_TL_SVC_REPLY_WRITER_SECURE ||
4155 #endif
4156  false;
4157  if (is_mutable == is_final) {
4158  if (is_mutable) {
4159  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: Sedp::Reader::data_received: "
4160  "entity id extensibility error over %C: both is_final and is_mutable are %d\n",
4161  to_string(entity_id).c_str(), is_mutable));
4162  }
4163  break;
4164  }
4166  is_mutable ? DCPS::MUTABLE : DCPS::FINAL;
4167 
4168  // Get Encoding from Encapsulation
4170  DCPS::Message_Block_Ptr payload(sample.data(&mb_alloc_));
4171  Serializer ser(payload.get(), encoding);
4173  if (!(ser >> encap)) {
4174  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::Reader::data_received - ")
4175  ACE_TEXT("failed to deserialize encapsulation header\n")));
4176  return;
4177  }
4178  if (!encap.to_encoding(encoding, extensibility)) {
4179  return;
4180  }
4181  ser.encoding(encoding);
4182 
4183  data_received_i(sample, entity_id, ser, extensibility);
4184  break;
4185  }
4186 
4187  default:
4188  break;
4189  }
4190 }
4191 
4192 void
4194  const DCPS::EntityId_t& entity_id,
4195  DCPS::Serializer& ser,
4197 {
4198  const DCPS::MessageId id = static_cast<DCPS::MessageId>(sample.header_.message_id_);
4199  const bool full_message = !sample.header_.key_fields_only_;
4200 
4201  if (entity_id == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER && full_message) {
4203  if (!(ser >> data)) {
4204  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::LivelinessReader::data_received_i - ")
4205  ACE_TEXT("failed to deserialize data\n")));
4206  return;
4207  }
4208  sedp_.data_received(id, data);
4209 
4210 #ifdef OPENDDS_SECURITY
4211  } else if (entity_id == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER && full_message) {
4213  if (!(ser >> data)) {
4214  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::LivelinessReader::data_received_i - ")
4215  ACE_TEXT("failed to deserialize data\n")));
4216  return;
4217  }
4219 #endif
4220  }
4221 }
4222 
4223 void
4225  const DCPS::EntityId_t& entity_id,
4226  DCPS::Serializer& ser,
4228 {
4229 #ifdef OPENDDS_SECURITY
4230  const DCPS::MessageId id = static_cast<DCPS::MessageId>(sample.header_.message_id_);
4231 
4234  ser.reset_alignment(); // https://issues.omg.org/browse/DDSIRTP23-63
4235  if (!(ser >> data)) {
4236  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::SecurityReader::data_received_i - ")
4237  ACE_TEXT("failed to deserialize data\n")));
4238  return;
4239  }
4243  if (!(ser >> data)) {
4244  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::SecurityReader::data_received_i - ")
4245  ACE_TEXT("failed to deserialize data\n")));
4246  return;
4247  }
4249  }
4250 #else
4251  ACE_UNUSED_ARG(sample);
4252  ACE_UNUSED_ARG(entity_id);
4253  ACE_UNUSED_ARG(ser);
4254 #endif
4255 }
4256 
4257 void
4259  const DCPS::EntityId_t& entity_id,
4260  DCPS::Serializer& ser,
4262 {
4263  const DCPS::MessageId id = static_cast<DCPS::MessageId>(sample.header_.message_id_);
4264 
4265  if (entity_id == ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER) {
4266  ParameterList data;
4267  if (!decode_parameter_list(sample, ser, extensibility, data)) {
4268  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::DiscoveryReader::data_received_i - ")
4269  ACE_TEXT("failed to deserialize data\n")));
4270  return;
4271  }
4272 
4273  DiscoveredPublication wdata;
4276  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4277  ACE_TEXT("failed to convert from ParameterList ")
4278  ACE_TEXT("to DiscoveredWriterData\n")));
4279  return;
4280  }
4281 #ifdef OPENDDS_SECURITY
4282  wdata.have_ice_agent_info_ = false;
4283  ICE::AgentInfoMap ai_map;
4284  if (!ParameterListConverter::from_param_list(data, ai_map)) {
4286  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4287  ACE_TEXT("failed to convert from ParameterList ")
4288  ACE_TEXT("to ICE Agent info\n")));
4289  return;
4290  }
4291  ICE::AgentInfoMap::const_iterator pos = ai_map.find("DATA");
4292  if (pos != ai_map.end()) {
4293  wdata.have_ice_agent_info_ = true;
4294  wdata.ice_agent_info_ = pos->second;
4295  }
4296 #endif
4297 
4300  const GUID_t& remote_guid = wdata.writer_data_.writerProxy.remoteWriterGuid;
4302  sedp_.type_lookup_service_->cache_type_info(key, wdata.type_info_);
4303  }
4304 
4305  sedp_.data_received(id, wdata);
4306 
4307 #ifdef OPENDDS_SECURITY
4308  } else if (entity_id == ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER) {
4309  ParameterList data;
4310  if (!decode_parameter_list(sample, ser, extensibility, data)) {
4311  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::DiscoveryReader::data_received_i - ")
4312  ACE_TEXT("failed to deserialize data\n")));
4313  return;
4314  }
4315 
4317 
4318  if (!ParameterListConverter::from_param_list(data, wdata_secure, sedp_.use_xtypes_, wdata_secure.type_info)) {
4320  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4321  ACE_TEXT("failed to convert from ParameterList ")
4322  ACE_TEXT("to DiscoveredPublication_SecurityWrapper\n")));
4323  return;
4324  }
4325 
4326  wdata_secure.have_ice_agent_info = false;
4327  ICE::AgentInfoMap ai_map;
4328  if (!ParameterListConverter::from_param_list(data, ai_map)) {
4330  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4331  ACE_TEXT("failed to convert from ParameterList ")
4332  ACE_TEXT("to ICE Agent info\n")));
4333  return;
4334  }
4335  ICE::AgentInfoMap::const_iterator pos = ai_map.find("DATA");
4336  if (pos != ai_map.end()) {
4337  wdata_secure.have_ice_agent_info = true;
4338  wdata_secure.ice_agent_info = pos->second;
4339  }
4340 
4343  const GUID_t& remote_guid = wdata_secure.data.writerProxy.remoteWriterGuid;
4345  sedp_.type_lookup_service_->cache_type_info(key, wdata_secure.type_info);
4346  }
4347 
4348  sedp_.data_received(id, wdata_secure);
4349 #endif
4350  } else if (entity_id == ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER) {
4351  ParameterList data;
4352  if (!decode_parameter_list(sample, ser, extensibility, data)) {
4353  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::DiscoveryReader::data_received_i - ")
4354  ACE_TEXT("failed to deserialize data\n")));
4355  return;
4356  }
4357 
4358  DiscoveredSubscription rdata;
4361  ACE_TEXT("(%P|%t) ERROR Sedp::DiscoveryReader::data_received_i - ")
4362  ACE_TEXT("failed to convert from ParameterList ")
4363  ACE_TEXT("to DiscoveredReaderData\n")));
4364  return;
4365  }
4366 #ifdef OPENDDS_SECURITY
4367  rdata.have_ice_agent_info_ = false;
4368  ICE::AgentInfoMap ai_map;
4369  if (!ParameterListConverter::from_param_list(data, ai_map)) {
4371  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4372  ACE_TEXT("failed to convert from ParameterList ")
4373  ACE_TEXT("to ICE Agent info\n")));
4374  return;
4375  }
4376  ICE::AgentInfoMap::const_iterator pos = ai_map.find("DATA");
4377  if (pos != ai_map.end()) {
4378  rdata.have_ice_agent_info_ = true;
4379  rdata.ice_agent_info_ = pos->second;
4380  }
4381 #endif
4384  }
4385 
4388  const GUID_t& remote_guid = rdata.reader_data_.readerProxy.remoteReaderGuid;
4390  sedp_.type_lookup_service_->cache_type_info(key, rdata.type_info_);
4391  }
4392 
4393  sedp_.data_received(id, rdata);
4394 
4395 #ifdef OPENDDS_SECURITY
4396  } else if (entity_id == ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER) {
4397  ParameterList data;
4398  if (!decode_parameter_list(sample, ser, extensibility, data)) {
4399  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::DiscoveryReader::data_received_i - ")
4400  ACE_TEXT("failed to deserialize data\n")));
4401  return;
4402  }
4403 
4405  if (!ParameterListConverter::from_param_list(data, rdata_secure, sedp_.use_xtypes_, rdata_secure.type_info)) {
4407  ACE_TEXT("(%P|%t) ERROR Sedp::DiscoveryReader::data_received_i - ")
4408  ACE_TEXT("failed to convert from ParameterList ")
4409  ACE_TEXT("to DiscoveredSubscription_SecurityWrapper\n")));
4410  return;
4411  }
4412 
4413  rdata_secure.have_ice_agent_info = false;
4414  ICE::AgentInfoMap ai_map;
4415  if (!ParameterListConverter::from_param_list(data, ai_map)) {
4417  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4418  ACE_TEXT("failed to convert from ParameterList ")
4419  ACE_TEXT("to ICE Agent info\n")));
4420  return;
4421  }
4422  ICE::AgentInfoMap::const_iterator pos = ai_map.find("DATA");
4423  if (pos != ai_map.end()) {
4424  rdata_secure.have_ice_agent_info = true;
4425  rdata_secure.ice_agent_info = pos->second;
4426  }
4427 
4428  if ((rdata_secure.data).readerProxy.expectsInlineQos) {
4429  set_inline_qos((rdata_secure.data).readerProxy.allLocators);
4430  }
4431 
4434  const GUID_t& remote_guid = rdata_secure.data.readerProxy.remoteReaderGuid;
4436  sedp_.type_lookup_service_->cache_type_info(key, rdata_secure.type_info);
4437  }
4438 
4439  sedp_.data_received(id, rdata_secure);
4440 
4442 
4443  ParameterList data;
4444  if (!decode_parameter_list(sample, ser, extensibility, data)) {
4445  ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: Sedp::DiscoveryReader::data_received_i - ")
4446  ACE_TEXT("failed to deserialize data\n")));
4447  return;
4448  }
4449 
4452  pdata.discoveredAt = MTZERO;
4453 
4454  if (!ParameterListConverter::from_param_list(data, pdata)) {
4456  ACE_TEXT("(%P|%t) ERROR: Sedp::DiscoveryReader::data_received_i - ")
4457  ACE_TEXT("failed to convert from ParameterList ")
4458  ACE_TEXT("to Security::SPDPdiscoveredParticipantData\n")));
4459  return;
4460  }
4461  const GUID_t guid = make_part_guid(sample.header_.publication_id_);
4462  sedp_.spdp_.process_participant_ice(data, pdata, guid);
4464 
4465 #endif
4466  }
4467 }
4468 
4469 void
4471  const DCPS::EntityId_t& entity_id,
4472  DCPS::Serializer& ser,
4474 {
4475  if (DCPS::DCPS_debug_level > 8) {
4476  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupRequestReader::data_received_i: from %C\n",
4478  }
4479 
4480  XTypes::TypeLookup_Reply type_lookup_reply;
4481  if (!process_type_lookup_request(ser, type_lookup_reply)) {
4482  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupRequestReader::data_received_i - ")
4483  ACE_TEXT("failed to take type lookup request\n")));
4484  return;
4485  }
4486 
4487 #ifdef OPENDDS_SECURITY
4488  if (entity_id == ENTITYID_TL_SVC_REQ_WRITER_SECURE) {
4489  const DCPS::GUID_t reader = make_id(sample.header_.publication_id_, ENTITYID_TL_SVC_REPLY_READER_SECURE);
4490  if (!sedp_.type_lookup_reply_secure_writer_->send_type_lookup_reply(type_lookup_reply, reader)) {
4491  if (DCPS::DCPS_debug_level) {
4492  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupRequestReader::data_received_i - ")
4493  ACE_TEXT("failed to send secure type lookup reply\n")));
4494  }
4495  return;
4496  }
4497  } else if (entity_id == ENTITYID_TL_SVC_REQ_WRITER) {
4498 #endif
4499  const DCPS::GUID_t reader = make_id(sample.header_.publication_id_, ENTITYID_TL_SVC_REPLY_READER);
4500  if (!sedp_.type_lookup_reply_writer_->send_type_lookup_reply(type_lookup_reply, reader)) {
4501  if (DCPS::DCPS_debug_level) {
4502  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupRequestReader::data_received_i - ")
4503  ACE_TEXT("failed to send type lookup reply\n")));
4504  }
4505  return;
4506  }
4507 #ifdef OPENDDS_SECURITY
4508  }
4509 #else
4510  ACE_UNUSED_ARG(entity_id);
4511 #endif
4512 }
4513 
4515  const DCPS::ReceivedDataSample& sample,
4516  const DCPS::EntityId_t& remote_id,
4517  DCPS::Serializer& ser,
4519 {
4520  if (DCPS::DCPS_debug_level > 8) {
4521  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::TypeLookupReplyReader::data_received_i: from %C\n",
4523  }
4524 
4525 #ifdef OPENDDS_SECURITY
4526  if (remote_id == ENTITYID_TL_SVC_REPLY_WRITER_SECURE) {
4527  if (!process_type_lookup_reply(sample, ser, true)) {
4528  if (DCPS::DCPS_debug_level) {
4529  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupReplyReader::data_received_i - ")
4530  ACE_TEXT("failed to process secure type lookup reply\n")));
4531  }
4532  return;
4533  }
4534  } else if (remote_id == ENTITYID_TL_SVC_REPLY_WRITER) {
4535 #endif
4536  if (!process_type_lookup_reply(sample, ser, false)) {
4537  if (DCPS::DCPS_debug_level) {
4538  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::TypeLookupReplyReader::data_received_i - ")
4539  ACE_TEXT("failed to process type lookup reply\n")));
4540  }
4541  return;
4542  }
4543 #ifdef OPENDDS_SECURITY
4544  }
4545 #else
4546  ACE_UNUSED_ARG(remote_id);
4547 #endif
4548 }
4549 
4550 void
4553  const GUID_t& publication_id,
4554  const LocalPublication& pub)
4555 {
4556  // Ignored on the wire dwd.ddsPublicationData.key
4557  // Ignored on the wire dwd.ddsPublicationData.participant_key
4558  OPENDDS_STRING topic_name = topic_names_[pub.topic_id_];
4559  dwd.ddsPublicationData.topic_name = topic_name.c_str();
4560  TopicDetails& topic_details = topics_[topic_name];
4561  dwd.ddsPublicationData.type_name = topic_details.local_data_type_name().c_str();
4562  dwd.ddsPublicationData.durability = pub.qos_.durability;
4563  dwd.ddsPublicationData.durability_service = pub.qos_.durability_service;
4564  dwd.ddsPublicationData.deadline = pub.qos_.deadline;
4565  dwd.ddsPublicationData.latency_budget = pub.qos_.latency_budget;
4566  dwd.ddsPublicationData.liveliness = pub.qos_.liveliness;
4567  dwd.ddsPublicationData.reliability = pub.qos_.reliability;
4568  dwd.ddsPublicationData.lifespan = pub.qos_.lifespan;
4569  dwd.ddsPublicationData.user_data = pub.qos_.user_data;
4570  dwd.ddsPublicationData.ownership = pub.qos_.ownership;
4571  dwd.ddsPublicationData.ownership_strength = pub.qos_.ownership_strength;
4572  dwd.ddsPublicationData.destination_order = pub.qos_.destination_order;
4573  dwd.ddsPublicationData.representation = pub.qos_.representation;
4574  dwd.ddsPublicationData.presentation = pub.publisher_qos_.presentation;
4575  dwd.ddsPublicationData.partition = pub.publisher_qos_.partition;
4576  dwd.ddsPublicationData.topic_data = topic_details.local_qos().topic_data;
4577  dwd.ddsPublicationData.group_data = pub.publisher_qos_.group_data;
4578 
4579  dwd.writerProxy.remoteWriterGuid = publication_id;
4580  // Ignore dwd.writerProxy.unicastLocatorList;
4581  // Ignore dwd.writerProxy.multicastLocatorList;
4583 }
4584 
4585 void
4588  const GUID_t& subscription_id,
4589  const LocalSubscription& sub)
4590 {
4591  // Ignored on the wire drd.ddsSubscription.key
4592  // Ignored on the wire drd.ddsSubscription.participant_key
4593  OPENDDS_STRING topic_name = topic_names_[sub.topic_id_];
4594  drd.ddsSubscriptionData.topic_name = topic_name.c_str();
4595  TopicDetails& topic_details = topics_[topic_name];
4596  drd.ddsSubscriptionData.type_name = topic_details.local_data_type_name().c_str();
4597  drd.ddsSubscriptionData.durability = sub.qos_.durability;
4598  drd.ddsSubscriptionData.deadline = sub.qos_.deadline;
4599  drd.ddsSubscriptionData.latency_budget = sub.qos_.latency_budget;
4600  drd.ddsSubscriptionData.liveliness = sub.qos_.liveliness;
4601  drd.ddsSubscriptionData.reliability = sub.qos_.reliability;
4602  drd.ddsSubscriptionData.ownership = sub.qos_.ownership;
4603  drd.ddsSubscriptionData.destination_order = sub.qos_.destination_order;
4604  drd.ddsSubscriptionData.user_data = sub.qos_.user_data;
4605  drd.ddsSubscriptionData.time_based_filter = sub.qos_.time_based_filter;
4606  drd.ddsSubscriptionData.representation = sub.qos_.representation;
4607  drd.ddsSubscriptionData.presentation = sub.subscriber_qos_.presentation;
4608  drd.ddsSubscriptionData.partition = sub.subscriber_qos_.partition;
4609  drd.ddsSubscriptionData.topic_data = topic_details.local_qos().topic_data;
4610  drd.ddsSubscriptionData.group_data = sub.subscriber_qos_.group_data;
4611  drd.ddsSubscriptionData.type_consistency = sub.qos_.type_consistency;
4612 
4613  drd.readerProxy.remoteReaderGuid = subscription_id;
4614  drd.readerProxy.expectsInlineQos = false; // We never expect inline qos
4615  // Ignore drd.readerProxy.unicastLocatorList;
4616  // Ignore drd.readerProxy.multicastLocatorList;
4618 
4620  DCPS::LogGuid(subscription_id).c_str();
4621  drd.contentFilterProperty.relatedTopicName = topic_name.c_str();
4622  drd.contentFilterProperty.filterClassName = ""; // PLConverter adds default
4625 
4626  const CORBA::ULong len = drd.readerProxy.associatedWriters.length();
4627  const CORBA::ULong added_len = static_cast<CORBA::ULong>(sub.remote_expectant_opendds_associations_.size());
4628  drd.readerProxy.associatedWriters.length(len + added_len);
4629 
4630  CORBA::ULong i = 0;
4631  for (DCPS::RepoIdSet::const_iterator writer =
4633  writer != sub.remote_expectant_opendds_associations_.end();
4634  ++writer) {
4635  drd.readerProxy.associatedWriters[len + i] = *writer;
4636  ++i;
4637  }
4638 }
4639 
4640 void
4642 {
4644 #ifdef OPENDDS_SECURITY
4646 #endif
4647  ))) {
4648  return;
4649  }
4650 
4651  if (secure) {
4652 #ifdef OPENDDS_SECURITY
4653  LocalPublicationIter pub, end = local_publications_.end();
4654  for (pub = local_publications_.begin(); pub != end; ++pub) {
4655  if (pub->second.security_attribs_.base.is_discovery_protected) {
4656  write_publication_data_secure(pub->first, pub->second, reader);
4657  }
4658  }
4659  publications_secure_writer_->end_historic_samples(reader);
4660 #endif
4661  } else {
4662  LocalPublicationIter pub, end = local_publications_.end();
4663  for (pub = local_publications_.begin(); pub != end; ++pub) {
4664 #ifdef OPENDDS_SECURITY
4665  if (!pub->second.security_attribs_.base.is_discovery_protected) {
4666  write_publication_data(pub->first, pub->second, reader);
4667  }
4668 #else
4669  write_publication_data(pub->first, pub->second, reader);
4670 #endif
4671  }
4672  publications_writer_->end_historic_samples(reader);
4673  }
4674 }
4675 
4676 void
4678 {
4680 #ifdef OPENDDS_SECURITY
4682 #endif
4683  ))) {
4684  return;
4685  }
4686 
4687  if (secure) {
4688 #ifdef OPENDDS_SECURITY
4690  for (sub = local_subscriptions_.begin(); sub != end; ++sub) {
4691  if (is_security_enabled() && sub->second.security_attribs_.base.is_discovery_protected) {
4692  write_subscription_data_secure(sub->first, sub->second, reader);
4693  }
4694  }
4695  subscriptions_secure_writer_->end_historic_samples(reader);
4696 #endif
4697  } else {
4699  for (sub = local_subscriptions_.begin(); sub != end; ++sub) {
4700 #ifdef OPENDDS_SECURITY
4701  if (!(is_security_enabled() && sub->second.security_attribs_.base.is_discovery_protected)) {
4702  write_subscription_data(sub->first, sub->second, reader);
4703  }
4704 #else
4705  write_subscription_data(sub->first, sub->second, reader);
4706 #endif
4707  }
4708  subscriptions_writer_->end_historic_samples(reader);
4709  }
4710 }
4711 
4712 void
4714 {
4716  return;
4717  }
4718 
4720  const GUID_t guid = make_id(participant_id_,
4723  }
4724 
4726  const GUID_t guid = make_id(participant_id_,
4729  }
4730 
4731  participant_message_writer_->end_historic_samples(reader);
4732 }
4733 
4734 #ifdef OPENDDS_SECURITY
4735 void
4737 {
4739  return;
4740  }
4741 
4743  const GUID_t guid = make_id(participant_id_,
4746  }
4747 
4749  const GUID_t guid = make_id(participant_id_,
4752  }
4753 
4754  participant_message_secure_writer_->end_historic_samples(reader);
4755 }
4756 
4759  const GUID_t& reader)
4760 {
4762  return participant_stateless_message_writer_->write_stateless_message(msg, reader, sequence);
4763 }
4764 
4767  const GUID_t& reader)
4768 {
4769  msg.message_identity.sequence_number = static_cast<unsigned long>(participant_volatile_message_secure_writer_->get_seq().getValue());
4771  return participant_volatile_message_secure_writer_->write_volatile_message_secure(msg, reader, sequence);
4772 }
4773 
4774 void
4776 {
4778  return;
4779  }
4780 
4783  dcps_participant_secure_writer_->end_historic_samples(reader);
4784 }
4785 
4788  const GUID_t& part)
4789 {
4790  DCPS::GUID_t remote_reader(part);
4791  if (part != GUID_UNKNOWN) {
4793  }
4794 
4795  return dcps_participant_secure_writer_->write_dcps_participant_secure(msg, remote_reader, participant_secure_sequence_);
4796 }
4797 
4800 {
4801  return dcps_participant_secure_writer_->write_unregister_dispose(part, PID_PARTICIPANT_GUID);
4802 }
4803 #endif
4804 
4806 Sedp::add_publication_i(const DCPS::GUID_t& rid,
4807  LocalPublication& pub)
4808 {
4810  pub.transport_context_ = spdp_.config()->participant_flags();
4811 #ifdef OPENDDS_SECURITY
4813  if (pl) {
4814  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
4815  if (endpoint) {
4816  pub.have_ice_agent_info = true;
4817  pub.ice_agent_info = ice_agent_->get_local_agent_info(endpoint);
4818  ice_agent_->add_local_agent_info_listener(endpoint, rid, DCPS::static_rchandle_cast<ICE::AgentInfoListener>(publication_agent_info_listener_));
4819  start_ice(rid, pub);
4820  }
4821  }
4822 #else
4823  ACE_UNUSED_ARG(rid);
4824  ACE_UNUSED_ARG(pub);
4825 #endif
4826  return DDS::RETCODE_OK;
4827 }
4828 
4831  const GUID_t& rid,
4832  LocalPublication& lp,
4833  const GUID_t& reader)
4834 {
4836 
4837 #ifdef OPENDDS_SECURITY
4839  result = write_publication_data_secure(rid, lp, reader);
4840 
4841  } else {
4842 #endif
4843 
4844  result = write_publication_data_unsecure(rid, lp, reader);
4845 
4846 #ifdef OPENDDS_SECURITY
4847  }
4848 #endif
4849 
4850  return result;
4851 }
4852 
4855  const GUID_t& rid,
4856  LocalPublication& lp,
4857  const GUID_t& reader)
4858 {
4861  }
4862 
4864  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
4865  !associated_participants_.empty())) {
4867  ParameterList plist;
4868  populate_discovered_writer_msg(dwd, rid, lp);
4869 
4870  // Convert to parameter list
4871  if (!ParameterListConverter::to_param_list(dwd, plist, use_xtypes_, lp.type_info_, false)) {
4873  ACE_TEXT("(%P|%t) ERROR: Sedp::write_publication_data_unsecure - ")
4874  ACE_TEXT("Failed to convert DiscoveredWriterData ")
4875  ACE_TEXT(" to ParameterList\n")));
4876  result = DDS::RETCODE_ERROR;
4877  }
4878 #ifdef OPENDDS_SECURITY
4879  if (lp.have_ice_agent_info) {
4880  ICE::AgentInfoMap ai_map;
4881  ai_map["DATA"] = lp.ice_agent_info;
4882  if (!ParameterListConverter::to_param_list(ai_map, plist)) {
4884  ACE_TEXT("(%P|%t) ERROR: Sedp::write_publication_data_unsecure - ")
4885  ACE_TEXT("Failed to convert ICE Agent info ")
4886  ACE_TEXT("to ParameterList\n")));
4887  result = DDS::RETCODE_ERROR;
4888  }
4889  }
4890 #endif
4891 
4892  if (DDS::RETCODE_OK == result) {
4893  result = publications_writer_->write_parameter_list(plist, reader, lp.sequence_);
4894  }
4895  } else if (DCPS::DCPS_debug_level > 3) {
4896  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_publication_data_unsecure - ")
4897  ACE_TEXT("not currently associated, dropping msg.\n")));
4898  }
4899  return result;
4900 }
4901 
4902 #ifdef OPENDDS_SECURITY
4905  const GUID_t& rid,
4906  LocalPublication& lp,
4907  const GUID_t& reader)
4908 {
4911  }
4912 
4914  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
4915  !associated_participants_.empty())) {
4916 
4918  ParameterList plist;
4919  populate_discovered_writer_msg(dwd.data, rid, lp);
4920 
4923 
4924  // Convert to parameter list
4925  if (!ParameterListConverter::to_param_list(dwd, plist, use_xtypes_, lp.type_info_, false)) {
4927  ACE_TEXT("(%P|%t) ERROR: Sedp::write_publication_data_secure - ")
4928  ACE_TEXT("Failed to convert DiscoveredWriterData ")
4929  ACE_TEXT("to ParameterList\n")));
4930  result = DDS::RETCODE_ERROR;
4931  }
4932  if (lp.have_ice_agent_info) {
4933  ICE::AgentInfoMap ai_map;
4934  ai_map["DATA"] = lp.ice_agent_info;
4935  if (!ParameterListConverter::to_param_list(ai_map, plist)) {
4937  ACE_TEXT("(%P|%t) ERROR: Sedp::write_publication_data_secure - ")
4938  ACE_TEXT("Failed to convert ICE Agent info ")
4939  ACE_TEXT("to ParameterList\n")));
4940  result = DDS::RETCODE_ERROR;
4941  }
4942  }
4943  if (DDS::RETCODE_OK == result) {
4944  GUID_t effective_reader = reader;
4945  if (reader != GUID_UNKNOWN)
4947  result = publications_secure_writer_->write_parameter_list(plist, effective_reader, lp.sequence_);
4948  }
4949  } else if (DCPS::DCPS_debug_level > 3) {
4950  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_publication_data_secure - ")
4951  ACE_TEXT("not currently associated, dropping msg.\n")));
4952  }
4953  return result;
4954 }
4955 #endif
4956 
4958 Sedp::add_subscription_i(const DCPS::GUID_t& rid,
4959  LocalSubscription& sub)
4960 {
4962  sub.transport_context_ = spdp_.config()->participant_flags();
4963 #ifdef OPENDDS_SECURITY
4965  if (sl) {
4966  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
4967  if (endpoint) {
4968  sub.have_ice_agent_info = true;
4969  sub.ice_agent_info = ice_agent_->get_local_agent_info(endpoint);
4970  ice_agent_->add_local_agent_info_listener(endpoint, rid, DCPS::static_rchandle_cast<ICE::AgentInfoListener>(subscription_agent_info_listener_));
4971  start_ice(rid, sub);
4972  }
4973  }
4974 #else
4975  ACE_UNUSED_ARG(rid);
4976  ACE_UNUSED_ARG(sub);
4977 #endif
4978  return DDS::RETCODE_OK;
4979 }
4980 
4983  const GUID_t& rid,
4984  LocalSubscription& ls,
4985  const GUID_t& reader)
4986 {
4988 
4989 #ifdef OPENDDS_SECURITY
4991  result = write_subscription_data_secure(rid, ls, reader);
4992 
4993  } else {
4994 #endif
4995 
4996  result = write_subscription_data_unsecure(rid, ls, reader);
4997 
4998 #ifdef OPENDDS_SECURITY
4999  }
5000 #endif
5001 
5002  return result;
5003 }
5004 
5007  const GUID_t& rid,
5008  LocalSubscription& ls,
5009  const GUID_t& reader)
5010 {
5013  }
5014 
5016  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
5017  !associated_participants_.empty())) {
5019  ParameterList plist;
5020  populate_discovered_reader_msg(drd, rid, ls);
5021 
5022  // Convert to parameter list
5023  if (!ParameterListConverter::to_param_list(drd, plist, use_xtypes_, ls.type_info_, false)) {
5025  ACE_TEXT("(%P|%t) ERROR: Sedp::write_subscription_data_unsecure - ")
5026  ACE_TEXT("Failed to convert DiscoveredReaderData ")
5027  ACE_TEXT("to ParameterList\n")));
5028  result = DDS::RETCODE_ERROR;
5029  }
5030 
5031 #ifdef OPENDDS_SECURITY
5032  if (ls.have_ice_agent_info) {
5033  ICE::AgentInfoMap ai_map;
5034  ai_map["DATA"] = ls.ice_agent_info;
5035  if (!ParameterListConverter::to_param_list(ai_map, plist)) {
5037  ACE_TEXT("(%P|%t) ERROR: Sedp::write_subscription_data_unsecure - ")
5038  ACE_TEXT("Failed to convert ICE Agent info ")
5039  ACE_TEXT("to ParameterList\n")));
5040  result = DDS::RETCODE_ERROR;
5041  }
5042  }
5043 #endif
5044  if (DDS::RETCODE_OK == result) {
5045  result = subscriptions_writer_->write_parameter_list(plist, reader, ls.sequence_);
5046  }
5047  } else if (DCPS::DCPS_debug_level > 3) {
5048  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_subscription_data_unsecure - ")
5049  ACE_TEXT("not currently associated, dropping msg.\n")));
5050  }
5051  return result;
5052 }
5053 
5054 #ifdef OPENDDS_SECURITY
5057  const GUID_t& rid,
5058  LocalSubscription& ls,
5059  const GUID_t& reader)
5060 {
5063  }
5064 
5066  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
5067  !associated_participants_.empty())) {
5068 
5070  ParameterList plist;
5071  populate_discovered_reader_msg(drd.data, rid, ls);
5072 
5075 
5076  // Convert to parameter list
5077  if (!ParameterListConverter::to_param_list(drd, plist, use_xtypes_, ls.type_info_, false)) {
5079  ACE_TEXT("(%P|%t) ERROR: Sedp::write_subscription_data_secure - ")
5080  ACE_TEXT("Failed to convert DiscoveredReaderData ")
5081  ACE_TEXT("to ParameterList\n")));
5082  result = DDS::RETCODE_ERROR;
5083  }
5084  if (ls.have_ice_agent_info) {
5085  ICE::AgentInfoMap ai_map;
5086  ai_map["DATA"] = ls.ice_agent_info;
5087  if (!ParameterListConverter::to_param_list(ai_map, plist)) {
5089  ACE_TEXT("(%P|%t) ERROR: Sedp::write_subscription_data_secure - ")
5090  ACE_TEXT("Failed to convert ICE Agent info ")
5091  ACE_TEXT("to ParameterList\n")));
5092  result = DDS::RETCODE_ERROR;
5093  }
5094  }
5095  if (DDS::RETCODE_OK == result) {
5096  GUID_t effective_reader = reader;
5097  if (reader != GUID_UNKNOWN)
5099  result = subscriptions_secure_writer_->write_parameter_list(plist, effective_reader, ls.sequence_);
5100  }
5101  } else if (DCPS::DCPS_debug_level > 3) {
5102  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_subscription_data_secure - ")
5103  ACE_TEXT("not currently associated, dropping msg.\n")));
5104  }
5105  return result;
5106 }
5107 #endif
5108 
5111  const GUID_t& rid,
5113  const GUID_t& reader)
5114 {
5117  }
5119  //Update liveliness for local subscriptions
5121  pmd.participantGuid = rid;
5122  notify_liveliness(pmd);
5123  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
5124  !associated_participants_.empty())) {
5125  result = participant_message_writer_->write_participant_message(pmd, reader, sn);
5126  } else if (DCPS::DCPS_debug_level > 3) {
5127  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_participant_message_data - ")
5128  ACE_TEXT("not currently associated, dropping msg.\n")));
5129  }
5130  return result;
5131 }
5132 
5133 #ifdef OPENDDS_SECURITY
5136  const GUID_t& rid,
5138  const GUID_t& reader)
5139 {
5142  }
5143 
5145  if (spdp_.associated() && (reader != GUID_UNKNOWN ||
5146  !associated_participants_.empty())) {
5148  pmd.participantGuid = rid;
5149  result = participant_message_secure_writer_->write_participant_message(pmd, reader, sn);
5150  } else if (DCPS::DCPS_debug_level > 3) {
5151  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) Sedp::write_participant_message_data_secure - ")
5152  ACE_TEXT("not currently associated, dropping msg.\n")));
5153  }
5154  return result;
5155 }
5156 #endif
5157 
5158 void
5160 {
5161  const OPENDDS_STRING rtps_udp = "rtps_udp";
5162  for (CORBA::ULong i = 0; i < locators.length(); ++i) {
5163  if (locators[i].transport_type.in() == rtps_udp) {
5164  DCPS::push_back(locators[i].data, CORBA::Octet(1));
5165  }
5166  }
5167 }
5168 
5169 bool
5171 {
5172  return spdp_.shutting_down();
5173 }
5174 
5175 void
5178  const GUID_t& reader)
5179 {
5180  DCPS::LocatorSeq locs;
5181  bool participantExpectsInlineQos = false;
5182  GUID_t remote_participant = reader;
5183  remote_participant.entityId = ENTITYID_PARTICIPANT;
5184  const bool participant_found =
5185  spdp_.get_default_locators(remote_participant, locs,
5186  participantExpectsInlineQos);
5187  if (!rTls.length()) { // if no locators provided, add the default
5188  if (!participant_found) {
5189  return;
5190  } else if (locs.length()) {
5192  size_t size = DCPS::serialized_size(encoding, locs);
5194 
5195  ACE_Message_Block mb_locator(size);
5196  Serializer ser_loc(&mb_locator, encoding);
5197  ser_loc << locs;
5198  const bool readerExpectsInlineQos =
5199  dsi->second.reader_data_.readerProxy.expectsInlineQos;
5200  ser_loc << ACE_OutputCDR::from_boolean(participantExpectsInlineQos
5201  || readerExpectsInlineQos);
5202 
5204  tl.transport_type = "rtps_udp";
5205  message_block_to_sequence(mb_locator, tl.data);
5206  rTls.length(1);
5207  rTls[0] = tl;
5208  } else {
5210  ACE_TEXT("(%P|%t) Sedp::match - ")
5211  ACE_TEXT("remote reader found with no locators ")
5212  ACE_TEXT("and no default locators\n")));
5213  }
5214  }
5215 }
5216 
5217 void
5219  DiscoveredPublicationIter& /*dpi*/,
5220  const GUID_t& writer)
5221 {
5222  DCPS::LocatorSeq locs;
5223  bool participantExpectsInlineQos = false;
5224  GUID_t remote_participant = writer;
5225  remote_participant.entityId = ENTITYID_PARTICIPANT;
5226  const bool participant_found =
5227  spdp_.get_default_locators(remote_participant, locs,
5228  participantExpectsInlineQos);
5229  if (!wTls.length()) { // if no locators provided, add the default
5230  if (!participant_found) {
5231  return;
5232  } else if (locs.length()) {
5234  size_t size = DCPS::serialized_size(encoding, locs);
5236 
5237  ACE_Message_Block mb_locator(size);
5238  Serializer ser_loc(&mb_locator, encoding);
5239  ser_loc << locs;
5240  ser_loc << ACE_OutputCDR::from_boolean(participantExpectsInlineQos);
5241 
5243  tl.transport_type = "rtps_udp";
5244  message_block_to_sequence(mb_locator, tl.data);
5245  wTls.length(1);
5246  wTls[0] = tl;
5247  } else {
5249  ACE_TEXT("(%P|%t) Sedp::match - ")
5250  ACE_TEXT("remote writer found with no locators ")
5251  ACE_TEXT("and no default locators\n")));
5252  }
5253  }
5254 }
5255 
5256 #ifdef OPENDDS_SECURITY
5259  const GUID_t& reader)
5260 {
5262  if (result != DDS::HANDLE_NIL) {
5263  return result;
5264  }
5265 
5266  const GUID_t writer_part = make_id(writer, ENTITYID_PARTICIPANT);
5268 
5269  if (info.first != DDS::HANDLE_NIL && info.second) {
5274  DDS::Security::CryptoKeyFactory_var key_factory = spdp_.get_security_config()->get_crypto_key_factory();
5275  DDS::Security::SecurityException se = {"", 0, 0};
5276  result = key_factory->register_matched_remote_datawriter(drch, info.first, info.second, se);
5277  get_handle_registry()->insert_remote_datawriter_crypto_handle(writer, result, attribs);
5278  if (result == DDS::HANDLE_NIL) {
5279  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::generate_remote_matched_writer_crypto_handle() - ")
5280  ACE_TEXT("Failure calling register_matched_remote_datawriter(). Security Exception[%d.%d]: %C\n"),
5281  se.code, se.minor_code, se.message.in()));
5282  }
5283  } else {
5284  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::generate_remote_matched_writer_crypto_handle() - ")
5285  ACE_TEXT("Unable to lookup remote participant crypto info.\n")));
5286  }
5287  return result;
5288 }
5289 
5292  const GUID_t& writer,
5293  bool relay_only)
5294 {
5296  if (result != DDS::HANDLE_NIL) {
5297  return result;
5298  }
5299 
5300  const GUID_t reader_part = make_id(reader, ENTITYID_PARTICIPANT);
5302 
5303  if (info.first != DDS::HANDLE_NIL && info.second) {
5308  DDS::Security::CryptoKeyFactory_var key_factory = spdp_.get_security_config()->get_crypto_key_factory();
5309  DDS::Security::SecurityException se = {"", 0, 0};
5310  result = key_factory->register_matched_remote_datareader(dwch, info.first, info.second, relay_only, se);
5311  get_handle_registry()->insert_remote_datareader_crypto_handle(reader, result, attribs);
5312  if (result == DDS::HANDLE_NIL) {
5313  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::generate_remote_matched_reader_crypto_handle() - ")
5314  ACE_TEXT("Failure calling register_matched_remote_datareader(). Security Exception[%d.%d]: %C\n"),
5315  se.code, se.minor_code, se.message.in()));
5316  }
5317  } else {
5318  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::generate_remote_matched_reader_crypto_handle() - ")
5319  ACE_TEXT("Unable to lookup remote participant crypto info.\n")));
5320  }
5321  return result;
5322 }
5323 
5324 void
5328 {
5329  DDS::Security::SecurityException se = {"", 0, 0};
5330  DDS::Security::CryptoKeyExchange_var key_exchange = spdp_.get_security_config()->get_crypto_key_exchange();
5331 
5332  if (!key_exchange->create_local_datareader_crypto_tokens(drcts, drch, dwch, se)) {
5333  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: ")
5334  ACE_TEXT("Sedp::create_datareader_crypto_tokens() - ")
5335  ACE_TEXT("Unable to create local datareader crypto tokens with crypto key exchange plugin. ")
5336  ACE_TEXT("Security Exception[%d.%d]: %C\n"), se.code, se.minor_code, se.message.in()));
5337  }
5338 }
5339 
5340 void
5342  const GUID_t& remote_writer,
5344 {
5345  if (drcts.length() != 0) {
5346  const DCPS::GUID_t remote_part = make_id(remote_writer, ENTITYID_PARTICIPANT);
5347  const DCPS::GUID_t local_volatile_writer = make_id(
5349  const DCPS::GUID_t remote_volatile_reader = make_id(
5351 
5353  msg.message_identity.source_guid = local_volatile_writer;
5355  msg.destination_participant_guid = remote_part;
5356  msg.destination_endpoint_guid = remote_writer;
5357  msg.source_endpoint_guid = local_reader;
5358  msg.message_data = reinterpret_cast<const DDS::Security::DataHolderSeq&>(drcts);
5360 
5361  if (write_volatile_message(msg, remote_volatile_reader) != DDS::RETCODE_OK) {
5362  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::send_datareader_crypto_tokens() - ")
5363  ACE_TEXT("Unable to write volatile message.\n")));
5364  }
5365  }
5366 }
5367 
5368 void
5372 {
5373  DDS::Security::SecurityException se = {"", 0, 0};
5374  DDS::Security::CryptoKeyExchange_var key_exchange = spdp_.get_security_config()->get_crypto_key_exchange();
5375 
5376  if (!key_exchange->create_local_datawriter_crypto_tokens(dwcts, dwch, drch, se)) {
5377  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: ")
5378  ACE_TEXT("Sedp::create_datawriter_crypto_tokens() - ")
5379  ACE_TEXT("Unable to create local datawriter crypto tokens with crypto key exchange plugin. ")
5380  ACE_TEXT("Security Exception[%d.%d]: %C\n"), se.code, se.minor_code, se.message.in()));
5381  }
5382 }
5383 
5384 void
5386  const GUID_t& remote_reader,
5388 {
5389  if (dwcts.length() != 0) {
5390  const DCPS::GUID_t remote_part = make_id(remote_reader, ENTITYID_PARTICIPANT);
5391  const DCPS::GUID_t local_volatile_writer = make_id(
5393  const DCPS::GUID_t remote_volatile_reader = make_id(
5395 
5397  msg.message_identity.source_guid = local_volatile_writer;
5399  msg.destination_participant_guid = remote_part;
5400  msg.destination_endpoint_guid = remote_reader;
5401  msg.source_endpoint_guid = local_writer;
5402  msg.message_data = reinterpret_cast<const DDS::Security::DataHolderSeq&>(dwcts);
5404 
5405  if (write_volatile_message(msg, remote_volatile_reader) != DDS::RETCODE_OK) {
5406  ACE_DEBUG((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: Sedp::send_datawriter_crypto_tokens() - ")
5407  ACE_TEXT("Unable to write volatile message.\n")));
5408  }
5409  }
5410 }
5411 
5412 bool
5414  if (DCPS::security_debug.auth_debug) {
5416  ACE_TEXT("(%P|%t) Sedp::handle_datawriter_crypto_tokens() %C\n"),
5418  }
5419 
5420  DDS::Security::SecurityException se = {"", 0, 0};
5421  Security::CryptoKeyExchange_var key_exchange = spdp_.get_security_config()->get_crypto_key_exchange();
5422 
5424 
5429 
5431  dwcts = reinterpret_cast<const DDS::Security::DatawriterCryptoTokenSeq&>(msg.message_data);
5432 
5433  if (dwch == DDS::HANDLE_NIL) {
5434  if (DCPS::security_debug.auth_debug) {
5436  ACE_TEXT("(%P|%t) Sedp::handle_datawriter_crypto_tokens() - ")
5437  ACE_TEXT("received tokens for unknown remote writer %C Caching.\n"),
5439  }
5440 
5442  return true;
5443  }
5444 
5445  if (drch == DDS::HANDLE_NIL) {
5446  if (DCPS::security_debug.auth_debug) {
5448  ACE_TEXT("(%P|%t) Sedp::handle_datawriter_crypto_tokens() - ")
5449  ACE_TEXT("received tokens for unknown local reader. Ignoring.\n")));
5450  }
5451  return false;
5452  }
5453 
5454  if (DCPS::security_debug.auth_debug) {
5456  ACE_TEXT("(%P|%t) Sedp::handle_datawriter_crypto_tokens() from %C drch %d dwch %d count %d\n"),
5457  DCPS::LogGuid(msg.source_endpoint_guid).c_str(), drch, dwch, dwcts.length()));
5458  }
5459 
5460  if (!key_exchange->set_remote_datawriter_crypto_tokens(drch, dwch, dwcts, se)) {
5461  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::handle_datawriter_crypto_tokens() - ")
5462  ACE_TEXT("Unable to set remote datawriter crypto tokens with crypto key exchange plugin. ")
5463  ACE_TEXT("Security Exception[%d.%d]: %C\n"), se.code, se.minor_code, se.message.in()));
5464  return false;
5465  }
5466 
5468  if (iter != spdp_.participants_.end()) {
5469  process_association_records_i(iter->second);
5470  }
5471 
5472  return true;
5473 }
5474 
5475 bool
5477  if (DCPS::security_debug.auth_debug) {
5479  ACE_TEXT("(%P|%t) Sedp::handle_datareader_crypto_tokens() %C\n"),
5481  }
5482 
5483  DDS::Security::SecurityException se = {"", 0, 0};
5484  Security::CryptoKeyExchange_var key_exchange = spdp_.get_security_config()->get_crypto_key_exchange();
5485 
5487 
5492 
5494  drcts = reinterpret_cast<const DDS::Security::DatareaderCryptoTokenSeq&>(msg.message_data);
5495 
5496  if (drch == DDS::HANDLE_NIL) {
5497  if (DCPS::security_debug.auth_debug) {
5499  ACE_TEXT("(%P|%t) Sedp::handle_datareader_crypto_tokens() - ")
5500  ACE_TEXT("received tokens for unknown remote reader %C Caching.\n"),
5502  }
5503 
5505  return true;
5506  }
5507 
5508  if (dwch == DDS::HANDLE_NIL) {
5509  if (DCPS::security_debug.auth_debug) {
5511  ACE_TEXT("(%P|%t) Sedp::handle_datareader_crypto_tokens() - ")
5512  ACE_TEXT("received tokens for unknown local writer. Ignoring.\n")));
5513  }
5514  return false;
5515  }
5516 
5517  if (DCPS::security_debug.auth_debug) {
5519  ACE_TEXT("(%P|%t) Sedp::handle_datareader_crypto_tokens() from %C dwch %d drch %d count %d\n"),
5520  DCPS::LogGuid(msg.source_endpoint_guid).c_str(), dwch, drch, drcts.length()));
5521  }
5522 
5523  if (!key_exchange->set_remote_datareader_crypto_tokens(dwch, drch, drcts, se)) {
5524  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Sedp::handle_datareader_crypto_tokens() - ")
5525  ACE_TEXT("Unable to set remote datareader crypto tokens with crypto key exchange plugin. ")
5526  ACE_TEXT("Security Exception[%d.%d]: %C\n"), se.code, se.minor_code, se.message.in()));
5527  return false;
5528  }
5529 
5531  if (iter != spdp_.participants_.end()) {
5532  process_association_records_i(iter->second);
5533  }
5534 
5535  return true;
5536 }
5537 
5539  return spdp_.get_domain_id();
5540 }
5541 
5543 {
5544  const GUID_t remote_participant = make_id(id, ENTITYID_PARTICIPANT);
5545 
5546  if (DCPS::security_debug.bookkeeping) {
5547  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
5548  ACE_TEXT("Sedp::resend_user_crypto_tokens(%C)\n"),
5549  DCPS::LogGuid(remote_participant).c_str()));
5550  }
5551 
5552  /*
5553  * For each user DataReader that has a crypto handle, send tokens to matched
5554  * DataWriters that have a crypto handle.
5555  */
5556 
5557  for (LocalSubscriptionCIter reader_pos = local_subscriptions_.begin(),
5558  reader_limit = local_subscriptions_.end();
5559  reader_pos != reader_limit; ++reader_pos) {
5560  if (!DCPS::GuidConverter(reader_pos->first).isUserDomainEntity()) {
5561  continue;
5562  }
5565  if (drch == DDS::HANDLE_NIL) {
5566  continue;
5567  }
5568  for (DCPS::RepoIdSet::const_iterator writer_pos = reader_pos->second.matched_endpoints_.begin(),
5569  writer_limit = reader_pos->second.matched_endpoints_.end();
5570  writer_pos != writer_limit; ++writer_pos) {
5571  if (!DCPS::equal_guid_prefixes(*writer_pos, remote_participant)) {
5572  continue;
5573  }
5576  if (dwch == DDS::HANDLE_NIL) {
5577  continue;
5578  }
5579  create_and_send_datareader_crypto_tokens(drch, reader_pos->first, dwch, *writer_pos);
5580  }
5581  }
5582 
5583  /*
5584  * For each user DataWriter that has a crypto handle, send tokens to matched
5585  * DataReaders that have a crypto handle.
5586  */
5587  for (LocalPublicationCIter writer_pos = local_publications_.begin(),
5588  writer_limit = local_publications_.end();
5589  writer_pos != writer_limit; ++writer_pos) {
5590  if (!DCPS::GuidConverter(writer_pos->first).isUserDomainEntity()) {
5591  continue;
5592  }
5595  if (dwch == DDS::HANDLE_NIL) {
5596  continue;
5597  }
5598  for (DCPS::RepoIdSet::const_iterator reader_pos = writer_pos->second.matched_endpoints_.begin(),
5599  reader_limit = writer_pos->second.matched_endpoints_.end();
5600  reader_pos != reader_limit; ++reader_pos) {
5601  if (!DCPS::equal_guid_prefixes(*reader_pos, remote_participant)) {
5602  continue;
5603  }
5606  if (drch == DDS::HANDLE_NIL) {
5607  continue;
5608  }
5609  create_and_send_datawriter_crypto_tokens(dwch, writer_pos->first, drch, *reader_pos);
5610  }
5611  }
5612 }
5613 #endif
5614 
5615 void
5616 Sedp::add_assoc_i(const DCPS::GUID_t& local_guid, const LocalPublication& lpub,
5617  const DCPS::GUID_t& remote_guid, const DiscoveredSubscription& dsub) {
5618 #ifdef OPENDDS_SECURITY
5620  if (pl) {
5621  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5622  if (endpoint && dsub.have_ice_agent_info_) {
5623  ice_agent_->start_ice(endpoint, local_guid, remote_guid, dsub.ice_agent_info_);
5624  }
5625  }
5626 #else
5627  ACE_UNUSED_ARG(local_guid);
5628  ACE_UNUSED_ARG(lpub);
5629  ACE_UNUSED_ARG(remote_guid);
5630  ACE_UNUSED_ARG(dsub);
5631 #endif
5632 }
5633 
5634 void
5635 Sedp::remove_assoc_i(const DCPS::GUID_t& local_guid, const LocalPublication& lpub,
5636  const DCPS::GUID_t& remote_guid) {
5637 #ifdef OPENDDS_SECURITY
5639  if (pl) {
5640  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5641  if (endpoint) {
5642  ice_agent_->stop_ice(endpoint, local_guid, remote_guid);
5643  }
5644  }
5645 #else
5646  ACE_UNUSED_ARG(local_guid);
5647  ACE_UNUSED_ARG(lpub);
5648  ACE_UNUSED_ARG(remote_guid);
5649 #endif
5650 }
5651 
5652 void
5653 Sedp::add_assoc_i(const DCPS::GUID_t& local_guid, const LocalSubscription& lsub,
5654  const DCPS::GUID_t& remote_guid, const DiscoveredPublication& dpub) {
5655 #ifdef OPENDDS_SECURITY
5657  if (sl) {
5658  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5659  if (endpoint && dpub.have_ice_agent_info_) {
5660  ice_agent_->start_ice(endpoint, local_guid, remote_guid, dpub.ice_agent_info_);
5661  }
5662  }
5663 #else
5664  ACE_UNUSED_ARG(local_guid);
5665  ACE_UNUSED_ARG(lsub);
5666  ACE_UNUSED_ARG(remote_guid);
5667  ACE_UNUSED_ARG(dpub);
5668 #endif
5669 }
5670 
5671 void
5672 Sedp::remove_assoc_i(const DCPS::GUID_t& local_guid, const LocalSubscription& lsub,
5673  const DCPS::GUID_t& remote_guid) {
5674 #ifdef OPENDDS_SECURITY
5676  if (sl) {
5677  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5678  if (endpoint) {
5679  ice_agent_->stop_ice(endpoint, local_guid, remote_guid);
5680  }
5681  }
5682 #else
5683  ACE_UNUSED_ARG(local_guid);
5684  ACE_UNUSED_ARG(lsub);
5685  ACE_UNUSED_ARG(remote_guid);
5686 #endif
5687 }
5688 
5689 #ifdef OPENDDS_SECURITY
5690 void
5692  const ICE::AgentInfo& a_agent_info)
5693 {
5694  ACE_GUARD(ACE_Thread_Mutex, g, sedp.lock_);
5695  LocalPublicationIter pos = sedp.local_publications_.find(a_local_guid);
5696  if (pos != sedp.local_publications_.end()) {
5697  pos->second.have_ice_agent_info = true;
5698  pos->second.ice_agent_info = a_agent_info;
5699  sedp.write_publication_data(a_local_guid, pos->second);
5700  }
5701 }
5702 
5703 void
5705 {
5706  ACE_GUARD(ACE_Thread_Mutex, g, sedp.lock_);
5707  LocalPublicationIter pos = sedp.local_publications_.find(a_local_guid);
5708  if (pos != sedp.local_publications_.end()) {
5709  pos->second.have_ice_agent_info = false;
5710  sedp.write_publication_data(a_local_guid, pos->second);
5711  }
5712 }
5713 
5714 void
5716  const ICE::AgentInfo& a_agent_info)
5717 {
5718  ACE_GUARD(ACE_Thread_Mutex, g, sedp.lock_);
5719  LocalSubscriptionIter pos = sedp.local_subscriptions_.find(a_local_guid);
5720  if (pos != sedp.local_subscriptions_.end()) {
5721  pos->second.have_ice_agent_info = true;
5722  pos->second.ice_agent_info = a_agent_info;
5723  sedp.write_subscription_data(a_local_guid, pos->second);
5724  }
5725 }
5726 
5727 void
5729 {
5730  ACE_GUARD(ACE_Thread_Mutex, g, sedp.lock_);
5731  LocalSubscriptionIter pos = sedp.local_subscriptions_.find(a_local_guid);
5732  if (pos != sedp.local_subscriptions_.end()) {
5733  pos->second.have_ice_agent_info = false;
5734  sedp.write_subscription_data(a_local_guid, pos->second);
5735  }
5736 }
5737 #endif
5738 
5739 void
5740 Sedp::start_ice(const DCPS::GUID_t& guid, const LocalPublication& lpub) {
5741 #ifdef OPENDDS_SECURITY
5743  if (pl) {
5744  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5745 
5746  if (!endpoint || !lpub.have_ice_agent_info) {
5747  return;
5748  }
5749 
5750  for (DCPS::RepoIdSet::const_iterator it = lpub.matched_endpoints_.begin(),
5751  end = lpub.matched_endpoints_.end(); it != end; ++it) {
5753  if (dsi != discovered_subscriptions_.end()) {
5754  if (dsi->second.have_ice_agent_info_) {
5755  ice_agent_->start_ice(endpoint, guid, dsi->first, dsi->second.ice_agent_info_);
5756  }
5757  }
5758  }
5759  }
5760 #else
5761  ACE_UNUSED_ARG(guid);
5762  ACE_UNUSED_ARG(lpub);
5763 #endif
5764 }
5765 
5766 void
5767 Sedp::start_ice(const DCPS::GUID_t& guid, const LocalSubscription& lsub) {
5768 #ifdef OPENDDS_SECURITY
5770  if (sl) {
5771  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5772 
5773  if (!endpoint || !lsub.have_ice_agent_info) {
5774  return;
5775  }
5776 
5777  for (DCPS::RepoIdSet::const_iterator it = lsub.matched_endpoints_.begin(),
5778  end = lsub.matched_endpoints_.end(); it != end; ++it) {
5780  if (dpi != discovered_publications_.end()) {
5781  if (dpi->second.have_ice_agent_info_) {
5782  ice_agent_->start_ice(endpoint, guid, dpi->first, dpi->second.ice_agent_info_);
5783  }
5784  }
5785  }
5786  }
5787 #else
5788  ACE_UNUSED_ARG(guid);
5789  ACE_UNUSED_ARG(lsub);
5790 #endif
5791 }
5792 
5793 void
5794 Sedp::start_ice(const DCPS::GUID_t& guid, const DiscoveredPublication& dpub) {
5795 #ifdef OPENDDS_SECURITY
5796  if (!dpub.have_ice_agent_info_) {
5797  return;
5798  }
5799 
5800  for (DCPS::RepoIdSet::const_iterator it = dpub.matched_endpoints_.begin(),
5801  end = dpub.matched_endpoints_.end(); it != end; ++it) {
5803  if (lsi != local_subscriptions_.end() &&
5804  lsi->second.matched_endpoints_.count(guid)) {
5805  DCPS::DataReaderCallbacks_rch sl = lsi->second.subscription_.lock();
5806  if (sl) {
5807  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5808  if (endpoint) {
5809  ice_agent_->start_ice(endpoint, lsi->first, guid, dpub.ice_agent_info_);
5810  }
5811  }
5812  }
5813  }
5814 #else
5815  ACE_UNUSED_ARG(guid);
5816  ACE_UNUSED_ARG(dpub);
5817 #endif
5818 }
5819 
5820 void
5821 Sedp::start_ice(const DCPS::GUID_t& guid, const DiscoveredSubscription& dsub) {
5822 #ifdef OPENDDS_SECURITY
5823  if (!dsub.have_ice_agent_info_) {
5824  return;
5825  }
5826 
5827  for (DCPS::RepoIdSet::const_iterator it = dsub.matched_endpoints_.begin(),
5828  end = dsub.matched_endpoints_.end(); it != end; ++it) {
5829  const DCPS::GuidConverter conv(*it);
5830  if (conv.isWriter()) {
5831  LocalPublicationIter lpi = local_publications_.find(*it);
5832  if (lpi != local_publications_.end() &&
5833  lpi->second.matched_endpoints_.count(guid)) {
5834  DCPS::DataWriterCallbacks_rch pl = lpi->second.publication_.lock();
5835  if (pl) {
5836  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5837  if (endpoint) {
5838  ice_agent_->start_ice(endpoint, lpi->first, guid, dsub.ice_agent_info_);
5839  }
5840  }
5841  }
5842  }
5843  }
5844 #else
5845  ACE_UNUSED_ARG(guid);
5846  ACE_UNUSED_ARG(dsub);
5847 #endif
5848 }
5849 
5850 void
5851 Sedp::stop_ice(const DCPS::GUID_t& guid, const DiscoveredPublication& dpub)
5852 {
5853 #ifdef OPENDDS_SECURITY
5854  for (DCPS::RepoIdSet::const_iterator it = dpub.matched_endpoints_.begin(),
5855  end = dpub.matched_endpoints_.end(); it != end; ++it) {
5856  const DCPS::GuidConverter conv(*it);
5857  if (conv.isReader()) {
5859  if (lsi != local_subscriptions_.end() &&
5860  lsi->second.matched_endpoints_.count(guid)) {
5861  DCPS::DataReaderCallbacks_rch sl = lsi->second.subscription_.lock();
5862  if (sl) {
5863  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5864  if (endpoint) {
5865  ice_agent_->stop_ice(endpoint, lsi->first, guid);
5866  }
5867  }
5868  }
5869  }
5870  }
5871 #else
5872  ACE_UNUSED_ARG(guid);
5873  ACE_UNUSED_ARG(dpub);
5874 #endif
5875 }
5876 
5877 void
5878 Sedp::stop_ice(const DCPS::GUID_t& guid, const DiscoveredSubscription& dsub)
5879 {
5880 #ifdef OPENDDS_SECURITY
5881  for (DCPS::RepoIdSet::const_iterator it = dsub.matched_endpoints_.begin(),
5882  end = dsub.matched_endpoints_.end(); it != end; ++it) {
5883  const DCPS::GuidConverter conv(*it);
5884  if (conv.isWriter()) {
5885  LocalPublicationIter lpi = local_publications_.find(*it);
5886  if (lpi != local_publications_.end() &&
5887  lpi->second.matched_endpoints_.count(guid)) {
5888  DCPS::DataWriterCallbacks_rch pl = lpi->second.publication_.lock();
5889  if (pl) {
5890  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5891  if (endpoint) {
5892  ice_agent_->stop_ice(endpoint, lpi->first, guid);
5893  }
5894  }
5895  }
5896  }
5897  }
5898 #else
5899  ACE_UNUSED_ARG(guid);
5900  ACE_UNUSED_ARG(dsub);
5901 #endif
5902 }
5903 
5904 void
5906 {
5908 }
5909 
5910 void
5912 {
5914 }
5915 
5916 void
5918 {
5920 
5921 #ifdef OPENDDS_SECURITY
5922  if (!f) {
5923  return;
5924  }
5925 
5927 
5928  for (LocalPublicationIter pos = local_publications_.begin(), limit = local_publications_.end(); pos != limit; ++pos) {
5929  LocalPublication& pub = pos->second;
5931  if (pl) {
5932  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = pl->get_ice_endpoint();
5933  if (endpoint) {
5934  pub.have_ice_agent_info = true;
5935  pub.ice_agent_info = ice_agent_->get_local_agent_info(endpoint);
5936  ice_agent_->add_local_agent_info_listener(endpoint, pos->first, DCPS::static_rchandle_cast<ICE::AgentInfoListener>(publication_agent_info_listener_));
5937  start_ice(pos->first, pub);
5938  }
5939  }
5940  }
5941  for (LocalSubscriptionIter pos = local_subscriptions_.begin(), limit = local_subscriptions_.end(); pos != limit; ++pos) {
5942  LocalSubscription& sub = pos->second;
5944  if (sl) {
5945  DCPS::WeakRcHandle<ICE::Endpoint> endpoint = sl->get_ice_endpoint();
5946  if (endpoint) {
5947  sub.have_ice_agent_info = true;
5948  sub.ice_agent_info = ice_agent_->get_local_agent_info(endpoint);
5949  ice_agent_->add_local_agent_info_listener(endpoint, pos->first, DCPS::static_rchandle_cast<ICE::AgentInfoListener>(subscription_agent_info_listener_));
5950  start_ice(pos->first, sub);
5951  }
5952  }
5953  }
5954 #endif
5955 }
5956 
5957 void
5959 {
5961  {
5962  ACE_GUARD(ACE_Thread_Mutex, g, rtps_inst->config_lock_);
5963  rtps_inst->rtps_relay_address_ = address;
5964  }
5965  rtps_inst->rtps_relay_address_change();
5966 }
5967 
5968 void
5970 {
5972  ACE_GUARD(ACE_Thread_Mutex, g, rtps_inst->config_lock_);
5973  rtps_inst->stun_server_address_ = address;
5974 }
5975 
5976 void
5978 {
5980 }
5981 
5983  const ParticipantProxy_t& y)
5984 {
5985  return locatorsChanged(x, y);
5986 }
5987 
5988 void Sedp::ignore(const GUID_t& to_ignore)
5989 {
5990  // Locked prior to call from Spdp.
5991  ignored_guids_.insert(to_ignore);
5992  {
5993  const DiscoveredPublicationIter iter =
5994  discovered_publications_.find(to_ignore);
5995  if (iter != discovered_publications_.end()) {
5996  // clean up tracking info
5997  const String topic_name = iter->second.get_topic_name();
5998  DCPS::TopicDetails& td = topics_[topic_name];
5999  td.remove_discovered_publication(to_ignore);
6000  remove_from_bit(iter->second);
6001  discovered_publications_.erase(iter);
6002  // break associations
6003  match_endpoints(to_ignore, td, true /*remove*/);
6004  if (td.is_dead()) {
6005  purge_dead_topic(topic_name);
6006  }
6007  return;
6008  }
6009  }
6010  {
6011  const DiscoveredSubscriptionIter iter =
6012  discovered_subscriptions_.find(to_ignore);
6013  if (iter != discovered_subscriptions_.end()) {
6014  // clean up tracking info
6015  const String topic_name = iter->second.get_topic_name();
6016  DCPS::TopicDetails& td = topics_[topic_name];
6017  td.remove_discovered_publication(to_ignore);
6018  remove_from_bit(iter->second);
6019  discovered_subscriptions_.erase(iter);
6020  // break associations
6021  match_endpoints(to_ignore, td, true /*remove*/);
6022  if (td.is_dead()) {
6023  purge_dead_topic(topic_name);
6024  }
6025  return;
6026  }
6027  }
6028  {
6029  const OPENDDS_MAP_CMP(GUID_t, String, GUID_tKeyLessThan)::iterator
6030  iter = topic_names_.find(to_ignore);
6031  if (iter != topic_names_.end()) {
6032  ignored_topics_.insert(iter->second);
6033  // Remove all publications and subscriptions on this topic
6034  DCPS::TopicDetails& td = topics_[iter->second];
6035  {
6036  const RepoIdSet ids = td.discovered_publications();
6037  for (RepoIdSet::const_iterator ep = ids.begin(); ep!= ids.end(); ++ep) {
6038  match_endpoints(*ep, td, true /*remove*/);
6040  // TODO: Do we need to remove from discovered_subscriptions?
6041  if (shutting_down()) { return; }
6042  }
6043  }
6044  {
6045  const RepoIdSet ids = td.discovered_subscriptions();
6046  for (RepoIdSet::const_iterator ep = ids.begin(); ep!= ids.end(); ++ep) {
6047  match_endpoints(*ep, td, true /*remove*/);
6049  // TODO: Do we need to remove from discovered_publications?
6050  if (shutting_down()) { return; }
6051  }
6052  }
6053  if (td.is_dead()) {
6054  purge_dead_topic(iter->second);
6055  }
6056  }
6057  }
6058 }
6059 
6061  GUID_t& topicId, const char* topicName,
6062  const char* dataTypeName, const DDS::TopicQos& qos,
6063  bool hasDcpsKey, DCPS::TopicCallbacks* topic_callbacks)
6064 {
6066  DCPS::TopicDetailsMap::iterator iter = topics_.find(topicName);
6067  if (iter != topics_.end()) {
6068  if (iter->second.local_is_set() && iter->second.local_data_type_name() != dataTypeName) {
6070  }
6071  topicId = iter->second.topic_id();
6072  iter->second.set_local(dataTypeName, qos, hasDcpsKey, topic_callbacks);
6073  return DCPS::FOUND;
6074  }
6075 
6076  DCPS::TopicDetails& td = topics_[topicName];
6077  topicId = make_topic_guid();
6078  td.init(topicName, topicId);
6079  topic_names_[topicId] = topicName;
6080  td.set_local(dataTypeName, qos, hasDcpsKey, topic_callbacks);
6081 
6082  return DCPS::CREATED;
6083 }
6084 
6086  const char* topicName,
6087  CORBA::String_out dataTypeName,
6088  DDS::TopicQos_out qos,
6089  GUID_t& topicId)
6090 {
6092  DCPS::TopicDetailsMap::const_iterator iter = topics_.find(topicName);
6093  if (iter == topics_.end()) {
6094  return DCPS::NOT_FOUND;
6095  }
6096 
6097  const DCPS::TopicDetails& td = iter->second;
6098 
6099  dataTypeName = td.local_data_type_name().c_str();
6100  qos = new DDS::TopicQos(td.local_qos());
6101  topicId = td.topic_id();
6102  return DCPS::FOUND;
6103 }
6104 
6106 {
6108  TopicNameMap::iterator name_iter = topic_names_.find(topicId);
6109  if (name_iter == topic_names_.end()) {
6110  return DCPS::NOT_FOUND;
6111  }
6112  const String& name = name_iter->second;
6114  td.unset_local();
6115  if (td.is_dead()) {
6116  purge_dead_topic(name);
6117  }
6118 
6119  return DCPS::REMOVED;
6120 }
6121 
6123  const GUID_t& topicId,
6124  DCPS::DataWriterCallbacks_rch publication,
6125  const DDS::DataWriterQos& qos,
6126  const DCPS::TransportLocatorSeq& transInfo,
6127  const DDS::PublisherQos& publisherQos,
6128  const XTypes::TypeInformation& type_info)
6129 {
6131 
6132  GUID_t rid = participant_id_;
6133  assign_publication_key(rid, topicId, qos);
6135  pb.topic_id_ = topicId;
6136  pb.publication_ = publication;
6137  pb.qos_ = qos;
6138  pb.trans_info_ = transInfo;
6139  pb.publisher_qos_ = publisherQos;
6140  pb.type_info_ = type_info;
6141  const String& topic_name = topic_names_[topicId];
6142 
6143 #ifdef OPENDDS_SECURITY
6144  if (is_security_enabled()) {
6146 
6149  if (!get_access_control()->get_topic_sec_attributes(permh, topic_name.data(), topic_sec_attr, ex)) {
6151  ACE_TEXT("(%P|%t) ERROR: ")
6152  ACE_TEXT("Sedp::add_publication: ")
6153  ACE_TEXT("Unable to get security attributes for topic '%C'. SecurityException[%d.%d]: %C\n"),
6154  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
6155  return GUID_t();
6156  }
6157 
6158  if (topic_sec_attr.is_write_protected) {
6159  if (!get_access_control()->check_create_datawriter(
6160  permh, get_domain_id(), topic_name.data(), qos,
6161  publisherQos.partition, DDS::Security::DataTagQosPolicy(), ex)) {
6162  ACE_ERROR((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: ")
6163  ACE_TEXT("Sedp::add_publication: ")
6164  ACE_TEXT("Permissions check failed for local datawriter on topic '%C'. ")
6165  ACE_TEXT("Security Exception[%d.%d]: %C\n"), topic_name.data(),
6166  ex.code, ex.minor_code, ex.message.in()));
6167  return GUID_t();
6168  }
6169  }
6170 
6171  if (!get_access_control()->get_datawriter_sec_attributes(permh, topic_name.data(),
6172  publisherQos.partition, DDS::Security::DataTagQosPolicy(), pb.security_attribs_, ex)) {
6173  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
6174  ACE_TEXT("Sedp::add_publication: ")
6175  ACE_TEXT("Unable to get security attributes for local datawriter. ")
6176  ACE_TEXT("Security Exception[%d.%d]: %C\n"),
6177  ex.code, ex.minor_code, ex.message.in()));
6178  return GUID_t();
6179  }
6180 
6183  get_crypto_key_factory()->register_local_datawriter(
6185  if (handle == DDS::HANDLE_NIL) {
6186  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
6187  ACE_TEXT("Sedp::add_publication: ")
6188  ACE_TEXT("Unable to get local datawriter crypto handle. ")
6189  ACE_TEXT("Security Exception[%d.%d]: %C\n"),
6190  ex.code, ex.minor_code, ex.message.in()));
6191  }
6192 
6194  }
6195  }
6196 #endif
6197 
6198  DCPS::TopicDetails& td = topics_[topic_name];
6199  td.add_local_publication(rid);
6200 
6201  if (DDS::RETCODE_OK != add_publication_i(rid, pb)) {
6202  return GUID_t();
6203  }
6204 
6205  if (DDS::RETCODE_OK != write_publication_data(rid, pb)) {
6206  return GUID_t();
6207  }
6208 
6209  if (DCPS_debug_level > 3) {
6210  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::add_publication: ")
6211  ACE_TEXT("calling match_endpoints\n")));
6212  }
6213  match_endpoints(rid, td);
6214 
6215  return rid;
6216 }
6217 
6218 void Sedp::remove_publication(const GUID_t& publicationId)
6219 {
6221  LocalPublicationIter iter = local_publications_.find(publicationId);
6222  if (iter != local_publications_.end()) {
6223  if (DDS::RETCODE_OK == remove_publication_i(publicationId, iter->second)) {
6224  String topic_name = topic_names_[iter->second.topic_id_];
6225 #ifdef OPENDDS_SECURITY
6226  if (is_security_enabled()) {
6227  cleanup_secure_writer(publicationId);
6228  }
6229 #endif
6230  local_publications_.erase(publicationId);
6231  DCPS::TopicDetailsMap::iterator top_it = topics_.find(topic_name);
6232  if (top_it != topics_.end()) {
6233  match_endpoints(publicationId, top_it->second, true /*remove*/);
6234  top_it->second.remove_local_publication(publicationId);
6235  // Local, no need to check for dead topic.
6236  }
6237  } else {
6239  ACE_TEXT("(%P|%t) ERROR: Sedp::remove_publication: ")
6240  ACE_TEXT("Failed to publish dispose msg\n")));
6241  }
6242  }
6243 }
6244 
6245 void Sedp::update_publication_locators(const GUID_t& publicationId,
6246  const DCPS::TransportLocatorSeq& transInfo)
6247 {
6249  LocalPublicationIter iter = local_publications_.find(publicationId);
6250  if (iter != local_publications_.end()) {
6251  if (DCPS_debug_level > 3) {
6252  ACE_DEBUG((LM_INFO,
6253  ACE_TEXT("(%P|%t) Sedp::update_publication_locators: updating locators for %C\n"),
6254  LogGuid(publicationId).c_str()));
6255  }
6256  iter->second.trans_info_ = transInfo;
6257  write_publication_data(publicationId, iter->second);
6258  }
6259 }
6260 
6262  const GUID_t& topicId,
6263  DCPS::DataReaderCallbacks_rch subscription,
6264  const DDS::DataReaderQos& qos,
6265  const DCPS::TransportLocatorSeq& transInfo,
6266  const DDS::SubscriberQos& subscriberQos,
6267  const char* filterClassName,
6268  const char* filterExpr,
6269  const DDS::StringSeq& params,
6270  const XTypes::TypeInformation& type_info)
6271 {
6273 
6274  GUID_t rid = participant_id_;
6275  assign_subscription_key(rid, topicId, qos);
6277  sb.topic_id_ = topicId;
6278  sb.subscription_ = subscription;
6279  sb.qos_ = qos;
6280  sb.trans_info_ = transInfo;
6281  sb.subscriber_qos_ = subscriberQos;
6282  sb.filterProperties.filterClassName = filterClassName;
6283  sb.filterProperties.filterExpression = filterExpr;
6285  sb.type_info_ = type_info;
6286  const String& topic_name = topic_names_[topicId];
6287 
6288 #ifdef OPENDDS_SECURITY
6289  if (is_security_enabled()) {
6291 
6293  if (!get_access_control()->get_topic_sec_attributes(
6294  get_permissions_handle(), topic_name.data(), topic_sec_attr, ex)) {
6296  ACE_TEXT("(%P|%t) ERROR: ")
6297  ACE_TEXT("Sedp::add_subscription: ")
6298  ACE_TEXT("Unable to get security attributes for topic '%C'. ")
6299  ACE_TEXT("SecurityException[%d.%d]: %C\n"),
6300  topic_name.data(), ex.code, ex.minor_code, ex.message.in()));
6301  return GUID_t();
6302  }
6303 
6304  if (topic_sec_attr.is_read_protected) {
6305  if (!get_access_control()->check_create_datareader(
6306  get_permissions_handle(), get_domain_id(), topic_name.data(), qos,
6307  subscriberQos.partition, DDS::Security::DataTagQosPolicy(), ex)) {
6308  ACE_ERROR((LM_WARNING, ACE_TEXT("(%P|%t) WARNING: ")
6309  ACE_TEXT("Sedp::add_subscription: ")
6310  ACE_TEXT("Permissions check failed for local datareader on topic '%C'. ")
6311  ACE_TEXT("Security Exception[%d.%d]: %C\n"), topic_name.data(),
6312  ex.code, ex.minor_code, ex.message.in()));
6313  return GUID_t();
6314  }
6315  }
6316 
6317  if (!get_access_control()->get_datareader_sec_attributes(get_permissions_handle(), topic_name.data(),
6318  subscriberQos.partition, DDS::Security::DataTagQosPolicy(), sb.security_attribs_, ex)) {
6319  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
6320  ACE_TEXT("Sedp::add_subscription: ")
6321  ACE_TEXT("Unable to get security attributes for local datareader. ")
6322  ACE_TEXT("Security Exception[%d.%d]: %C\n"),
6323  ex.code, ex.minor_code, ex.message.in()));
6324  return GUID_t();
6325  }
6326 
6329  get_crypto_key_factory()->register_local_datareader(
6331  if (handle == DDS::HANDLE_NIL) {
6332  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
6333  ACE_TEXT("Sedp::add_subscription: ")
6334  ACE_TEXT("Unable to get local datareader crypto handle. ")
6335  ACE_TEXT("Security Exception[%d.%d]: %C\n"),
6336  ex.code, ex.minor_code, ex.message.in()));
6337  }
6338 
6340  }
6341  }
6342 #endif
6343 
6344  DCPS::TopicDetails& td = topics_[topic_name];
6345  td.add_local_subscription(rid);
6346 
6347  if (DDS::RETCODE_OK != add_subscription_i(rid, sb)) {
6348  return GUID_t();
6349  }
6350 
6351  if (DDS::RETCODE_OK != write_subscription_data(rid, sb)) {
6352  return GUID_t();
6353  }
6354 
6355  if (DCPS_debug_level > 3) {
6356  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::add_subscription: ")
6357  ACE_TEXT("calling match_endpoints\n")));
6358  }
6359  match_endpoints(rid, td);
6360 
6361  return rid;
6362 }
6363 
6364 void Sedp::remove_subscription(const GUID_t& subscriptionId)
6365 {
6367  LocalSubscriptionIter iter = local_subscriptions_.find(subscriptionId);
6368  if (iter != local_subscriptions_.end()) {
6369  if (DDS::RETCODE_OK == remove_subscription_i(subscriptionId, iter->second)) {
6370  String topic_name = topic_names_[iter->second.topic_id_];
6371 #ifdef OPENDDS_SECURITY
6372  if (is_security_enabled()) {
6373  cleanup_secure_reader(subscriptionId);
6374  }
6375 #endif
6376  local_subscriptions_.erase(subscriptionId);
6377  DCPS::TopicDetailsMap::iterator top_it = topics_.find(topic_name);
6378  if (top_it != topics_.end()) {
6379  match_endpoints(subscriptionId, top_it->second, true /*remove*/);
6380  top_it->second.remove_local_subscription(subscriptionId);
6381  // Local, no need to check for dead topic.
6382  }
6383  } else {
6385  ACE_TEXT("(%P|%t) ERROR: Sedp::remove_subscription - ")
6386  ACE_TEXT("Failed to publish dispose msg\n")));
6387  }
6388  }
6389 }
6390 
6392  const GUID_t& subscriptionId,
6393  const DCPS::TransportLocatorSeq& transInfo)
6394 {
6396  LocalSubscriptionIter iter = local_subscriptions_.find(subscriptionId);
6397  if (iter != local_subscriptions_.end()) {
6398  if (DCPS_debug_level > 3) {
6399  ACE_DEBUG((LM_INFO,
6400  ACE_TEXT("(%P|%t) Sedp::update_subscription_locators: updating locators for %C\n"),
6401  LogGuid(subscriptionId).c_str()));
6402  }
6403  iter->second.trans_info_ = transInfo;
6404  write_subscription_data(subscriptionId, iter->second);
6405  }
6406 }
6407 
6408 bool Sedp::remote_knows_about_local_i(const GUID_t& local, const GUID_t& remote) const
6409 {
6410  if (DCPS_debug_level > 6) {
6411  ACE_DEBUG((LM_INFO,
6412  ACE_TEXT("(%P|%t) Sedp::remote_knows_about_local_i: local %C remote %C\n"),
6413  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6414  }
6415 
6416  const DCPS::GuidConverter gc(local);
6417  if (gc.isBuiltinDomainEntity()) {
6418  OPENDDS_ASSERT(DCPS::GuidConverter(remote).isBuiltinDomainEntity());
6419  // One improvement to returning true here would be waiting until
6420  // the remote actually sends confirmation that it knows about the
6421  // local. A directed SPDP message from the remote would work.
6422  return true;
6423  }
6424 
6425  if (gc.isWriter()) {
6426  LocalPublicationCIter pub = local_publications_.find(local);
6427  if (pub != local_publications_.end()) {
6428 #ifdef OPENDDS_SECURITY
6429  if (pub->second.security_attribs_.base.is_discovery_protected) {
6431  }
6432 #endif
6434  } else {
6435  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) Sedp::remote_knows_about_local_i - could not find local publication %C\n"), LogGuid(local).c_str()));
6436  return false;
6437  }
6438  } else {
6439  LocalSubscriptionCIter pub = local_subscriptions_.find(local);
6440  if (pub != local_subscriptions_.end()) {
6441 #ifdef OPENDDS_SECURITY
6442  if (pub->second.security_attribs_.base.is_discovery_protected) {
6444  }
6445 #endif
6447  } else {
6448  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) Sedp::remote_knows_about_local_i - could not find local subscription %C\n"), LogGuid(local).c_str()));
6449  return false;
6450  }
6451  }
6452 }
6453 
6454 #ifdef OPENDDS_SECURITY
6455 bool Sedp::remote_is_authenticated_i(const GUID_t& local, const GUID_t& remote, const DiscoveredParticipant& participant) const
6456 {
6457  if (DCPS_debug_level > 6) {
6458  ACE_DEBUG((LM_INFO,
6459  ACE_TEXT("(%P|%t) Sedp::remote_is_authenticated_i: local %C remote %C\n"),
6460  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6461  }
6462 
6463  if (!spdp_.is_security_enabled()) {
6464  return true;
6465  }
6466 
6467  if (is_stateless(local)) {
6468  // Don't need authentication.
6469  return true;
6470  }
6471 
6472  if (!participant.has_security_data()) {
6474  } else {
6475  return participant.auth_state_ == AUTH_STATE_AUTHENTICATED;
6476  }
6477 }
6478 #endif
6479 
6480 #ifdef OPENDDS_SECURITY
6481 bool Sedp::local_has_remote_participant_token_i(const GUID_t& local, const GUID_t& remote) const
6482 {
6483  if (DCPS_debug_level > 6) {
6484  ACE_DEBUG((LM_INFO,
6485  ACE_TEXT("(%P|%t) Sedp::local_has_remote_participant_token_i: local %C remote %C\n"),
6486  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6487  }
6488 
6490  return true;
6491  }
6492 
6493  const GUID_t remote_part = make_id(remote, ENTITYID_PARTICIPANT);
6494 
6495  if (is_stateless_or_volatile(local)) {
6496  // Don't need the token so okay.
6497  return true;
6498  }
6499 
6500  Security::CryptoKeyExchange_var key_exchange = spdp_.security_config_->get_crypto_key_exchange();
6501  const DDS::Security::ParticipantCryptoHandle dp_crypto_handle =
6503 
6504  return !key_exchange->have_local_participant_crypto_tokens(crypto_handle_, dp_crypto_handle) ||
6505  key_exchange->have_remote_participant_crypto_tokens(crypto_handle_, dp_crypto_handle);
6506 }
6507 
6508 bool Sedp::remote_has_local_participant_token_i(const GUID_t& local, const GUID_t& remote, const DiscoveredParticipant& participant) const
6509 {
6510  if (DCPS_debug_level > 6) {
6511  ACE_DEBUG((LM_INFO,
6512  ACE_TEXT("(%P|%t) Sedp::remote_has_local_participant_token_i: local %C remote %C\n"),
6513  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6514  }
6515 
6517  return true;
6518  }
6519 
6520  const GUID_t remote_part = make_id(remote, ENTITYID_PARTICIPANT);
6521 
6522  if (is_stateless_or_volatile(local)) {
6523  // Don't need the token so okay.
6524  return true;
6525  }
6526 
6527  Security::CryptoKeyExchange_var key_exchange = spdp_.security_config_->get_crypto_key_exchange();
6528  const DDS::Security::ParticipantCryptoHandle dp_crypto_handle =
6530 
6531  return !key_exchange->have_local_participant_crypto_tokens(crypto_handle_, dp_crypto_handle) ||
6532  (participant.participant_tokens_sent_ &&
6534 }
6535 
6536 bool Sedp::local_has_remote_endpoint_token_i(const GUID_t& local, const GUID_t& remote) const
6537 {
6538  if (DCPS_debug_level > 6) {
6539  ACE_DEBUG((LM_INFO,
6540  ACE_TEXT("(%P|%t) Sedp::local_has_remote_endpoint_token_i: local %C remote %C\n"),
6541  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6542  }
6543 
6545  return true;
6546  }
6547 
6548  if (is_stateless_or_volatile(local)) {
6549  // Don't need the token so okay.
6550  return true;
6551  }
6552 
6553  Security::CryptoKeyExchange_var key_exchange = spdp_.security_config_->get_crypto_key_exchange();
6554  if (DCPS::GuidConverter(local).isWriter()) {
6555  const DDS::Security::DatawriterCryptoHandle local_crypto_handle =
6557  if (local_crypto_handle == DDS::HANDLE_NIL) {
6558  return true;
6559  }
6560  const DDS::Security::DatareaderCryptoHandle remote_crypto_handle =
6564  return !attribs.is_submessage_protected ||
6565  key_exchange->have_remote_datareader_crypto_tokens(local_crypto_handle, remote_crypto_handle);
6566  } else {
6567  const DDS::Security::DatareaderCryptoHandle local_crypto_handle =
6569  if (local_crypto_handle == DDS::HANDLE_NIL) {
6570  return true;
6571  }
6572  const DDS::Security::DatawriterCryptoHandle remote_crypto_handle =
6576  return (!attribs.is_submessage_protected && !attribs.is_payload_protected) ||
6577  key_exchange->have_remote_datawriter_crypto_tokens(local_crypto_handle, remote_crypto_handle);
6578  }
6579 }
6580 
6581 bool Sedp::remote_has_local_endpoint_token_i(const GUID_t& local, bool local_tokens_sent,
6582  const GUID_t& remote) const
6583 {
6584  if (DCPS_debug_level > 6) {
6585  ACE_DEBUG((LM_INFO,
6586  ACE_TEXT("(%P|%t) Sedp::remote_has_local_endpoint_token_i: local %C remote %C\n"),
6587  LogGuid(local).c_str(), LogGuid(remote).c_str()));
6588  }
6589 
6591  return true;
6592  }
6593 
6594  if (is_stateless_or_volatile(local)) {
6595  // Don't need the token so okay.
6596  return true;
6597  }
6598 
6599  Security::CryptoKeyExchange_var key_exchange = spdp_.security_config_->get_crypto_key_exchange();
6600  if (DCPS::GuidConverter(local).isWriter()) {
6601  const DDS::Security::DatawriterCryptoHandle local_crypto_handle =
6603  const DDS::Security::DatareaderCryptoHandle remote_crypto_handle =
6605  return !key_exchange->have_local_datawriter_crypto_tokens(local_crypto_handle, remote_crypto_handle) ||
6607  } else {
6608  const DDS::Security::DatareaderCryptoHandle local_crypto_handle =
6610  const DDS::Security::DatawriterCryptoHandle remote_crypto_handle =
6612  return !key_exchange->have_local_datareader_crypto_tokens(local_crypto_handle, remote_crypto_handle) ||
6614  }
6615 }
6616 
6617 void Sedp::cleanup_secure_writer(const GUID_t& publicationId)
6618 {
6619  using namespace DDS::Security;
6620 
6622  if (!handle_registry) {
6623  return;
6624  }
6625  const DatawriterCryptoHandle dwch =
6626  handle_registry->get_local_datawriter_crypto_handle(publicationId);
6627  if (dwch == DDS::HANDLE_NIL) {
6628  return;
6629  }
6630 
6631  SecurityException ex = {"", 0, 0};
6632  if (!get_crypto_key_factory()->unregister_datawriter(dwch, ex)) {
6633  if (DCPS::security_debug.cleanup_error) {
6635  ACE_TEXT("(%P|%t) {cleanup_error} Sedp::cleanup_secure_writer() - ")
6636  ACE_TEXT("Failure calling unregister_datawriter. (ch %d)")
6637  ACE_TEXT(" Security Exception[%d.%d]: %C\n"),
6638  dwch, ex.code, ex.minor_code, ex.message.in()));
6639  }
6640  }
6641  handle_registry->erase_local_datawriter_crypto_handle(publicationId);
6642 }
6643 
6644 void Sedp::cleanup_secure_reader(const GUID_t& subscriptionId)
6645 {
6646  using namespace DDS::Security;
6647 
6649  if (!handle_registry) {
6650  return;
6651  }
6652  const DatareaderCryptoHandle drch =
6653  handle_registry->get_local_datareader_crypto_handle(subscriptionId);
6654  if (drch == DDS::HANDLE_NIL) {
6655  return;
6656  }
6657 
6658  SecurityException ex = {"", 0, 0};
6659  if (!get_crypto_key_factory()->unregister_datareader(drch, ex)) {
6660  if (DCPS::security_debug.cleanup_error) {
6662  ACE_TEXT("(%P|%t) {cleanup_error} Sedp::cleanup_secure_reader() - ")
6663  ACE_TEXT("Failure calling unregister_datareader (ch %d).")
6664  ACE_TEXT(" Security Exception[%d.%d]: %C\n"),
6665  drch, ex.code, ex.minor_code, ex.message.in()));
6666  }
6667  }
6668  handle_registry->erase_local_datareader_crypto_handle(subscriptionId);
6669 }
6670 #endif
6671 
6672 // TODO: This is perhaps too generic since the context probably has the details this function computes.
6673 void Sedp::match_endpoints(GUID_t repoId, const DCPS::TopicDetails& td, bool remove)
6674 {
6675  if (DCPS_debug_level >= 4) {
6676  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match_endpoints %C%C\n",
6677  remove ? "remove " : "", LogGuid(repoId).c_str()));
6678  }
6679 
6680  const bool reader = DCPS::GuidConverter(repoId).isReader();
6681  // Copy the endpoint set - lock can be released in match()
6682  RepoIdSet local_endpoints;
6683  RepoIdSet discovered_endpoints;
6684  if (reader) {
6685  local_endpoints = td.local_publications();
6686  discovered_endpoints = td.discovered_publications();
6687  } else {
6688  local_endpoints = td.local_subscriptions();
6689  discovered_endpoints = td.discovered_subscriptions();
6690  }
6691 
6692  const bool is_remote = !equal_guid_prefixes(repoId, participant_id_);
6693  if (is_remote && local_endpoints.empty()) {
6694  // Nothing to match.
6695  return;
6696  }
6697 
6698  for (RepoIdSet::const_iterator iter = local_endpoints.begin();
6699  iter != local_endpoints.end(); ++iter) {
6700  // check to make sure it's a Reader/Writer or Writer/Reader match
6701  if (DCPS::GuidConverter(*iter).isReader() != reader) {
6702  if (remove) {
6703  remove_assoc(*iter, repoId);
6704  } else {
6705  match(reader ? *iter : repoId, reader ? repoId : *iter);
6706  }
6707  }
6708  }
6709 
6710  // Remote/remote matches are a waste of time
6711  if (is_remote) {
6712  return;
6713  }
6714 
6715  for (RepoIdSet::const_iterator iter = discovered_endpoints.begin();
6716  iter != discovered_endpoints.end(); ++iter) {
6717  // check to make sure it's a Reader/Writer or Writer/Reader match
6718  if (DCPS::GuidConverter(*iter).isReader() != reader) {
6719  if (remove) {
6720  remove_assoc(*iter, repoId);
6721  } else {
6722  match(reader ? *iter : repoId, reader ? repoId : *iter);
6723  }
6724  }
6725  }
6726 }
6727 
6729  const GUID_t& writer,
6730  const GUID_t& reader)
6731 {
6733  if (part_iter != spdp_.participants_.end()) {
6734  for (DiscoveredParticipant::WriterAssociationRecords::iterator pos = part_iter->second.writer_pending_records_.begin(), limit = part_iter->second.writer_pending_records_.end(); pos != limit; ++pos) {
6735  if ((*pos)->writer_id() == writer && (*pos)->reader_id() == reader) {
6736  part_iter->second.writer_pending_records_.erase(pos);
6737  break;
6738  }
6739  }
6740 
6741  for (DiscoveredParticipant::WriterAssociationRecords::iterator pos = part_iter->second.writer_associated_records_.begin(), limit = part_iter->second.writer_associated_records_.end(); pos != limit; ++pos) {
6742  if ((*pos)->writer_id() == writer && (*pos)->reader_id() == reader) {
6743  event_dispatcher_->dispatch(DCPS::make_rch<WriterRemoveAssociations>(*pos));
6744  part_iter->second.writer_associated_records_.erase(pos);
6745  break;
6746  }
6747  }
6748  } else if (equal_guid_prefixes(writer, participant_id_) && equal_guid_prefixes(reader, participant_id_)) {
6750  ra.readerId = reader;
6751  ra.participantDiscoveredAt = MTZERO;
6752  ra.subQos = TheServiceParticipant->initial_SubscriberQos();
6753  ra.readerQos = TheServiceParticipant->initial_DataReaderQos();
6754  ra.transportContext = 0;
6755  event_dispatcher_->dispatch(DCPS::make_rch<WriterRemoveAssociations>(DCPS::make_rch<WriterAssociationRecord>(callbacks, writer, ra)));
6756  }
6757 }
6758 
6760  const GUID_t& reader,
6761  const GUID_t& writer)
6762 {
6764  if (part_iter != spdp_.participants_.end()) {
6765  for (DiscoveredParticipant::ReaderAssociationRecords::iterator pos = part_iter->second.reader_pending_records_.begin(), limit = part_iter->second.reader_pending_records_.end(); pos != limit; ++pos) {
6766  if ((*pos)->reader_id() == reader && (*pos)->writer_id() == writer) {
6767  part_iter->second.reader_pending_records_.erase(pos);
6768  break;
6769  }
6770  }
6771 
6772  for (DiscoveredParticipant::ReaderAssociationRecords::iterator pos = part_iter->second.reader_associated_records_.begin(), limit = part_iter->second.reader_associated_records_.end(); pos != limit; ++pos) {
6773  if ((*pos)->reader_id() == reader && (*pos)->writer_id() == writer) {
6774  event_dispatcher_->dispatch(DCPS::make_rch<ReaderRemoveAssociations>(*pos));
6775  part_iter->second.reader_associated_records_.erase(pos);
6776  break;
6777  }
6778  }
6779  } else if (equal_guid_prefixes(reader, participant_id_) && equal_guid_prefixes(writer, participant_id_)) {
6781  wa.writerId = writer;
6782  wa.participantDiscoveredAt = MTZERO;
6783  wa.pubQos = TheServiceParticipant->initial_PublisherQos();
6784  wa.writerQos = TheServiceParticipant->initial_DataWriterQos();
6785  wa.transportContext = 0;
6786  event_dispatcher_->dispatch(DCPS::make_rch<ReaderRemoveAssociations>(DCPS::make_rch<ReaderAssociationRecord>(callbacks, reader, wa)));
6787  }
6788 }
6789 
6790 void Sedp::remove_assoc(const GUID_t& remove_from, const GUID_t& removing)
6791 {
6792  if (DCPS::GuidConverter(remove_from).isReader()) {
6793  const LocalSubscriptionIter lsi = local_subscriptions_.find(remove_from);
6794  if (lsi != local_subscriptions_.end()) {
6795  lsi->second.matched_endpoints_.erase(removing);
6796  const DiscoveredPublicationIter dpi = discovered_publications_.find(removing);
6797  if (dpi != discovered_publications_.end()) {
6798  dpi->second.matched_endpoints_.erase(remove_from);
6799  }
6800  const size_t count = lsi->second.remote_expectant_opendds_associations_.erase(removing);
6801  cleanup_reader_association(lsi->second.subscription_, remove_from, removing);
6802  remove_assoc_i(remove_from, lsi->second, removing);
6803  // Update writer
6804  if (count) {
6805  write_subscription_data(remove_from, lsi->second);
6806  }
6807  }
6808 
6809  } else {
6810  const LocalPublicationIter lpi = local_publications_.find(remove_from);
6811  if (lpi != local_publications_.end()) {
6812  lpi->second.matched_endpoints_.erase(removing);
6813  const DiscoveredSubscriptionIter dsi = discovered_subscriptions_.find(removing);
6814  if (dsi != discovered_subscriptions_.end()) {
6815  dsi->second.matched_endpoints_.erase(remove_from);
6816  }
6817  lpi->second.remote_expectant_opendds_associations_.erase(removing);
6818  cleanup_writer_association(lpi->second.publication_, remove_from, removing);
6819  remove_assoc_i(remove_from, lpi->second, removing);
6820  }
6821  }
6822 }
6823 
6824 void Sedp::match(const GUID_t& writer, const GUID_t& reader)
6825 {
6826  if (DCPS_debug_level >= 4) {
6827  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: w: %C r: %C\n",
6828  LogGuid(writer).c_str(), LogGuid(reader).c_str()));
6829  }
6830 
6831  // 1. collect type info about the writer, which may be local or discovered
6832  XTypes::TypeInformation* writer_type_info = 0;
6833 
6834  const LocalPublicationIter lpi = local_publications_.find(writer);
6836  bool writer_local = false;
6837  if (lpi != local_publications_.end()) {
6838  writer_local = true;
6839  writer_type_info = &lpi->second.type_info_;
6840  } else if ((dpi = discovered_publications_.find(writer))
6841  != discovered_publications_.end()) {
6842  writer_type_info = &dpi->second.type_info_;
6843  } else {
6844  if (DCPS_debug_level >= 4) {
6845  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: Undiscovered Writer\n"));
6846  }
6847  return; // Possible and ok, since lock is released
6848  }
6849 
6850  // 2. collect type info about the reader, which may be local or discovered
6851  XTypes::TypeInformation* reader_type_info = 0;
6852 
6853  const LocalSubscriptionIter lsi = local_subscriptions_.find(reader);
6855  bool reader_local = false;
6856  if (lsi != local_subscriptions_.end()) {
6857  reader_local = true;
6858  reader_type_info = &lsi->second.type_info_;
6859  } else if ((dsi = discovered_subscriptions_.find(reader))
6860  != discovered_subscriptions_.end()) {
6861  reader_type_info = &dsi->second.type_info_;
6862  } else {
6863  if (DCPS_debug_level >= 4) {
6864  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: Undiscovered Reader\n"));
6865  }
6866  return; // Possible and ok, since lock is released
6867  }
6868 
6869  // if the type object is not in cache, send RPC request
6870  // NOTE(sonndinh): Is it possible for a discovered endpoint to include only the "complete"
6871  // part in its TypeInformation? If it's possible, then we may need to handle that case, i.e.,
6872  // request only the remote complete TypeObject (if it's not already in the cache).
6873  // The following code assumes when the "minimal" part is not included in the discovered
6874  // endpoint's TypeInformation, then the "complete" part also is not included.
6875  bool request = false;
6876  bool need_minimal, need_complete;
6877  if ((writer_type_info->minimal.typeid_with_size.type_id.kind() != XTypes::TK_NONE) &&
6878  (reader_type_info->minimal.typeid_with_size.type_id.kind() != XTypes::TK_NONE)) {
6879  if (!writer_local && reader_local) {
6880  if (need_minimal_and_or_complete_types(writer_type_info, need_minimal, need_complete)) {
6881  if (DCPS_debug_level >= 4) {
6882  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: "
6883  "Need to get type objects from remote writer\n"));
6884  }
6885  request = true;
6886  }
6887  } else if (!reader_local && writer_local) {
6888  if (need_minimal_and_or_complete_types(reader_type_info, need_minimal, need_complete)) {
6889  if (DCPS_debug_level >= 4) {
6890  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: "
6891  "Need to get type objects from remote reader\n"));
6892  }
6893  request = true;
6894  }
6895  }
6896  } else if (reader_local && !writer_local && use_xtypes_ &&
6897  writer_type_info->minimal.typeid_with_size.type_id.kind() != XTypes::TK_NONE) {
6898  // We are a recorder trying to associate with a remote xtypes writer
6899  if (need_minimal_and_or_complete_types(writer_type_info, need_minimal, need_complete)) {
6900  if (DCPS_debug_level >= 4) {
6901  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match: "
6902  "Need to get type objects from remote reader for recorder\n"));
6903  }
6904  request = true;
6905  }
6906  }
6907 
6908  if (request) {
6910  reader_local ? writer_type_info : reader_type_info,
6911  MatchingPair(reader, writer, reader_local),
6912 #ifdef OPENDDS_SECURITY
6913  reader_local ?
6914  lsi->second.security_attribs_.base.is_discovery_protected :
6915  lpi->second.security_attribs_.base.is_discovery_protected,
6916 #else
6917  false,
6918 #endif
6919  need_minimal, need_complete);
6920  } else {
6921  match_continue(writer, reader);
6922  }
6923 }
6924 
6926  const GUID_t& remote_entity, const XTypes::TypeInformation& remote_type_info,
6927  DCPS::TypeObjReqCond& cond)
6928 {
6929  bool discovered = false;
6930  bool discovery_protected = false;
6931  DCPS::GuidConverter gc(remote_entity);
6932  if (gc.isWriter()) {
6933  DiscoveredPublicationIter dpi = discovered_publications_.find(remote_entity);
6934  if (dpi != discovered_publications_.end()) {
6935  discovered = true;
6936 #ifdef OPENDDS_SECURITY
6937  discovery_protected = dpi->second.security_attribs_.base.is_discovery_protected;
6938 #endif
6939  }
6940  } else if (gc.isReader()) {
6941  DiscoveredSubscriptionIter dsi = discovered_subscriptions_.find(remote_entity);
6942  if (dsi != discovered_subscriptions_.end()) {
6943  discovered = true;
6944 #ifdef OPENDDS_SECURITY
6945  discovery_protected = dsi->second.security_attribs_.base.is_discovery_protected;
6946 #endif
6947  }
6948  }
6949 
6950  if (!discovered) {
6951  if (log_level >= LogLevel::Notice) {
6952  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: Sedp::request_remote_complete_type_objects: ",
6953  "GUID passed, %C, is not a discovered reader or writer\n",
6954  String(gc).c_str()));
6955  }
6957  return;
6958  }
6959 
6960  request_type_objects(&remote_type_info, MatchingPair(remote_entity, gc.isReader(), &cond),
6961  discovery_protected, false, true);
6962 }
6963 
6965  bool& need_minimal,
6966  bool& need_complete) const
6967 {
6968  need_minimal = type_lookup_service_ &&
6969  !type_lookup_service_->type_object_in_cache(type_info->minimal.typeid_with_size.type_id);
6970 
6971  need_complete = use_xtypes_complete_ && type_lookup_service_ &&
6973  !type_lookup_service_->type_object_in_cache(type_info->complete.typeid_with_size.type_id);
6974 
6975  return need_minimal || need_complete;
6976 }
6977 
6979 {
6981  const MonotonicTimePoint now = MonotonicTimePoint::now();
6982 
6983  MatchingDataIter end_iter = matching_data_buffer_.end();
6984  for (MatchingDataIter iter = matching_data_buffer_.begin(); iter != end_iter; ) {
6985  // Do not try to simplify increment: "associative container erase idiom"
6986  if (now - iter->second.time_added_to_map >= max_type_lookup_service_reply_period_) {
6987  if (DCPS_debug_level >= 4) {
6988  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::remove_expired_endpoints: "
6989  "clean up pending pair local: %C remote: %C\n",
6990  LogGuid(iter->first.local).c_str(), LogGuid(iter->first.remote).c_str()));
6991  }
6992  if (iter->first.type_obj_req_cond) {
6993  iter->first.type_obj_req_cond->done(DDS::RETCODE_TIMEOUT);
6994  }
6995  matching_data_buffer_.erase(iter++);
6996  } else {
6997  ++iter;
6998  }
6999  }
7000 
7001  // Clean up internal data used by getTypeDependencies
7002  for (OrigSeqNumberMap::iterator it = orig_seq_numbers_.begin(); it != orig_seq_numbers_.end();) {
7003  if (now - it->second.time_started >= max_type_lookup_service_reply_period_) {
7004  if (DCPS_debug_level >= 4) {
7005  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::remove_expired_endpoints: "
7006  "clean up type lookup data for %C\n",
7007  LogGuid(it->second.participant).c_str()));
7008  }
7009  cleanup_type_lookup_data(it->second.participant, it->second.type_id, it->second.secure);
7010  orig_seq_numbers_.erase(it++);
7011  } else {
7012  ++it;
7013  }
7014  }
7015 }
7016 
7018 {
7019  DCPS::GuidConverter conv(id);
7020  if (conv.isBuiltinDomainEntity()) {
7021  DCPS::LocatorSeq locators;
7022  bool expects_inline_qos = false;
7023  bool found = spdp_.get_last_recv_locator(make_id(id, ENTITYID_PARTICIPANT), locators, expects_inline_qos);
7024 
7025  if (!found || !locators.length()) {
7026  return;
7027  }
7028 
7030  size_t size = serialized_size(encoding, locators);
7031  primitive_serialized_size_boolean(encoding, size);
7032 
7033  ACE_Message_Block mb_locator(size);
7034  Serializer ser_loc(&mb_locator, encoding);
7035  ser_loc << locators;
7036  ser_loc << ACE_OutputCDR::from_boolean(expects_inline_qos);
7037 
7038  tl.transport_type = "rtps_udp";
7039  RTPS::message_block_to_sequence(mb_locator, tl.data);
7040  } else {
7041  if (conv.isReader()) {
7043  } else {
7045  }
7046  }
7047 }
7048 
7049 void Sedp::match_continue(const GUID_t& writer, const GUID_t& reader)
7050 {
7051  if (DCPS_debug_level >= 4) {
7052  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::match_continue: w: %C r: %C\n",
7053  LogGuid(writer).c_str(), LogGuid(reader).c_str()));
7054  }
7055 
7056  // 0. For discovered endpoints, we'll have the QoS info in the form of the
7057  // publication or subscription BIT data which doesn't use the same structures
7058  // for QoS. In those cases we can copy the individual QoS policies to temp
7059  // QoS structs:
7060  DDS::DataWriterQos tempDwQos;
7061  DDS::PublisherQos tempPubQos;
7062  DDS::DataReaderQos tempDrQos;
7063  DDS::SubscriberQos tempSubQos;
7065 
7068  if (dpi != discovered_publications_.end() && dsi != discovered_subscriptions_.end()) {
7069  // This is a discovered/discovered match, nothing for us to do
7070  return;
7071  }
7072 
7073  // 1. Collect details about the writer, which may be local or discovered
7074  const DDS::DataWriterQos* dwQos = 0;
7075  const DDS::PublisherQos* pubQos = 0;
7076  DCPS::TransportLocatorSeq* wTls = 0;
7077  ACE_CDR::ULong wTransportContext = 0;
7078  XTypes::TypeInformation* writer_type_info = 0;
7079  String topic_name;
7080  DCPS::MonotonicTime_t writer_participant_discovered_at;
7081 
7082  const LocalPublicationIter lpi = local_publications_.find(writer);
7083  bool writer_local = false, already_matched = false;
7084  if (lpi != local_publications_.end()) {
7085  writer_local = true;
7086  dwQos = &lpi->second.qos_;
7087  pubQos = &lpi->second.publisher_qos_;
7088  wTls = &lpi->second.trans_info_;
7089  wTransportContext = lpi->second.transport_context_;
7090  already_matched = lpi->second.matched_endpoints_.count(reader);
7091  writer_type_info = &lpi->second.type_info_;
7092  topic_name = topic_names_[lpi->second.topic_id_];
7093  writer_participant_discovered_at = lpi->second.participant_discovered_at_;
7094  } else if (dpi != discovered_publications_.end()) {
7095  wTls = &dpi->second.writer_data_.writerProxy.allLocators;
7096  wTransportContext = dpi->second.transport_context_;
7097  writer_type_info = &dpi->second.type_info_;
7098  topic_name = dpi->second.get_topic_name();
7099  writer_participant_discovered_at = dpi->second.participant_discovered_at_;
7100 
7102  dpi->second.writer_data_.ddsPublicationData;
7103  tempDwQos.durability = bit.durability;
7104  tempDwQos.durability_service = bit.durability_service;
7105  tempDwQos.deadline = bit.deadline;
7106  tempDwQos.latency_budget = bit.latency_budget;
7107  tempDwQos.liveliness = bit.liveliness;
7108  tempDwQos.reliability = bit.reliability;
7109  tempDwQos.destination_order = bit.destination_order;
7110  tempDwQos.history = TheServiceParticipant->initial_HistoryQosPolicy();
7111  tempDwQos.resource_limits =
7112  TheServiceParticipant->initial_ResourceLimitsQosPolicy();
7113  tempDwQos.transport_priority =
7114  TheServiceParticipant->initial_TransportPriorityQosPolicy();
7115  tempDwQos.lifespan = bit.lifespan;
7116  tempDwQos.user_data = bit.user_data;
7117  tempDwQos.ownership = bit.ownership;
7118  tempDwQos.ownership_strength = bit.ownership_strength;
7119  tempDwQos.writer_data_lifecycle =
7120  TheServiceParticipant->initial_WriterDataLifecycleQosPolicy();
7121  tempDwQos.representation = bit.representation;
7122  dwQos = &tempDwQos;
7123 
7124  tempPubQos.presentation = bit.presentation;
7125  tempPubQos.partition = bit.partition;
7126  tempPubQos.group_data = bit.group_data;
7127  tempPubQos.entity_factory =
7128  TheServiceParticipant->initial_EntityFactoryQosPolicy();
7129  pubQos = &tempPubQos;
7130 
7131  populate_transport_locator_sequence(*wTls, dpi, writer);
7132  } else {
7133  return; // Possible and ok, since lock is released
7134  }
7135 
7136  // 2. Collect details about the reader, which may be local or discovered
7137  const DDS::DataReaderQos* drQos = 0;
7138  const DDS::SubscriberQos* subQos = 0;
7139  DCPS::TransportLocatorSeq* rTls = 0;
7140  ACE_CDR::ULong rTransportContext = 0;
7141 #ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC
7142  const DCPS::ContentFilterProperty_t* cfProp = 0;
7143 #endif
7144  XTypes::TypeInformation* reader_type_info = 0;
7145  DCPS::MonotonicTime_t reader_participant_discovered_at;
7146 
7147  const LocalSubscriptionIter lsi = local_subscriptions_.find(reader);
7148  bool reader_local = false;
7149  if (lsi != local_subscriptions_.end()) {
7150  reader_local = true;
7151  drQos = &lsi->second.qos_;
7152  subQos = &lsi->second.subscriber_qos_;
7153  rTls = &lsi->second.trans_info_;
7154  rTransportContext = lsi->second.transport_context_;
7155  reader_type_info = &lsi->second.type_info_;
7156  if (lsi->second.filterProperties.filterExpression[0] != 0) {
7157  tempCfp.filterExpression = lsi->second.filterProperties.filterExpression;
7158  tempCfp.expressionParameters = lsi->second.filterProperties.expressionParameters;
7159  }
7160 #ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC
7161  cfProp = &tempCfp;
7162 #endif
7163  if (!already_matched) {
7164  already_matched = lsi->second.matched_endpoints_.count(writer);
7165  }
7166  reader_participant_discovered_at = lsi->second.participant_discovered_at_;
7167  } else if (dsi != discovered_subscriptions_.end()) {
7168  rTls = &dsi->second.reader_data_.readerProxy.allLocators;
7169 
7170  populate_transport_locator_sequence(*rTls, dsi, reader);
7171  rTransportContext = dsi->second.transport_context_;
7172 
7174  dsi->second.reader_data_.ddsSubscriptionData;
7175  tempDrQos.durability = bit.durability;
7176  tempDrQos.deadline = bit.deadline;
7177  tempDrQos.latency_budget = bit.latency_budget;
7178  tempDrQos.liveliness = bit.liveliness;
7179  tempDrQos.reliability = bit.reliability;
7180  tempDrQos.destination_order = bit.destination_order;
7181  tempDrQos.history = TheServiceParticipant->initial_HistoryQosPolicy();
7182  tempDrQos.resource_limits =
7183  TheServiceParticipant->initial_ResourceLimitsQosPolicy();
7184  tempDrQos.user_data = bit.user_data;
7185  tempDrQos.ownership = bit.ownership;
7186  tempDrQos.time_based_filter = bit.time_based_filter;
7187  tempDrQos.reader_data_lifecycle =
7188  TheServiceParticipant->initial_ReaderDataLifecycleQosPolicy();
7189  tempDrQos.representation = bit.representation;
7190  tempDrQos.type_consistency = bit.type_consistency;
7191  drQos = &tempDrQos;
7192 
7193  tempSubQos.presentation = bit.presentation;
7194  tempSubQos.partition = bit.partition;
7195  tempSubQos.group_data = bit.group_data;
7196  tempSubQos.entity_factory =
7197  TheServiceParticipant->initial_EntityFactoryQosPolicy();
7198  subQos = &tempSubQos;
7199 
7200 #ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC
7201  cfProp = &dsi->second.reader_data_.contentFilterProperty;
7202 #endif
7203  reader_type_info = &dsi->second.type_info_;
7204  reader_participant_discovered_at = dsi->second.participant_discovered_at_;
7205  } else {
7206  return; // Possible and ok, since lock is released
7207  }
7208 
7209  // 3. Perform type consistency check (XTypes 1.3, Section 7.6.3.4.2)
7210  bool consistent = false;
7211 
7212  DCPS::TopicDetailsMap::iterator td_iter = topics_.find(topic_name);
7213  if (td_iter == topics_.end()) {
7215  ACE_TEXT("(%P|%t) Sedp::match_continue - ERROR ")
7216  ACE_TEXT("Didn't find topic for consistency check\n")));
7217  return;
7218  } else {
7219  const XTypes::TypeIdentifier& writer_type_id =
7220  writer_type_info->minimal.typeid_with_size.type_id;
7221  const XTypes::TypeIdentifier& reader_type_id =
7222  reader_type_info->minimal.typeid_with_size.type_id;
7223  if (writer_type_id.kind() != XTypes::TK_NONE && reader_type_id.kind() != XTypes::TK_NONE) {
7224  if (!writer_local || !reader_local) {
7225  DCPS::Encoding::Kind encoding_kind;
7226  if (tempDwQos.representation.value.length() > 0 &&
7227  DCPS::repr_to_encoding_kind(tempDwQos.representation.value[0], encoding_kind) &&
7228  encoding_kind == DCPS::Encoding::KIND_XCDR1) {
7229  const XTypes::TypeFlag extensibility_mask = XTypes::IS_APPENDABLE;
7230  if (type_lookup_service_->extensibility(extensibility_mask, writer_type_id)) {
7232  ACE_DEBUG((LM_WARNING, "(%P|%t) WARNING: "
7233  "Sedp::match_continue: "
7234  "Encountered unsupported combination of XCDR1 encoding and appendable "
7235  "extensibility\n"));
7236  }
7237  }
7238  }
7239  }
7240 
7241  XTypes::TypeConsistencyAttributes type_consistency;
7244  type_consistency.ignore_member_names = drQos->type_consistency.ignore_member_names;
7246  XTypes::TypeAssignability ta(type_lookup_service_, type_consistency);
7247 
7249  consistent = ta.assignable(reader_type_id, writer_type_id);
7250  } else {
7251  // The two types must be equivalent for DISALLOW_TYPE_COERCION
7252  consistent = reader_type_id == writer_type_id;
7253  if (!consistent && DCPS::DCPS_debug_level >= 4) {
7254  ACE_DEBUG((LM_WARNING, "(%P|%t) Sedp::match_continue: will not match because type "
7255  "ids must be the same when using DISALLOW_TYPE_COERCION\n"));
7256  }
7257  }
7258  } else {
7260  // Cannot do type validation since not both TypeObjects are available
7261  consistent = false;
7262  if (DCPS::DCPS_debug_level >= 4) {
7263  ACE_DEBUG((LM_WARNING, "(%P|%t) Sedp::match_continue: will not match because "
7264  "force_type_validation is true, but TypeObjects are not available\n"));
7265  }
7266  } else {
7267  // Fall back to matching type names
7268  String writer_type_name;
7269  String reader_type_name;
7270  if (writer_local) {
7271  writer_type_name = td_iter->second.local_data_type_name();
7272  } else {
7273  writer_type_name = dpi->second.get_type_name();
7274  }
7275  if (reader_local) {
7276  reader_type_name = td_iter->second.local_data_type_name();
7277  } else {
7278  reader_type_name = dsi->second.get_type_name();
7279  }
7280  consistent = reader_type_name.empty() || writer_type_name == reader_type_name;
7281  }
7282  }
7283 
7284  if (!consistent) {
7285  td_iter->second.increment_inconsistent();
7286  if (DCPS::DCPS_debug_level) {
7288  ACE_TEXT("(%P|%t) Sedp::match_continue - WARNING ")
7289  ACE_TEXT("Data types of topic %C does not match (inconsistent)\n"),
7290  topic_name.c_str()));
7291  }
7292  return;
7293  }
7294  }
7295 
7296  // 4. Check transport and QoS compatibility
7297 
7298  // Copy entries from local publication and local subscription maps
7299  // prior to releasing lock
7302  if (writer_local) {
7303  dwr = lpi->second.publication_;
7304  OPENDDS_ASSERT(lpi->second.publication_);
7305  OPENDDS_ASSERT(dwr);
7306  }
7307  if (reader_local) {
7308  drr = lsi->second.subscription_;
7309  OPENDDS_ASSERT(lsi->second.subscription_);
7310  OPENDDS_ASSERT(drr);
7311  }
7312 
7313  DCPS::IncompatibleQosStatus writerStatus = {0, 0, 0, DDS::QosPolicyCountSeq()};
7314  DCPS::IncompatibleQosStatus readerStatus = {0, 0, 0, DDS::QosPolicyCountSeq()};
7315 
7316  if (compatibleQOS(&writerStatus, &readerStatus, *wTls, *rTls,
7317  dwQos, drQos, pubQos, subQos)) {
7318 
7319  bool call_writer = false, call_reader = false;
7320 
7321  if (writer_local) {
7322  call_writer = lpi->second.matched_endpoints_.insert(reader).second;
7323  dwr = lpi->second.publication_;
7324  if (!reader_local) {
7325  dsi->second.matched_endpoints_.insert(writer);
7326  }
7327  }
7328  if (reader_local) {
7329  call_reader = lsi->second.matched_endpoints_.insert(writer).second;
7330  drr = lsi->second.subscription_;
7331  if (!writer_local) {
7332  dpi->second.matched_endpoints_.insert(reader);
7333  }
7334  }
7335 
7336  if (writer_local && !reader_local) {
7337  add_assoc_i(writer, lpi->second, reader, dsi->second);
7338  }
7339  if (reader_local && !writer_local) {
7340  add_assoc_i(reader, lsi->second, writer, dpi->second);
7341  }
7342 
7343  if (!call_writer && !call_reader) {
7344  return; // nothing more to do
7345  }
7346 
7347  // Copy reader and writer association data prior to releasing lock
7349  if (call_writer) {
7350  war = make_rch<WriterAssociationRecord>(dwr, writer, DCPS::ReaderAssociation());
7351  DCPS::ReaderAssociation& ra = const_cast<DCPS::ReaderAssociation&>(war->reader_association_);
7352  ra.readerTransInfo = *rTls;
7353  populate_origination_locator(reader, ra.readerDiscInfo);
7354  ra.transportContext = rTransportContext;
7355  ra.readerId = reader;
7356  ra.subQos = *subQos;
7357  ra.readerQos = *drQos;
7358 #ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC
7359  ra.filterClassName = cfProp->filterClassName;
7360  ra.filterExpression = cfProp->filterExpression;
7361  ra.exprParams = cfProp->expressionParameters;
7362 #endif
7363  XTypes::serialize_type_info(*reader_type_info, ra.serializedTypeInfo);
7364  ra.participantDiscoveredAt = writer_participant_discovered_at;
7365  }
7366 
7368  if (call_reader) {
7369  rar = make_rch<ReaderAssociationRecord>(drr, reader, DCPS::WriterAssociation());
7370  DCPS::WriterAssociation& wa = const_cast<DCPS::WriterAssociation&>(rar->writer_association_);
7371  wa.writerTransInfo = *wTls;
7372  populate_origination_locator(writer, wa.writerDiscInfo);
7373  wa.transportContext = wTransportContext;
7374  wa.writerId = writer;
7375  wa.pubQos = *pubQos;
7376  wa.writerQos = *dwQos;
7377  XTypes::serialize_type_info(*writer_type_info, wa.serializedTypeInfo);
7378  wa.participantDiscoveredAt = writer_participant_discovered_at;
7379  }
7380 
7381 #ifdef OPENDDS_SECURITY
7382  if (is_security_enabled()) {
7383  match_continue_security_enabled(writer, reader, call_writer, call_reader);
7384  }
7385 #endif
7386 
7387  if (call_reader && call_writer) {
7388  // Associate immediately.
7389  event_dispatcher_->dispatch(DCPS::make_rch<ReaderAddAssociation>(rar));
7390  event_dispatcher_->dispatch(DCPS::make_rch<WriterAddAssociation>(war));
7391 
7392 #ifndef OPENDDS_SAFETY_PROFILE
7394  // Reader is a local recorder using complete types
7395  DCPS::DataReaderCallbacks_rch lock = rar->callbacks_.lock();
7396  OpenDDS::DCPS::RecorderImpl* ri = dynamic_cast<OpenDDS::DCPS::RecorderImpl*>(lock.in());
7397  if (ri) {
7398  XTypes::TypeInformation type_info;
7399  if (XTypes::deserialize_type_info(type_info, rar->writer_association_.serializedTypeInfo)) {
7400  ri->add_to_dynamic_type_map(rar->writer_id(), type_info.complete.typeid_with_size.type_id);
7401  }
7402  }
7403  }
7404 #endif
7405 
7406  } else if (call_reader) {
7407 #ifndef OPENDDS_SAFETY_PROFILE
7409  // Reader is a local recorder using complete types
7410  DCPS::DataReaderCallbacks_rch lock = rar->callbacks_.lock();
7411  OpenDDS::DCPS::RecorderImpl* ri = dynamic_cast<OpenDDS::DCPS::RecorderImpl*>(lock.in());
7412  if (ri) {
7413  XTypes::TypeInformation type_info;
7414  if (XTypes::deserialize_type_info(type_info, rar->writer_association_.serializedTypeInfo)) {
7415  ri->add_to_dynamic_type_map(rar->writer_id(), type_info.complete.typeid_with_size.type_id);
7416  }
7417  }
7418  }
7419 #endif
7421  if (iter != spdp_.participants_.end()) {
7422  iter->second.reader_pending_records_.push_back(rar);
7423  process_association_records_i(iter->second);
7424  }
7425  } else if (call_writer) {
7427  if (iter != spdp_.participants_.end()) {
7428  iter->second.writer_pending_records_.push_back(war);
7429  process_association_records_i(iter->second);
7430  }
7431  }
7432 
7433  } else if (already_matched) { // break an existing association
7434  if (writer_local) {
7435  lpi->second.matched_endpoints_.erase(reader);
7436  lpi->second.remote_expectant_opendds_associations_.erase(reader);
7437  if (dsi != discovered_subscriptions_.end()) {
7438  dsi->second.matched_endpoints_.erase(writer);
7439  }
7440  }
7441  if (reader_local) {
7442  lsi->second.matched_endpoints_.erase(writer);
7443  lsi->second.remote_expectant_opendds_associations_.erase(writer);
7444  if (dpi != discovered_publications_.end()) {
7445  dpi->second.matched_endpoints_.erase(reader);
7446  }
7447  }
7448  if (writer_local && !reader_local) {
7449  remove_assoc_i(writer, lpi->second, reader);
7450  }
7451  if (reader_local && !writer_local) {
7452  remove_assoc_i(reader, lsi->second, writer);
7453  }
7454  if (writer_local) {
7455  cleanup_writer_association(dwr, writer, reader);
7456  }
7457  if (reader_local) {
7458  cleanup_reader_association(drr, reader, writer);
7459  }
7460  } else { // something was incompatible
7461  if (writer_local && writerStatus.count_since_last_send) {
7462  if (DCPS_debug_level > 3) {
7463  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::match_continue - ")
7464  ACE_TEXT("writer incompatible\n")));
7465  }
7466  DCPS::DataWriterCallbacks_rch dwr_lock = dwr.lock();
7467  if (dwr_lock) {
7468  dwr_lock->update_incompatible_qos(writerStatus);
7469  }
7470  }
7471  if (reader_local && readerStatus.count_since_last_send) {
7472  if (DCPS_debug_level > 3) {
7473  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Sedp::match_continue - ")
7474  ACE_TEXT("reader incompatible\n")));
7475  }
7476  DCPS::DataReaderCallbacks_rch drr_lock = drr.lock();
7477  if (drr_lock) {
7478  drr_lock->update_incompatible_qos(readerStatus);
7479  }
7480  }
7481  }
7482 }
7483 
7485  const MatchingPair& mp, bool is_discovery_protected,
7486  bool get_minimal, bool get_complete)
7487 {
7488  OPENDDS_ASSERT(get_minimal || get_complete);
7489  MatchingData md;
7490  md.time_added_to_map = MonotonicTimePoint::now();
7491 
7492  if (get_minimal) {
7494  md.got_minimal = false;
7495  } else {
7497  md.got_minimal = true;
7498  }
7499 
7500  if (get_complete) {
7502  md.got_complete = false;
7503  } else {
7505  md.got_complete = true;
7506  }
7507 
7508  matching_data_buffer_[mp] = md;
7509 
7510  // Send a sequence of requests for minimal remote TypeObjects
7511  if (get_minimal) {
7512  if (DCPS_debug_level >= 4) {
7513  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::request_type_objects: minimal remote: %C seq: %q\n",
7515  }
7516  get_remote_type_objects(type_info->minimal, md, true, mp.remote, is_discovery_protected);
7517  }
7518 
7519  // Send another sequence of requests for complete remote TypeObjects
7520  if (get_complete) {
7521  if (DCPS_debug_level >= 4) {
7522  ACE_DEBUG((LM_DEBUG, "(%P|%t) Sedp::request_type_objects: complete remote: %C seq: %q\n",
7524  }
7525  get_remote_type_objects(type_info->complete, md, false, mp.remote, is_discovery_protected);
7526  }
7527 }
7528 
7530  MatchingData& md, bool get_minimal, const GUID_t& remote_id,
7531  bool is_discovery_protected)
7532 {
7533  // Store an entry for the first request in the sequence.
7534  TypeIdOrigSeqNumber orig_req_data;
7535  orig_req_data.participant = make_part_guid(remote_id);
7536  orig_req_data.type_id = tid_with_deps.typeid_with_size.type_id;
7537  const SequenceNumber& orig_seqnum = get_minimal ? md.rpc_seqnum_minimal : md.rpc_seqnum_complete;
7538  orig_req_data.seq_number = orig_seqnum;
7539  orig_req_data.secure = false;
7540 #ifdef OPENDDS_SECURITY
7541  if (is_security_enabled() && is_discovery_protected) {
7542  orig_req_data.secure = true;
7543  }
7544 #endif
7545  orig_req_data.time_started = md.time_added_to_map;
7546  orig_seq_numbers_.insert(std::make_pair(orig_seqnum, orig_req_data));
7547 
7548  XTypes::TypeIdentifierSeq type_ids;
7549  if (tid_with_deps.dependent_typeid_count == -1 ||
7550  tid_with_deps.dependent_typeids.length() < (CORBA::ULong)tid_with_deps.dependent_typeid_count) {
7551  type_ids.append(tid_with_deps.typeid_with_size.type_id);
7552 
7553  // Get dependencies of the topic type. TypeObjects of both topic type and
7554  // its dependencies are obtained in subsequent type lookup requests.
7555  send_type_lookup_request(type_ids, remote_id, is_discovery_protected, false, orig_req_data.seq_number);
7556  } else {
7557  type_ids.length(tid_with_deps.dependent_typeid_count + 1);
7558  type_ids[0] = tid_with_deps.typeid_with_size.type_id;
7559  for (unsigned i = 1; i <= (unsigned)tid_with_deps.dependent_typeid_count; ++i) {
7560  type_ids[i] = tid_with_deps.dependent_typeids[i - 1].type_id;
7561  }
7562 
7563  // Get TypeObjects of topic type and all of its dependencies.
7564  send_type_lookup_request(type_ids, remote_id, is_discovery_protected, true, orig_req_data.seq_number);
7565  }
7567 }
7568 
7569 #ifdef OPENDDS_SECURITY
7571  const GUID_t& writer, const GUID_t& reader, bool call_writer, bool call_reader)
7572 {
7573  DDS::Security::CryptoKeyExchange_var keyexg = get_crypto_key_exchange();
7574  if (call_reader && !call_writer) {
7579 
7580  // It might not exist due to security attributes, and that's OK
7581  if (drch != DDS::HANDLE_NIL) {
7584  DatawriterCryptoTokenSeqMap::iterator t_iter =
7586  if (t_iter != pending_remote_writer_crypto_tokens_.end()) {
7588  if (!keyexg->set_remote_datawriter_crypto_tokens(drch, dwch, t_iter->second, se)) {
7589  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
7590  ACE_TEXT("DiscoveryBase::match_continue_security_enabled: ")
7591  ACE_TEXT("Unable to set pending remote datawriter crypto tokens with ")
7592  ACE_TEXT("crypto key exchange plugin. Security Exception[%d.%d]: %C\n"),
7593  se.code, se.minor_code, se.message.in()));
7594  }
7596  }
7597  // Yes, this is different for remote datawriters than readers (see 8.8.9.3 vs 8.8.9.2)
7598  if (attribs.is_submessage_protected) {
7599  create_and_send_datareader_crypto_tokens(drch, reader, dwch, writer);
7600  }
7601  }
7602  }
7603 
7604  if (call_writer && !call_reader) {
7609 
7610  // It might not exist due to security attributes, and that's OK
7611  if (dwch != DDS::HANDLE_NIL) {
7614  relay_only_readers_.count(reader));
7615  DatareaderCryptoTokenSeqMap::iterator t_iter =
7617  if (t_iter != pending_remote_reader_crypto_tokens_.end()) {
7619  if (!keyexg->set_remote_datareader_crypto_tokens(dwch, drch, t_iter->second, se)) {
7620  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ")
7621  ACE_TEXT("DiscoveryBase::match_continue_security_enabled: ")
7622  ACE_TEXT("Unable to set pending remote datareader crypto tokens with crypto ")
7623  ACE_TEXT("key exchange plugin. Security Exception[%d.%d]: %C\n"),
7624  se.code, se.minor_code, se.message.in()));
7625  }
7627  }
7628  if (attribs.is_submessage_protected || attribs.is_payload_protected) {
7629  create_and_send_datawriter_crypto_tokens(dwch, writer, drch, reader);
7630  }
7631  }
7632  }
7633 }
7634 #endif
7635 
7637 {
7638  DCPS::DataWriterCallbacks_rch lock = record_->callbacks_.lock();
7639  if (lock) {
7640  if (DCPS_debug_level > 3) {
7642  ACE_TEXT("(%P|%t) Sedp::WriterAddAssociation::handle_event - ")
7643  ACE_TEXT("adding writer %C association for reader %C\n"), LogGuid(record_->writer_id()).c_str(),
7644  LogGuid(record_->reader_id()).c_str()));
7645  }
7646  lock->add_association(record_->writer_id(), record_->reader_association_, true);
7647  }
7648 }
7649 
7651 {
7652  DCPS::DataWriterCallbacks_rch lock = record_->callbacks_.lock();
7653  if (lock) {
7654  if (DCPS_debug_level > 3) {
7656  ACE_TEXT("(%P|%t) Sedp::WriterRemoveAssociations::handle_event - ")
7657  ACE_TEXT("removing writer %C association for reader %C\n"), LogGuid(record_->writer_id()).c_str(),
7658  LogGuid(record_->reader_id()).c_str()));
7659  }
7660  DCPS::ReaderIdSeq reader_seq(1);
7661  reader_seq.length(1);
7662  reader_seq[0] = record_->reader_id();
7663  lock->remove_associations(reader_seq, false);
7664  }
7665 }
7666 
7668 {
7669  DCPS::DataReaderCallbacks_rch lock = record_->callbacks_.lock();
7670  if (lock) {
7671  if (DCPS_debug_level > 3) {
7673  ACE_TEXT("(%P|%t) Sedp::ReaderAddAssociation::handle_event - ")
7674  ACE_TEXT("adding reader %C association for writer %C\n"), LogGuid(record_->reader_id()).c_str(),
7675  LogGuid(record_->writer_id()).c_str()));
7676  }
7677  lock->add_association(record_->reader_id(), record_->writer_association_, false);
7678  }
7679 }
7680 
7682 {
7683  DCPS::DataReaderCallbacks_rch lock = record_->callbacks_.lock();
7684  if (lock) {
7685  if (DCPS_debug_level > 3) {
7687  ACE_TEXT("(%P|%t) Sedp::ReaderRemoveAssociations::handle_event - ")
7688  ACE_TEXT("removing reader %C association for writer %C\n"), LogGuid(record_->reader_id()).c_str(),
7689  LogGuid(record_->writer_id()).c_str()));
7690  }
7691  DCPS::WriterIdSeq writer_seq(1);
7692  writer_seq.length(1);
7693  writer_seq[0] = record_->writer_id();
7694  lock->remove_associations(writer_seq, false);
7695  }
7696 }
7697 
7698 } // namespace RTPS
7699 } // namespace OpenDDS
7700 
void set_sample(Message_Block_Ptr sample)
DDS::RPC::ReplyHeader header
Definition: TypeLookup.idl:88
unsigned long BuiltinEndpointQos_t
Definition: RtpsCore.idl:232
const int AC_EMPTY
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER
Definition: MessageTypes.h:81
DiscoveryWriter_rch dcps_participant_secure_writer_
Definition: Sedp.h:1288
const size_t boolean_cdr_size
Definition: Serializer.h:89
DataSampleHeader header_
The demarshalled sample header.
void send(SendStateDataSampleList send_list, ACE_UINT64 transaction_id=0)
TimeDuration max_type_lookup_service_reply_period_
Definition: Sedp.h:1244
#define TheTransportRegistry
PartitionQosPolicy partition
DCPS::GUID_t get_guid() const
Definition: Sedp.h:364
DDS::ReturnCode_t write_stateless_message(const DDS::Security::ParticipantStatelessMessage &msg, const DCPS::GUID_t &reader)
Definition: Sedp.cpp:4758
SampleIdentity requestId
Definition: RtpsRpc.idl:41
bool from_param_list(const ParameterList &param_list, DDS::ParticipantBuiltinTopicData &pbtd)
#define ACE_DEBUG(X)
DiscoveryReader_rch subscriptions_secure_reader_
Definition: Sedp.h:1304
DDS::Security::ParticipantSecurityAttributes participant_sec_attr_
Definition: Sedp.h:1256
void insert_local_datawriter_crypto_handle(const DCPS::GUID_t &id, DDS::Security::DatawriterCryptoHandle handle, const DDS::Security::EndpointSecurityAttributes &attributes)
HistoryQosPolicy history
void remove_discovered_subscription(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:118
ACE_CDR::Long Long
ACE_Thread_Mutex & lock_
Definition: Sedp.h:1228
void process_participant_ice(const ParameterList &plist, const ParticipantData_t &pdata, const DCPS::GUID_t &guid)
Definition: Spdp.cpp:4373
DDS::PublicationBuiltinTopicData base
const DDS::Security::EndpointSecurityAttributes & get_local_datareader_security_attributes(const DCPS::GUID_t &id) const
#define ACE_ERROR(X)
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_INET_Addr default_multicast_group() const
bool send_type_lookup_request(const XTypes::TypeIdentifierSeq &type_ids, const DCPS::GUID_t &reader, bool is_discovery_protected, bool send_get_types, const SequenceNumber &seq_num)
Definition: Sedp.cpp:3064
DDS::ReturnCode_t write_dcps_participant_dispose(const DCPS::GUID_t &part)
Definition: Sedp.cpp:4799
virtual void append_transport_statistics(TransportStatisticsSequence &)
DDS::ReturnCode_t write_participant_message_data(const DCPS::GUID_t &rid, DCPS::SequenceNumber &sn, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:5110
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER
Definition: RtpsCore.idl:206
DiscoveryWriter_rch publications_secure_writer_
Definition: Sedp.h:1278
void create_datareader_crypto_tokens(const DDS::Security::DatareaderCryptoHandle &drch, const DDS::Security::DatawriterCryptoHandle &dwch, DDS::Security::DatareaderCryptoTokenSeq &drcts)
Definition: Sedp.cpp:5325
DDS::Security::PermissionsHandle get_permissions_handle() const
Definition: Sedp.h:1186
DCPS::LocatorSeq defaultMulticastLocatorList
Definition: RtpsCore.idl:613
TypeLookup_getTypeDependencies_Out result
Definition: TypeLookup.idl:61
void insert_remote_datawriter_crypto_handle(const DCPS::GUID_t &id, DDS::Security::DatawriterCryptoHandle handle, const DDS::Security::EndpointSecurityAttributes &attributes)
void insert_remote_datareader_crypto_handle(const DCPS::GUID_t &id, DDS::Security::DatareaderCryptoHandle handle, const DDS::Security::EndpointSecurityAttributes &attributes)
const DataSampleHeader & get_header() const
const ReturnCode_t RETCODE_PRECONDITION_NOT_MET
const InstanceHandle_t HANDLE_NIL
std::string String
SampleIdentity relatedRequestId
Definition: RtpsRpc.idl:47
char message_id_
The enum MessageId.
const ExtendedBuiltinEndpointSet_t TYPE_LOOKUP_SERVICE_REPLY_READER_SECURE
DDS::Security::DatawriterCryptoHandle get_local_datawriter_crypto_handle(const DCPS::GUID_t &id) const
bool is_expectant_opendds(const GUID_t &participant) const
Definition: Spdp.cpp:2191
void init(const OPENDDS_STRING &name, const DCPS::GUID_t &topic_id)
Definition: TopicDetails.h:34
void populate_discovered_reader_msg(DCPS::DiscoveredReaderData &drd, const DCPS::GUID_t &subscription_id, const LocalSubscription &sub)
Definition: Sedp.cpp:4586
DCPS::RepoIdSet matched_endpoints_
Definition: LocalEntities.h:59
sequence< QosPolicyCount > QosPolicyCountSeq
Definition: DdsDcpsCore.idl:62
void cleanup(const DCPS::GUID_t &guid, const XTypes::TypeIdentifier &ti)
Definition: Sedp.cpp:3834
OpenDDS_Dcps_Export void primitive_serialized_size_ulong(const Encoding &encoding, size_t &size, size_t count=1)
RemoteExceptionCode_t remoteEx
Definition: RtpsRpc.idl:48
const octet ENTITYKIND_BUILTIN_WRITER_WITH_KEY
Definition: DdsDcpsGuid.idl:33
ReliabilityQosPolicy reliability
bool got_complete
Whether all complete types are obtained.
Definition: Sedp.h:1072
const string GMCLASSID_SECURITY_DATAREADER_CRYPTO_TOKENS
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_WRITER
Definition: RtpsCore.idl:223
DCPS::TransportConfig_rch transport_cfg_
Definition: Sedp.h:771
RtpsDiscoveryConfig_rch config() const
void cleanup_secure_reader(const GUID_t &subscriptionId)
Definition: Sedp.cpp:6644
GroupDataQosPolicy group_data
DDS::ReturnCode_t write_volatile_message(DDS::Security::ParticipantVolatileMessageSecure &msg, const DCPS::GUID_t &reader)
Definition: Sedp.cpp:4766
DDS::ReturnCode_t write_publication_data_unsecure(const DCPS::GUID_t &rid, LocalPublication &pub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:4854
bool locators_changed(const ParticipantProxy_t &x, const ParticipantProxy_t &y)
Definition: Sedp.cpp:5982
void set_sub_id(CORBA::ULong index, OpenDDS::DCPS::GUID_t id)
DiscoveredSubscriptionMap discovered_subscriptions_
Definition: Sedp.h:1235
static bool decode_parameter_list(const DCPS::ReceivedDataSample &sample, Serializer &ser, DCPS::Extensibility extensibility, ParameterList &data)
Definition: Sedp.cpp:4090
ICE::AgentInfo ice_agent_info
Definition: LocalEntities.h:66
LM_INFO
OpenDDS_Dcps_Export TransportDebug transport_debug
Definition: debug.cpp:26
const DCPS::NetworkAddress & multicast_group() const
Definition: Sedp.cpp:946
OwnershipQosPolicy ownership
TypeLookupReplyWriter_rch type_lookup_reply_writer_
Definition: Sedp.h:1293
virtual void get_last_recv_locator(const GUID_t &, TransportLocator &)
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER
Definition: RtpsCore.idl:198
void set_handle_registry(const Security::HandleRegistry_rch &hr)
Definition: Sedp.h:1221
DurabilityQosPolicy durability
bool ready(const DiscoveredParticipant &participant, const GUID_t &local_id, const GUID_t &remote_id, bool local_tokens_sent) const
Definition: Sedp.cpp:1022
TransportLocatorSeq remote_data_
bool key_fields_only_
Only the key fields of the data sample are present in the payload.
bool remote_has_local_endpoint_token_i(const GUID_t &local, bool local_tokens_sent, const GUID_t &remote) const
Definition: Sedp.cpp:6581
LocalSubscriptionMap local_subscriptions_
Definition: Sedp.h:1233
virtual bool is_expectant_opendds(const GUID_t &endpoint) const
Definition: Sedp.cpp:2912
DCPS::TransportInst_rch transport_inst_
Definition: Sedp.h:770
const EntityId_t ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER
Definition: GuidUtils.h:43
const RepoIdSet & local_publications() const
Definition: TopicDetails.h:78
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59
void rtps_relay_only_now(bool f)
Definition: Sedp.cpp:5905
DiscoveredSubscriptionMap::iterator DiscoveredSubscriptionIter
Definition: Sedp.h:272
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER
Definition: RtpsCore.idl:202
const ParameterId_t PID_PARTICIPANT_GUID
Definition: RtpsCore.idl:289
void handle_auth_request(const DDS::Security::ParticipantStatelessMessage &msg)
Definition: Spdp.cpp:1142
bool isReader() const
Returns true if the GUID represents a reader entity.
DDS::ReturnCode_t add_publication_i(const DCPS::GUID_t &rid, LocalPublication &pub)
Definition: Sedp.cpp:4806
const BuiltinEndpointSet_t SEDP_BUILTIN_PUBLICATIONS_SECURE_READER
void data_delivered(const DCPS::DataSampleElement *)
Definition: Sedp.cpp:3213
virtual void data_received_i(const DCPS::ReceivedDataSample &sample, const DCPS::EntityId_t &entity_id, DCPS::Serializer &ser, DCPS::Extensibility extensibility)
Definition: Sedp.cpp:4514
const EntityId_t ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_READER
Definition: MessageTypes.h:78
TimeBasedFilterQosPolicy time_based_filter
sequence< octet > key
void replay_durable_data_for(const DCPS::GUID_t &remote_sub_id)
Definition: Sedp.cpp:3241
virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator &trans_info, ConnectionInfoFlags flags) const =0
Populate a transport locator sequence. Return the number of "locators.".
virtual void handle_event()
Called when the event is dispatched by an EventDispatcher.
Definition: Sedp.cpp:7650
DDS::Security::DatareaderCryptoHandle get_local_datareader_crypto_handle(const DCPS::GUID_t &id) const
const RepoIdSet & discovered_subscriptions() const
Definition: TopicDetails.h:123
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER
Definition: GuidUtils.h:47
String to_dds_string(unsigned short to_convert)
DiscoveryReader_rch publications_secure_reader_
Definition: Sedp.h:1300
bool associated() const
Definition: Spdp.cpp:3682
const EntityId_t ENTITYID_TL_SVC_REQ_WRITER
Definition: GuidUtils.h:52
EventDispatcher_rch event_dispatcher()
RepoIdSet ignored_guids_
Definition: Sedp.h:1230
TypeLookupRequestWriter_rch type_lookup_request_secure_writer_
Definition: Sedp.h:1295
void generate_remote_matched_crypto_handles(DiscoveredParticipant &participant)
Definition: Sedp.cpp:1334
const char SEDP_AGENT_INFO_KEY[]
Definition: Spdp.h:57
bool isUserDomainEntity() const
Returns true if the GUID represents a user defined type domain entity.
size_t array_count(Type(&)[count])
Definition: Util.h:221
const BuiltinEndpointQos_t BEST_EFFORT_PARTICIPANT_MESSAGE_DATA_READER
Definition: RtpsCore.idl:233
void received_stateless_message(DCPS::MessageId message_id, const DDS::Security::ParticipantStatelessMessage &data)
Definition: Sedp.cpp:2846
MonotonicTime_t participant_discovered_at_
DiscoveredParticipantMap::iterator DiscoveredParticipantIter
Definition: Spdp.h:70
SequenceNumber rpc_seqnum_complete
Definition: Sedp.h:1069
void process_association_records_i(DiscoveredParticipant &participant)
Definition: Sedp.cpp:1264
GuidSet RepoIdSet
Definition: GuidUtils.h:113
RcHandle< T > make_rch()
Definition: RcHandle_T.h:256
OwnershipQosPolicy ownership
DDS::ReturnCode_t init(const DCPS::GUID_t &guid, const RtpsDiscovery &disco, DDS::DomainId_t domainId, XTypes::TypeLookupService_rch tls)
Definition: Sedp.cpp:378
OpenDDS::DCPS::GUID_t destination_participant_guid
const char * c_str() const
const RepoIdSet & local_subscriptions() const
Definition: TopicDetails.h:93
MatchingDataMap matching_data_buffer_
Definition: Sedp.h:1242
const DDS::Security::EndpointSecurityAttributes & get_remote_datareader_security_attributes(const DCPS::GUID_t &id) const
Implementation of Recorder functionality.
Definition: RecorderImpl.h:45
ACE_CDR::Octet kind() const
Definition: TypeObject.h:748
DCPS::DataReaderCallbacks_wrch subscription_
Definition: LocalEntities.h:78
const EntityId_t ENTITYID_TL_SVC_REPLY_READER
Definition: GuidUtils.h:55
DCPS::TopicStatus remove_topic(const GUID_t &topicId)
Definition: Sedp.cpp:6105
#define OPENDDS_ASSERT(C)
Definition: Definitions.h:72
DDS::Security::ParticipantCryptoHandle crypto_handle_
Definition: Sedp.h:1264
DCPS::TopicDetailsMap topics_
Definition: Sedp.h:1236
Writer(const DCPS::GUID_t &pub_id, Sedp &sedp, ACE_INT64 seq_init=1)
Definition: Sedp.cpp:3180
DCPS::SequenceNumber sequence_
Definition: LocalEntities.h:61
const int AC_GENERATE_REMOTE_MATCHED_CRYPTO_HANDLE
TransportLocator discovery_locator_
ACE_CDR::ULong get_participant_flags(const DCPS::GUID_t &guid) const
Definition: Spdp.cpp:3693
ACE_CDR::ULong remote_transport_context_
void control_delivered(const DCPS::Message_Block_Ptr &sample)
Definition: Sedp.cpp:3231
LivelinessQosPolicy liveliness
void update_publication_locators(const GUID_t &publicationId, const DCPS::TransportLocatorSeq &transInfo)
Definition: Sedp.cpp:6245
bool process_type_lookup_reply(const DCPS::ReceivedDataSample &, DCPS::Serializer &ser, bool is_discovery_protected)
Definition: Sedp.cpp:3848
sequence< Locator_t > LocatorSeq
OpenDDS_Dcps_Export GUID_t make_unknown_guid(const GuidPrefix_t &prefix)
Definition: GuidUtils.h:228
unsigned long ExtendedBuiltinEndpointSet_t
DeadlineQosPolicy deadline
void add_local_publication(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:68
bool process_get_types_request(const XTypes::TypeLookup_Request &type_lookup_request, XTypes::TypeLookup_Reply &type_lookup_reply)
Definition: Sedp.cpp:3771
TimePoint_T< SystemClock > SystemTimePoint
Definition: TimeTypes.h:32
XTypes::TypeLookupService_rch type_lookup_service_
Definition: Sedp.h:1240
void received_participant_message_data_secure(DCPS::MessageId message_id, const ParticipantMessageData &data)
Definition: Sedp.cpp:2729
bool should_drop_stateless_message(const DDS::Security::ParticipantGenericMessage &msg)
Definition: Sedp.cpp:2752
bool associated_with_counterpart_if_not_pending(const DCPS::GUID_t &remote_part) const
Definition: Sedp.cpp:3167
DCPS::SequenceNumber type_lookup_service_sequence_number_
Definition: Sedp.h:1245
DiscoveryReader_rch subscriptions_reader_
Definition: Sedp.h:1302
const EntityId_t ENTITYID_TL_SVC_REQ_WRITER_SECURE
Definition: MessageTypes.h:90
key GuidPrefix_t guidPrefix
Definition: DdsDcpsGuid.idl:58
ACE_Thread_Mutex lock_
Seems to protect accesses to impls_, pending_, links_, data_link_index_.
const DDS::BuiltinTopicKey_t BUILTIN_TOPIC_KEY_UNKNOWN
DestinationOrderQosPolicy destination_order
reference_wrapper< T > ref(T &r)
Definition: RcHandle_T.h:237
sequence< TransportLocator > TransportLocatorSeq
EntityFactoryQosPolicy entity_factory
void match_endpoints(GUID_t repoId, const DCPS::TopicDetails &td, bool remove=false)
Definition: Sedp.cpp:6673
bool compatibleQOS(OpenDDS::DCPS::IncompatibleQosStatus *writerStatus, OpenDDS::DCPS::IncompatibleQosStatus *readerStatus, const OpenDDS::DCPS::TransportLocatorSeq &pubTLS, const OpenDDS::DCPS::TransportLocatorSeq &subTLS, DDS::DataWriterQos const *const writerQos, DDS::DataReaderQos const *const readerQos, DDS::PublisherQos const *const pubQos, DDS::SubscriberQos const *const subQos)
Definition: DCPS_Utils.cpp:237
const EntityId_t ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_READER
Definition: MessageTypes.h:88
void rtps_relay_only_now(bool flag)
T::rv_reference move(T &p)
Definition: unique_ptr.h:141
DDS::Security::CryptoKeyFactory_var get_crypto_key_factory() const
Definition: Sedp.h:1206
const ExtendedBuiltinEndpointSet_t TYPE_LOOKUP_SERVICE_REPLY_WRITER_SECURE
void remove_from_bit_i(const DiscoveredPublication &pub)
Definition: Sedp.cpp:1828
DataRepresentationQosPolicy representation
Security::HandleRegistry_rch get_handle_registry() const
Definition: Sedp.h:257
PluginEndpointSecurityAttributesMask plugin_endpoint_security_attributes
DDS::Security::ExtendedBuiltinEndpointSet_t available_extended_builtin_endpoints() const
Definition: Spdp.h:203
const octet ENTITYKIND_BUILTIN_WRITER_NO_KEY
Definition: DdsDcpsGuid.idl:34
#define ACE_CDR_BYTE_ORDER
const DCPS::GUID_t & topic_id() const
Definition: TopicDetails.h:136
void update(const DDS::TopicQos &qos)
Definition: TopicDetails.h:63
void set_access_control(DDS::Security::AccessControl_var acl)
Definition: Sedp.h:1191
OpenDDSParticipantFlagsBits_t bits
Definition: RtpsCore.idl:330
bool operator==(const DisjointSequence::OrderedRanges< T > &a, const DisjointSequence::OrderedRanges< T > &b)
void disassociate(const GUID_t &peerId)
const int AC_REMOTE_DURABLE
DDS::ReturnCode_t write_publication_data_secure(const DCPS::GUID_t &rid, LocalPublication &pub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:4904
sequence< DataHolder > DataHolderSeq
ACE_Guard< ACE_Thread_Mutex > lock_
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER
Definition: RtpsCore.idl:218
void serialized_size(const Encoding &encoding, size_t &size, const SequenceNumber &)
DDS::PublicationBuiltinTopicData ddsPublicationData
virtual void data_received_i(const DCPS::ReceivedDataSample &sample, const DCPS::EntityId_t &entity_id, DCPS::Serializer &ser, DCPS::Extensibility extensibility)
Definition: Sedp.cpp:4258
const size_t uint32_cdr_size
Definition: Serializer.h:96
void remove_assoc(const GUID_t &remove_from, const GUID_t &removing)
Definition: Sedp.cpp:6790
DDS::RPC::RequestHeader header
Definition: TypeLookup.idl:74
bool remote_is_authenticated_i(const GUID_t &local, const GUID_t &remote, const DiscoveredParticipant &participant) const
Definition: Sedp.cpp:6455
DDS::SubscriptionBuiltinTopicData ddsSubscriptionData
EntityFactoryQosPolicy entity_factory
const int AC_REMOTE_RELIABLE
Sedp(const DCPS::GUID_t &participant_id, Spdp &owner, ACE_Thread_Mutex &lock)
Definition: Sedp.cpp:283
void write_durable_dcps_participant_secure(const DCPS::GUID_t &reader)
Definition: Sedp.cpp:4775
DDS::ReturnCode_t write_stateless_message(const DDS::Security::ParticipantStatelessMessage &msg, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence)
Definition: Sedp.cpp:3377
DCPS::DiscoveredWriterData writer_data_
void OpenDDS_Dcps_Export log_progress(const char *activity, const GUID_t &local, const GUID_t &remote, const MonotonicTime_t &start_time, const GUID_t &reference)
Definition: Logging.cpp:20
Conversion processing and value testing utilities for RTPS GUID_t types.
Definition: GuidConverter.h:62
bool get_last_recv_locator(const DCPS::GUID_t &part_id, DCPS::LocatorSeq &target, bool &inlineQos)
Definition: Spdp.cpp:3668
OpenDDS::RTPS::ParticipantProxy_t participantProxy
virtual void handle_event()
Called when the event is dispatched by an EventDispatcher.
Definition: Sedp.cpp:7636
void cleanup_volatile_crypto(const DCPS::GUID_t &remote)
Definition: Sedp.cpp:1379
DCPS::JobQueue_rch job_queue_
Definition: Sedp.h:773
void data_acked(const GUID_t &remote)
Definition: Sedp.cpp:3225
const EntityId_t ENTITYID_TL_SVC_REPLY_READER_SECURE
Definition: MessageTypes.h:93
EndpointSecurityAttributesMask endpoint_security_attributes
const long TypeLookup_getTypes_HashId
Definition: TypeLookup.idl:26
DCPS::LocatorSeq metatrafficMulticastLocatorList
Definition: RtpsCore.idl:612
AuthState lookup_participant_auth_state(const GUID_t &id) const
Definition: Spdp.cpp:3855
DDS::SubscriberQos subscriber_qos_
Definition: LocalEntities.h:80
const bool use_xtypes_
Definition: Sedp.h:1246
void reset_alignment()
Reset alignment as if a new instance were created.
Definition: Serializer.cpp:443
void type_lookup_fini()
Definition: Sedp.h:299
DDS::ReturnCode_t add_subscription_i(const DCPS::GUID_t &rid, LocalSubscription &sub)
Definition: Sedp.cpp:4958
BuiltinAssociationRecords builtin_associated_records_
void data_dropped(const DCPS::DataSampleElement *, bool by_transport)
Definition: Sedp.cpp:3219
LatencyBudgetQosPolicy latency_budget
PluginEndpointSecurityAttributesMask plugin_endpoint_attributes
DCPS::EventDispatcher_rch event_dispatcher_
Definition: Sedp.h:774
MessageId
One byte message id (<256)
LocalSubscriptionMap::const_iterator LocalSubscriptionCIter
Definition: Sedp.h:327
static TimePoint_T< MonotonicClock > now()
Definition: TimePoint_T.inl:41
const BuiltinEndpointSet_t SPDP_BUILTIN_PARTICIPANT_SECURE_READER
TypeLookupReplyReader_rch type_lookup_reply_reader_
Definition: Sedp.h:1314
OrigSeqNumberMap orig_seq_numbers_
Definition: Sedp.h:1241
void populate_origination_locator(const GUID_t &id, DCPS::TransportLocator &tl)
Definition: Sedp.cpp:7017
RcHandle< EndpointManagerSporadic > type_lookup_reply_deadline_processor_
Definition: Sedp.h:1243
DCPS::MonotonicTime_t participant_discovered_at_
virtual void assign_subscription_key(GUID_t &rid, const GUID_t &topicId, const DDS::DataReaderQos &)
Definition: Sedp.h:1028
DDS::DomainId_t get_domain_id() const
Definition: Spdp.h:169
const DCPS::GUID_t & writer_id() const
#define OPENDDS_STRING
DDS::Security::DatawriterCryptoHandle generate_remote_matched_writer_crypto_handle(const DCPS::GUID_t &writer, const DCPS::GUID_t &reader)
Definition: Sedp.cpp:5258
DDS::Security::ParticipantBuiltinTopicDataSecure ddsParticipantDataSecure
sequence< GUID_t > ReaderIdSeq
void stop_ice(const DCPS::GUID_t &guid, const DiscoveredPublication &dpub)
Definition: Sedp.cpp:5851
void update_agent_info(const DCPS::GUID_t &a_local_guid, const ICE::AgentInfo &a_agent_info)
Definition: Sedp.cpp:5715
bool process_get_types_reply(const XTypes::TypeLookup_Reply &reply)
Definition: Sedp.cpp:3954
DurabilityServiceQosPolicy durability_service
void remove_publication(const GUID_t &publicationId)
Definition: Sedp.cpp:6218
ReaderAssociationRecords reader_pending_records_
TypeConsistencyEnforcementQosPolicy type_consistency
DDS::PublisherQos publisher_qos_
Definition: LocalEntities.h:74
RcHandle< PublicationAgentInfoListener > publication_agent_info_listener_
Definition: Sedp.h:1322
void write_durable_publication_data(const DCPS::GUID_t &reader, bool secure)
Definition: Sedp.cpp:4641
DOMAINID_TYPE_NATIVE DomainId_t
const EntityId_t ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER
Definition: GuidUtils.h:44
XTypes::TypeIdentifier type_id
Definition: Sedp.h:333
const EntityId_t ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER
Definition: GuidUtils.h:45
DDS::Security::ParticipantCryptoHandle crypto_handle_
Definition: Spdp.h:625
const EntityId_t ENTITYID_PARTICIPANT
Definition: GuidUtils.h:37
const TypeConsistencyEnforcementQosPolicyKind_t ALLOW_TYPE_COERCION
PresentationQosPolicy presentation
const DDS::TopicQos local_qos() const
Definition: TopicDetails.h:135
void data_received(const DCPS::ReceivedDataSample &sample)
Definition: Sedp.cpp:4109
void enqueue_tail(const DataSampleElement *element)
LM_DEBUG
NativeCryptoHandle DatawriterCryptoHandle
const DCPS::GUID_t & remote_id() const
bool get_default_locators(const DCPS::GUID_t &part_id, DCPS::LocatorSeq &target, bool &inlineQos)
Definition: Spdp.cpp:3639
void associate(DiscoveredParticipant &participant, const DDS::Security::ParticipantSecurityAttributes &participant_sec_attr)
Definition: Sedp.cpp:1044
GUID_t make_topic_guid()
Definition: Sedp.h:1154
LocalSubscriptionMap::iterator LocalSubscriptionIter
Definition: Sedp.h:326
MonotonicTimePoint time_added_to_map
Definition: Sedp.h:1074
const DDS::Security::EndpointSecurityAttributes & get_remote_datawriter_security_attributes(const DCPS::GUID_t &id) const
XTypes::TypeInformation type_info_
Definition: LocalEntities.h:63
typedef OPENDDS_MAP_CMP(GUID_t, DataLink_rch, GUID_tKeyLessThan) DataLinkIndex
const ViewStateKind NOT_NEW_VIEW_STATE
bool associated_with_counterpart(const DCPS::GUID_t &remote_part) const
Definition: Sedp.cpp:3162
void send_datareader_crypto_tokens(const DCPS::GUID_t &local_reader, const DCPS::GUID_t &remote_writer, const DDS::Security::DatareaderCryptoTokenSeq &drcts)
Definition: Sedp.cpp:5341
TypeLookupReplyWriter_rch type_lookup_reply_secure_writer_
Definition: Sedp.h:1296
SequenceNumber participant_secure_sequence_
Definition: Sedp.h:1273
bool remote_has_local_participant_token_i(const GUID_t &local, const GUID_t &remote, const DiscoveredParticipant &participant) const
Definition: Sedp.cpp:6508
DCPS::WeakRcHandle< ICE::Endpoint > get_ice_endpoint_if_added()
Definition: Spdp.cpp:612
bool remote_knows_about_local_i(const GUID_t &local, const GUID_t &remote) const
Definition: Sedp.cpp:6408
MatchingDataMap::iterator MatchingDataIter
Definition: Sedp.h:1119
CryptoTokenSeq DatareaderCryptoTokenSeq
TypeLookupReplyReader_rch type_lookup_reply_secure_reader_
Definition: Sedp.h:1317
ACE_CDR::ULong ULong
virtual void handle_event()
Called when the event is dispatched by an EventDispatcher.
Definition: Sedp.cpp:7681
Class to serialize and deserialize data for DDS.
Definition: Serializer.h:369
DurabilityQosPolicy durability
ParticipantCryptoInfoPair lookup_participant_crypto_info(const DCPS::GUID_t &id) const
Definition: Spdp.cpp:3788
bool is_security_enabled()
Definition: Sedp.h:1176
DDS::ReturnCode_t write_subscription_data(const DCPS::GUID_t &rid, LocalSubscription &sub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:4982
void add_discovered_subscription(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:113
DDS::ReturnCode_t write_subscription_data_secure(const DCPS::GUID_t &rid, LocalSubscription &sub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:5056
const ParameterId_t PID_ENDPOINT_GUID
Definition: RtpsCore.idl:298
CryptoKeyExchange_var get_crypto_key_exchange() const
const int AC_SEND_LOCAL_TOKEN
static size_t get_max_serialized_size()
Similar to IDL compiler generated methods.
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER
Definition: RtpsCore.idl:220
void set_permissions_handle(DDS::Security::PermissionsHandle h)
Definition: Sedp.h:1181
bool handle_datareader_crypto_tokens(const DDS::Security::ParticipantVolatileMessageSecure &msg)
Definition: Sedp.cpp:5476
TypeIdentifierWithDependencies complete
Definition: TypeObject.h:3374
void end_historic_samples(const DCPS::GUID_t &reader)
Definition: Sedp.cpp:3513
OwnershipStrengthQosPolicy ownership_strength
DCPS::WeakRcHandle< ICE::Endpoint > get_ice_endpoint()
Definition: Sedp.cpp:3117
DCPS::TopicStatus find_topic(const char *topicName, CORBA::String_out dataTypeName, DDS::TopicQos_out qos, GUID_t &topicId)
Definition: Sedp.cpp:6085
OpenDDS::DCPS::GUID_t writer_guid
Definition: RtpsRpc.idl:21
bool update_subscription_params(const DCPS::GUID_t &subId, const DDS::StringSeq &params)
Definition: Sedp.cpp:1977
OpenDDS::RTPS::SequenceNumber_t sequence_number
Definition: RtpsRpc.idl:22
LivelinessReader_rch participant_message_secure_reader_
Definition: Sedp.h:1308
DestinationOrderQosPolicy destination_order
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
Definition: CHANGELOG.txt:8
sequence< TransportStatistics > TransportStatisticsSequence
Holds a data sample received by the transport.
DeferredSamples deferred_samples_
Definition: Sedp.h:478
const ReturnCode_t RETCODE_TIMEOUT
void populate_locators(DCPS::TransportLocatorSeq &remote_data, const ParticipantData_t &pdata)
Definition: Sedp.cpp:970
DataRepresentationQosPolicy representation
unsigned char ttl() const
bool process_type_lookup_request(DCPS::Serializer &ser, XTypes::TypeLookup_Reply &type_lookup_reply)
Definition: Sedp.cpp:3737
void match_continue(const GUID_t &writer, const GUID_t &reader)
Definition: Sedp.cpp:7049
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
const long TypeLookup_getDependencies_HashId
Definition: TypeLookup.idl:27
BuiltinEndpointSet_t available_builtin_endpoints() const
Definition: Spdp.h:201
void serialize_type_info(const TypeInformation &type_info, T &seq, const DCPS::Encoding *encoding_option=0)
Definition: TypeObject.h:3382
DDS::Security::AccessControl_var get_access_control() const
Definition: Sedp.h:1196
void cleanup_reader_association(DCPS::DataReaderCallbacks_wrch callbacks, const GUID_t &reader, const GUID_t &writer)
Definition: Sedp.cpp:6759
NativeCryptoHandle DatareaderCryptoHandle
OPENDDS_STRING multicast_interface() const
ParticipantData_t build_local_pdata(bool always_in_the_clear, Security::DiscoveredParticipantDataKind kind)
Definition: Spdp.cpp:2201
OPENDDS_STRING get_instance_name(const DCPS::GUID_t &id) const
Definition: Sedp.h:405
void associate_volatile(DiscoveredParticipant &participant)
Definition: Sedp.cpp:1385
bool initialized()
Definition: Spdp.h:110
bool handle_participant_crypto_tokens(const DDS::Security::ParticipantVolatileMessageSecure &msg)
Definition: Spdp.cpp:1885
DDS::Security::DatareaderCryptoHandle generate_remote_matched_reader_crypto_handle(const DCPS::GUID_t &reader, const DCPS::GUID_t &writer, bool relay_only)
Definition: Sedp.cpp:5291
const EntityId_t ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER
Definition: MessageTypes.h:79
LivelinessWriter_rch participant_message_writer_
Definition: Sedp.h:1284
const ViewStateKind NEW_VIEW_STATE
WriterAssociationRecords writer_pending_records_
void message_block_to_sequence(const ACE_Message_Block &mb_locator, T &out)
Definition: MessageUtils.h:101
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_WRITER
WriterAssociationRecords writer_associated_records_
typedef OPENDDS_MAP_CMP(GUID_t, DiscoveredSubscription, GUID_tKeyLessThan) DiscoveredSubscriptionMap
DDS::Security::PermissionsHandle lookup_participant_permissions(const DCPS::GUID_t &id) const
Definition: Spdp.cpp:3843
LM_NOTICE
DDS::Security::ExtendedBuiltinEndpointSet_t availableExtendedBuiltinEndpoints
Definition: RtpsCore.idl:620
const DCPS::TransportClient_rch transport_client_
void set_local(const OPENDDS_STRING &data_type_name, const DDS::TopicQos &qos, bool has_dcps_key, TopicCallbacks *topic_callbacks)
Definition: TopicDetails.h:40
bool deserialize_type_info(TypeInformation &type_info, const T &seq)
Definition: TypeObject.h:3397
LocalPublicationMap::const_iterator LocalPublicationCIter
Definition: Sedp.h:322
ACE_Message_Block * cont(void) const
DCPS::TransportLocatorSeq trans_info_
Definition: LocalEntities.h:56
ResourceLimitsQosPolicy resource_limits
DCPS::LocatorSeq metatrafficUnicastLocatorList
Definition: RtpsCore.idl:611
const EntityId_t ENTITYID_TL_SVC_REPLY_WRITER_SECURE
Definition: MessageTypes.h:92
void disassociate(DiscoveredParticipant &participant)
Definition: Sedp.cpp:1544
DDS::Security::CryptoKeyExchange_var get_crypto_key_exchange() const
Definition: Sedp.h:1216
void remove_agent_info(const DCPS::GUID_t &a_local_guid)
Definition: Sedp.cpp:5728
void update_subscription_locators(const GUID_t &subscriptionId, const DCPS::TransportLocatorSeq &transInfo)
Definition: Sedp.cpp:6391
virtual DDS::ReturnCode_t remove_publication_i(const DCPS::GUID_t &publicationId, LocalPublication &pub)
Definition: Sedp.cpp:1878
void send_participant_crypto_tokens(const DCPS::GUID_t &id)
Definition: Spdp.cpp:3801
HandleRegistry_rch get_handle_registry(const DCPS::GUID_t &participant_id)
SecurityReader_rch participant_volatile_message_secure_reader_
Definition: Sedp.h:1310
TimePoint_T< MonotonicClock > MonotonicTimePoint
Definition: TimeTypes.h:51
ACE_CDR::UShort UShort
GUID_t add_publication(const GUID_t &topicId, DCPS::DataWriterCallbacks_rch publication, const DDS::DataWriterQos &qos, const DCPS::TransportLocatorSeq &transInfo, const DDS::PublisherQos &publisherQos, const XTypes::TypeInformation &type_info)
Definition: Sedp.cpp:6122
GUID_t participant_id_
Definition: Sedp.h:1229
const RepoIdSet & discovered_publications() const
Definition: TopicDetails.h:108
bool send_type_lookup_reply(XTypes::TypeLookup_Reply &type_lookup_reply, const DCPS::GUID_t &reader)
Definition: Sedp.cpp:3696
void process_discovered_reader_data(DCPS::MessageId message_id, const DCPS::DiscoveredReaderData &rdata, const DCPS::GUID_t &guid, const XTypes::TypeInformation &type_info, bool have_ice_agent_info, const ICE::AgentInfo &ice_agent_info, const DDS::Security::EndpointSecurityInfo *security_info=NULL)
Definition: Sedp.cpp:2336
SecurityReader_rch participant_stateless_message_reader_
Definition: Sedp.h:1309
DCPS::SequenceNumber local_participant_manual_liveliness_sn_secure_
Definition: Sedp.h:1254
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_STATELESS_MESSAGE_WRITER
const EntityId_t ENTITYID_TL_SVC_REQ_READER
Definition: GuidUtils.h:53
const EntityId_t ENTITYID_TL_SVC_REPLY_WRITER
Definition: GuidUtils.h:54
sequence< GUID_t > WriterIdSeq
bool local_has_remote_endpoint_token_i(const GUID_t &local, const GUID_t &remote) const
Definition: Sedp.cpp:6536
ACE_CDR::ULong transport_context_
Definition: LocalEntities.h:58
const ExtendedBuiltinEndpointSet_t TYPE_LOOKUP_SERVICE_REQUEST_READER_SECURE
GUID_t add_subscription(const GUID_t &topicId, DCPS::DataReaderCallbacks_rch subscription, const DDS::DataReaderQos &qos, const DCPS::TransportLocatorSeq &transInfo, const DDS::SubscriberQos &subscriberQos, const char *filterClassName, const char *filterExpr, const DDS::StringSeq &params, const XTypes::TypeInformation &type_info)
Definition: Sedp.cpp:6261
DDS::PropertySeq PropertySeq
Definition: RtpsCore.idl:49
const bool use_xtypes_complete_
Definition: Sedp.h:1247
const EntityId_t ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER
Definition: GuidUtils.h:40
static SequenceNumber ZERO()
TopicDataQosPolicy topic_data
void insert_local_datareader_crypto_handle(const DCPS::GUID_t &id, DDS::Security::DatareaderCryptoHandle handle, const DDS::Security::EndpointSecurityAttributes &attributes)
virtual void data_received_i(const DCPS::ReceivedDataSample &sample, const DCPS::EntityId_t &entity_id, DCPS::Serializer &ser, DCPS::Extensibility extensibility)
Definition: Sedp.cpp:4224
char * wr_ptr(void) const
DCPS::DiscoveredReaderData reader_data_
void signal_liveliness_unsecure(DDS::LivelinessQosPolicyKind kind)
Definition: Sedp.cpp:3036
TypeLookup_getTypeDependencies_In getTypeDependencies
Definition: TypeLookup.idl:69
LM_WARNING
void write_durable_participant_message_data_secure(const DCPS::GUID_t &reader)
Definition: Sedp.cpp:4736
OpenDDS_Rtps_Export DCPS::LocatorSeq transport_locator_to_locator_seq(const DCPS::TransportLocator &info)
void association_complete_i(const DCPS::GUID_t &localId, const DCPS::GUID_t &remoteId)
Definition: Sedp.cpp:2920
std::pair< DDS::Security::ParticipantCryptoHandle, DDS::Security::SharedSecretHandle_var > ParticipantCryptoInfoPair
Definition: Spdp.h:165
ACE_UINT32 ULong
DCPS::SequenceNumber local_participant_automatic_liveliness_sn_secure_
Definition: Sedp.h:1253
const DCPS::GUID_t & reader_id() const
void set_num_subs(CORBA::ULong num_subs)
The End User API.
bool need_minimal_and_or_complete_types(const XTypes::TypeInformation *type_info, bool &need_minimal, bool &need_complete) const
Definition: Sedp.cpp:6964
void request_remote_complete_type_objects(const GUID_t &remote_entity, const XTypes::TypeInformation &remote_type_info, DCPS::TypeObjReqCond &cond)
Definition: Sedp.cpp:6925
DataTags DataTagQosPolicy
OPENDDS_STRING uniqueParticipantId() const
DCPS::MonotonicTime_t get_participant_discovered_at() const
Definition: Spdp.cpp:4461
void use_rtps_relay_now(bool f)
Definition: Sedp.cpp:5911
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_WRITER
Definition: MessageTypes.h:83
AccessControl_var get_access_control() const
void remove_expired_endpoints(const MonotonicTimePoint &)
Definition: Sedp.cpp:6978
DDS::ParticipantBuiltinTopicData base
bool assignable(const TypeObject &ta, const TypeObject &tb) const
Both input type objects must be minimal.
DiscoveryWriter_rch subscriptions_writer_
Definition: Sedp.h:1280
LivelinessReader_rch participant_message_reader_
Definition: Sedp.h:1306
const octet ENTITYKIND_BUILTIN_UNKNOWN
Definition: DdsDcpsGuid.idl:31
virtual ACE_Reactor * reactor(void) const
AtomicBool shutting_down_
Definition: Sedp.h:425
void match(const GUID_t &writer, const GUID_t &reader)
Definition: Sedp.cpp:6824
bool shutting_down()
Definition: Spdp.h:118
DCPS::SequenceNumber local_participant_automatic_liveliness_sn_
Definition: Sedp.h:1250
bool process_get_dependencies_reply(const DCPS::ReceivedDataSample &sample, const XTypes::TypeLookup_Reply &reply, const DCPS::SequenceNumber &seq_num, bool is_discovery_protected)
Definition: Sedp.cpp:3990
DDS::Security::ParticipantCryptoHandle get_remote_participant_crypto_handle(const DCPS::GUID_t &id) const
const char *const name
Definition: debug.cpp:60
ReaderDataLifecycleQosPolicy reader_data_lifecycle
Sequence & append(const T &member)
Definition: TypeObject.h:155
void purge_dead_topic(const String &topic_name)
Definition: Sedp.h:307
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR
Definition: RtpsCore.idl:200
DCPS::RepoIdSet associated_participants_
Definition: Sedp.h:864
static void set_inline_qos(DCPS::TransportLocatorSeq &locators)
Definition: Sedp.cpp:5159
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_READER
Definition: RtpsCore.idl:229
TypeLookupRequestReader_rch type_lookup_request_secure_reader_
Definition: Sedp.h:1316
void get_remote_type_objects(const XTypes::TypeIdentifierWithDependencies &tid_with_deps, MatchingData &md, bool get_minimal, const GUID_t &remote_id, bool is_discovery_protected)
Definition: Sedp.cpp:7529
bool isBuiltinDomainEntity() const
Returns true if the GUID represents a builtin type domain entity.
void data_acked_i(const DCPS::GUID_t &local_id, const DCPS::GUID_t &remote_id)
Definition: Sedp.cpp:2977
DiscoveryReader_rch dcps_participant_secure_reader_
Definition: Sedp.h:1311
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_WRITER
Definition: MessageTypes.h:85
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER
Definition: MessageTypes.h:82
void add_discovered_publication(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:98
Mix-in class for DDS entities which directly use the transport layer.
sequence< Parameter > ParameterList
void create_and_send_datareader_crypto_tokens(const DDS::Security::DatareaderCryptoHandle &drch, const DCPS::GUID_t &local_reader, const DDS::Security::DatawriterCryptoHandle &dwch, const DCPS::GUID_t &remote_writer)
Definition: Sedp.cpp:1462
DDS::ReturnCode_t write_subscription_data_unsecure(const DCPS::GUID_t &rid, LocalSubscription &sub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:5006
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_TYPE_LOOKUP_REPLY_DATA_WRITER
Definition: RtpsCore.idl:227
ACE_TEXT("TCP_Factory")
HistoryQosPolicy history
WeakRcHandle< ICE::Endpoint > get_ice_endpoint()
DatareaderCryptoTokenSeqMap pending_remote_reader_crypto_tokens_
Definition: Sedp.h:1268
bool got_minimal
Whether all minimal types are obtained.
Definition: Sedp.h:1065
OpenDDS_Dcps_Export GUID_t make_part_guid(const GuidPrefix_t &prefix)
Definition: GuidUtils.h:216
const EntityId_t ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER
Definition: MessageTypes.h:77
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR
Definition: RtpsCore.idl:208
DCPS::LocatorSeq defaultUnicastLocatorList
Definition: RtpsCore.idl:614
Authentication_var get_authentication() const
const DCPS::EntityId_t PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE
Definition: MessageTypes.h:117
virtual void data_received_i(const DCPS::ReceivedDataSample &sample, const DCPS::EntityId_t &entity_id, DCPS::Serializer &ser, DCPS::Extensibility extensibility)
Definition: Sedp.cpp:4193
ACE_INT32 Long
void update_agent_info(const DCPS::GUID_t &a_local_guid, const ICE::AgentInfo &a_agent_info)
Definition: Sedp.cpp:5691
void set_crypto_key_exchange(DDS::Security::CryptoKeyExchange_var ckf)
Definition: Sedp.h:1211
void assign_bit_key(DiscoveredPublication &pub)
Definition: Sedp.cpp:954
SendControlStatus send_control(const DataSampleHeader &header, Message_Block_Ptr msg)
bool associate(const AssociationData &peer, bool active)
void erase_local_datawriter_crypto_handle(const DCPS::GUID_t &id)
const EntityId_t ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER
Definition: GuidUtils.h:42
TransportPriorityQosPolicy transport_priority
LivelinessWriter_rch participant_message_secure_writer_
Definition: Sedp.h:1286
const char SPDP_AGENT_INFO_KEY[]
Definition: Spdp.h:56
void populate_discovered_writer_msg(DCPS::DiscoveredWriterData &dwd, const DCPS::GUID_t &publication_id, const LocalPublication &pub)
Definition: Sedp.cpp:4551
const BuiltinEndpointSet_t SPDP_BUILTIN_PARTICIPANT_SECURE_WRITER
void remove_assoc_i(const DCPS::GUID_t &local_guid, const LocalPublication &lpub, const DCPS::GUID_t &remote_guid)
Definition: Sedp.cpp:5635
DDS::ReturnCode_t write_dcps_participant_secure(const Security::SPDPdiscoveredParticipantData &msg, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence)
Definition: Sedp.cpp:3433
BuiltinEndpointSet_t availableBuiltinEndpoints
Definition: RtpsCore.idl:609
ACE_CDR::UShort TypeFlag
Definition: TypeObject.h:399
void erase_remote_datawriter_crypto_handle(const DCPS::GUID_t &id)
const BuiltinEndpointSet_t SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER
TypeLookupRequestWriter_rch type_lookup_request_writer_
Definition: Sedp.h:1292
bool process_get_dependencies_request(const XTypes::TypeLookup_Request &request, XTypes::TypeLookup_Reply &reply)
Definition: Sedp.cpp:3803
bool should_drop_volatile_message(const DDS::Security::ParticipantGenericMessage &msg)
Definition: Sedp.cpp:2779
void use_ice_now(bool f)
Definition: Sedp.cpp:5917
OpenDDS_Dcps_Export bool equal_guid_prefixes(const GuidPrefix_t &lhs, const GuidPrefix_t &rhs)
Definition: GuidUtils.h:132
#define OPENDDS_VECTOR(T)
OpenDDS::DCPS::GUID_t source_guid
DiscoveryWriter_rch subscriptions_secure_writer_
Definition: Sedp.h:1282
virtual void assign_publication_key(GUID_t &rid, const GUID_t &topicId, const DDS::DataWriterQos &)
Definition: Sedp.h:1018
DatareaderCryptoHandleList get_all_remote_datareaders(const DCPS::GUID_t &prefix) const
void push_back(Seq &seq, const typename Seq::value_type &val)
std::vector-style push_back() for CORBA Sequences
Definition: Util.h:138
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_READER
Definition: MessageTypes.h:86
DDS::Security::DatawriterCryptoHandle get_remote_datawriter_crypto_handle(const DCPS::GUID_t &id) const
bool local_has_remote_participant_token_i(const GUID_t &local, const GUID_t &remote) const
Definition: Sedp.cpp:6481
void write_durable_participant_message_data(const DCPS::GUID_t &reader)
Definition: Sedp.cpp:4713
ReliabilityQosPolicy reliability
OpenDDS_Dcps_Export LogLevel log_level
DCPS::GuidPrefix_t guidPrefix
Definition: RtpsCore.idl:606
void add_local_subscription(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:83
void disassociate_helper_extended(DDS::Security::ExtendedBuiltinEndpointSet_t &extended_associated_endpoints, const CORBA::ULong flags, const DCPS::GUID_t &id, const EntityId_t &ent, DCPS::TransportClient &client)
Definition: Sedp.cpp:1411
sequence< octet, 32 > OctetSeq32
Definition: TypeLookup.idl:45
void replay_durable_data_for(const DCPS::GUID_t &remote_sub_id)
Definition: Sedp.cpp:1634
void send_datawriter_crypto_tokens(const DCPS::GUID_t &local_writer, const DCPS::GUID_t &remote_reader, const DDS::Security::DatawriterCryptoTokenSeq &dwcts)
Definition: Sedp.cpp:5385
ReactorTask_rch reactor_task()
OpenDDSParticipantFlags_t opendds_participant_flags
Definition: RtpsCore.idl:617
void send_deferred_samples(const GUID_t &reader)
Definition: Sedp.cpp:3283
bool repr_to_encoding_kind(DDS::DataRepresentationId_t repr, Encoding::Kind &kind)
Definition: DCPS_Utils.cpp:455
DDS::Security::DatareaderCryptoHandle get_remote_datareader_crypto_handle(const DCPS::GUID_t &id) const
void set_header_fields(DCPS::DataSampleHeader &dsh, size_t size, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence, bool historic_sample=false, DCPS::MessageId id=DCPS::SAMPLE_DATA)
Definition: Sedp.cpp:3569
bool is_security_enabled() const
Definition: Spdp.h:159
GUID_t make_counterpart_guid(const DCPS::GUID_t &remote_part) const
Definition: Sedp.cpp:3157
SecurityWriter_rch participant_volatile_message_secure_writer_
Definition: Sedp.h:1290
void append_transport_statistics(DCPS::TransportStatisticsSequence &seq)
Definition: Sedp.cpp:5977
const SequenceNumber_t SEQUENCENUMBER_UNKNOWN
Definition: MessageTypes.h:50
void remove_from_bit(const DiscoveredPublication &pub)
Definition: Sedp.h:1144
const BuiltinEndpointSet_t SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER
virtual void handle_event()
Called when the event is dispatched by an EventDispatcher.
Definition: Sedp.cpp:7667
DCPS::DataWriterCallbacks_wrch publication_
Definition: LocalEntities.h:72
DDS::Security::EndpointSecurityAttributes security_attribs_
Definition: LocalEntities.h:67
const string GMCLASSID_SECURITY_AUTH_HANDSHAKE
void write_control_msg(DCPS::Message_Block_Ptr payload, size_t size, DCPS::MessageId id, DCPS::SequenceNumber seq=DCPS::SequenceNumber())
Definition: Sedp.cpp:3557
MonotonicTimePoint time_started
Definition: Sedp.h:336
Sequence number abstraction. Only allows positive 64 bit values.
void ignore(const GUID_t &to_ignore)
Definition: Sedp.cpp:5988
ReactorInterceptor_rch interceptor() const
Definition: ReactorTask.inl:65
void handle_handshake_message(const DDS::Security::ParticipantStatelessMessage &msg)
Definition: Spdp.cpp:1452
octet GuidPrefix_t[12]
Definition: DdsDcpsGuid.idl:19
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_READER
Definition: MessageTypes.h:84
const EntityId_t ENTITYID_TL_SVC_REQ_READER_SECURE
Definition: MessageTypes.h:91
const string GMCLASSID_SECURITY_AUTH_REQUEST
const char * retcode_to_string(DDS::ReturnCode_t value)
Definition: DCPS_Utils.cpp:29
RcHandle< T > static_rchandle_cast(const RcHandle< U > &h)
Definition: RcHandle_T.h:202
void request_type_objects(const XTypes::TypeInformation *type_info, const MatchingPair &mp, bool is_discovery_protected, bool get_minimal, bool get_complete)
Definition: Sedp.cpp:7484
void write_durable_subscription_data(const DCPS::GUID_t &reader, bool secure)
Definition: Sedp.cpp:4677
DDS::ReturnCode_t write_volatile_message_secure(const DDS::Security::ParticipantVolatileMessageSecure &msg, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence)
Definition: Sedp.cpp:3405
static SequenceNumber SEQUENCENUMBER_UNKNOWN()
const ExtendedBuiltinEndpointSet_t TYPE_LOOKUP_SERVICE_REQUEST_WRITER_SECURE
virtual void data_received_i(const DCPS::ReceivedDataSample &sample, const DCPS::EntityId_t &entity_id, DCPS::Serializer &ser, DCPS::Extensibility extensibility)
Definition: Sedp.cpp:4470
void notify_liveliness(const ParticipantMessageData &pmd)
Definition: Sedp.cpp:2671
const DCPS::Encoding & get_locators_encoding()
const ReturnCode_t RETCODE_ERROR
DiscoveredPublicationMap discovered_publications_
Definition: Sedp.h:1234
DCPS::RcHandle< ICE::Agent > ice_agent_
Definition: Sedp.h:1321
bool send_type_lookup_request(const XTypes::TypeIdentifierSeq &type_ids, const DCPS::GUID_t &reader, const DCPS::SequenceNumber &rpc_sequence, CORBA::Long tl_kind)
Definition: Sedp.cpp:3627
ACE_CDR::Octet Octet
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
RcHandle< SubscriptionAgentInfoListener > subscription_agent_info_listener_
Definition: Sedp.h:1323
ContentFilterProperty_t contentFilterProperty
bool to_param_list(const DDS::ParticipantBuiltinTopicData &pbtd, ParameterList &param_list)
const DDS::Security::EndpointSecurityAttributes & get_local_datawriter_security_attributes(const DCPS::GUID_t &id) const
Security::SecurityConfig_rch security_config_
Definition: Spdp.h:618
LifespanQosPolicy lifespan
void generate_remote_matched_crypto_handle(const BuiltinAssociationRecord &record)
Definition: Sedp.cpp:1012
DCPS::TopicStatus assert_topic(GUID_t &topicId, const char *topicName, const char *dataTypeName, const DDS::TopicQos &qos, bool hasDcpsKey, DCPS::TopicCallbacks *topic_callbacks)
Definition: Sedp.cpp:6060
void remove_discovered_publication(const DCPS::GUID_t &guid)
Definition: TopicDetails.h:103
bool ignoring(const GUID_t &guid) const
Definition: Sedp.h:205
DCPS::RcHandle< RtpsDiscoveryConfig > config() const
Definition: Spdp.h:218
DCPS::MonotonicTime_t participant_discovered_at_
void set_port_number(u_short, int encode=1)
static const char DEFAULT_INST_PREFIX[]
ACE_Message_Block * data(ACE_Allocator *mb_alloc=0) const
WriterDataLifecycleQosPolicy writer_data_lifecycle
RcHandle< DCPS::BitSubscriber > get_builtin_subscriber_proxy() const
Definition: Sedp.cpp:3174
const BuiltinEndpointSet_t DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR
Definition: RtpsCore.idl:204
DDS::ReturnCode_t write_unregister_dispose(const DCPS::GUID_t &rid, CORBA::UShort pid=PID_ENDPOINT_GUID)
Definition: Sedp.cpp:3469
string transport_type
The transport type (e.g. tcp or udp)
ACE_Reactor * get_reactor()
Definition: ReactorTask.inl:14
bool should_drop_message(const char *unsecure_topic_name)
Definition: Sedp.cpp:2825
void send_builtin_crypto_tokens(const DCPS::GUID_t &remoteId)
Definition: Sedp.cpp:1512
DCPS::RepoIdSet remote_expectant_opendds_associations_
Definition: LocalEntities.h:62
DCPS::WeakRcHandle< ICE::Endpoint > get_ice_endpoint()
const TypeFlag IS_APPENDABLE
Definition: TypeObject.h:401
void type_lookup_init(DCPS::ReactorInterceptor_rch reactor_interceptor)
Definition: Sedp.h:290
const ReturnCode_t RETCODE_OK
DDS::DomainId_t get_domain_id() const
Definition: Sedp.cpp:5538
void disassociate_volatile(DiscoveredParticipant &participant)
Definition: Sedp.cpp:1345
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_VOLATILE_MESSAGE_SECURE_READER
ReaderAssociationRecords reader_associated_records_
void remove_entities_belonging_to(Map &m, DCPS::GUID_t participant, bool subscription, OPENDDS_VECTOR(typename Map::mapped_type)&to_remove_from_bit)
Definition: Sedp.cpp:1795
CryptoKeyFactory_var get_crypto_key_factory() const
void remove_agent_info(const DCPS::GUID_t &a_local_guid)
Definition: Sedp.cpp:5704
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_STATELESS_MESSAGE_READER
void add_to_dynamic_type_map(const GUID_t &pub_id, const XTypes::TypeIdentifier &ti)
const DCPS::GUID_t & reader_id() const
DiscoveryReader_rch publications_reader_
Definition: Sedp.h:1298
void process_discovered_writer_data(DCPS::MessageId message_id, const DCPS::DiscoveredWriterData &wdata, const DCPS::GUID_t &guid, const XTypes::TypeInformation &type_info, bool have_ice_agent_info, const ICE::AgentInfo &ice_agent_info, const DDS::Security::EndpointSecurityInfo *security_info=NULL)
Definition: Sedp.cpp:2042
bool update_subscription_qos(const DCPS::GUID_t &subscriptionId, const DDS::DataReaderQos &qos, const DDS::SubscriberQos &subscriberQos)
Definition: Sedp.cpp:1951
const char * to_string(MessageId value)
const DCPS::NetworkAddress & local_address() const
Definition: Sedp.cpp:928
long long ACE_INT64
void stun_server_address(const ACE_INET_Addr &address)
Definition: Sedp.cpp:5969
DCPS::RcHandle< DCPS::BitSubscriber > bit_subscriber_
Definition: Spdp.h:379
Security::SecurityConfig_rch get_security_config() const
Definition: Spdp.h:128
LocalPublicationMap local_publications_
Definition: Sedp.h:1232
void assign(EntityId_t &dest, const EntityId_t &src)
Definition: GuidUtils.h:157
DCPS::LocatorSeq multicast_locators() const
Definition: Sedp.cpp:920
void gen_continuation_point(XTypes::OctetSeq32 &cont_point) const
Definition: Sedp.cpp:3796
const EntityId_t ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_WRITER
Definition: MessageTypes.h:87
TopicNameMap topic_names_
Definition: Sedp.h:1237
bool assoc(const DCPS::AssociationData &subscription)
Definition: Sedp.cpp:3190
const OPENDDS_STRING local_data_type_name() const
Definition: TopicDetails.h:134
SequenceNumber rpc_seqnum_minimal
Sequence number of the first request for remote minimal types.
Definition: Sedp.h:1062
void enable_transport_using_config(bool reliable, bool durable, const TransportConfig_rch &tc)
DCPS::GUID_t repo_id_
Definition: Sedp.h:423
DDS::ReturnCode_t write_publication_data(const DCPS::GUID_t &rid, LocalPublication &pub, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:4830
const BuiltinEndpointSet_t BUILTIN_ENDPOINT_TYPE_LOOKUP_REQUEST_DATA_READER
Definition: RtpsCore.idl:225
const EntityId_t ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER
Definition: GuidUtils.h:41
LivelinessQosPolicy liveliness
void request_ack(const DCPS::GUID_t &reader)
Definition: Sedp.cpp:3535
RcHandle< T > lock() const
Definition: RcObject.h:188
ACE_thread_mutex_t lock_
TypeConsistencyEnforcementQosPolicyKind_t kind
virtual bool dispatch(EventBase_rch event)=0
DatawriterCryptoTokenSeqMap pending_remote_writer_crypto_tokens_
Definition: Sedp.h:1271
DataRepresentationIdSeq value
GUID_t make_id(const GuidPrefix_t &prefix, const EntityId_t &entity)
Definition: GuidUtils.h:200
DatawriterCryptoHandleList get_all_remote_datawriters(const DCPS::GUID_t &prefix) const
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER
const string GMCLASSID_SECURITY_DATAWRITER_CRYPTO_TOKENS
UserDataQosPolicy user_data
TypeLookupRequestReader_rch type_lookup_request_reader_
Definition: Sedp.h:1313
void set_crypto_handles(DDS::Security::ParticipantCryptoHandle p, DDS::Security::NativeCryptoHandle e=DDS::HANDLE_NIL)
Definition: Sedp.h:383
void signal_liveliness(DDS::LivelinessQosPolicyKind kind)
Definition: Sedp.cpp:2997
const EntityId_t ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER
Definition: GuidUtils.h:46
UserDataQosPolicy user_data
RTPS::SequenceNumber_t to_rtps_seqnum(const DCPS::SequenceNumber &opendds_seqnum)
Definition: MessageUtils.h:139
virtual void populate_transport_locator_sequence(DCPS::TransportLocatorSeq &tls, DiscoveredSubscriptionIter &iter, const DCPS::GUID_t &reader)
Definition: Sedp.cpp:5176
BuiltinAssociationRecords builtin_pending_records_
DeadlineQosPolicy deadline
DCPS::ReactorTask_rch reactor_task_
Definition: Sedp.h:772
const EntityId_t ENTITYID_UNKNOWN
Definition: GuidUtils.h:36
virtual bool shutting_down() const
Definition: Sedp.cpp:5170
virtual DDS::ReturnCode_t remove_subscription_i(const DCPS::GUID_t &subscriptionId, LocalSubscription &sub)
Definition: Sedp.cpp:1927
GroupDataQosPolicy group_data
void signal_liveliness_secure(DDS::LivelinessQosPolicyKind kind)
Definition: Sedp.cpp:3089
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
void resend_user_crypto_tokens(const DCPS::GUID_t &remote_participant)
Definition: Sedp.cpp:5542
Defines the interface for Discovery callbacks into the Topic.
#define TheServiceParticipant
const TypeKind TK_NONE
Definition: TypeObject.h:213
bool isWriter() const
Returns true if the GUID represents a writer entity.
const BuiltinEndpointSet_t SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER
EntityId_t counterpart_entity_id() const
Definition: Sedp.cpp:3127
void transport_assoc_done(int flags, const DCPS::GUID_t &remote)
Definition: Sedp.cpp:3195
const DDS::Security::EndpointSecurityAttributes & default_endpoint_security_attributes() const
TypeLookup_getTypes_In getTypes
Definition: TypeLookup.idl:66
void match_continue_security_enabled(const GUID_t &writer, const GUID_t &reader, bool call_writer, bool call_reader)
Definition: Sedp.cpp:7570
void data_received(DCPS::MessageId message_id, const DiscoveredPublication &wdata)
Definition: Sedp.cpp:2279
OpenDDS_Dcps_Export DDS::BuiltinTopicKey_t guid_to_bit_key(const GUID_t &guid)
Definition: GuidUtils.h:243
void send_sample(DCPS::Message_Block_Ptr payload, size_t size, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence, bool historic=false)
Definition: Sedp.cpp:3247
void update_locators(const ParticipantData_t &pdata)
Definition: Sedp.cpp:1659
LM_ERROR
bool has_discovered_participant(const DCPS::GUID_t &guid) const
Definition: Spdp.cpp:3688
void create_datawriter_crypto_tokens(const DDS::Security::DatawriterCryptoHandle &dwch, const DDS::Security::DatareaderCryptoHandle &drch, DDS::Security::DatawriterCryptoTokenSeq &dwcts)
Definition: Sedp.cpp:5369
PartitionQosPolicy partition
bool update_publication_qos(const DCPS::GUID_t &publicationId, const DDS::DataWriterQos &qos, const DDS::PublisherQos &publisherQos)
Definition: Sedp.cpp:1901
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
SecurityWriter_rch participant_stateless_message_writer_
Definition: Sedp.h:1287
void create_and_send_datawriter_crypto_tokens(const DDS::Security::DatawriterCryptoHandle &dwch, const DCPS::GUID_t &local_writer, const DDS::Security::DatareaderCryptoHandle &drch, const DCPS::GUID_t &remote_reader)
Definition: Sedp.cpp:1481
CryptoTokenSeq DatawriterCryptoTokenSeq
const octet ENTITYKIND_BUILTIN_READER_NO_KEY
Definition: DdsDcpsGuid.idl:35
void cleanup_type_lookup_data(const DCPS::GUID_t &guid, const XTypes::TypeIdentifier &ti, bool secure)
Definition: Sedp.cpp:4050
DDS::ReturnCode_t write_participant_message(const ParticipantMessageData &pmd, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence)
Definition: Sedp.cpp:3346
DDS::ReturnCode_t write_dcps_participant_secure(const Security::SPDPdiscoveredParticipantData &msg, const DCPS::GUID_t &part)
Definition: Sedp.cpp:4787
void cleanup_secure_writer(const GUID_t &publicationId)
Definition: Sedp.cpp:6617
DiscoveredParticipantMap participants_
Definition: Spdp.h:382
const octet ENTITYKIND_BUILTIN_READER_WITH_KEY
Definition: DdsDcpsGuid.idl:36
TypeIdentifierWithDependencies minimal
Definition: TypeObject.h:3373
void create_association_data_proto(DCPS::AssociationData &proto, const ParticipantData_t &pdata)
Definition: Sedp.cpp:1000
DCPS::SequenceNumber to_opendds_seqnum(const RTPS::SequenceNumber_t &rtps_seqnum)
Definition: MessageUtils.h:132
PresentationQosPolicy presentation
void get_continuation_point(const GUID_t &guid, const XTypes::TypeIdentifier &remote_ti, XTypes::OctetSeq32 &cont_point) const
Definition: Sedp.cpp:3821
void erase_remote_datareader_crypto_handle(const DCPS::GUID_t &id)
ACE_CDR::ULong length() const
Definition: TypeObject.h:167
static const size_t serialized_size
Definition: Serializer.h:251
ResourceLimitsQosPolicy resource_limits
DCPS::SequenceNumber local_participant_manual_liveliness_sn_
Definition: Sedp.h:1251
bool handle_datawriter_crypto_tokens(const DDS::Security::ParticipantVolatileMessageSecure &msg)
Definition: Sedp.cpp:5413
void use_rtps_relay_now(bool flag)
DDS::OctetArray16 address
void add_assoc_i(const DCPS::GUID_t &local_guid, const LocalPublication &lpub, const DCPS::GUID_t &remote_guid, const DiscoveredSubscription &dsub)
Definition: Sedp.cpp:5616
void remove_remote_crypto_handle(const DCPS::GUID_t &participant, const EntityId_t &entity)
Definition: Sedp.cpp:1421
LivelinessQosPolicyKind
const EntityId_t ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER
Definition: MessageTypes.h:80
OpenDDS_Dcps_Export void primitive_serialized_size_boolean(const Encoding &encoding, size_t &size, size_t count=1)
void control_dropped(const DCPS::Message_Block_Ptr &sample, bool dropped_by_transport)
Definition: Sedp.cpp:3236
OpenDDS_Dcps_Export SecurityDebug security_debug
Definition: debug.cpp:32
DDS::ReturnCode_t write_parameter_list(const ParameterList &plist, const DCPS::GUID_t &reader, DCPS::SequenceNumber &sequence)
Definition: Sedp.cpp:3308
virtual void update_locators(const GUID_t &, const TransportLocatorSeq &)
DiscoveredPublicationMap::iterator DiscoveredPublicationIter
Definition: Sedp.h:276
bool update_topic_qos(const DCPS::GUID_t &topicId, const DDS::TopicQos &qos)
Definition: Sedp.cpp:1840
key EntityId_t entityId
Definition: DdsDcpsGuid.idl:59
DCPS::MonotonicTime_t participant_discovered_at_
Definition: LocalEntities.h:57
bool assoc(const DCPS::AssociationData &publication)
Definition: Sedp.cpp:4083
DDS::ReturnCode_t init_security(DDS::Security::IdentityHandle id_handle, DDS::Security::PermissionsHandle perm_handle, DDS::Security::ParticipantCryptoHandle crypto_handle)
Definition: Sedp.cpp:579
static const ConnectionInfoFlags CONNINFO_MULTICAST
void set_crypto_key_factory(DDS::Security::CryptoKeyFactory_var ckf)
Definition: Sedp.h:1201
void cleanup_writer_association(DCPS::DataWriterCallbacks_wrch callbacks, const GUID_t &writer, const GUID_t &reader)
Definition: Sedp.cpp:6728
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50
extensibility(MUTABLE) struct TypeLookup_getTypes_In
Definition: TypeLookup.idl:29
DCPS::SequenceNumber seq_
Definition: Sedp.h:505
void start_ice(const DCPS::GUID_t &guid, const LocalPublication &lpub)
Definition: Sedp.cpp:5740
void send_sample_i(DCPS::DataSampleElement *el)
Definition: Sedp.cpp:3299
void erase_local_datareader_crypto_handle(const DCPS::GUID_t &id)
unsigned long BuiltinEndpointSet_t
Definition: RtpsCore.idl:197
void handle_participant_data(DCPS::MessageId id, const ParticipantData_t &pdata, const DCPS::MonotonicTimePoint &now, const DCPS::SequenceNumber &seq, const ACE_INET_Addr &from, bool from_sedp)
Definition: Spdp.cpp:710
Discovery Strategy class that implements RTPS discovery.
Definition: RtpsDiscovery.h:55
static const ConnectionInfoFlags CONNINFO_UNICAST
DiscoveryWriter_rch publications_writer_
Definition: Sedp.h:1276
DDS::Security::ParticipantCryptoHandle crypto_handle() const
Definition: Spdp.h:129
void erase_handle_registry(const DCPS::GUID_t &participant_id)
DDS::ReturnCode_t write_participant_message_data_secure(const DCPS::GUID_t &rid, DCPS::SequenceNumber &sn, const DCPS::GUID_t &reader=GUID_UNKNOWN)
Definition: Sedp.cpp:5135
DDS::Security::ParticipantSecurityAttributesMask security_attributes_to_bitmask(const DDS::Security::ParticipantSecurityAttributes &sec_attr)
Definition: MessageUtils.h:177
const DCPS::EntityId_t PARTICIPANT_MESSAGE_DATA_KIND_MANUAL_LIVELINESS_UPDATE
Definition: MessageTypes.h:119
const string GMCLASSID_SECURITY_PARTICIPANT_CRYPTO_TOKENS
void done(DDS::ReturnCode_t retcode)
Definition: Discovery.cpp:38
LatencyBudgetQosPolicy latency_budget
const DCPS::GUID_t & writer_id() const
LocalPublicationMap::iterator LocalPublicationIter
Definition: Sedp.h:321
const BuiltinEndpointSet_t BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER
void rtps_relay_address(const ACE_INET_Addr &address)
Definition: Sedp.cpp:5958
DCPS::ContentFilterProperty_t filterProperties
Definition: LocalEntities.h:81
void received_volatile_message_secure(DCPS::MessageId message_id, const DDS::Security::ParticipantVolatileMessageSecure &data)
Definition: Sedp.cpp:2876
void remove_subscription(const GUID_t &subscriptionId)
Definition: Sedp.cpp:6364
const ReturnCode_t RETCODE_BAD_PARAMETER
virtual bool deferrable() const
Definition: Sedp.h:500
DCPS::LocatorSeq unicast_locators() const
Definition: Sedp.cpp:912
DDS::SubscriptionBuiltinTopicData base