Line data Source code
1 : /*
2 : * Distributed under the OpenDDS License.
3 : * See: http://www.opendds.org/license.html
4 : */
5 :
6 : #ifndef OPENDDS_DCPS_SERVICE_PARTICIPANT_H
7 : #define OPENDDS_DCPS_SERVICE_PARTICIPANT_H
8 :
9 : #include "Definitions.h"
10 : #include "MonitorFactory.h"
11 : #include "Discovery.h"
12 : #include "PoolAllocator.h"
13 : #include "DomainParticipantFactoryImpl.h"
14 : #include "ConfigUtils.h"
15 : #include "unique_ptr.h"
16 : #include "ReactorTask.h"
17 : #include "JobQueue.h"
18 : #include "NetworkConfigMonitor.h"
19 : #include "NetworkConfigModifier.h"
20 : #include "Recorder.h"
21 : #include "Replayer.h"
22 : #include "TimeSource.h"
23 : #include "AtomicBool.h"
24 :
25 : #include <dds/DdsDcpsInfrastructureC.h>
26 : #include <dds/DdsDcpsDomainC.h>
27 : #include <dds/DdsDcpsInfoUtilsC.h>
28 :
29 : #include <ace/Task.h>
30 : #include <ace/Time_Value.h>
31 : #include <ace/ARGV.h>
32 : #include <ace/Barrier.h>
33 :
34 : #include <memory>
35 :
36 : #ifndef ACE_LACKS_PRAGMA_ONCE
37 : # pragma once
38 : #endif
39 :
40 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
41 :
42 : namespace OpenDDS {
43 : namespace DCPS {
44 :
45 : #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
46 : class DataDurabilityCache;
47 : #endif
48 : class ThreadStatusManager;
49 :
50 : const char DEFAULT_ORB_NAME[] = "OpenDDS_DCPS";
51 :
52 : class ShutdownListener : public virtual RcObject {
53 : public:
54 : virtual ~ShutdownListener() {}
55 : virtual void notify_shutdown() = 0;
56 : };
57 :
58 : /**
59 : * @class Service_Participant
60 : *
61 : * @brief Service entrypoint.
62 : *
63 : * This class is a singleton that allows DDS client applications to
64 : * configure OpenDDS.
65 : *
66 : * @note This class may read a configuration file that will
67 : * configure Transports as well as DCPS (e.g. number of ORB
68 : * threads).
69 : */
70 : class OpenDDS_Dcps_Export Service_Participant {
71 : public:
72 : /// Domain value for the default repository IOR.
73 : enum { ANY_DOMAIN = -1 };
74 :
75 : Service_Participant();
76 :
77 : ~Service_Participant();
78 :
79 : /// Return a singleton instance of this class.
80 : static Service_Participant* instance();
81 :
82 : const TimeSource& time_source() const;
83 :
84 : /// Get the common timer interface.
85 : /// Intended for use by OpenDDS internals only.
86 : ACE_Reactor_Timer_Interface* timer();
87 :
88 : ACE_Reactor* reactor();
89 :
90 : ACE_thread_t reactor_owner() const;
91 :
92 : ReactorInterceptor_rch interceptor() const;
93 :
94 : JobQueue_rch job_queue() const;
95 :
96 : void set_shutdown_listener(RcHandle<ShutdownListener> listener);
97 :
98 : /**
99 : * Initialize the DDS client environment and get the
100 : * @c DomainParticipantFactory.
101 : *
102 : * This method consumes @c -DCPS* and -ORB* options and their arguments.
103 : */
104 : DDS::DomainParticipantFactory_ptr get_domain_participant_factory(
105 : int &argc = zero_argc,
106 : ACE_TCHAR *argv[] = 0);
107 :
108 : #ifdef ACE_USES_WCHAR
109 : DDS::DomainParticipantFactory_ptr
110 : get_domain_participant_factory(int &argc, char *argv[]);
111 : #endif
112 :
113 : /**
114 : * Stop being a participant in the service.
115 : *
116 : * @note
117 : * All Domain Participants have to be deleted before calling or
118 : * DDS::RETCODE_PRECONDITION_NOT_MET is returned.
119 : *
120 : * If the Service Participant has already been shutdown then
121 : * DDS::RETCODE_ALREADY_DELETED will be returned.
122 : */
123 : DDS::ReturnCode_t shutdown();
124 :
125 : /// Accessor for if the participant has been shutdown
126 : bool is_shut_down() const;
127 :
128 : /// Accessor of the Discovery object for a given domain.
129 : Discovery_rch get_discovery(const DDS::DomainId_t domain);
130 :
131 : /** Accessors of the qos policy initial values. **/
132 : const DDS::UserDataQosPolicy& initial_UserDataQosPolicy() const;
133 : const DDS::TopicDataQosPolicy& initial_TopicDataQosPolicy() const;
134 : const DDS::GroupDataQosPolicy& initial_GroupDataQosPolicy() const;
135 : const DDS::TransportPriorityQosPolicy& initial_TransportPriorityQosPolicy() const;
136 : const DDS::LifespanQosPolicy& initial_LifespanQosPolicy() const;
137 : const DDS::DurabilityQosPolicy& initial_DurabilityQosPolicy() const;
138 : const DDS::DurabilityServiceQosPolicy& initial_DurabilityServiceQosPolicy() const;
139 : const DDS::PresentationQosPolicy& initial_PresentationQosPolicy() const;
140 : const DDS::DeadlineQosPolicy& initial_DeadlineQosPolicy() const;
141 : const DDS::LatencyBudgetQosPolicy& initial_LatencyBudgetQosPolicy() const;
142 : const DDS::OwnershipQosPolicy& initial_OwnershipQosPolicy() const;
143 : const DDS::OwnershipStrengthQosPolicy& initial_OwnershipStrengthQosPolicy() const;
144 : const DDS::LivelinessQosPolicy& initial_LivelinessQosPolicy() const;
145 : const DDS::TimeBasedFilterQosPolicy& initial_TimeBasedFilterQosPolicy() const;
146 : const DDS::PartitionQosPolicy& initial_PartitionQosPolicy() const;
147 : const DDS::ReliabilityQosPolicy& initial_ReliabilityQosPolicy() const;
148 : const DDS::DestinationOrderQosPolicy& initial_DestinationOrderQosPolicy() const;
149 : const DDS::HistoryQosPolicy& initial_HistoryQosPolicy() const;
150 : const DDS::ResourceLimitsQosPolicy& initial_ResourceLimitsQosPolicy() const;
151 : const DDS::EntityFactoryQosPolicy& initial_EntityFactoryQosPolicy() const;
152 : const DDS::WriterDataLifecycleQosPolicy& initial_WriterDataLifecycleQosPolicy() const;
153 : const DDS::ReaderDataLifecycleQosPolicy& initial_ReaderDataLifecycleQosPolicy() const;
154 : const DDS::PropertyQosPolicy& initial_PropertyQosPolicy() const;
155 : const DDS::DataRepresentationQosPolicy& initial_DataRepresentationQosPolicy() const;
156 :
157 : const DDS::DomainParticipantFactoryQos& initial_DomainParticipantFactoryQos() const;
158 : const DDS::DomainParticipantQos& initial_DomainParticipantQos() const;
159 : const DDS::TopicQos& initial_TopicQos() const;
160 : const DDS::DataWriterQos& initial_DataWriterQos() const;
161 : const DDS::PublisherQos& initial_PublisherQos() const;
162 : const DDS::DataReaderQos& initial_DataReaderQos() const;
163 : const DDS::SubscriberQos& initial_SubscriberQos() const;
164 : const DDS::TypeConsistencyEnforcementQosPolicy& initial_TypeConsistencyEnforcementQosPolicy() const;
165 :
166 : /**
167 : * This accessor is to provide the configurable number of chunks
168 : * that a @c DataWriter's cached allocator need to allocate when
169 : * the resource limits are infinite. Has a default, can be set
170 : * by the @c -DCPSChunks option, or by @c n_chunks() setter.
171 : */
172 : size_t n_chunks() const;
173 :
174 : /// Set the value returned by @c n_chunks() accessor.
175 : /**
176 : * @see Accessor description.
177 : */
178 : void n_chunks(size_t chunks);
179 :
180 : /// This accessor is to provide the multiplier for allocators
181 : /// that have resources used on a per association basis.
182 : /// Has a default, can be set by the
183 : /// @c -DCPSChunkAssociationMultiplier
184 : /// option, or by @c n_association_chunk_multiplier() setter.
185 : size_t association_chunk_multiplier() const;
186 :
187 : /// Set the value returned by
188 : /// @c n_association_chunk_multiplier() accessor.
189 : /**
190 : * See accessor description.
191 : */
192 : void association_chunk_multiplier(size_t multiplier);
193 :
194 : /// Set the Liveliness propagation delay factor.
195 : /// @param factor % of lease period before sending a liveliness
196 : /// message.
197 : void liveliness_factor(int factor);
198 :
199 : /// Accessor of the Liveliness propagation delay factor.
200 : /// @return % of lease period before sending a liveliness
201 : /// message.
202 : int liveliness_factor() const;
203 :
204 : ///
205 : void add_discovery(Discovery_rch discovery);
206 :
207 : bool set_repo_ior(const char* ior,
208 : Discovery::RepoKey key = Discovery::DEFAULT_REPO,
209 : bool attach_participant = true);
210 :
211 : #ifdef DDS_HAS_WCHAR
212 : /// Convenience overload for wchar_t
213 : bool set_repo_ior(const wchar_t* ior,
214 : Discovery::RepoKey key = Discovery::DEFAULT_REPO,
215 : bool attach_participant = true);
216 : #endif
217 :
218 : bool use_bidir_giop() const;
219 :
220 : /// Rebind a domain from one repository to another.
221 : void remap_domains(Discovery::RepoKey oldKey,
222 : Discovery::RepoKey newKey,
223 : bool attach_participant = true);
224 :
225 : /// Bind DCPSInfoRepo IORs to domains.
226 : void set_repo_domain(const DDS::DomainId_t domain,
227 : Discovery::RepoKey repo,
228 : bool attach_participant = true);
229 :
230 : void set_default_discovery(const Discovery::RepoKey& defaultDiscovery);
231 : Discovery::RepoKey get_default_discovery();
232 :
233 :
234 :
235 : /// Convert domainId to repository key.
236 : Discovery::RepoKey domain_to_repo(const DDS::DomainId_t domain) const;
237 :
238 : /// Failover to a new repository.
239 : void repository_lost(Discovery::RepoKey key);
240 :
241 : /// Accessors for FederationRecoveryDuration in seconds.
242 : //@{
243 : int& federation_recovery_duration();
244 : int federation_recovery_duration() const;
245 : //@}
246 :
247 : /// Accessors for FederationInitialBackoffSeconds.
248 : //@{
249 : int& federation_initial_backoff_seconds();
250 : int federation_initial_backoff_seconds() const;
251 : //@}
252 :
253 : /// Accessors for FederationBackoffMultiplier.
254 : //@{
255 : int& federation_backoff_multiplier();
256 : int federation_backoff_multiplier() const;
257 : //@}
258 :
259 : /// Accessors for FederationLivelinessDuration.
260 : //@{
261 : int& federation_liveliness();
262 : int federation_liveliness() const;
263 : //@}
264 :
265 : /// Accessors for scheduling policy value.
266 : //@{
267 : long& scheduler();
268 : long scheduler() const;
269 : //@}
270 :
271 : /// Accessors for PublisherContentFilter.
272 : //@{
273 : bool& publisher_content_filter();
274 : bool publisher_content_filter() const;
275 : //@}
276 :
277 : /// Accessors for pending data timeout.
278 : //@{
279 : TimeDuration pending_timeout() const;
280 : void pending_timeout(const TimeDuration& value);
281 : //@}
282 :
283 : /// Get a new pending timeout deadline
284 : MonotonicTimePoint new_pending_timeout_deadline() const;
285 :
286 : /// Accessors for priority extremums for the current scheduler.
287 : //@{
288 : int priority_min() const;
289 : int priority_max() const;
290 : //@}
291 :
292 : /**
293 : * Accessors for @c bit_transport_port_.
294 : *
295 : * The accessor is used for client application to configure
296 : * the local transport listening port number.
297 : *
298 : * @note The default port is INVALID. The user needs call
299 : * this function to setup the desired port number.
300 : */
301 : //@{
302 : int bit_transport_port() const;
303 : void bit_transport_port(int port);
304 : //@}
305 :
306 : OPENDDS_STRING bit_transport_ip() const;
307 :
308 : /**
309 : * Accessor for bit_lookup_duration_msec_.
310 : * The accessor is used for client application to configure
311 : * the timeout for lookup data from the builtin topic
312 : * datareader. Value is in milliseconds.
313 : */
314 : //@{
315 : int bit_lookup_duration_msec() const;
316 : void bit_lookup_duration_msec(int msec);
317 : //@}
318 :
319 : #if defined(OPENDDS_SECURITY)
320 0 : bool get_security() {
321 0 : return security_enabled_;
322 : }
323 :
324 : void set_security(bool b) {
325 : security_enabled_ = b;
326 : }
327 : #endif
328 :
329 0 : bool get_BIT() {
330 0 : return bit_enabled_;
331 : }
332 :
333 : void set_BIT(bool b) {
334 : bit_enabled_ = b;
335 : }
336 :
337 0 : const NetworkAddress& default_address() const { return default_address_; }
338 :
339 : #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
340 : /// Get the data durability cache corresponding to the given
341 : /// DurabilityQosPolicy and sample list depth.
342 : DataDurabilityCache * get_data_durability_cache(
343 : DDS::DurabilityQosPolicy const & durability);
344 : #endif
345 :
346 : /// For internal OpenDDS Use (needed for monitor code)
347 : typedef OPENDDS_MAP(Discovery::RepoKey, Discovery_rch) RepoKeyDiscoveryMap;
348 : const RepoKeyDiscoveryMap& discoveryMap() const;
349 : typedef OPENDDS_MAP(DDS::DomainId_t, Discovery::RepoKey) DomainRepoMap;
350 : const DomainRepoMap& domainRepoMap() const;
351 :
352 : void register_discovery_type(const char* section_name,
353 : Discovery::Config* cfg);
354 :
355 : #ifndef OPENDDS_SAFETY_PROFILE
356 : ACE_ARGV* ORB_argv() { return &ORB_argv_; }
357 : #endif
358 :
359 : /**
360 : * Create a Recorder object.
361 : */
362 : Recorder_ptr create_recorder(DDS::DomainParticipant_ptr participant,
363 : DDS::Topic_ptr a_topic,
364 : const DDS::SubscriberQos & subscriber_qos,
365 : const DDS::DataReaderQos & datareader_qos,
366 : const RecorderListener_rch & a_listener );
367 :
368 :
369 :
370 : /**
371 : * Delete an existing Recorder from its DomainParticipant.
372 : */
373 : DDS::ReturnCode_t delete_recorder(Recorder_ptr recorder);
374 :
375 : /**
376 : * Create a Replayer object
377 : */
378 : Replayer_ptr create_replayer(DDS::DomainParticipant_ptr participant,
379 : DDS::Topic_ptr a_topic,
380 : const DDS::PublisherQos & publisher_qos,
381 : const DDS::DataWriterQos & datawriter_qos,
382 : const ReplayerListener_rch & a_listener );
383 :
384 : /**
385 : * Delete an existing Replayer from its DomainParticipant.
386 : */
387 : DDS::ReturnCode_t delete_replayer(Replayer_ptr replayer);
388 :
389 : /**
390 : * Create a topic that does not have the data type registered.
391 : */
392 : DDS::Topic_ptr create_typeless_topic(DDS::DomainParticipant_ptr participant,
393 : const char * topic_name,
394 : const char * type_name,
395 : bool type_has_keys,
396 : const DDS::TopicQos & qos,
397 : DDS::TopicListener_ptr a_listener = 0,
398 : DDS::StatusMask mask = 0);
399 :
400 : /**
401 : * Import the configuration file to the ACE_Configuration_Heap
402 : * object and load common section configuration to the
403 : * Service_Participant singleton and load the factory and
404 : * transport section configuration to the TransportRegistry
405 : * singleton.
406 : */
407 : int load_configuration(ACE_Configuration_Heap& cf,
408 : const ACE_TCHAR* filename);
409 :
410 : /**
411 : * Used by TransportRegistry to determine if a domain ID
412 : * is part of a [DomainRange]
413 : */
414 : bool belongs_to_domain_range(DDS::DomainId_t domainId) const;
415 :
416 : bool get_transport_base_config_name(DDS::DomainId_t domainId, ACE_TString& name) const;
417 :
418 : #ifdef OPENDDS_SAFETY_PROFILE
419 : /**
420 : * Configure the safety profile pool
421 : */
422 : void configure_pool();
423 : #endif
424 :
425 : /**
426 : * Set a configuration file to use if -DCPSConfigFile wasn't passed to
427 : * TheParticipantFactoryWithArgs. Must be used before
428 : * TheParticipantFactory*() functions are called.
429 : */
430 : void default_configuration_file(const ACE_TCHAR* path);
431 :
432 : #ifdef OPENDDS_NETWORK_CONFIG_MODIFIER
433 : NetworkConfigModifier* network_config_modifier();
434 : #endif
435 :
436 : DDS::Duration_t bit_autopurge_nowriter_samples_delay() const;
437 : void bit_autopurge_nowriter_samples_delay(const DDS::Duration_t& duration);
438 :
439 : DDS::Duration_t bit_autopurge_disposed_samples_delay() const;
440 : void bit_autopurge_disposed_samples_delay(const DDS::Duration_t& duration);
441 :
442 : /**
443 : * Get TypeInformation of a remote entity given the corresponding BuiltinTopicKey_t.
444 : */
445 : XTypes::TypeInformation get_type_information(DDS::DomainParticipant_ptr participant,
446 : const DDS::BuiltinTopicKey_t& key) const;
447 :
448 : #ifndef OPENDDS_SAFETY_PROFILE
449 : DDS::ReturnCode_t get_dynamic_type(DDS::DynamicType_var& type,
450 : DDS::DomainParticipant_ptr participant, const DDS::BuiltinTopicKey_t& key) const;
451 : #endif
452 :
453 : /**
454 : * Get TypeObject for a given TypeIdentifier.
455 : */
456 : XTypes::TypeObject get_type_object(DDS::DomainParticipant_ptr participant,
457 : const XTypes::TypeIdentifier& ti) const;
458 :
459 : enum TypeObjectEncoding { Encoding_Normal, Encoding_WriteOldFormat, Encoding_ReadOldFormat };
460 : TypeObjectEncoding type_object_encoding() const;
461 : void type_object_encoding(TypeObjectEncoding encoding);
462 : void type_object_encoding(const char* encoding);
463 :
464 : RcHandle<InternalTopic<NetworkInterfaceAddress> > network_interface_address_topic() const
465 : {
466 : return network_interface_address_topic_;
467 : }
468 :
469 54 : unsigned int printer_value_writer_indent() const
470 : {
471 54 : return printer_value_writer_indent_;
472 : }
473 :
474 : void printer_value_writer_indent(unsigned int value)
475 : {
476 : printer_value_writer_indent_ = value;
477 : }
478 :
479 : private:
480 :
481 : /// Initialize default qos.
482 : void initialize();
483 :
484 : /// Initialize the thread scheduling and initial priority.
485 : void initializeScheduling();
486 :
487 : /**
488 : * Parse the command line for user options. e.g. "-DCPSInfoRepo <iorfile>".
489 : * It consumes -DCPS* options and their arguments
490 : */
491 : int parse_args(int &argc, ACE_TCHAR *argv[]);
492 :
493 : /**
494 : * Import the configuration file to the ACE_Configuration_Heap
495 : * object and load common section configuration to the
496 : * Service_Participant singleton and load the factory and
497 : * transport section configuration to the TransportRegistry
498 : * singleton.
499 : */
500 : int load_configuration();
501 :
502 : /**
503 : * Load the common configuration to the Service_Participant
504 : * singleton.
505 : *
506 : * @note The values from command line can overwrite the values
507 : * in configuration file.
508 : */
509 : int load_common_configuration(ACE_Configuration_Heap& cf,
510 : const ACE_TCHAR* filename);
511 :
512 : /**
513 : * Load the domain configuration to the Service_Participant
514 : * singleton.
515 : */
516 : int load_domain_configuration(ACE_Configuration_Heap& cf,
517 : const ACE_TCHAR* filename);
518 :
519 : /**
520 : * Load the domain range template configuration
521 : * prior to discovery and domain configuration
522 : */
523 : int load_domain_ranges(ACE_Configuration_Heap& cf);
524 :
525 : /**
526 : * Load the discovery template information
527 : */
528 : int load_discovery_templates(ACE_Configuration_Heap& cf);
529 :
530 : /**
531 : * Process the domain range template and activate the
532 : * domain for the given domain ID
533 : */
534 : int configure_domain_range_instance(DDS::DomainId_t domainId);
535 :
536 : /**
537 : * Load the discovery configuration to the Service_Participant
538 : * singleton.
539 : */
540 : int load_discovery_configuration(ACE_Configuration_Heap& cf,
541 : const ACE_TCHAR* section_name);
542 :
543 : /**
544 : * Create and load a discovery config from a discovery template
545 : */
546 : int configure_discovery_template(DDS::DomainId_t domainId,
547 : const OPENDDS_STRING& discovery_name);
548 :
549 : typedef OPENDDS_MAP(OPENDDS_STRING, container_supported_unique_ptr<Discovery::Config>) DiscoveryTypes;
550 : DiscoveryTypes discovery_types_;
551 :
552 : #ifndef OPENDDS_SAFETY_PROFILE
553 : ACE_ARGV ORB_argv_;
554 : #endif
555 :
556 : const TimeSource time_source_;
557 : ReactorTask reactor_task_;
558 : JobQueue_rch job_queue_;
559 :
560 : RcHandle<DomainParticipantFactoryImpl> dp_factory_servant_;
561 :
562 : /// The RepoKey to Discovery object mapping
563 : RepoKeyDiscoveryMap discoveryMap_;
564 :
565 : /// The DomainId to RepoKey mapping.
566 : DomainRepoMap domainRepoMap_;
567 :
568 : Discovery::RepoKey defaultDiscovery_;
569 :
570 : /// The lock to serialize DomainParticipantFactory singleton
571 : /// creation and shutdown.
572 : mutable ACE_Thread_Mutex factory_lock_;
573 :
574 : /// The initial values of qos policies.
575 : DDS::UserDataQosPolicy initial_UserDataQosPolicy_;
576 : DDS::TopicDataQosPolicy initial_TopicDataQosPolicy_;
577 : DDS::GroupDataQosPolicy initial_GroupDataQosPolicy_;
578 : DDS::TransportPriorityQosPolicy initial_TransportPriorityQosPolicy_;
579 : DDS::LifespanQosPolicy initial_LifespanQosPolicy_;
580 : DDS::DurabilityQosPolicy initial_DurabilityQosPolicy_;
581 : DDS::DurabilityServiceQosPolicy initial_DurabilityServiceQosPolicy_;
582 : DDS::PresentationQosPolicy initial_PresentationQosPolicy_;
583 : DDS::DeadlineQosPolicy initial_DeadlineQosPolicy_;
584 : DDS::LatencyBudgetQosPolicy initial_LatencyBudgetQosPolicy_;
585 : DDS::OwnershipQosPolicy initial_OwnershipQosPolicy_;
586 : DDS::OwnershipStrengthQosPolicy initial_OwnershipStrengthQosPolicy_;
587 : DDS::LivelinessQosPolicy initial_LivelinessQosPolicy_;
588 : DDS::TimeBasedFilterQosPolicy initial_TimeBasedFilterQosPolicy_;
589 : DDS::PartitionQosPolicy initial_PartitionQosPolicy_;
590 : DDS::ReliabilityQosPolicy initial_ReliabilityQosPolicy_;
591 : DDS::DestinationOrderQosPolicy initial_DestinationOrderQosPolicy_;
592 : DDS::HistoryQosPolicy initial_HistoryQosPolicy_;
593 : DDS::ResourceLimitsQosPolicy initial_ResourceLimitsQosPolicy_;
594 : DDS::EntityFactoryQosPolicy initial_EntityFactoryQosPolicy_;
595 : DDS::WriterDataLifecycleQosPolicy initial_WriterDataLifecycleQosPolicy_;
596 : DDS::ReaderDataLifecycleQosPolicy initial_ReaderDataLifecycleQosPolicy_;
597 : DDS::PropertyQosPolicy initial_PropertyQosPolicy_;
598 : DDS::DataRepresentationQosPolicy initial_DataRepresentationQosPolicy_;
599 :
600 : DDS::DomainParticipantQos initial_DomainParticipantQos_;
601 : DDS::TopicQos initial_TopicQos_;
602 : DDS::DataWriterQos initial_DataWriterQos_;
603 : DDS::PublisherQos initial_PublisherQos_;
604 : DDS::DataReaderQos initial_DataReaderQos_;
605 : DDS::SubscriberQos initial_SubscriberQos_;
606 : DDS::DomainParticipantFactoryQos initial_DomainParticipantFactoryQos_;
607 : DDS::TypeConsistencyEnforcementQosPolicy initial_TypeConsistencyEnforcementQosPolicy_;
608 :
609 : /// The configurable value of the number chunks that the
610 : /// @c DataWriter's cached allocator can allocate.
611 : size_t n_chunks_;
612 :
613 : /// The configurable value of maximum number of expected
614 : /// associations for publishers and subscribers. This is used
615 : /// to pre allocate enough memory and reduce heap allocations.
616 : size_t association_chunk_multiplier_;
617 :
618 : /// The propagation delay factor.
619 : int liveliness_factor_;
620 :
621 : /// The builtin topic transport address.
622 : ACE_TString bit_transport_ip_;
623 :
624 : /// The builtin topic transport port number.
625 : int bit_transport_port_;
626 :
627 : bool bit_enabled_;
628 :
629 : #if defined(OPENDDS_SECURITY)
630 : bool security_enabled_;
631 : #endif
632 :
633 : /// The timeout for lookup data from the builtin topic
634 : /// @c DataReader.
635 : int bit_lookup_duration_msec_;
636 :
637 : /// The default network address to use.
638 : NetworkAddress default_address_;
639 :
640 : /// Specifies the name of the transport configuration that
641 : /// is used when the entity tree does not specify one. If
642 : /// not set, the default transport configuration is used.
643 : ACE_TString global_transport_config_;
644 :
645 : // domain range template support
646 : struct DomainRange
647 : {
648 : DDS::DomainId_t range_start;
649 : DDS::DomainId_t range_end;
650 : OPENDDS_STRING discovery_template_name;
651 : OPENDDS_STRING transport_config_name;
652 : ValueMap domain_info;
653 :
654 0 : DomainRange() : range_start(-1), range_end(-1) {}
655 : };
656 :
657 : struct DiscoveryInfo
658 : {
659 : OPENDDS_STRING discovery_name;
660 : ValueMap customizations;
661 : ValueMap disc_info;
662 : };
663 :
664 : OPENDDS_MAP(DDS::DomainId_t, OPENDDS_STRING) domain_to_transport_name_map_;
665 :
666 : OPENDDS_VECTOR(DomainRange) domain_ranges_;
667 :
668 : OPENDDS_VECTOR(DiscoveryInfo) discovery_infos_;
669 :
670 : int parse_domain_range(const OPENDDS_STRING& range, int& start, int& end);
671 :
672 : bool has_domain_range() const;
673 :
674 : bool get_domain_range_info(DDS::DomainId_t id, DomainRange& inst);
675 :
676 : bool process_customizations(DDS::DomainId_t id, const OPENDDS_STRING& discovery_name, ValueMap& customs);
677 :
678 : OpenDDS::DCPS::Discovery::RepoKey get_discovery_template_instance_name(DDS::DomainId_t id);
679 :
680 : bool is_discovery_template(const OPENDDS_STRING& name);
681 :
682 : public:
683 : /// getter for lock that protects the static initialization of XTypes related data structures
684 : ACE_Thread_Mutex& get_static_xtypes_lock();
685 :
686 : /// Get the service participant's thread status manager.
687 : ThreadStatusManager& get_thread_status_manager();
688 :
689 : /// Pointer to the monitor factory that is used to create
690 : /// monitor objects.
691 : MonitorFactory* monitor_factory_;
692 :
693 : /// Pointer to the monitor object for this object
694 : unique_ptr<Monitor> monitor_;
695 :
696 : private:
697 : /// The FederationRecoveryDuration value in seconds.
698 : int federation_recovery_duration_;
699 :
700 : /// The FederationInitialBackoffSeconds value.
701 : int federation_initial_backoff_seconds_;
702 :
703 : /// This FederationBackoffMultiplier.
704 : int federation_backoff_multiplier_;
705 :
706 : /// This FederationLivelinessDuration.
707 : int federation_liveliness_;
708 :
709 : /// Scheduling policy value from configuration file.
710 : ACE_TString schedulerString_;
711 :
712 : /// Scheduler time slice from configuration file.
713 : TimeDuration schedulerQuantum_;
714 :
715 : #if OPENDDS_POOL_ALLOCATOR
716 : /// Pool size from configuration file.
717 : size_t pool_size_;
718 :
719 : /// Pool granularity from configuration file.
720 : size_t pool_granularity_;
721 : #endif
722 :
723 : /// Scheduling policy value used for setting thread priorities.
724 : long scheduler_;
725 :
726 : /// Minimum priority value for the current scheduling policy.
727 : int priority_min_;
728 :
729 : /// Maximum priority value for the current scheduling policy.
730 : int priority_max_;
731 :
732 : /// Allow the publishing side to do content filtering?
733 : bool publisher_content_filter_;
734 :
735 : #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
736 :
737 : /// The @c TRANSIENT data durability cache.
738 : unique_ptr<DataDurabilityCache> transient_data_cache_;
739 :
740 : /// The @c PERSISTENT data durability cache.
741 : unique_ptr<DataDurabilityCache> persistent_data_cache_;
742 :
743 : /// The @c PERSISTENT data durability directory.
744 : ACE_CString persistent_data_dir_;
745 :
746 : #endif
747 :
748 : /// Number of seconds to wait on pending samples to be sent
749 : /// or dropped.
750 : TimeDuration pending_timeout_;
751 :
752 : /// Enable TAO's Bidirectional GIOP?
753 : bool bidir_giop_;
754 :
755 : ThreadStatusManager thread_status_manager_;
756 :
757 : /// Thread mutex used to protect the static initialization of XTypes data structures
758 : ACE_Thread_Mutex xtypes_lock_;
759 :
760 : /// Enable Monitor functionality
761 : bool monitor_enabled_;
762 :
763 : /// Used to track state of service participant
764 : AtomicBool shut_down_;
765 :
766 : RcHandle<ShutdownListener> shutdown_listener_;
767 :
768 : /// Guard access to the internal maps.
769 : ACE_Recursive_Thread_Mutex maps_lock_;
770 :
771 : static int zero_argc;
772 :
773 : /**
774 : * If set before TheParticipantFactoryWithArgs and -DCPSConfigFile is not
775 : * passed, use this as the configuration file.
776 : */
777 : ACE_TString default_configuration_file_;
778 :
779 : NetworkConfigMonitor_rch network_config_monitor_;
780 : mutable ACE_Thread_Mutex network_config_monitor_lock_;
781 :
782 : DDS::Duration_t bit_autopurge_nowriter_samples_delay_;
783 : DDS::Duration_t bit_autopurge_disposed_samples_delay_;
784 :
785 : TypeObjectEncoding type_object_encoding_;
786 :
787 : RcHandle<InternalTopic<NetworkInterfaceAddress> > network_interface_address_topic_;
788 :
789 : unsigned int printer_value_writer_indent_;
790 : };
791 :
792 : #define TheServiceParticipant OpenDDS::DCPS::Service_Participant::instance()
793 :
794 : #define TheParticipantFactory TheServiceParticipant->get_domain_participant_factory()
795 :
796 : #define TheParticipantFactoryWithArgs(argc, argv) TheServiceParticipant->get_domain_participant_factory(argc, argv)
797 :
798 : } // namespace DCPS
799 : } // namespace OpenDDS
800 :
801 : OPENDDS_END_VERSIONED_NAMESPACE_DECL
802 :
803 : #if defined(__ACE_INLINE__)
804 : #include "Service_Participant.inl"
805 : #endif /* __ACE_INLINE__ */
806 :
807 : #endif /* OPENDDS_DCPS_SERVICE_PARTICIPANT_H */
|