OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
OpenDDS::DCPS::StaticDiscovery Class Reference

#include <StaticDiscovery.h>

Inheritance diagram for OpenDDS::DCPS::StaticDiscovery:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::StaticDiscovery:
Collaboration graph
[legend]

Public Member Functions

 StaticDiscovery (const RepoKey &key)
 
int load_configuration (ACE_Configuration_Heap &config)
 
virtual GUID_t generate_participant_guid ()
 
virtual AddDomainStatus add_domain_participant (DDS::DomainId_t domain, const DDS::DomainParticipantQos &qos, XTypes::TypeLookupService_rch tls)
 
virtual AddDomainStatus add_domain_participant_secure (DDS::DomainId_t domain, const DDS::DomainParticipantQos &qos, XTypes::TypeLookupService_rch tls, const GUID_t &guid, DDS::Security::IdentityHandle id, DDS::Security::PermissionsHandle perm, DDS::Security::ParticipantCryptoHandle part_crypto)
 
RcHandle< BitSubscriberinit_bit (DCPS::DomainParticipantImpl *participant)
 
void fini_bit (DCPS::DomainParticipantImpl *participant)
 
bool attach_participant (DDS::DomainId_t domainId, const GUID_t &participantId)
 
bool remove_domain_participant (DDS::DomainId_t domain_id, const GUID_t &participantId)
 
bool ignore_domain_participant (DDS::DomainId_t domain, const GUID_t &myParticipantId, const GUID_t &ignoreId)
 
bool update_domain_participant_qos (DDS::DomainId_t domain, const GUID_t &participant, const DDS::DomainParticipantQos &qos)
 
DCPS::TopicStatus assert_topic (GUID_t &topicId, DDS::DomainId_t domainId, const GUID_t &participantId, const char *topicName, const char *dataTypeName, const DDS::TopicQos &qos, bool hasDcpsKey, DCPS::TopicCallbacks *topic_callbacks)
 
DCPS::TopicStatus find_topic (DDS::DomainId_t domainId, const GUID_t &participantId, const char *topicName, CORBA::String_out dataTypeName, DDS::TopicQos_out qos, GUID_t &topicId)
 
DCPS::TopicStatus remove_topic (DDS::DomainId_t domainId, const GUID_t &participantId, const GUID_t &topicId)
 
bool ignore_topic (DDS::DomainId_t domainId, const GUID_t &myParticipantId, const GUID_t &ignoreId)
 
bool update_topic_qos (const GUID_t &topicId, DDS::DomainId_t domainId, const GUID_t &participantId, const DDS::TopicQos &qos)
 
GUID_t add_publication (DDS::DomainId_t domainId, const GUID_t &participantId, 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)
 
bool remove_publication (DDS::DomainId_t domainId, const GUID_t &participantId, const GUID_t &publicationId)
 
bool ignore_publication (DDS::DomainId_t domainId, const GUID_t &participantId, const GUID_t &ignoreId)
 
bool update_publication_qos (DDS::DomainId_t domainId, const GUID_t &partId, const GUID_t &dwId, const DDS::DataWriterQos &qos, const DDS::PublisherQos &publisherQos)
 
void update_publication_locators (DDS::DomainId_t domainId, const GUID_t &partId, const GUID_t &dwId, const DCPS::TransportLocatorSeq &transInfo)
 
GUID_t add_subscription (DDS::DomainId_t domainId, const GUID_t &participantId, 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)
 
bool remove_subscription (DDS::DomainId_t domainId, const GUID_t &participantId, const GUID_t &subscriptionId)
 
bool ignore_subscription (DDS::DomainId_t domainId, const GUID_t &participantId, const GUID_t &ignoreId)
 
bool update_subscription_qos (DDS::DomainId_t domainId, const GUID_t &partId, const GUID_t &drId, const DDS::DataReaderQos &qos, const DDS::SubscriberQos &subQos)
 
bool update_subscription_params (DDS::DomainId_t domainId, const GUID_t &partId, const GUID_t &subId, const DDS::StringSeq &params)
 
void update_subscription_locators (DDS::DomainId_t domainId, const GUID_t &partId, const GUID_t &subId, const DCPS::TransportLocatorSeq &transInfo)
 
- Public Member Functions inherited from OpenDDS::DCPS::Discovery
 Discovery (const RepoKey &key)
 
virtual bool active ()
 
RepoKey key () const
 
virtual TopicStatus assert_topic (GUID_t_out topicId, DDS::DomainId_t domainId, const GUID_t &participantId, const char *topicName, const char *dataTypeName, const DDS::TopicQos &qos, bool hasDcpsKey, TopicCallbacks *topic_callbacks)=0
 
virtual TopicStatus find_topic (DDS::DomainId_t domainId, const GUID_t &participantId, const char *topicName, CORBA::String_out dataTypeName, DDS::TopicQos_out qos, GUID_t_out topicId)=0
 
virtual bool supports_liveliness () const
 
virtual void signal_liveliness (const DDS::DomainId_t, const GUID_t &, DDS::LivelinessQosPolicyKind)
 
virtual void request_remote_complete_type_objects (DDS::DomainId_t, const GUID_t &, const GUID_t &, const XTypes::TypeInformation &, TypeObjReqCond &cond)
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Static Public Member Functions

static StaticDiscovery_rch instance ()
 

Public Attributes

EndpointRegistry registry
 

Private Types

typedef RcHandle< StaticParticipantParticipantHandle
 

Private Member Functions

typedef OPENDDS_MAP_CMP (GUID_t, ParticipantHandle, GUID_tKeyLessThan) ParticipantMap
 
typedef OPENDDS_MAP (DDS::DomainId_t, ParticipantMap) DomainParticipantMap
 
ParticipantHandle get_part (const DDS::DomainId_t domain_id, const GUID_t &part_id) const
 
void create_bit_dr (DDS::TopicDescription_ptr topic, const char *type, SubscriberImpl *sub, const DDS::DataReaderQos &qos)
 
int parse_topics (ACE_Configuration_Heap &cf)
 
int parse_datawriterqos (ACE_Configuration_Heap &cf)
 
int parse_datareaderqos (ACE_Configuration_Heap &cf)
 
int parse_publisherqos (ACE_Configuration_Heap &cf)
 
int parse_subscriberqos (ACE_Configuration_Heap &cf)
 
int parse_endpoints (ACE_Configuration_Heap &cf)
 
void pre_writer (DataWriterImpl *writer)
 
void pre_reader (DataReaderImpl *reader)
 

Private Attributes

ACE_Thread_Mutex lock_
 
DomainParticipantMap participants_
 

Static Private Attributes

static StaticDiscovery_rch instance_
 

Additional Inherited Members

- Public Types inherited from OpenDDS::DCPS::Discovery
typedef OPENDDS_STRING RepoKey
 
- Static Public Attributes inherited from OpenDDS::DCPS::Discovery
static const char * DEFAULT_REPO = "DEFAULT_REPO"
 Key value for the default repository IOR. More...
 
static const char * DEFAULT_RTPS = "DEFAULT_RTPS"
 
static const char * DEFAULT_STATIC = "DEFAULT_STATIC"
 
- Protected Member Functions inherited from OpenDDS::DCPS::Discovery
DDS::ReturnCode_t create_bit_topics (DomainParticipantImpl *participant)
 
- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 

Detailed Description

Definition at line 865 of file StaticDiscovery.h.

Member Typedef Documentation

◆ ParticipantHandle

Definition at line 1003 of file StaticDiscovery.h.

Constructor & Destructor Documentation

◆ StaticDiscovery()

OpenDDS::DCPS::StaticDiscovery::StaticDiscovery ( const RepoKey key)
explicit

Definition at line 1499 of file StaticDiscovery.cpp.

References OPENDDS_STRING.

1500  : Discovery(key)
1501 {}
sequence< octet > key
Discovery(const RepoKey &key)
Definition: Discovery.h:82

Member Function Documentation

◆ add_domain_participant()

AddDomainStatus OpenDDS::DCPS::StaticDiscovery::add_domain_participant ( DDS::DomainId_t  domain,
const DDS::DomainParticipantQos qos,
XTypes::TypeLookupService_rch  tls 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 1569 of file StaticDiscovery.cpp.

References ACE_ERROR, ACE_GUARD_RETURN, ACE_TEXT(), OpenDDS::DCPS::EndpointRegistry::build_id(), OpenDDS::DCPS::ENTITYID_PARTICIPANT, get_part(), OpenDDS::DCPS::AddDomainStatus::id, OpenDDS::DCPS::RcHandle< T >::is_nil(), LM_ERROR, lock_, participants_, OpenDDS::DCPS::ref(), registry, DDS::DomainParticipantQos::user_data, and DDS::UserDataQosPolicy::value.

1572 {
1573  AddDomainStatus ads = {GUID_t(), false /*federated*/};
1574 
1575  if (qos.user_data.value.length() != BYTES_IN_PARTICIPANT) {
1576  ACE_ERROR((LM_ERROR,
1577  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
1578  ACE_TEXT("No userdata to identify participant\n")));
1579  return ads;
1580  }
1581 
1582  GUID_t id = EndpointRegistry::build_id(domain,
1583  qos.user_data.value.get_buffer(),
1585  if (!get_part(domain, id).is_nil()) {
1586  ACE_ERROR((LM_ERROR,
1587  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
1588  ACE_TEXT("Duplicate participant\n")));
1589  return ads;
1590  }
1591 
1592  const RcHandle<StaticParticipant> participant (make_rch<StaticParticipant>(ref(id), qos, registry));
1593 
1594  {
1596  participants_[domain][id] = participant;
1597  }
1598 
1599  participant->type_lookup_service(tls);
1600 
1601  ads.id = id;
1602  return ads;
1603 }
#define ACE_ERROR(X)
UserDataQosPolicy user_data
reference_wrapper< T > ref(T &r)
Definition: RcHandle_T.h:237
DomainParticipantMap participants_
const EntityId_t ENTITYID_PARTICIPANT
Definition: GuidUtils.h:37
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
ACE_TEXT("TCP_Factory")
static EntityId_t build_id(const unsigned char *entity_key, const unsigned char entity_kind)
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ add_domain_participant_secure()

AddDomainStatus OpenDDS::DCPS::StaticDiscovery::add_domain_participant_secure ( DDS::DomainId_t  domain,
const DDS::DomainParticipantQos qos,
XTypes::TypeLookupService_rch  tls,
const GUID_t guid,
DDS::Security::IdentityHandle  id,
DDS::Security::PermissionsHandle  perm,
DDS::Security::ParticipantCryptoHandle  part_crypto 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 1607 of file StaticDiscovery.cpp.

References ACE_ERROR, ACE_TEXT(), atoi(), DDS::DURATION_INFINITE_NSEC, DDS::DURATION_INFINITE_SEC, OpenDDS::DCPS::GUID_UNKNOWN, LM_ERROR, DDS::PartitionQosPolicy::name, OPENDDS_STRING, OpenDDS::Security::XmlUtils::parse_bool(), and value.

1615 {
1616  const DCPS::AddDomainStatus ads = {OpenDDS::DCPS::GUID_UNKNOWN, false /*federated*/};
1617  ACE_ERROR((LM_ERROR,
1618  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant_secure ")
1619  ACE_TEXT("Security not supported for static discovery.\n")));
1620  return ads;
1621 }
#define ACE_ERROR(X)
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59
ACE_TEXT("TCP_Factory")

◆ add_publication()

GUID_t OpenDDS::DCPS::StaticDiscovery::add_publication ( DDS::DomainId_t  domainId,
const GUID_t participantId,
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 
)
virtual

add the passed in publication into discovery. Discovery does not participate in memory management for the publication pointer, so it requires that the publication pointer remain valid until remove_publication is called.

Implements OpenDDS::DCPS::Discovery.

Definition at line 2960 of file StaticDiscovery.cpp.

References get_part().

2969 {
2970  return get_part(domainId, participantId)->add_publication(
2971  topicId, publication, qos, transInfo, publisherQos, type_info);
2972 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ add_subscription()

GUID_t OpenDDS::DCPS::StaticDiscovery::add_subscription ( DDS::DomainId_t  domainId,
const GUID_t participantId,
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 *  filterExpression,
const DDS::StringSeq exprParams,
const XTypes::TypeInformation type_info 
)
virtual

add the passed in subscription into discovery. Discovery does not participate in memory management for the subscription pointer, so it requires that the subscription pointer remain valid until remove_subscription is called.

Implements OpenDDS::DCPS::Discovery.

Definition at line 3006 of file StaticDiscovery.cpp.

References get_part().

3018 {
3019  return get_part(domainId, participantId)->add_subscription(
3020  topicId, subscription, qos, transInfo, subscriberQos, filterClassName,
3021  filterExpr, params, type_info);
3022 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ assert_topic()

DCPS::TopicStatus OpenDDS::DCPS::StaticDiscovery::assert_topic ( GUID_t topicId,
DDS::DomainId_t  domainId,
const GUID_t participantId,
const char *  topicName,
const char *  dataTypeName,
const DDS::TopicQos qos,
bool  hasDcpsKey,
DCPS::TopicCallbacks topic_callbacks 
)

Definition at line 2906 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, OpenDDS::DCPS::INTERNAL_ERROR, lock_, and participants_.

2915 {
2917  // Verified its safe to hold lock during call to assert_topic
2918  return participants_[domainId][participantId]->assert_topic(topicId, topicName,
2919  dataTypeName, qos,
2920  hasDcpsKey, topic_callbacks);
2921 }
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ attach_participant()

bool OpenDDS::DCPS::StaticDiscovery::attach_participant ( DDS::DomainId_t  domainId,
const GUID_t participantId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2862 of file StaticDiscovery.cpp.

2864 {
2865  return false; // This is just for DCPSInfoRepo?
2866 }

◆ create_bit_dr()

void OpenDDS::DCPS::StaticDiscovery::create_bit_dr ( DDS::TopicDescription_ptr  topic,
const char *  type,
SubscriberImpl sub,
const DDS::DataReaderQos qos 
)
private

Definition at line 3076 of file StaticDiscovery.cpp.

References ACE_ERROR, ACE_TEXT(), OpenDDS::DCPS::DataReaderImpl::disable_transport(), OpenDDS::DCPS::DataReaderImpl::enable(), OpenDDS::DCPS::SubscriberImpl::get_participant(), OpenDDS::DCPS::DataReaderImpl::init(), LM_ERROR, and Registered_Data_Types.

Referenced by init_bit().

3078 {
3079  TopicDescriptionImpl* bit_topic_i =
3080  dynamic_cast<TopicDescriptionImpl*>(topic);
3081  if (bit_topic_i == 0) {
3082  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PeerDiscovery::create_bit_dr")
3083  ACE_TEXT(" - Could not cast TopicDescription to TopicDescriptionImpl\n")));
3084  return;
3085  }
3086 
3087  DDS::DomainParticipant_var participant = sub->get_participant();
3088  DomainParticipantImpl* participant_i =
3089  dynamic_cast<DomainParticipantImpl*>(participant.in());
3090  if (participant_i == 0) {
3091  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PeerDiscovery::create_bit_dr")
3092  ACE_TEXT(" - Could not cast DomainParticipant to DomainParticipantImpl\n")));
3093  return;
3094  }
3095 
3096  TypeSupport_var type_support =
3097  Registered_Data_Types->lookup(participant, type);
3098 
3099  DDS::DataReader_var dr = type_support->create_datareader();
3100  DataReaderImpl* dri = dynamic_cast<DataReaderImpl*>(dr.in());
3101  if (dri == 0) {
3102  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PeerDiscovery::create_bit_dr")
3103  ACE_TEXT(" - Could not cast DataReader to DataReaderImpl\n")));
3104  return;
3105  }
3106 
3107  dri->init(bit_topic_i, qos, 0 /*listener*/, 0 /*mask*/, participant_i, sub);
3108  dri->disable_transport();
3109  dri->enable();
3110 }
#define ACE_ERROR(X)
#define Registered_Data_Types
ACE_TEXT("TCP_Factory")

◆ find_topic()

DCPS::TopicStatus OpenDDS::DCPS::StaticDiscovery::find_topic ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const char *  topicName,
CORBA::String_out  dataTypeName,
DDS::TopicQos_out  qos,
GUID_t topicId 
)

Definition at line 2923 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, OpenDDS::DCPS::INTERNAL_ERROR, lock_, and participants_.

2930 {
2932  return participants_[domainId][participantId]->find_topic(topicName, dataTypeName, qos, topicId);
2933 }
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ fini_bit()

void OpenDDS::DCPS::StaticDiscovery::fini_bit ( DCPS::DomainParticipantImpl participant)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2857 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::DomainParticipantImpl::get_domain_id(), OpenDDS::DCPS::DomainParticipantImpl::get_id(), and get_part().

2858 {
2859  get_part(participant->get_domain_id(), participant->get_id())->fini_bit();
2860 }
void fini_bit(DCPS::DomainParticipantImpl *participant)
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ generate_participant_guid()

OpenDDS::DCPS::GUID_t OpenDDS::DCPS::StaticDiscovery::generate_participant_guid ( )
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 1563 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::GUID_UNKNOWN.

1564 {
1565  return GUID_UNKNOWN;
1566 }
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59

◆ get_part()

StaticDiscovery::ParticipantHandle OpenDDS::DCPS::StaticDiscovery::get_part ( const DDS::DomainId_t  domain_id,
const GUID_t part_id 
) const
private

Definition at line 3061 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, lock_, and participants_.

Referenced by add_domain_participant(), add_publication(), add_subscription(), fini_bit(), ignore_domain_participant(), ignore_publication(), ignore_subscription(), ignore_topic(), init_bit(), remove_publication(), remove_subscription(), update_domain_participant_qos(), update_publication_locators(), update_publication_qos(), update_subscription_locators(), update_subscription_params(), and update_subscription_qos().

3063 {
3065  DomainParticipantMap::const_iterator domain = participants_.find(domain_id);
3066  if (domain == participants_.end()) {
3067  return ParticipantHandle();
3068  }
3069  ParticipantMap::const_iterator part = domain->second.find(part_id);
3070  if (part == domain->second.end()) {
3071  return ParticipantHandle();
3072  }
3073  return part->second;
3074 }
RcHandle< StaticParticipant > ParticipantHandle
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ ignore_domain_participant()

bool OpenDDS::DCPS::StaticDiscovery::ignore_domain_participant ( DDS::DomainId_t  domain,
const GUID_t myParticipantId,
const GUID_t ignoreId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2893 of file StaticDiscovery.cpp.

References get_part().

2895 {
2896  get_part(domain, myParticipantId)->ignore_domain_participant(ignoreId);
2897  return true;
2898 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ ignore_publication()

bool OpenDDS::DCPS::StaticDiscovery::ignore_publication ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const GUID_t ignoreId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2981 of file StaticDiscovery.cpp.

References get_part().

2983 {
2984  get_part(domainId, participantId)->ignore_publication(ignoreId);
2985  return true;
2986 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ ignore_subscription()

bool OpenDDS::DCPS::StaticDiscovery::ignore_subscription ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const GUID_t ignoreId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 3031 of file StaticDiscovery.cpp.

References get_part().

3033 {
3034  get_part(domainId, participantId)->ignore_subscription(ignoreId);
3035  return true;
3036 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ ignore_topic()

bool OpenDDS::DCPS::StaticDiscovery::ignore_topic ( DDS::DomainId_t  domainId,
const GUID_t myParticipantId,
const GUID_t ignoreId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2945 of file StaticDiscovery.cpp.

References get_part().

2947 {
2948  get_part(domainId, myParticipantId)->ignore_topic(ignoreId);
2949  return true;
2950 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ init_bit()

RcHandle< BitSubscriber > OpenDDS::DCPS::StaticDiscovery::init_bit ( DCPS::DomainParticipantImpl participant)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2774 of file StaticDiscovery.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), OpenDDS::DCPS::BUILT_IN_CONNECTION_RECORD_TOPIC, OpenDDS::DCPS::BUILT_IN_CONNECTION_RECORD_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_INTERNAL_THREAD_TOPIC, OpenDDS::DCPS::BUILT_IN_INTERNAL_THREAD_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_PARTICIPANT_LOCATION_TOPIC, OpenDDS::DCPS::BUILT_IN_PARTICIPANT_LOCATION_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_PARTICIPANT_TOPIC, OpenDDS::DCPS::BUILT_IN_PARTICIPANT_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC, OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_SUBSCRIPTION_TOPIC, OpenDDS::DCPS::BUILT_IN_SUBSCRIPTION_TOPIC_TYPE, OpenDDS::DCPS::BUILT_IN_TOPIC_TOPIC, OpenDDS::DCPS::BUILT_IN_TOPIC_TOPIC_TYPE, create_bit_dr(), OpenDDS::DCPS::Discovery::create_bit_topics(), OpenDDS::DCPS::DomainParticipantImpl::create_subscriber(), OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::DEFAULT_STATUS_MASK, OpenDDS::DCPS::SubscriberImpl::get_default_datareader_qos(), OpenDDS::DCPS::DomainParticipantImpl::get_domain_id(), OpenDDS::DCPS::DomainParticipantImpl::get_id(), get_part(), OpenDDS::DCPS::RcHandle< T >::in(), LM_ERROR, LM_INFO, OpenDDS::DCPS::DomainParticipantImpl::lookup_topicdescription(), DDS::RETCODE_OK, SUBSCRIBER_QOS_DEFAULT, TheServiceParticipant, and DDS::TRANSIENT_LOCAL_DURABILITY_QOS.

2775 {
2776  DDS::Subscriber_var bit_subscriber;
2777 #ifndef DDS_HAS_MINIMUM_BIT
2778  if (!TheServiceParticipant->get_BIT()) {
2779  get_part(participant->get_domain_id(), participant->get_id())->init_bit(bit_subscriber);
2780  return RcHandle<BitSubscriber>();
2781  }
2782 
2783  if (create_bit_topics(participant) != DDS::RETCODE_OK) {
2784  return RcHandle<BitSubscriber>();
2785  }
2786 
2787  bit_subscriber =
2788  participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
2789  DDS::SubscriberListener::_nil(),
2791  SubscriberImpl* sub = dynamic_cast<SubscriberImpl*>(bit_subscriber.in());
2792  if (sub == 0) {
2793  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) PeerDiscovery::init_bit")
2794  ACE_TEXT(" - Could not cast Subscriber to SubscriberImpl\n")));
2795  return RcHandle<BitSubscriber>();
2796  }
2797 
2798  DDS::DataReaderQos dr_qos;
2799  sub->get_default_datareader_qos(dr_qos);
2801 
2802  dr_qos.reader_data_lifecycle.autopurge_nowriter_samples_delay =
2803  TheServiceParticipant->bit_autopurge_nowriter_samples_delay();
2804  dr_qos.reader_data_lifecycle.autopurge_disposed_samples_delay =
2805  TheServiceParticipant->bit_autopurge_disposed_samples_delay();
2806 
2807  DDS::TopicDescription_var bit_part_topic =
2808  participant->lookup_topicdescription(BUILT_IN_PARTICIPANT_TOPIC);
2810  sub, dr_qos);
2811 
2812  DDS::TopicDescription_var bit_topic_topic =
2813  participant->lookup_topicdescription(BUILT_IN_TOPIC_TOPIC);
2814  create_bit_dr(bit_topic_topic, BUILT_IN_TOPIC_TOPIC_TYPE,
2815  sub, dr_qos);
2816 
2817  DDS::TopicDescription_var bit_pub_topic =
2818  participant->lookup_topicdescription(BUILT_IN_PUBLICATION_TOPIC);
2820  sub, dr_qos);
2821 
2822  DDS::TopicDescription_var bit_sub_topic =
2823  participant->lookup_topicdescription(BUILT_IN_SUBSCRIPTION_TOPIC);
2825  sub, dr_qos);
2826 
2827  DDS::TopicDescription_var bit_part_loc_topic =
2828  participant->lookup_topicdescription(BUILT_IN_PARTICIPANT_LOCATION_TOPIC);
2830  sub, dr_qos);
2831 
2832  DDS::TopicDescription_var bit_connection_record_topic =
2833  participant->lookup_topicdescription(BUILT_IN_CONNECTION_RECORD_TOPIC);
2834  create_bit_dr(bit_connection_record_topic, BUILT_IN_CONNECTION_RECORD_TOPIC_TYPE,
2835  sub, dr_qos);
2836 
2837  DDS::TopicDescription_var bit_internal_thread_topic =
2838  participant->lookup_topicdescription(BUILT_IN_INTERNAL_THREAD_TOPIC);
2839  create_bit_dr(bit_internal_thread_topic, BUILT_IN_INTERNAL_THREAD_TOPIC_TYPE,
2840  sub, dr_qos);
2841 
2842  const DDS::ReturnCode_t ret = bit_subscriber->enable();
2843  if (ret != DDS::RETCODE_OK) {
2844  if (DCPS_debug_level) {
2845  ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) PeerDiscovery::init_bit")
2846  ACE_TEXT(" - Error %d enabling subscriber\n"), ret));
2847  }
2848  return RcHandle<BitSubscriber>();
2849  }
2850 #endif /* DDS_HAS_MINIMUM_BIT */
2851 
2852  get_part(participant->get_domain_id(), participant->get_id())->init_bit(bit_subscriber);
2853 
2854  return make_rch<BitSubscriber>(bit_subscriber);
2855 }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char *const BUILT_IN_TOPIC_TOPIC_TYPE
const ReturnCode_t RETCODE_OK
const char *const BUILT_IN_CONNECTION_RECORD_TOPIC_TYPE
const char *const BUILT_IN_PARTICIPANT_LOCATION_TOPIC_TYPE
const char *const BUILT_IN_CONNECTION_RECORD_TOPIC
const DDS::StatusMask DEFAULT_STATUS_MASK
void create_bit_dr(DDS::TopicDescription_ptr topic, const char *type, SubscriberImpl *sub, const DDS::DataReaderQos &qos)
const char *const BUILT_IN_PARTICIPANT_TOPIC
RcHandle< BitSubscriber > init_bit(DCPS::DomainParticipantImpl *participant)
const char *const BUILT_IN_INTERNAL_THREAD_TOPIC
const char *const BUILT_IN_PUBLICATION_TOPIC
DurabilityQosPolicy durability
DurabilityQosPolicyKind kind
const char *const BUILT_IN_INTERNAL_THREAD_TOPIC_TYPE
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
#define SUBSCRIBER_QOS_DEFAULT
const char *const BUILT_IN_SUBSCRIPTION_TOPIC
DDS::ReturnCode_t create_bit_topics(DomainParticipantImpl *participant)
Definition: Discovery.cpp:51
const char *const BUILT_IN_TOPIC_TOPIC
const char *const BUILT_IN_PUBLICATION_TOPIC_TYPE
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const
const char *const BUILT_IN_PARTICIPANT_LOCATION_TOPIC
#define TheServiceParticipant
const char *const BUILT_IN_SUBSCRIPTION_TOPIC_TYPE
const char *const BUILT_IN_PARTICIPANT_TOPIC_TYPE

◆ instance()

static StaticDiscovery_rch OpenDDS::DCPS::StaticDiscovery::instance ( void  )
inlinestatic

◆ load_configuration()

int OpenDDS::DCPS::StaticDiscovery::load_configuration ( ACE_Configuration_Heap config)

Definition at line 1682 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::EndpointRegistry::match(), parse_datareaderqos(), parse_datawriterqos(), parse_endpoints(), parse_publisherqos(), parse_subscriberqos(), parse_topics(), and registry.

1683 {
1684  if (parse_topics(cf) ||
1685  parse_datawriterqos(cf) ||
1686  parse_datareaderqos(cf) ||
1687  parse_publisherqos(cf) ||
1688  parse_subscriberqos(cf) ||
1689  parse_endpoints(cf)) {
1690  return -1;
1691  }
1692 
1693  registry.match();
1694 
1695  return 0;
1696 }
int parse_topics(ACE_Configuration_Heap &cf)
int parse_publisherqos(ACE_Configuration_Heap &cf)
int parse_subscriberqos(ACE_Configuration_Heap &cf)
int parse_endpoints(ACE_Configuration_Heap &cf)
int parse_datawriterqos(ACE_Configuration_Heap &cf)
int parse_datareaderqos(ACE_Configuration_Heap &cf)

◆ OPENDDS_MAP()

typedef OpenDDS::DCPS::StaticDiscovery::OPENDDS_MAP ( DDS::DomainId_t  ,
ParticipantMap   
)
private

◆ OPENDDS_MAP_CMP()

typedef OpenDDS::DCPS::StaticDiscovery::OPENDDS_MAP_CMP ( GUID_t  ,
ParticipantHandle  ,
GUID_tKeyLessThan   
)
private

◆ parse_datareaderqos()

int OpenDDS::DCPS::StaticDiscovery::parse_datareaderqos ( ACE_Configuration_Heap cf)
private

Definition at line 1976 of file StaticDiscovery.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), atoi(), DDS::AUTOMATIC_LIVELINESS_QOS, DDS::BEST_EFFORT_RELIABILITY_QOS, DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS, DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS, OpenDDS::DCPS::EndpointRegistry::datareaderqos_map, OpenDDS::DCPS::DCPS_debug_level, DDS::KEEP_ALL_HISTORY_QOS, DDS::KEEP_LAST_HISTORY_QOS, LM_ERROR, LM_NOTICE, DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, DDS::PERSISTENT_DURABILITY_QOS, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, DDS::RELIABLE_RELIABILITY_QOS, ACE_Configuration::root_section(), TheServiceParticipant, DDS::TRANSIENT_DURABILITY_QOS, DDS::TRANSIENT_LOCAL_DURABILITY_QOS, value, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

1977 {
1978  const ACE_Configuration_Section_Key& root = cf.root_section();
1980 
1981  if (cf.open_section(root, DATAREADERQOS_SECTION_NAME, false, section) != 0) {
1982  if (DCPS_debug_level > 0) {
1983  // This is not an error if the configuration file does not have
1984  // any datareaderqos (sub)section.
1985  ACE_DEBUG((LM_NOTICE,
1986  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
1987  ACE_TEXT("no [%s] sections.\n"),
1988  DATAREADERQOS_SECTION_NAME));
1989  }
1990  return 0;
1991  }
1992 
1993  // Ensure there are no key/values in the [datareaderqos] section.
1994  // Every key/value must be in a [datareaderqos/*] sub-section.
1995  ValueMap vm;
1996  if (pullValues(cf, section, vm) > 0) {
1997  ACE_ERROR_RETURN((LM_ERROR,
1998  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
1999  ACE_TEXT("[datareaderqos] sections must have a subsection name\n")),
2000  -1);
2001  }
2002  // Process the subsections of this section
2003  KeyList keys;
2004  if (processSections(cf, section, keys) != 0) {
2005  ACE_ERROR_RETURN((LM_ERROR,
2006  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2007  ACE_TEXT("too many nesting layers in the [datareaderqos] section.\n")),
2008  -1);
2009  }
2010 
2011  // Loop through the [datareaderqos/*] sections
2012  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
2013  OPENDDS_STRING datareaderqos_name = it->first;
2014 
2015  if (DCPS_debug_level > 0) {
2016  ACE_DEBUG((LM_NOTICE,
2017  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
2018  ACE_TEXT("processing [datareaderqos/%C] section.\n"),
2019  datareaderqos_name.c_str()));
2020  }
2021 
2022  ValueMap values;
2023  pullValues(cf, it->second, values);
2024 
2025  DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
2026 
2027  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
2028  OPENDDS_STRING name = it->first;
2029  OPENDDS_STRING value = it->second;
2030 
2031  if (name == "durability.kind") {
2032  if (value == "VOLATILE") {
2033  datareaderqos.durability.kind = DDS::VOLATILE_DURABILITY_QOS;
2034  } else if (value == "TRANSIENT_LOCAL") {
2035  datareaderqos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
2036 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
2037  } else if (value == "TRANSIENT") {
2038  datareaderqos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS;
2039  } else if (value == "PERSISTENT") {
2040  datareaderqos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS;
2041 #endif
2042  } else {
2043  ACE_ERROR_RETURN((LM_ERROR,
2044  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2045  ACE_TEXT("Illegal value for durability.kind (%C) in [datareaderqos/%C] section.\n"),
2046  value.c_str(), datareaderqos_name.c_str()),
2047  -1);
2048  }
2049  } else if (name == "deadline.period.sec") {
2050  parse_second(datareaderqos.deadline.period.sec, value);
2051  } else if (name == "deadline.period.nanosec") {
2052  parse_nanosecond(datareaderqos.deadline.period.nanosec, value);
2053  } else if (name == "latency_budget.duration.sec") {
2054  parse_second(datareaderqos.latency_budget.duration.sec, value);
2055  } else if (name == "latency_budget.duration.nanosec") {
2056  parse_nanosecond(datareaderqos.latency_budget.duration.nanosec, value);
2057  } else if (name == "liveliness.kind") {
2058  if (value == "AUTOMATIC") {
2059  datareaderqos.liveliness.kind = DDS::AUTOMATIC_LIVELINESS_QOS;
2060  } else if (value == "MANUAL_BY_TOPIC") {
2061  datareaderqos.liveliness.kind = DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
2062  } else if (value == "MANUAL_BY_PARTICIPANT") {
2063  datareaderqos.liveliness.kind = DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
2064  } else {
2065  ACE_ERROR_RETURN((LM_ERROR,
2066  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2067  ACE_TEXT("Illegal value for liveliness.kind (%C) in [datareaderqos/%C] section.\n"),
2068  value.c_str(), datareaderqos_name.c_str()),
2069  -1);
2070  }
2071  } else if (name == "liveliness.lease_duration.sec") {
2072  parse_second(datareaderqos.liveliness.lease_duration.sec, value);
2073  } else if (name == "liveliness.lease_duration.nanosec") {
2074  parse_nanosecond(datareaderqos.liveliness.lease_duration.nanosec, value);
2075  } else if (name == "reliability.kind") {
2076  if (value == "BEST_EFFORT") {
2077  datareaderqos.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
2078  } else if (value == "RELIABLE") {
2079  datareaderqos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
2080  } else {
2081  ACE_ERROR_RETURN((LM_ERROR,
2082  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2083  ACE_TEXT("Illegal value for reliability.kind (%C) in [datareaderqos/%C] section.\n"),
2084  value.c_str(), datareaderqos_name.c_str()),
2085  -1);
2086  }
2087  } else if (name == "reliability.max_blocking_time.sec") {
2088  parse_second(datareaderqos.reliability.max_blocking_time.sec, value);
2089  } else if (name == "reliability.max_blocking_time.nanosec") {
2090  parse_nanosecond(datareaderqos.reliability.max_blocking_time.nanosec, value);
2091  } else if (name == "destination_order.kind") {
2092  if (value == "BY_RECEPTION_TIMESTAMP") {
2093  datareaderqos.destination_order.kind = DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
2094  } else if (value == "BY_SOURCE_TIMESTAMP") {
2095  datareaderqos.destination_order.kind = DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
2096  } else {
2097  ACE_ERROR_RETURN((LM_ERROR,
2098  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2099  ACE_TEXT("Illegal value for destination_order.kind (%C) in [datareaderqos/%C] section.\n"),
2100  value.c_str(), datareaderqos_name.c_str()),
2101  -1);
2102  }
2103  } else if (name == "history.kind") {
2104  if (value == "KEEP_ALL") {
2105  datareaderqos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
2106  } else if (value == "KEEP_LAST") {
2107  datareaderqos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
2108  } else {
2109  ACE_ERROR_RETURN((LM_ERROR,
2110  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2111  ACE_TEXT("Illegal value for history.kind (%C) in [datareaderqos/%C] section.\n"),
2112  value.c_str(), datareaderqos_name.c_str()),
2113  -1);
2114  }
2115  } else if (name == "history.depth") {
2116  datareaderqos.history.depth = atoi(value.c_str());
2117  } else if (name == "resource_limits.max_samples") {
2118  datareaderqos.resource_limits.max_samples = atoi(value.c_str());
2119  } else if (name == "resource_limits.max_instances") {
2120  datareaderqos.resource_limits.max_instances = atoi(value.c_str());
2121  } else if (name == "resource_limits.max_samples_per_instance") {
2122  datareaderqos.resource_limits.max_samples_per_instance = atoi(value.c_str());
2123  } else if (name == "time_based_filter.minimum_separation.sec") {
2124  parse_second(datareaderqos.time_based_filter.minimum_separation.sec, value);
2125  } else if (name == "time_based_filter.minimum_separation.nanosec") {
2126  parse_nanosecond(datareaderqos.time_based_filter.minimum_separation.nanosec, value);
2127  } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.sec") {
2128  parse_second(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.sec, value);
2129  } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec") {
2130  parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec, value);
2131  } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.sec") {
2132  parse_second(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.sec, value);
2133  } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec") {
2134  parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec, value);
2135  } else {
2136  ACE_ERROR_RETURN((LM_ERROR,
2137  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
2138  ACE_TEXT("Unexpected entry (%C) in [datareaderqos/%C] section.\n"),
2139  name.c_str(), datareaderqos_name.c_str()),
2140  -1);
2141  }
2142  }
2143 
2144  registry.datareaderqos_map[datareaderqos_name] = datareaderqos;
2145  }
2146 
2147  return 0;
2148 }
#define ACE_DEBUG(X)
const LogLevel::Value value
Definition: debug.cpp:61
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
virtual const ACE_Configuration_Section_Key & root_section(void) const
#define OPENDDS_STRING
DataReaderQosMapType datareaderqos_map
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
int atoi(const char *s)
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
#define ACE_ERROR_RETURN(X, Y)
#define TheServiceParticipant

◆ parse_datawriterqos()

int OpenDDS::DCPS::StaticDiscovery::parse_datawriterqos ( ACE_Configuration_Heap cf)
private

Definition at line 1793 of file StaticDiscovery.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), atoi(), DDS::AUTOMATIC_LIVELINESS_QOS, DDS::BEST_EFFORT_RELIABILITY_QOS, DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS, DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS, OpenDDS::DCPS::EndpointRegistry::datawriterqos_map, OpenDDS::DCPS::DCPS_debug_level, DDS::EXCLUSIVE_OWNERSHIP_QOS, DDS::KEEP_ALL_HISTORY_QOS, DDS::KEEP_LAST_HISTORY_QOS, LM_ERROR, LM_NOTICE, DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, DDS::PERSISTENT_DURABILITY_QOS, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, DDS::RELIABLE_RELIABILITY_QOS, ACE_Configuration::root_section(), DDS::SHARED_OWNERSHIP_QOS, TheServiceParticipant, DDS::TRANSIENT_DURABILITY_QOS, DDS::TRANSIENT_LOCAL_DURABILITY_QOS, value, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

1794 {
1795  const ACE_Configuration_Section_Key& root = cf.root_section();
1797 
1798  if (cf.open_section(root, DATAWRITERQOS_SECTION_NAME, false, section) != 0) {
1799  if (DCPS_debug_level > 0) {
1800  // This is not an error if the configuration file does not have
1801  // any datawriterqos (sub)section.
1802  ACE_DEBUG((LM_NOTICE,
1803  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datawriterqos ")
1804  ACE_TEXT("no [%s] sections.\n"),
1805  DATAWRITERQOS_SECTION_NAME));
1806  }
1807  return 0;
1808  }
1809 
1810  // Ensure there are no key/values in the [datawriterqos] section.
1811  // Every key/value must be in a [datawriterqos/*] sub-section.
1812  ValueMap vm;
1813  if (pullValues(cf, section, vm) > 0) {
1814  ACE_ERROR_RETURN((LM_ERROR,
1815  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1816  ACE_TEXT("[datawriterqos] sections must have a subsection name\n")),
1817  -1);
1818  }
1819  // Process the subsections of this section
1820  KeyList keys;
1821  if (processSections(cf, section, keys) != 0) {
1822  ACE_ERROR_RETURN((LM_ERROR,
1823  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1824  ACE_TEXT("too many nesting layers in the [datawriterqos] section.\n")),
1825  -1);
1826  }
1827 
1828  // Loop through the [datawriterqos/*] sections
1829  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
1830  OPENDDS_STRING datawriterqos_name = it->first;
1831 
1832  if (DCPS_debug_level > 0) {
1833  ACE_DEBUG((LM_NOTICE,
1834  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datawriterqos ")
1835  ACE_TEXT("processing [datawriterqos/%C] section.\n"),
1836  datawriterqos_name.c_str()));
1837  }
1838 
1839  ValueMap values;
1840  pullValues(cf, it->second, values);
1841 
1842  DDS::DataWriterQos datawriterqos(TheServiceParticipant->initial_DataWriterQos());
1843 
1844  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
1845  OPENDDS_STRING name = it->first;
1846  OPENDDS_STRING value = it->second;
1847 
1848  if (name == "durability.kind") {
1849  if (value == "VOLATILE") {
1850  datawriterqos.durability.kind = DDS::VOLATILE_DURABILITY_QOS;
1851  } else if (value == "TRANSIENT_LOCAL") {
1852  datawriterqos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
1853 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
1854  } else if (value == "TRANSIENT") {
1855  datawriterqos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS;
1856  } else if (value == "PERSISTENT") {
1857  datawriterqos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS;
1858 #endif
1859  } else {
1860  ACE_ERROR_RETURN((LM_ERROR,
1861  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1862  ACE_TEXT("Illegal value for durability.kind (%C) in [datawriterqos/%C] section.\n"),
1863  value.c_str(), datawriterqos_name.c_str()),
1864  -1);
1865  }
1866  } else if (name == "deadline.period.sec") {
1867  parse_second(datawriterqos.deadline.period.sec, value);
1868  } else if (name == "deadline.period.nanosec") {
1869  parse_nanosecond(datawriterqos.deadline.period.nanosec, value);
1870  } else if (name == "latency_budget.duration.sec") {
1871  parse_second(datawriterqos.latency_budget.duration.sec, value);
1872  } else if (name == "latency_budget.duration.nanosec") {
1873  parse_nanosecond(datawriterqos.latency_budget.duration.nanosec, value);
1874  } else if (name == "liveliness.kind") {
1875  if (value == "AUTOMATIC") {
1876  datawriterqos.liveliness.kind = DDS::AUTOMATIC_LIVELINESS_QOS;
1877  } else if (value == "MANUAL_BY_TOPIC") {
1878  datawriterqos.liveliness.kind = DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
1879  } else if (value == "MANUAL_BY_PARTICIPANT") {
1880  datawriterqos.liveliness.kind = DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
1881  } else {
1882  ACE_ERROR_RETURN((LM_ERROR,
1883  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1884  ACE_TEXT("Illegal value for liveliness.kind (%C) in [datawriterqos/%C] section.\n"),
1885  value.c_str(), datawriterqos_name.c_str()),
1886  -1);
1887  }
1888  } else if (name == "liveliness.lease_duration.sec") {
1889  parse_second(datawriterqos.liveliness.lease_duration.sec, value);
1890  } else if (name == "liveliness.lease_duration.nanosec") {
1891  parse_nanosecond(datawriterqos.liveliness.lease_duration.nanosec, value);
1892  } else if (name == "reliability.kind") {
1893  if (value == "BEST_EFFORT") {
1894  datawriterqos.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
1895  } else if (value == "RELIABLE") {
1896  datawriterqos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
1897  } else {
1898  ACE_ERROR_RETURN((LM_ERROR,
1899  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1900  ACE_TEXT("Illegal value for reliability.kind (%C) in [datawriterqos/%C] section.\n"),
1901  value.c_str(), datawriterqos_name.c_str()),
1902  -1);
1903  }
1904  } else if (name == "reliability.max_blocking_time.sec") {
1905  parse_second(datawriterqos.reliability.max_blocking_time.sec, value);
1906  } else if (name == "reliability.max_blocking_time.nanosec") {
1907  parse_nanosecond(datawriterqos.reliability.max_blocking_time.nanosec, value);
1908  } else if (name == "destination_order.kind") {
1909  if (value == "BY_RECEPTION_TIMESTAMP") {
1910  datawriterqos.destination_order.kind = DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
1911  } else if (value == "BY_SOURCE_TIMESTAMP") {
1912  datawriterqos.destination_order.kind = DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
1913  } else {
1914  ACE_ERROR_RETURN((LM_ERROR,
1915  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1916  ACE_TEXT("Illegal value for destination_order.kind (%C) in [datawriterqos/%C] section.\n"),
1917  value.c_str(), datawriterqos_name.c_str()),
1918  -1);
1919  }
1920  } else if (name == "history.kind") {
1921  if (value == "KEEP_ALL") {
1922  datawriterqos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
1923  } else if (value == "KEEP_LAST") {
1924  datawriterqos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
1925  } else {
1926  ACE_ERROR_RETURN((LM_ERROR,
1927  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1928  ACE_TEXT("Illegal value for history.kind (%C) in [datawriterqos/%C] section.\n"),
1929  value.c_str(), datawriterqos_name.c_str()),
1930  -1);
1931  }
1932  } else if (name == "history.depth") {
1933  datawriterqos.history.depth = atoi(value.c_str());
1934  } else if (name == "resource_limits.max_samples") {
1935  datawriterqos.resource_limits.max_samples = atoi(value.c_str());
1936  } else if (name == "resource_limits.max_instances") {
1937  datawriterqos.resource_limits.max_instances = atoi(value.c_str());
1938  } else if (name == "resource_limits.max_samples_per_instance") {
1939  datawriterqos.resource_limits.max_samples_per_instance = atoi(value.c_str());
1940  } else if (name == "transport_priority.value") {
1941  datawriterqos.transport_priority.value = atoi(value.c_str());
1942  } else if (name == "lifespan.duration.sec") {
1943  parse_second(datawriterqos.lifespan.duration.sec, value);
1944  } else if (name == "lifespan.duration.nanosec") {
1945  parse_nanosecond(datawriterqos.lifespan.duration.nanosec, value);
1946  } else if (name == "ownership.kind") {
1947  if (value == "SHARED") {
1948  datawriterqos.ownership.kind = DDS::SHARED_OWNERSHIP_QOS;
1949  } else if (value == "EXCLUSIVE") {
1950  datawriterqos.ownership.kind = DDS::EXCLUSIVE_OWNERSHIP_QOS;
1951  } else {
1952  ACE_ERROR_RETURN((LM_ERROR,
1953  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1954  ACE_TEXT("Illegal value for ownership.kind (%C) in [datawriterqos/%C] section.\n"),
1955  value.c_str(), datawriterqos_name.c_str()),
1956  -1);
1957  }
1958  } else if (name == "ownership_strength.value") {
1959  datawriterqos.ownership_strength.value = atoi(value.c_str());
1960  } else {
1961  ACE_ERROR_RETURN((LM_ERROR,
1962  ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
1963  ACE_TEXT("Unexpected entry (%C) in [datawriterqos/%C] section.\n"),
1964  name.c_str(), datawriterqos_name.c_str()),
1965  -1);
1966  }
1967  }
1968 
1969  registry.datawriterqos_map[datawriterqos_name] = datawriterqos;
1970  }
1971 
1972  return 0;
1973 }
#define ACE_DEBUG(X)
const LogLevel::Value value
Definition: debug.cpp:61
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
DataWriterQosMapType datawriterqos_map
virtual const ACE_Configuration_Section_Key & root_section(void) const
#define OPENDDS_STRING
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
int atoi(const char *s)
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
#define ACE_ERROR_RETURN(X, Y)
#define TheServiceParticipant

◆ parse_endpoints()

int OpenDDS::DCPS::StaticDiscovery::parse_endpoints ( ACE_Configuration_Heap cf)
private

Definition at line 2382 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), OpenDDS::DCPS::EndpointRegistry::build_id(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::convertToInteger(), OpenDDS::DCPS::EndpointRegistry::datareaderqos_map, OpenDDS::DCPS::EndpointRegistry::datawriterqos_map, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::EntityId_t::entityKey, OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY, OpenDDS::DCPS::RcHandle< T >::is_nil(), LM_DEBUG, LM_ERROR, LM_NOTICE, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::DCPS::TransportConfig::populate_locators(), OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::pullValues(), OpenDDS::DCPS::EndpointRegistry::reader_map, registry, ACE_Configuration::root_section(), OpenDDS::DCPS::set_reader_effective_data_rep_qos(), OpenDDS::DCPS::set_writer_effective_data_rep_qos(), OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, TheServiceParticipant, TheTransportRegistry, OpenDDS::DCPS::EndpointRegistry::topic_map, value, and OpenDDS::DCPS::EndpointRegistry::writer_map.

Referenced by load_configuration().

2383 {
2384  const ACE_Configuration_Section_Key& root = cf.root_section();
2386 
2387  if (cf.open_section(root, ENDPOINT_SECTION_NAME, false, section) != 0) {
2388  if (DCPS_debug_level > 0) {
2389  // This is not an error if the configuration file does not have
2390  // any endpoint (sub)section.
2391  ACE_DEBUG((LM_NOTICE,
2392  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
2393  ACE_TEXT("no [%s] sections.\n"),
2394  ENDPOINT_SECTION_NAME));
2395  }
2396  return 0;
2397  }
2398 
2399  // Ensure there are no key/values in the [endpoint] section.
2400  // Every key/value must be in a [endpoint/*] sub-section.
2401  ValueMap vm;
2402  if (pullValues(cf, section, vm) > 0) {
2403  ACE_ERROR_RETURN((LM_ERROR,
2404  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2405  ACE_TEXT("[endpoint] sections must have a subsection name\n")),
2406  -1);
2407  }
2408  // Process the subsections of this section
2409  KeyList keys;
2410  if (processSections(cf, section, keys) != 0) {
2411  ACE_ERROR_RETURN((LM_ERROR,
2412  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2413  ACE_TEXT("too many nesting layers in the [endpoint] section.\n")),
2414  -1);
2415  }
2416 
2417  // Loop through the [endpoint/*] sections
2418  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
2419  OPENDDS_STRING endpoint_name = it->first;
2420 
2421  if (DCPS_debug_level > 0) {
2422  ACE_DEBUG((LM_NOTICE,
2423  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
2424  ACE_TEXT("processing [endpoint/%C] section.\n"),
2425  endpoint_name.c_str()));
2426  }
2427 
2428  ValueMap values;
2429  pullValues(cf, it->second, values);
2430  int domain = 0;
2431  unsigned char participant[6] = { 0 };
2432  unsigned char entity[3] = { 0 };
2433  enum Type {
2434  Reader,
2435  Writer
2436  };
2437  Type type = Reader; // avoid warning
2438  OPENDDS_STRING topic_name;
2439  DDS::DataWriterQos datawriterqos(TheServiceParticipant->initial_DataWriterQos());
2440  DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
2441  DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
2442  DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
2443  TransportLocatorSeq trans_info;
2444  OPENDDS_STRING config_name;
2445 
2446  bool domain_specified = false,
2447  participant_specified = false,
2448  entity_specified = false,
2449  type_specified = false,
2450  topic_name_specified = false,
2451  config_name_specified = false;
2452 
2453  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
2454  OPENDDS_STRING name = it->first;
2455  OPENDDS_STRING value = it->second;
2456 
2457  if (name == "domain") {
2458  if (convertToInteger(value, domain)) {
2459  domain_specified = true;
2460  } else {
2461  ACE_ERROR_RETURN((LM_ERROR,
2462  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2463  ACE_TEXT("Illegal integer value for domain (%C) in [endpoint/%C] section.\n"),
2464  value.c_str(), endpoint_name.c_str()),
2465  -1);
2466  }
2467  } else if (name == "participant") {
2468  const OPENDDS_STRING::difference_type count = std::count_if(value.begin(), value.end(), isxdigit);
2469  if (value.size() != HEX_DIGITS_IN_PARTICIPANT || static_cast<size_t>(count) != HEX_DIGITS_IN_PARTICIPANT) {
2470  ACE_ERROR_RETURN((LM_ERROR,
2471  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2472  ACE_TEXT("participant (%C) must be 12 hexadecimal digits in [endpoint/%C] section.\n"),
2473  value.c_str(), endpoint_name.c_str()),
2474  -1);
2475  }
2476 
2477  for (size_t idx = 0; idx != BYTES_IN_PARTICIPANT; ++idx) {
2478  participant[idx] = fromhex(value, idx);
2479  }
2480  participant_specified = true;
2481  } else if (name == "entity") {
2482  const OPENDDS_STRING::difference_type count = std::count_if(value.begin(), value.end(), isxdigit);
2483  if (value.size() != HEX_DIGITS_IN_ENTITY || static_cast<size_t>(count) != HEX_DIGITS_IN_ENTITY) {
2484  ACE_ERROR_RETURN((LM_ERROR,
2485  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2486  ACE_TEXT("entity (%C) must be 6 hexadecimal digits in [endpoint/%C] section.\n"),
2487  value.c_str(), endpoint_name.c_str()),
2488  -1);
2489  }
2490 
2491  for (size_t idx = 0; idx != BYTES_IN_ENTITY; ++idx) {
2492  entity[idx] = fromhex(value, idx);
2493  }
2494  entity_specified = true;
2495  } else if (name == "type") {
2496  if (value == "reader") {
2497  type = Reader;
2498  type_specified = true;
2499  } else if (value == "writer") {
2500  type = Writer;
2501  type_specified = true;
2502  } else {
2503  ACE_ERROR_RETURN((LM_ERROR,
2504  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2505  ACE_TEXT("Illegal string value for type (%C) in [endpoint/%C] section.\n"),
2506  value.c_str(), endpoint_name.c_str()),
2507  -1);
2508  }
2509  } else if (name == "topic") {
2510  EndpointRegistry::TopicMapType::const_iterator pos = this->registry.topic_map.find(value);
2511  if (pos != this->registry.topic_map.end()) {
2512  topic_name = pos->second.name;
2513  topic_name_specified = true;
2514  } else {
2515  ACE_ERROR_RETURN((LM_ERROR,
2516  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2517  ACE_TEXT("Illegal topic reference (%C) in [endpoint/%C] section.\n"),
2518  value.c_str(), endpoint_name.c_str()),
2519  -1);
2520  }
2521  } else if (name == "datawriterqos") {
2522  EndpointRegistry::DataWriterQosMapType::const_iterator pos = this->registry.datawriterqos_map.find(value);
2523  if (pos != this->registry.datawriterqos_map.end()) {
2524  datawriterqos = pos->second;
2525  } else {
2526  ACE_ERROR_RETURN((LM_ERROR,
2527  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2528  ACE_TEXT("Illegal datawriterqos reference (%C) in [endpoint/%C] section.\n"),
2529  value.c_str(), endpoint_name.c_str()),
2530  -1);
2531  }
2532  } else if (name == "publisherqos") {
2533  EndpointRegistry::PublisherQosMapType::const_iterator pos = this->registry.publisherqos_map.find(value);
2534  if (pos != this->registry.publisherqos_map.end()) {
2535  publisherqos = pos->second;
2536  } else {
2537  ACE_ERROR_RETURN((LM_ERROR,
2538  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2539  ACE_TEXT("Illegal publisherqos reference (%C) in [endpoint/%C] section.\n"),
2540  value.c_str(), endpoint_name.c_str()),
2541  -1);
2542  }
2543  } else if (name == "datareaderqos") {
2544  EndpointRegistry::DataReaderQosMapType::const_iterator pos = this->registry.datareaderqos_map.find(value);
2545  if (pos != this->registry.datareaderqos_map.end()) {
2546  datareaderqos = pos->second;
2547  } else {
2548  ACE_ERROR_RETURN((LM_ERROR,
2549  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2550  ACE_TEXT("Illegal datareaderqos reference (%C) in [endpoint/%C] section.\n"),
2551  value.c_str(), endpoint_name.c_str()),
2552  -1);
2553  }
2554  } else if (name == "subscriberqos") {
2555  EndpointRegistry::SubscriberQosMapType::const_iterator pos = this->registry.subscriberqos_map.find(value);
2556  if (pos != this->registry.subscriberqos_map.end()) {
2557  subscriberqos = pos->second;
2558  } else {
2559  ACE_ERROR_RETURN((LM_ERROR,
2560  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2561  ACE_TEXT("Illegal subscriberqos reference (%C) in [endpoint/%C] section.\n"),
2562  value.c_str(), endpoint_name.c_str()),
2563  -1);
2564  }
2565  } else if (name == "config") {
2566  config_name = value;
2567  config_name_specified = true;
2568  } else {
2569  ACE_ERROR_RETURN((LM_ERROR,
2570  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2571  ACE_TEXT("Unexpected entry (%C) in [endpoint/%C] section.\n"),
2572  name.c_str(), endpoint_name.c_str()),
2573  -1);
2574  }
2575  }
2576 
2577  if (!domain_specified) {
2578  ACE_ERROR_RETURN((LM_ERROR,
2579  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2580  ACE_TEXT("No domain specified for [endpoint/%C] section.\n"),
2581  endpoint_name.c_str()),
2582  -1);
2583  }
2584 
2585  if (!participant_specified) {
2586  ACE_ERROR_RETURN((LM_ERROR,
2587  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2588  ACE_TEXT("No participant specified for [endpoint/%C] section.\n"),
2589  endpoint_name.c_str()),
2590  -1);
2591  }
2592 
2593  if (!entity_specified) {
2594  ACE_ERROR_RETURN((LM_ERROR,
2595  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2596  ACE_TEXT("No entity specified for [endpoint/%C] section.\n"),
2597  endpoint_name.c_str()),
2598  -1);
2599  }
2600 
2601  if (!type_specified) {
2602  ACE_ERROR_RETURN((LM_ERROR,
2603  ACE_TEXT("(%P|%t) ERROR:StaticDiscovery::parse_endpoints ")
2604  ACE_TEXT("No type specified for [endpoint/%C] section.\n"),
2605  endpoint_name.c_str()),
2606  -1);
2607  }
2608 
2609  if (!topic_name_specified) {
2610  ACE_ERROR_RETURN((LM_ERROR,
2611  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2612  ACE_TEXT("No topic specified for [endpoint/%C] section.\n"),
2613  endpoint_name.c_str()),
2614  -1);
2615  }
2616 
2617  TransportConfig_rch config;
2618 
2619  if (config_name_specified) {
2620  config = TheTransportRegistry->get_config(config_name);
2621  if (config.is_nil()) {
2622  ACE_ERROR_RETURN((LM_ERROR,
2623  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2624  ACE_TEXT("Illegal config reference (%C) in [endpoint/%C] section.\n"),
2625  config_name.c_str(), endpoint_name.c_str()),
2626  -1);
2627  }
2628  }
2629 
2630  if (config.is_nil() && domain_specified) {
2631  config = TheTransportRegistry->domain_default_config(domain);
2632  }
2633 
2634  if (config.is_nil()) {
2635  config = TheTransportRegistry->global_config();
2636  }
2637 
2638  try {
2639  config->populate_locators(trans_info);
2640  }
2641  catch (const CORBA::Exception& ex) {
2642  ACE_ERROR_RETURN((LM_ERROR,
2643  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2644  ACE_TEXT("Exception caught while populating locators for [endpoint/%C] section. %C\n"),
2645  endpoint_name.c_str(), ex._info().c_str()),
2646  -1);
2647  }
2648  if (trans_info.length() == 0) {
2649  ACE_ERROR_RETURN((LM_ERROR,
2650  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2651  ACE_TEXT("No locators for [endpoint/%C] section.\n"),
2652  endpoint_name.c_str()),
2653  -1);
2654  }
2655 
2656  EntityId_t entity_id = EndpointRegistry::build_id(entity,
2658 
2659  GUID_t id = EndpointRegistry::build_id(domain, participant, entity_id);
2660 
2661  if (DCPS_debug_level > 0) {
2662  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) DEBUG: StaticDiscovery::parse_endpoints adding entity with id %C\n"), LogGuid(id).c_str()));
2663  }
2664 
2665  switch (type) {
2666  case Reader:
2667  // Populate the userdata.
2668  datareaderqos.user_data.value.length(3);
2669  datareaderqos.user_data.value[0] = entity_id.entityKey[0];
2670  datareaderqos.user_data.value[1] = entity_id.entityKey[1];
2671  datareaderqos.user_data.value[2] = entity_id.entityKey[2];
2672  set_reader_effective_data_rep_qos(datareaderqos.representation.value);
2673  if (!registry.reader_map.insert(std::make_pair(id,
2674  EndpointRegistry::Reader(topic_name, datareaderqos, subscriberqos, config_name, trans_info))).second) {
2675  ACE_ERROR_RETURN((LM_ERROR,
2676  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2677  ACE_TEXT("Section [endpoint/%C] ignored - duplicate reader.\n"),
2678  endpoint_name.c_str()),
2679  -1);
2680  }
2681  break;
2682  case Writer:
2683  // Populate the userdata.
2684  datawriterqos.user_data.value.length(3);
2685  datawriterqos.user_data.value[0] = entity_id.entityKey[0];
2686  datawriterqos.user_data.value[1] = entity_id.entityKey[1];
2687  datawriterqos.user_data.value[2] = entity_id.entityKey[2];
2688  bool encapsulated_only = false;
2689  for (CORBA::ULong i = 0; i < trans_info.length(); ++i) {
2690  if (0 == std::strcmp(trans_info[i].transport_type, "rtps_udp")) {
2691  encapsulated_only = true;
2692  break;
2693  }
2694  }
2695  set_writer_effective_data_rep_qos(datawriterqos.representation.value, encapsulated_only);
2696 
2697  if (!registry.writer_map.insert(std::make_pair(id,
2698  EndpointRegistry::Writer(topic_name, datawriterqos, publisherqos, config_name, trans_info))).second) {
2699  ACE_ERROR_RETURN((LM_ERROR,
2700  ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
2701  ACE_TEXT("Section [endpoint/%C] ignored - duplicate writer.\n"),
2702  endpoint_name.c_str()),
2703  -1);
2704  }
2705  break;
2706  }
2707  }
2708 
2709  return 0;
2710 }
#define TheTransportRegistry
#define ACE_DEBUG(X)
const char * c_str(void) const
const LogLevel::Value value
Definition: debug.cpp:61
void set_writer_effective_data_rep_qos(DDS::DataRepresentationIdSeq &qos, bool cdr_encapsulated)
Definition: DCPS_Utils.cpp:508
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
sequence< TransportLocator > TransportLocatorSeq
DataWriterQosMapType datawriterqos_map
virtual const ACE_Configuration_Section_Key & root_section(void) const
bool convertToInteger(const String &s, T &value)
const octet ENTITYKIND_USER_READER_WITH_KEY
Definition: DdsDcpsGuid.idl:43
PublisherQosMapType publisherqos_map
#define OPENDDS_STRING
ACE_CDR::ULong ULong
DataReaderQosMapType datareaderqos_map
virtual ACE_CString _info(void) const=0
void set_reader_effective_data_rep_qos(DDS::DataRepresentationIdSeq &qos)
Definition: DCPS_Utils.cpp:517
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
SubscriberQosMapType subscriberqos_map
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
const octet ENTITYKIND_USER_WRITER_WITH_KEY
Definition: DdsDcpsGuid.idl:40
#define ACE_ERROR_RETURN(X, Y)
static EntityId_t build_id(const unsigned char *entity_key, const unsigned char entity_kind)
#define TheServiceParticipant
RcHandle< TransportConfig > TransportConfig_rch

◆ parse_publisherqos()

int OpenDDS::DCPS::StaticDiscovery::parse_publisherqos ( ACE_Configuration_Heap cf)
private

Definition at line 2151 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, LM_ERROR, LM_NOTICE, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::Security::XmlUtils::parse_bool(), OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::pullValues(), registry, ACE_Configuration::root_section(), TheServiceParticipant, DDS::TOPIC_PRESENTATION_QOS, and value.

Referenced by load_configuration().

2152 {
2153  const ACE_Configuration_Section_Key& root = cf.root_section();
2155 
2156  if (cf.open_section(root, PUBLISHERQOS_SECTION_NAME, false, section) != 0) {
2157  if (DCPS_debug_level > 0) {
2158  // This is not an error if the configuration file does not have
2159  // any publisherqos (sub)section.
2160  ACE_DEBUG((LM_NOTICE,
2161  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
2162  ACE_TEXT("no [%s] sections.\n"),
2163  PUBLISHERQOS_SECTION_NAME));
2164  }
2165  return 0;
2166  }
2167 
2168  // Ensure there are no key/values in the [publisherqos] section.
2169  // Every key/value must be in a [publisherqos/*] sub-section.
2170  ValueMap vm;
2171  if (pullValues(cf, section, vm) > 0) {
2172  ACE_ERROR_RETURN((LM_ERROR,
2173  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2174  ACE_TEXT("[publisherqos] sections must have a subsection name\n")),
2175  -1);
2176  }
2177  // Process the subsections of this section
2178  KeyList keys;
2179  if (processSections(cf, section, keys) != 0) {
2180  ACE_ERROR_RETURN((LM_ERROR,
2181  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2182  ACE_TEXT("too many nesting layers in the [publisherqos] section.\n")),
2183  -1);
2184  }
2185 
2186  // Loop through the [publisherqos/*] sections
2187  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
2188  OPENDDS_STRING publisherqos_name = it->first;
2189 
2190  if (DCPS_debug_level > 0) {
2191  ACE_DEBUG((LM_NOTICE,
2192  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
2193  ACE_TEXT("processing [publisherqos/%C] section.\n"),
2194  publisherqos_name.c_str()));
2195  }
2196 
2197  ValueMap values;
2198  pullValues(cf, it->second, values);
2199 
2200  DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
2201 
2202  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
2203  OPENDDS_STRING name = it->first;
2204  OPENDDS_STRING value = it->second;
2205 
2206  if (name == "presentation.access_scope") {
2207  if (value == "INSTANCE") {
2208  publisherqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
2209  } else if (value == "TOPIC") {
2210  publisherqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
2211  } else if (value == "GROUP") {
2212  publisherqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
2213  } else {
2214  ACE_ERROR_RETURN((LM_ERROR,
2215  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2216  ACE_TEXT("Illegal value for presentation.access_scope (%C) in [publisherqos/%C] section.\n"),
2217  value.c_str(), publisherqos_name.c_str()),
2218  -1);
2219  }
2220  } else if (name == "presentation.coherent_access") {
2221  if (parse_bool(publisherqos.presentation.coherent_access, value)) {
2222  } else {
2223  ACE_ERROR_RETURN((LM_ERROR,
2224  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2225  ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [publisherqos/%C] section.\n"),
2226  value.c_str(), publisherqos_name.c_str()),
2227  -1);
2228  }
2229  } else if (name == "presentation.ordered_access") {
2230  if (parse_bool(publisherqos.presentation.ordered_access, value)) {
2231  } else {
2232  ACE_ERROR_RETURN((LM_ERROR,
2233  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2234  ACE_TEXT("Illegal value for presentation.ordered_access (%C)")
2235  ACE_TEXT("in [publisherqos/%C] section.\n"),
2236  value.c_str(), publisherqos_name.c_str()),
2237  -1);
2238  }
2239  } else if (name == "partition.name") {
2240  try {
2241  parse_list(publisherqos.partition, value);
2242  }
2243  catch (const CORBA::Exception& ex) {
2244  ACE_ERROR_RETURN((LM_ERROR,
2245  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2246  ACE_TEXT("Exception caught while parsing partition.name (%C) ")
2247  ACE_TEXT("in [publisherqos/%C] section: %C.\n"),
2248  value.c_str(), publisherqos_name.c_str(), ex._info().c_str()),
2249  -1);
2250  }
2251  } else {
2252  ACE_ERROR_RETURN((LM_ERROR,
2253  ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
2254  ACE_TEXT("Unexpected entry (%C) in [publisherqos/%C] section.\n"),
2255  name.c_str(), publisherqos_name.c_str()),
2256  -1);
2257  }
2258  }
2259 
2260  registry.publisherqos_map[publisherqos_name] = publisherqos;
2261  }
2262 
2263  return 0;
2264 }
#define ACE_DEBUG(X)
const char * c_str(void) const
const LogLevel::Value value
Definition: debug.cpp:61
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
virtual const ACE_Configuration_Section_Key & root_section(void) const
PublisherQosMapType publisherqos_map
#define OPENDDS_STRING
virtual ACE_CString _info(void) const=0
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
#define ACE_ERROR_RETURN(X, Y)
bool parse_bool(const XMLCh *in, bool &value)
Definition: XmlUtils.cpp:150
#define TheServiceParticipant

◆ parse_subscriberqos()

int OpenDDS::DCPS::StaticDiscovery::parse_subscriberqos ( ACE_Configuration_Heap cf)
private

Definition at line 2267 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, LM_ERROR, LM_NOTICE, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::Security::XmlUtils::parse_bool(), OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, ACE_Configuration::root_section(), OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, TheServiceParticipant, DDS::TOPIC_PRESENTATION_QOS, and value.

Referenced by load_configuration().

2268 {
2269  const ACE_Configuration_Section_Key& root = cf.root_section();
2271 
2272  if (cf.open_section(root, SUBSCRIBERQOS_SECTION_NAME, false, section) != 0) {
2273  if (DCPS_debug_level > 0) {
2274  // This is not an error if the configuration file does not have
2275  // any subscriberqos (sub)section.
2276  ACE_DEBUG((LM_NOTICE,
2277  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
2278  ACE_TEXT("no [%s] sections.\n"),
2279  SUBSCRIBERQOS_SECTION_NAME));
2280  }
2281  return 0;
2282  }
2283 
2284  // Ensure there are no key/values in the [subscriberqos] section.
2285  // Every key/value must be in a [subscriberqos/*] sub-section.
2286  ValueMap vm;
2287  if (pullValues(cf, section, vm) > 0) {
2288  ACE_ERROR_RETURN((LM_ERROR,
2289  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2290  ACE_TEXT("[subscriberqos] sections must have a subsection name\n")),
2291  -1);
2292  }
2293  // Process the subsections of this section
2294  KeyList keys;
2295  if (processSections(cf, section, keys) != 0) {
2296  ACE_ERROR_RETURN((LM_ERROR,
2297  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2298  ACE_TEXT("too many nesting layers in the [subscriberqos] section.\n")),
2299  -1);
2300  }
2301 
2302  // Loop through the [subscriberqos/*] sections
2303  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
2304  OPENDDS_STRING subscriberqos_name = it->first;
2305 
2306  if (DCPS_debug_level > 0) {
2307  ACE_DEBUG((LM_NOTICE,
2308  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
2309  ACE_TEXT("processing [subscriberqos/%C] section.\n"),
2310  subscriberqos_name.c_str()));
2311  }
2312 
2313  ValueMap values;
2314  pullValues(cf, it->second, values);
2315 
2316  DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
2317 
2318  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
2319  OPENDDS_STRING name = it->first;
2320  OPENDDS_STRING value = it->second;
2321 
2322  if (name == "presentation.access_scope") {
2323  if (value == "INSTANCE") {
2324  subscriberqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
2325  } else if (value == "TOPIC") {
2326  subscriberqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
2327  } else if (value == "GROUP") {
2328  subscriberqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
2329  } else {
2330  ACE_ERROR_RETURN((LM_ERROR,
2331  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2332  ACE_TEXT("Illegal value for presentation.access_scope (%C) in [subscriberqos/%C] section.\n"),
2333  value.c_str(), subscriberqos_name.c_str()),
2334  -1);
2335  }
2336  } else if (name == "presentation.coherent_access") {
2337  if (parse_bool(subscriberqos.presentation.coherent_access, value)) {
2338  } else {
2339  ACE_ERROR_RETURN((LM_ERROR,
2340  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2341  ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [subscriberqos/%C] section.\n"),
2342  value.c_str(), subscriberqos_name.c_str()),
2343  -1);
2344  }
2345  } else if (name == "presentation.ordered_access") {
2346  if (parse_bool(subscriberqos.presentation.ordered_access, value)) {
2347  } else {
2348  ACE_ERROR_RETURN((LM_ERROR,
2349  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2350  ACE_TEXT("Illegal value for presentation.ordered_access (%C) in [subscriberqos/%C] section.\n"),
2351  value.c_str(), subscriberqos_name.c_str()),
2352  -1);
2353  }
2354  } else if (name == "partition.name") {
2355  try {
2356  parse_list(subscriberqos.partition, value);
2357  }
2358  catch (const CORBA::Exception& ex) {
2359  ACE_ERROR_RETURN((LM_ERROR,
2360  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2361  ACE_TEXT("Exception caught while parsing partition.name (%C) ")
2362  ACE_TEXT("in [subscriberqos/%C] section: %C.\n"),
2363  value.c_str(), subscriberqos_name.c_str(), ex._info().c_str()),
2364  -1);
2365  }
2366  } else {
2367  ACE_ERROR_RETURN((LM_ERROR,
2368  ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
2369  ACE_TEXT("Unexpected entry (%C) in [subscriberqos/%C] section.\n"),
2370  name.c_str(), subscriberqos_name.c_str()),
2371  -1);
2372  }
2373  }
2374 
2375  registry.subscriberqos_map[subscriberqos_name] = subscriberqos;
2376  }
2377 
2378  return 0;
2379 }
#define ACE_DEBUG(X)
const char * c_str(void) const
const LogLevel::Value value
Definition: debug.cpp:61
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
virtual const ACE_Configuration_Section_Key & root_section(void) const
#define OPENDDS_STRING
virtual ACE_CString _info(void) const=0
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
SubscriberQosMapType subscriberqos_map
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
#define ACE_ERROR_RETURN(X, Y)
bool parse_bool(const XMLCh *in, bool &value)
Definition: XmlUtils.cpp:150
#define TheServiceParticipant

◆ parse_topics()

int OpenDDS::DCPS::StaticDiscovery::parse_topics ( ACE_Configuration_Heap cf)
private

Definition at line 1699 of file StaticDiscovery.cpp.

References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, LM_ERROR, LM_NOTICE, OpenDDS::DCPS::EndpointRegistry::Topic::name, name, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, ACE_Configuration::root_section(), OpenDDS::DCPS::EndpointRegistry::topic_map, OpenDDS::DCPS::EndpointRegistry::Topic::type_name, and value.

Referenced by load_configuration().

1700 {
1701  const ACE_Configuration_Section_Key& root = cf.root_section();
1703 
1704  if (cf.open_section(root, TOPIC_SECTION_NAME, false, section) != 0) {
1705  if (DCPS_debug_level > 0) {
1706  // This is not an error if the configuration file does not have
1707  // any topic (sub)section.
1708  ACE_DEBUG((LM_NOTICE,
1709  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
1710  ACE_TEXT("no [%s] sections.\n"),
1711  TOPIC_SECTION_NAME));
1712  }
1713  return 0;
1714  }
1715 
1716  // Ensure there are no key/values in the [topic] section.
1717  // Every key/value must be in a [topic/*] sub-section.
1718  ValueMap vm;
1719  if (pullValues(cf, section, vm) > 0) {
1720  ACE_ERROR_RETURN((LM_ERROR,
1721  ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
1722  ACE_TEXT("[topic] sections must have a subsection name\n")),
1723  -1);
1724  }
1725  // Process the subsections of this section
1726  KeyList keys;
1727  if (processSections(cf, section, keys) != 0) {
1728  ACE_ERROR_RETURN((LM_ERROR,
1729  ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
1730  ACE_TEXT("too many nesting layers in the [topic] section.\n")),
1731  -1);
1732  }
1733 
1734  // Loop through the [topic/*] sections
1735  for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
1736  OPENDDS_STRING topic_name = it->first;
1737 
1738  if (DCPS_debug_level > 0) {
1739  ACE_DEBUG((LM_NOTICE,
1740  ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
1741  ACE_TEXT("processing [topic/%C] section.\n"),
1742  topic_name.c_str()));
1743  }
1744 
1745  ValueMap values;
1746  pullValues(cf, it->second, values);
1747 
1749  bool name_specified = false,
1750  type_name_specified = false;
1751 
1752  for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
1753  OPENDDS_STRING name = it->first;
1754  OPENDDS_STRING value = it->second;
1755 
1756  if (name == "name") {
1757  topic.name = value;
1758  name_specified = true;
1759  } else if (name == "type_name") {
1760  if (value.size() >= TYPE_NAME_MAX) {
1761  ACE_ERROR_RETURN((LM_ERROR,
1762  ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
1763  ACE_TEXT("type_name (%C) must be less than 128 characters in [topic/%C] section.\n"),
1764  value.c_str(), topic_name.c_str()),
1765  -1);
1766  }
1767  topic.type_name = value;
1768  type_name_specified = true;
1769  } else {
1770  // Typos are ignored to avoid parsing FACE-specific keys.
1771  }
1772  }
1773 
1774  if (!name_specified) {
1775  topic.name = topic_name;
1776  }
1777 
1778  if (!type_name_specified) {
1779  ACE_ERROR_RETURN((LM_ERROR,
1780  ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
1781  ACE_TEXT("No type_name specified for [topic/%C] section.\n"),
1782  topic_name.c_str()),
1783  -1);
1784  }
1785 
1786  registry.topic_map[topic_name] = topic;
1787  }
1788 
1789  return 0;
1790 }
#define ACE_DEBUG(X)
const LogLevel::Value value
Definition: debug.cpp:61
int processSections(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, KeyList &subsections)
Definition: ConfigUtils.cpp:41
int pullValues(ACE_Configuration_Heap &cf, const ACE_Configuration_Section_Key &key, ValueMap &values)
Definition: ConfigUtils.cpp:17
virtual const ACE_Configuration_Section_Key & root_section(void) const
#define OPENDDS_STRING
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
virtual int open_section(const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, bool create, ACE_Configuration_Section_Key &result)
#define ACE_ERROR_RETURN(X, Y)

◆ pre_reader()

void OpenDDS::DCPS::StaticDiscovery::pre_reader ( DataReaderImpl reader)
privatevirtual

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 2742 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::TransportRegistry::bind_config(), OpenDDS::DCPS::EndpointRegistry::build_id(), OpenDDS::DCPS::Discovery::DEFAULT_STATIC, OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::DataReaderImpl::get_qos(), OpenDDS::DCPS::DataReaderImpl::get_subscriber(), OpenDDS::DCPS::TransportRegistry::instance(), instance_, OpenDDS::DCPS::EndpointRegistry::reader_map, registry, DDS::DataReaderQos::user_data, DDS::DomainParticipantQos::user_data, and DDS::UserDataQosPolicy::value.

2743 {
2744  const DDS::Subscriber_var sub = reader->get_subscriber();
2745  const DDS::DomainParticipant_var part = sub->get_participant();
2746  const DDS::DomainId_t dom = part->get_domain_id();
2747 
2748  DDS::DomainParticipantQos partQos;
2749  part->get_qos(partQos);
2750  if (partQos.user_data.value.length() < 6)
2751  return;
2752  const unsigned char* const partId = partQos.user_data.value.get_buffer();
2753 
2754  DDS::DataReaderQos qos;
2755  reader->get_qos(qos);
2756  if (qos.user_data.value.length() < 3)
2757  return;
2758  const unsigned char* const drId = qos.user_data.value.get_buffer();
2759 
2760  const EntityId_t entId =
2762  const GUID_t rid = EndpointRegistry::build_id(dom, partId, entId);
2763 
2764  const EndpointRegistry::ReaderMapType::const_iterator iter =
2765  registry.reader_map.find(rid);
2766 
2767  if (iter != registry.reader_map.end() && !iter->second.trans_cfg.empty()) {
2768  TransportRegistry::instance()->bind_config(iter->second.trans_cfg, reader);
2769  }
2770 }
UserDataQosPolicy user_data
const octet ENTITYKIND_USER_READER_WITH_KEY
Definition: DdsDcpsGuid.idl:43
DOMAINID_TYPE_NATIVE DomainId_t
static TransportRegistry * instance()
Return a singleton instance of this class.
UserDataQosPolicy user_data
void bind_config(const OPENDDS_STRING &name, DDS::Entity_ptr entity)
static EntityId_t build_id(const unsigned char *entity_key, const unsigned char entity_kind)

◆ pre_writer()

void OpenDDS::DCPS::StaticDiscovery::pre_writer ( DataWriterImpl writer)
privatevirtual

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 2712 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::TransportRegistry::bind_config(), OpenDDS::DCPS::EndpointRegistry::build_id(), OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY, OpenDDS::DCPS::DataWriterImpl::get_publisher(), OpenDDS::DCPS::DataWriterImpl::get_qos(), OpenDDS::DCPS::TransportRegistry::instance(), registry, DDS::DataWriterQos::user_data, DDS::DomainParticipantQos::user_data, DDS::UserDataQosPolicy::value, and OpenDDS::DCPS::EndpointRegistry::writer_map.

2713 {
2714  const DDS::Publisher_var pub = writer->get_publisher();
2715  const DDS::DomainParticipant_var part = pub->get_participant();
2716  const DDS::DomainId_t dom = part->get_domain_id();
2717 
2718  DDS::DomainParticipantQos partQos;
2719  part->get_qos(partQos);
2720  if (partQos.user_data.value.length() < 6)
2721  return;
2722  const unsigned char* const partId = partQos.user_data.value.get_buffer();
2723 
2724  DDS::DataWriterQos qos;
2725  writer->get_qos(qos);
2726  if (qos.user_data.value.length() < 3)
2727  return;
2728  const unsigned char* const dwId = qos.user_data.value.get_buffer();
2729 
2730  const EntityId_t entId =
2732  const GUID_t rid = EndpointRegistry::build_id(dom, partId, entId);
2733 
2734  const EndpointRegistry::WriterMapType::const_iterator iter =
2735  registry.writer_map.find(rid);
2736 
2737  if (iter != registry.writer_map.end() && !iter->second.trans_cfg.empty()) {
2738  TransportRegistry::instance()->bind_config(iter->second.trans_cfg, writer);
2739  }
2740 }
UserDataQosPolicy user_data
UserDataQosPolicy user_data
DOMAINID_TYPE_NATIVE DomainId_t
static TransportRegistry * instance()
Return a singleton instance of this class.
const octet ENTITYKIND_USER_WRITER_WITH_KEY
Definition: DdsDcpsGuid.idl:40
void bind_config(const OPENDDS_STRING &name, DDS::Entity_ptr entity)
static EntityId_t build_id(const unsigned char *entity_key, const unsigned char entity_kind)

◆ remove_domain_participant()

bool OpenDDS::DCPS::StaticDiscovery::remove_domain_participant ( DDS::DomainId_t  domain_id,
const GUID_t participantId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2868 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, lock_, and participants_.

2870 {
2871  // Use reference counting to ensure participant
2872  // does not get deleted until lock as been released.
2873  ParticipantHandle participant;
2875  DomainParticipantMap::iterator domain = participants_.find(domain_id);
2876  if (domain == participants_.end()) {
2877  return false;
2878  }
2879  ParticipantMap::iterator part = domain->second.find(participantId);
2880  if (part == domain->second.end()) {
2881  return false;
2882  }
2883  participant = part->second;
2884  domain->second.erase(part);
2885  if (domain->second.empty()) {
2886  participants_.erase(domain);
2887  }
2888 
2889  participant->shutdown();
2890  return true;
2891 }
RcHandle< StaticParticipant > ParticipantHandle
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ remove_publication()

bool OpenDDS::DCPS::StaticDiscovery::remove_publication ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const GUID_t publicationId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2974 of file StaticDiscovery.cpp.

References get_part().

2976 {
2977  get_part(domainId, participantId)->remove_publication(publicationId);
2978  return true;
2979 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ remove_subscription()

bool OpenDDS::DCPS::StaticDiscovery::remove_subscription ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const GUID_t subscriptionId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 3024 of file StaticDiscovery.cpp.

References get_part().

3026 {
3027  get_part(domainId, participantId)->remove_subscription(subscriptionId);
3028  return true;
3029 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ remove_topic()

DCPS::TopicStatus OpenDDS::DCPS::StaticDiscovery::remove_topic ( DDS::DomainId_t  domainId,
const GUID_t participantId,
const GUID_t topicId 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2935 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, OpenDDS::DCPS::INTERNAL_ERROR, lock_, and participants_.

2939 {
2941  // Safe to hold lock while calling remove topic
2942  return participants_[domainId][participantId]->remove_topic(topicId);
2943 }
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ update_domain_participant_qos()

bool OpenDDS::DCPS::StaticDiscovery::update_domain_participant_qos ( DDS::DomainId_t  domain,
const GUID_t participant,
const DDS::DomainParticipantQos qos 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2900 of file StaticDiscovery.cpp.

References get_part().

2902 {
2903  return get_part(domain, participant)->update_domain_participant_qos(qos);
2904 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_publication_locators()

void OpenDDS::DCPS::StaticDiscovery::update_publication_locators ( DDS::DomainId_t  domainId,
const GUID_t partId,
const GUID_t dwId,
const DCPS::TransportLocatorSeq transInfo 
)
virtual

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 2999 of file StaticDiscovery.cpp.

References get_part().

3002 {
3003  get_part(domainId, partId)->update_publication_locators(dwId, transInfo);
3004 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_publication_qos()

bool OpenDDS::DCPS::StaticDiscovery::update_publication_qos ( DDS::DomainId_t  domainId,
const GUID_t partId,
const GUID_t dwId,
const DDS::DataWriterQos qos,
const DDS::PublisherQos publisherQos 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2988 of file StaticDiscovery.cpp.

References get_part().

2994 {
2995  return get_part(domainId, partId)->update_publication_qos(dwId, qos,
2996  publisherQos);
2997 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_subscription_locators()

void OpenDDS::DCPS::StaticDiscovery::update_subscription_locators ( DDS::DomainId_t  domainId,
const GUID_t partId,
const GUID_t subId,
const DCPS::TransportLocatorSeq transInfo 
)
virtual

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 3054 of file StaticDiscovery.cpp.

References get_part().

3057 {
3058  get_part(domainId, partId)->update_subscription_locators(subId, transInfo);
3059 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_subscription_params()

bool OpenDDS::DCPS::StaticDiscovery::update_subscription_params ( DDS::DomainId_t  domainId,
const GUID_t partId,
const GUID_t subId,
const DDS::StringSeq params 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 3048 of file StaticDiscovery.cpp.

References get_part().

3050 {
3051  return get_part(domainId, partId)->update_subscription_params(subId, params);
3052 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_subscription_qos()

bool OpenDDS::DCPS::StaticDiscovery::update_subscription_qos ( DDS::DomainId_t  domainId,
const GUID_t partId,
const GUID_t drId,
const DDS::DataReaderQos qos,
const DDS::SubscriberQos subQos 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 3038 of file StaticDiscovery.cpp.

References get_part().

3044 {
3045  return get_part(domainId, partId)->update_subscription_qos(drId, qos, subQos);
3046 }
ParticipantHandle get_part(const DDS::DomainId_t domain_id, const GUID_t &part_id) const

◆ update_topic_qos()

bool OpenDDS::DCPS::StaticDiscovery::update_topic_qos ( const GUID_t topicId,
DDS::DomainId_t  domainId,
const GUID_t participantId,
const DDS::TopicQos qos 
)
virtual

Implements OpenDDS::DCPS::Discovery.

Definition at line 2952 of file StaticDiscovery.cpp.

References ACE_GUARD_RETURN, lock_, and participants_.

2954 {
2956  // Safe to hold lock while calling update_topic_qos
2957  return participants_[domainId][participantId]->update_topic_qos(topicId, qos);
2958 }
DomainParticipantMap participants_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

Member Data Documentation

◆ instance_

StaticDiscovery_rch OpenDDS::DCPS::StaticDiscovery::instance_
staticprivate

Definition at line 1023 of file StaticDiscovery.h.

Referenced by pre_reader().

◆ lock_

ACE_Thread_Mutex OpenDDS::DCPS::StaticDiscovery::lock_
mutableprivate

◆ participants_

DomainParticipantMap OpenDDS::DCPS::StaticDiscovery::participants_
private

◆ registry

EndpointRegistry OpenDDS::DCPS::StaticDiscovery::registry

The documentation for this class was generated from the following files: