OpenDDS  Snapshot(2023/04/28-20:55)
DCPSInfo_i.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef DCPSINFO_I_H
9 #define DCPSINFO_I_H
10 
11 #include "inforepo_export.h"
12 
13 #include /**/ "dds/DCPS/InfoRepoDiscovery/InfoS.h"
14 #include /**/ "dds/DCPS/InfoRepoDiscovery/DataReaderRemoteC.h"
15 #include /**/ "dds/DCPS/InfoRepoDiscovery/DataWriterRemoteC.h"
16 
17 #include /**/ "DCPS_IR_Topic.h"
18 #include /**/ "DCPS_IR_Topic_Description.h"
19 #include /**/ "DCPS_IR_Participant.h"
20 #include /**/ "DCPS_IR_Publication.h"
21 #include /**/ "DCPS_IR_Subscription.h"
22 #include /**/ "DCPS_IR_Domain.h"
24 #include "FederationId.h"
25 #include "UpdateManager.h"
26 
27 #include <map>
28 
29 #if !defined (ACE_LACKS_PRAGMA_ONCE)
30 #pragma once
31 #endif /* ACE_LACKS_PRAGMA_ONCE */
32 
34 
35 // typedef declarations
36 typedef std::map<DDS::DomainId_t, OpenDDS::DCPS::RcHandle<DCPS_IR_Domain> > DCPS_IR_Domain_Map;
37 
38 // Forward declaration
39 namespace Update {
40 class Manager;
41 }
42 
43 class ShutdownInterface;
44 
45 /**
46  * @class TAO_DDS_DCPSInfo_i
47  *
48  * @brief Implementation of the DCPSInfo
49  *
50  * This is the Information Repository object. Clients of
51  * the system will use the CORBA reference of this object.
52  */
54  : public virtual POA_OpenDDS::DCPS::DCPSInfo,
55  public virtual ACE_Event_Handler {
56 public:
58  CORBA::ORB_ptr orb,
59  bool reincarnate,
61  const TAO_DDS_DCPSFederationId& federation);
62 
63  virtual ~TAO_DDS_DCPSInfo_i();
64 
65  virtual int handle_timeout(const ACE_Time_Value& now,
66  const void* arg);
67 
68  virtual CORBA::Boolean attach_participant(
69  DDS::DomainId_t domainId,
70  const OpenDDS::DCPS::GUID_t& participantId);
71 
72  virtual OpenDDS::DCPS::TopicStatus assert_topic(
73  OpenDDS::DCPS::GUID_t_out topicId,
74  DDS::DomainId_t domainId,
75  const OpenDDS::DCPS::GUID_t& participantId,
76  const char * topicName,
77  const char * dataTypeName,
78  const DDS::TopicQos & qos,
79  bool hasDcpsKey);
80 
81  /**
82  * @brief Add a previously existing topic to the repository.
83  *
84  * @param topicId the Topic Entity GUID Id to use.
85  * @param domainId the Domain in which the Topic is contained.
86  * @param participantId the Participant in which the Topic is contained.
87  * @param topicName the name of the Topic.
88  * @param dataTypeName the name of the data type.
89  * @param qos the QoS value to use for the Topic.
90  *
91  * Adds a Topic Entity to the repository using a specified TopicId
92  * value. If the TopicId indicates that this Topic was created by
93  * within this repository (the federation Id is the current repositories
94  * federation Id), this method will ensure that any subsequent calls to
95  * add a Topic and obtain a newly generated Id value will return an Id
96  * value greater than the Id value of the current one.
97  */
98  bool add_topic(const OpenDDS::DCPS::GUID_t& topicId,
99  DDS::DomainId_t domainId,
100  const OpenDDS::DCPS::GUID_t& participantId,
101  const char* topicName,
102  const char* dataTypeName,
103  const DDS::TopicQos& qos);
104 
105  virtual OpenDDS::DCPS::TopicStatus find_topic(
106  DDS::DomainId_t domainId,
107  const char * topicName,
108  CORBA::String_out dataTypeName,
109  DDS::TopicQos_out qos,
110  OpenDDS::DCPS::GUID_t_out topicId);
111 
112  virtual OpenDDS::DCPS::TopicStatus remove_topic(
113  DDS::DomainId_t domainId,
114  const OpenDDS::DCPS::GUID_t& participantId,
115  const OpenDDS::DCPS::GUID_t& topicId);
116 
117  virtual OpenDDS::DCPS::GUID_t add_publication(
118  DDS::DomainId_t domainId,
119  const OpenDDS::DCPS::GUID_t& participantId,
120  const OpenDDS::DCPS::GUID_t& topicId,
121  OpenDDS::DCPS::DataWriterRemote_ptr publication,
122  const DDS::DataWriterQos & qos,
123  const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
124  const DDS::PublisherQos & publisherQos,
125  const DDS::OctetSeq & serializedTypeInfo);
126 
127  /**
128  * @brief Add a previously existing publication to the repository.
129  *
130  * @param domainId the Domain in which the Publication is contained.
131  * @param participantId the Participant in which the Publication is contained.
132  * @param topicId the Topic of the Publication.
133  * @param pubId the GUID Id value to use for the Publication.
134  * @param pub_str stringified publication callback to DataWriter.
135  * @param qos the QoS value of the DataWriter.
136  * @param transInfo the transport information for the Publication.
137  * @param publisherQos the QoS value of the Publisher.
138  * @param associate indicate whether to create new associations.
139  *
140  * Adds a Publication to the repository using a specified Publication
141  * GUID Id value. If the PublicationId indicates that this Publication
142  * was created by within this repository (the federation Id is the
143  * current repositories federation Id), this method will ensure that any
144  * subsequent calls to add a Publication and obtain a newly generated
145  * Id value will return an Id value greater than the Id value of the
146  * current one.
147  */
148  bool add_publication(DDS::DomainId_t domainId,
149  const OpenDDS::DCPS::GUID_t& participantId,
150  const OpenDDS::DCPS::GUID_t& topicId,
151  const OpenDDS::DCPS::GUID_t& pubId,
152  const char* pub_str,
153  const DDS::DataWriterQos & qos,
154  const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
155  ACE_CDR::ULong transportContext,
156  const DDS::PublisherQos & publisherQos,
157  const DDS::OctetSeq & serializedTypeInfo,
158  bool associate = false);
159 
160  virtual void remove_publication(
161  DDS::DomainId_t domainId,
162  const OpenDDS::DCPS::GUID_t& participantId,
163  const OpenDDS::DCPS::GUID_t& publicationId);
164 
165  virtual OpenDDS::DCPS::GUID_t add_subscription(
166  DDS::DomainId_t domainId,
167  const OpenDDS::DCPS::GUID_t& participantId,
168  const OpenDDS::DCPS::GUID_t& topicId,
169  OpenDDS::DCPS::DataReaderRemote_ptr subscription,
170  const DDS::DataReaderQos & qos,
171  const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
172  const DDS::SubscriberQos & subscriberQos,
173  const char* filterClassName,
174  const char* filterExpression,
175  const DDS::StringSeq& exprParams,
176  const DDS::OctetSeq & serializedTypeInfo);
177 
178  /**
179  * @brief Add a previously existing subscription to the repository.
180  *
181  * @param domainId the Domain in which the Subscription is contained.
182  * @param participantId the Participant in which the Subscription is contained.
183  * @param topicId the Topic of the Subscription.
184  * @param subId the GUID Id value to use for the Subscription.
185  * @param sub_str stringified publication callback to DataReader.
186  * @param qos the QoS value of the DataReader.
187  * @param transInfo the transport information for the Subscription.
188  * @param subscriberQos the QoS value of the Subscriber.
189  * @param associate indicate whether to create new associations.
190  *
191  * Adds a Subscription to the repository using a specified Subscription
192  * GUID Id value. If the SubscriptionId indicates that this Subscription
193  * was created by within this repository (the federation Id is the
194  * current repositories federation Id), this method will ensure that any
195  * subsequent calls to add a Publication and obtain a newly generated
196  * Id value will return an Id value greater than the Id value of the
197  * current one.
198  */
199  bool add_subscription(DDS::DomainId_t domainId,
200  const OpenDDS::DCPS::GUID_t& participantId,
201  const OpenDDS::DCPS::GUID_t& topicId,
202  const OpenDDS::DCPS::GUID_t& subId,
203  const char* sub_str,
204  const DDS::DataReaderQos & qos,
205  const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
206  ACE_CDR::ULong transportContext,
207  const DDS::SubscriberQos & subscriberQos,
208  const char* filterClassName,
209  const char* filterExpression,
210  const DDS::StringSeq& exprParams,
211  const DDS::OctetSeq & serializedTypeInfo,
212  bool associate = false);
213 
214  virtual void remove_subscription(
215  DDS::DomainId_t domainId,
216  const OpenDDS::DCPS::GUID_t& participantId,
217  const OpenDDS::DCPS::GUID_t& subscriptionId);
218 
219  virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant(
220  DDS::DomainId_t domain,
221  const DDS::DomainParticipantQos & qos);
222 
223  /**
224  * @brief Add a previously existing participant to the repository.
225  *
226  * @param domainId the Domain in which the Participant is contained.
227  * @param participantId the GUID Id value to use for the Participant.
228  * @param qos the QoS value of the Participant.
229  *
230  * Adds a Participant to the repository using a specified Participant
231  * GUID Id value. If the ParticipantId indicates that this Participant
232  * was created by within this repository (the federation Id is the
233  * current repositories federation Id), this method will ensure that any
234  * subsequent calls to add a Publication and obtain a newly generated
235  * Id value will return an Id value greater than the Id value of the
236  * current one.
237  */
238  bool add_domain_participant(DDS::DomainId_t domainId
239  , const OpenDDS::DCPS::GUID_t& participantId
240  , const DDS::DomainParticipantQos & qos);
241 
242  virtual void remove_domain_participant(
243  DDS::DomainId_t domainId,
244  const OpenDDS::DCPS::GUID_t& participantId);
245 
246  bool remove_by_owner(
247  DDS::DomainId_t domain,
248  long owner);
249 
250  virtual void disassociate_participant(
251  DDS::DomainId_t domainId,
252  const OpenDDS::DCPS::GUID_t& local_id,
253  const OpenDDS::DCPS::GUID_t& remote_id);
254 
255  virtual void disassociate_subscription(
256  DDS::DomainId_t domainId,
257  const OpenDDS::DCPS::GUID_t& participantId,
258  const OpenDDS::DCPS::GUID_t& local_id,
259  const OpenDDS::DCPS::GUID_t& remote_id);
260 
261  virtual void disassociate_publication(
262  DDS::DomainId_t domainId,
263  const OpenDDS::DCPS::GUID_t& participantId,
264  const OpenDDS::DCPS::GUID_t& local_id,
265  const OpenDDS::DCPS::GUID_t& remote_id);
266 
267  virtual void ignore_domain_participant(
268  DDS::DomainId_t domainId,
269  const OpenDDS::DCPS::GUID_t& myParticipantId,
270  const OpenDDS::DCPS::GUID_t& ignoreId);
271 
272  virtual void ignore_topic(
273  DDS::DomainId_t domainId,
274  const OpenDDS::DCPS::GUID_t& myParticipantId,
275  const OpenDDS::DCPS::GUID_t& ignoreId);
276 
277  virtual void ignore_subscription(
278  DDS::DomainId_t domainId,
279  const OpenDDS::DCPS::GUID_t& myParticipantId,
280  const OpenDDS::DCPS::GUID_t& ignoreId);
281 
282  virtual void ignore_publication(
283  DDS::DomainId_t domainId,
284  const OpenDDS::DCPS::GUID_t& myParticipantId,
285  const OpenDDS::DCPS::GUID_t& ignoreId);
286 
287  virtual CORBA::Boolean update_publication_qos(
288  DDS::DomainId_t domainId,
289  const OpenDDS::DCPS::GUID_t& partId,
290  const OpenDDS::DCPS::GUID_t& dwId,
291  const DDS::DataWriterQos & qos,
292  const DDS::PublisherQos & publisherQos);
293 
294  /// Entry for federation updates of DataWriterQos values.
295  void update_publication_qos(
296  DDS::DomainId_t domainId,
297  const OpenDDS::DCPS::GUID_t& partId,
298  const OpenDDS::DCPS::GUID_t& dwId,
299  const DDS::DataWriterQos& qos);
300 
301  /// Entry for federation updates of PublisherQos values.
302  void update_publication_qos(
303  DDS::DomainId_t domainId,
304  const OpenDDS::DCPS::GUID_t& partId,
305  const OpenDDS::DCPS::GUID_t& dwId,
306  const DDS::PublisherQos& qos);
307 
308  virtual CORBA::Boolean update_subscription_qos(
309  DDS::DomainId_t domainId,
310  const OpenDDS::DCPS::GUID_t& partId,
311  const OpenDDS::DCPS::GUID_t& drId,
312  const DDS::DataReaderQos & qos,
313  const DDS::SubscriberQos & subscriberQos);
314 
315  /// Entry for federation updates of DataReaderQos values.
316  void update_subscription_qos(
317  DDS::DomainId_t domainId,
318  const OpenDDS::DCPS::GUID_t& partId,
319  const OpenDDS::DCPS::GUID_t& drId,
320  const DDS::DataReaderQos& qos);
321 
322  /// Entry for federation updates of SubscriberQos values.
323  void update_subscription_qos(
324  DDS::DomainId_t domainId,
325  const OpenDDS::DCPS::GUID_t& partId,
326  const OpenDDS::DCPS::GUID_t& drId,
327  const DDS::SubscriberQos& qos);
328 
329  virtual ::CORBA::Boolean update_subscription_params(
330  DDS::DomainId_t domainId,
331  const OpenDDS::DCPS::GUID_t& participantId,
332  const OpenDDS::DCPS::GUID_t& subscriptionId,
333  const DDS::StringSeq& params);
334 
335  virtual CORBA::Boolean update_topic_qos(
336  const OpenDDS::DCPS::GUID_t& topicId,
337  DDS::DomainId_t domainId,
338  const OpenDDS::DCPS::GUID_t& participantId,
339  const DDS::TopicQos & qos);
340 
341  virtual CORBA::Boolean update_domain_participant_qos(
342  DDS::DomainId_t domain,
343  const OpenDDS::DCPS::GUID_t& participantId,
344  const DDS::DomainParticipantQos & qos);
345 
346  /// Cause the entire repository to exit.
347  virtual void shutdown();
348 
349  /// Dump the Repos state to string.
350  virtual char* dump_to_string();
351 
352  /**
353  * @brief assert new ownership for a participant and its contained entities.
354  *
355  * @param domainId the domain in which the participant resides.
356  * @param participantId the participant to be owned.
357  * @param sender the repository sending the update data.
358  * @param owner the repository which is to make callbacks for
359  * entities within the participant.
360  * @return boolean indicating that ownership has been assigned.
361  *
362  * This establishes @c owner as the new owner of the participant.
363  * Ownership consists of calling back to the reader and writer remote
364  * interfaces when associations are established and removed from a
365  * publication or subscription. Owner may be the special value of
366  * OWNER_NONE to indicate that the previous owner is no longer
367  * available to make callbacks and the application has not indicated
368  * which repository is to replace it in this capacity.
369  *
370  * The @c sender of the update is included so that the participant can
371  * check that transitions to OWNER_NONE are only honored when initiated
372  * by the current owner of the participant.
373  *
374  * A return value of @c false indicates that the ownership was
375  * specified for a domain or participant which could not be found.
376  */
377  bool changeOwnership(
378  DDS::DomainId_t domainId,
379  const OpenDDS::DCPS::GUID_t& participantId,
380  long sender,
381  long owner);
382 
383  /// Initialize the transport for the Built-In Topics
384  /// Returns 0 (zero) if succeeds
385  int init_transport(int listen_address_given,
386  const char* listen_str);
387 
388  bool receive_image(const Update::UImage& image);
389 
390  /// Add an additional Updater interface.
391  void add(Update::Updater* updater);
392 
393  /// Convert a domain Id into a reference to a DCPS_IR_Domain object.
394  DCPS_IR_Domain* domain(DDS::DomainId_t domain);
395 
396  /// Expose a readable reference of the domain map.
397  const DCPS_IR_Domain_Map& domains() const;
398 
399  /// Expose the ORB.
400  CORBA::ORB_ptr orb();
401 
402  bool init_persistence();
403 
404  bool init_reassociation(const ACE_Time_Value& delay);
405 
406  bool init_dispatchChecking(const ACE_Time_Value& delay);
407 
408  /// Cleanup state for shutdown.
409  void finalize();
410 
411  void cleanup_all_built_in_topics();
412 
413 private:
417 
420 
423 
424  /// Interface to effect shutdown of the process.
426 
428 
431 
432 #ifndef DDS_HAS_MINIMUM_BIT
434  {
436  : parent_(parent), domain_(domain), cv_(parent_->lock_), done_(false)
437  {
438  reference_counting_policy().value(Reference_Counting_Policy::ENABLED);
439  parent->_add_ref();
440  }
441 
442  int handle_exception(ACE_HANDLE fd);
443 
447  bool done_;
448  };
449 
451 #endif
452 };
453 
455 
456 #endif /* DCPSINFO_I_H */
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL typedef std::map< DDS::DomainId_t, OpenDDS::DCPS::RcHandle< DCPS_IR_Domain > > DCPS_IR_Domain_Map
Definition: DCPSInfo_i.h:36
DCPS_IR_Domain_Map domains_
Definition: DCPSInfo_i.h:414
sequence< TransportLocator > TransportLocatorSeq
CORBA::ORB_var orb_
Definition: DCPSInfo_i.h:415
Update::Manager * um_
Definition: DCPSInfo_i.h:421
CORBA::ORB_var dispatchingOrb_
Definition: DCPSInfo_i.h:416
#define OpenDDS_InfoRepoLib_Export
OpenDDS::DCPS::ConditionVariable< ACE_Recursive_Thread_Mutex > cv_
Definition: DCPSInfo_i.h:446
DOMAINID_TYPE_NATIVE DomainId_t
ACE_CDR::Boolean Boolean
Create RepoId values for use within DDS.
BIT_Cleanup_Handler(TAO_DDS_DCPSInfo_i *parent, DDS::DomainId_t domain)
Definition: DCPSInfo_i.h:435
sequence< octet > OctetSeq
Definition: DdsDcpsCore.idl:64
ACE_UINT32 ULong
Implementation of the DCPSInfo.
Definition: DCPSInfo_i.h:53
ShutdownInterface * shutdown_
Interface to effect shutdown of the process.
Definition: DCPSInfo_i.h:425
long dispatch_check_timer_id_
Definition: DCPSInfo_i.h:430
bool in_cleanup_all_built_in_topics_
Definition: DCPSInfo_i.h:450
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
PortableServer::Servant_var< TAO_DDS_DCPSInfo_i > parent_
Definition: DCPSInfo_i.h:444
Representation of a Domain in the system.
const TAO_DDS_DCPSFederationId & federation_
Definition: DCPSInfo_i.h:418
int shutdown(ACE_HANDLE handle, int how)
long reassociate_timer_id_
Definition: DCPSInfo_i.h:429
OpenDDS::DCPS::RepoIdGenerator participantIdGenerator_
Definition: DCPSInfo_i.h:419
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50
ACE_Recursive_Thread_Mutex lock_
Definition: DCPSInfo_i.h:427