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