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]

List of all members.

Public Member Functions

 StaticDiscovery (const RepoKey &key)
int load_configuration (ACE_Configuration_Heap &config)
virtual OpenDDS::DCPS::RepoId generate_participant_guid ()
virtual AddDomainStatus add_domain_participant (DDS::DomainId_t domain, const DDS::DomainParticipantQos &qos)

Static Public Member Functions

static StaticDiscovery_rch instance ()

Public Attributes

EndpointRegistry registry

Private Member Functions

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)

Static Private Attributes

static StaticDiscovery_rch instance_

Detailed Description

Definition at line 239 of file StaticDiscovery.h.


Constructor & Destructor Documentation

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

Definition at line 610 of file StaticDiscovery.cpp.

00611   : PeerDiscovery<StaticParticipant>(key)
00612 {}


Member Function Documentation

AddDomainStatus OpenDDS::DCPS::StaticDiscovery::add_domain_participant ( DDS::DomainId_t  domain,
const DDS::DomainParticipantQos qos 
) [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 680 of file StaticDiscovery.cpp.

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

00682 {
00683   AddDomainStatus ads = {RepoId(), false /*federated*/};
00684 
00685   if (qos.user_data.value.length() != BYTES_IN_PARTICIPANT) {
00686     ACE_ERROR((LM_ERROR,
00687                 ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
00688                 ACE_TEXT("No userdata to identify participant\n")));
00689     return ads;
00690   }
00691 
00692   RepoId id = EndpointRegistry::build_id(domain,
00693                                          qos.user_data.value.get_buffer(),
00694                                          ENTITYID_PARTICIPANT);
00695   if (!get_part(domain, id).is_nil()) {
00696     ACE_ERROR((LM_ERROR,
00697                 ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
00698                 ACE_TEXT("Duplicate participant\n")));
00699     return ads;
00700   }
00701 
00702   const RcHandle<StaticParticipant> participant (make_rch<StaticParticipant>(ref(id), qos, registry));
00703 
00704   {
00705     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, lock_, ads);
00706     participants_[domain][id] = participant;
00707   }
00708 
00709   ads.id = id;
00710   return ads;
00711 }

Here is the call graph for this function:

OpenDDS::DCPS::RepoId OpenDDS::DCPS::StaticDiscovery::generate_participant_guid (  )  [virtual]

Implements OpenDDS::DCPS::Discovery.

Definition at line 674 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::GUID_UNKNOWN.

00675 {
00676   return GUID_UNKNOWN;
00677 }

static StaticDiscovery_rch OpenDDS::DCPS::StaticDiscovery::instance ( void   )  [inline, static]

Definition at line 263 of file StaticDiscovery.h.

Referenced by OpenDDS::DCPS::Service_Participant::load_configuration(), OpenDDS::FaceTSS::config::Parser::parse(), pre_reader(), and pre_writer().

00263 { return instance_; }

Here is the caller graph for this function:

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

Definition at line 793 of file StaticDiscovery.cpp.

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

00794 {
00795   if (parse_topics(cf) ||
00796       parse_datawriterqos(cf) ||
00797       parse_datareaderqos(cf) ||
00798       parse_publisherqos(cf) ||
00799       parse_subscriberqos(cf) ||
00800       parse_endpoints(cf)) {
00801     return -1;
00802   }
00803 
00804   registry.match();
00805 
00806   return 0;
00807 }

Here is the call graph for this function:

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

Definition at line 1087 of file StaticDiscovery.cpp.

References 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, 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, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

01088 {
01089   const ACE_Configuration_Section_Key& root = cf.root_section();
01090   ACE_Configuration_Section_Key section;
01091 
01092   if (cf.open_section(root, DATAREADERQOS_SECTION_NAME, 0, section) != 0) {
01093     if (DCPS_debug_level > 0) {
01094       // This is not an error if the configuration file does not have
01095       // any datareaderqos (sub)section.
01096       ACE_DEBUG((LM_NOTICE,
01097                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
01098                   ACE_TEXT("no [%s] sections.\n"),
01099                   DATAREADERQOS_SECTION_NAME));
01100     }
01101     return 0;
01102   }
01103 
01104   // Ensure there are no key/values in the [datareaderqos] section.
01105   // Every key/value must be in a [datareaderqos/*] sub-section.
01106   ValueMap vm;
01107   if (pullValues(cf, section, vm) > 0) {
01108     ACE_ERROR_RETURN((LM_ERROR,
01109                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01110                       ACE_TEXT("[datareaderqos] sections must have a subsection name\n")),
01111                       -1);
01112   }
01113   // Process the subsections of this section
01114   KeyList keys;
01115   if (processSections(cf, section, keys) != 0) {
01116     ACE_ERROR_RETURN((LM_ERROR,
01117                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01118                       ACE_TEXT("too many nesting layers in the [datareaderqos] section.\n")),
01119                       -1);
01120   }
01121 
01122   // Loop through the [datareaderqos/*] sections
01123   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01124     OPENDDS_STRING datareaderqos_name = it->first;
01125 
01126     if (DCPS_debug_level > 0) {
01127       ACE_DEBUG((LM_NOTICE,
01128                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
01129                   ACE_TEXT("processing [datareaderqos/%C] section.\n"),
01130                   datareaderqos_name.c_str()));
01131     }
01132 
01133     ValueMap values;
01134     pullValues(cf, it->second, values);
01135 
01136     DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
01137 
01138     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01139       OPENDDS_STRING name = it->first;
01140       OPENDDS_STRING value = it->second;
01141 
01142       if (name == "durability.kind") {
01143         if (value == "VOLATILE") {
01144           datareaderqos.durability.kind = DDS::VOLATILE_DURABILITY_QOS;
01145         } else if (value == "TRANSIENT_LOCAL") {
01146           datareaderqos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
01147 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01148         } else if (value == "TRANSIENT") {
01149           datareaderqos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS;
01150         } else if (value == "PERSISTENT") {
01151           datareaderqos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS;
01152 #endif
01153         } else {
01154           ACE_ERROR_RETURN((LM_ERROR,
01155                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01156                             ACE_TEXT("Illegal value for durability.kind (%C) in [datareaderqos/%C] section.\n"),
01157                             value.c_str(), datareaderqos_name.c_str()),
01158                             -1);
01159         }
01160       } else if (name == "deadline.period.sec") {
01161         parse_second(datareaderqos.deadline.period.sec, value);
01162       } else if (name == "deadline.period.nanosec") {
01163         parse_nanosecond(datareaderqos.deadline.period.nanosec, value);
01164       } else if (name == "latency_budget.duration.sec") {
01165         parse_second(datareaderqos.latency_budget.duration.sec, value);
01166       } else if (name == "latency_budget.duration.nanosec") {
01167         parse_nanosecond(datareaderqos.latency_budget.duration.nanosec, value);
01168       } else if (name == "liveliness.kind") {
01169         if (value == "AUTOMATIC") {
01170           datareaderqos.liveliness.kind = DDS::AUTOMATIC_LIVELINESS_QOS;
01171         } else if (value == "MANUAL_BY_TOPIC") {
01172           datareaderqos.liveliness.kind = DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
01173         } else if (value == "MANUAL_BY_PARTICIPANT") {
01174           datareaderqos.liveliness.kind = DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
01175         } else {
01176           ACE_ERROR_RETURN((LM_ERROR,
01177                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01178                             ACE_TEXT("Illegal value for liveliness.kind (%C) in [datareaderqos/%C] section.\n"),
01179                             value.c_str(), datareaderqos_name.c_str()),
01180                             -1);
01181         }
01182       } else if (name == "liveliness.lease_duration.sec") {
01183         parse_second(datareaderqos.liveliness.lease_duration.sec, value);
01184       } else if (name == "liveliness.lease_duration.nanosec") {
01185         parse_nanosecond(datareaderqos.liveliness.lease_duration.nanosec, value);
01186       } else if (name == "reliability.kind") {
01187         if (value == "BEST_EFFORT") {
01188           datareaderqos.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
01189         } else if (value == "RELIABLE") {
01190           datareaderqos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
01191         } else {
01192           ACE_ERROR_RETURN((LM_ERROR,
01193                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01194                             ACE_TEXT("Illegal value for reliability.kind (%C) in [datareaderqos/%C] section.\n"),
01195                             value.c_str(), datareaderqos_name.c_str()),
01196                             -1);
01197         }
01198       } else if (name == "reliability.max_blocking_time.sec") {
01199         parse_second(datareaderqos.reliability.max_blocking_time.sec, value);
01200       } else if (name == "reliability.max_blocking_time.nanosec") {
01201         parse_nanosecond(datareaderqos.reliability.max_blocking_time.nanosec, value);
01202       } else if (name == "destination_order.kind") {
01203         if (value == "BY_RECEPTION_TIMESTAMP") {
01204           datareaderqos.destination_order.kind = DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
01205         } else if (value == "BY_SOURCE_TIMESTAMP") {
01206           datareaderqos.destination_order.kind = DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
01207         } else {
01208           ACE_ERROR_RETURN((LM_ERROR,
01209                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01210                             ACE_TEXT("Illegal value for destination_order.kind (%C) in [datareaderqos/%C] section.\n"),
01211                             value.c_str(), datareaderqos_name.c_str()),
01212                             -1);
01213         }
01214       } else if (name == "history.kind") {
01215         if (value == "KEEP_ALL") {
01216           datareaderqos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
01217         } else if (value == "KEEP_LAST") {
01218           datareaderqos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
01219         } else {
01220           ACE_ERROR_RETURN((LM_ERROR,
01221                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01222                             ACE_TEXT("Illegal value for history.kind (%C) in [datareaderqos/%C] section.\n"),
01223                             value.c_str(), datareaderqos_name.c_str()),
01224                             -1);
01225         }
01226       } else if (name == "history.depth") {
01227         datareaderqos.history.depth = atoi(value.c_str());
01228       } else if (name == "resource_limits.max_samples") {
01229         datareaderqos.resource_limits.max_samples = atoi(value.c_str());
01230       } else if (name == "resource_limits.max_instances") {
01231         datareaderqos.resource_limits.max_instances = atoi(value.c_str());
01232       } else if (name == "resource_limits.max_samples_per_instance") {
01233         datareaderqos.resource_limits.max_samples_per_instance = atoi(value.c_str());
01234       } else if (name == "time_based_filter.minimum_separation.sec") {
01235         parse_second(datareaderqos.time_based_filter.minimum_separation.sec, value);
01236       } else if (name == "time_based_filter.minimum_separation.nanosec") {
01237         parse_nanosecond(datareaderqos.time_based_filter.minimum_separation.nanosec, value);
01238       } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.sec") {
01239         parse_second(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.sec, value);
01240       } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec") {
01241         parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec, value);
01242       } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.sec") {
01243         parse_second(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.sec, value);
01244       } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec") {
01245         parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec, value);
01246       } else {
01247         ACE_ERROR_RETURN((LM_ERROR,
01248                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01249                           ACE_TEXT("Unexpected entry (%C) in [datareaderqos/%C] section.\n"),
01250                           name.c_str(), datareaderqos_name.c_str()),
01251                           -1);
01252       }
01253     }
01254 
01255     registry.datareaderqos_map[datareaderqos_name] = datareaderqos;
01256   }
01257 
01258   return 0;
01259 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 904 of file StaticDiscovery.cpp.

References 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, 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, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

00905 {
00906   const ACE_Configuration_Section_Key& root = cf.root_section();
00907   ACE_Configuration_Section_Key section;
00908 
00909   if (cf.open_section(root, DATAWRITERQOS_SECTION_NAME, 0, section) != 0) {
00910     if (DCPS_debug_level > 0) {
00911       // This is not an error if the configuration file does not have
00912       // any datawriterqos (sub)section.
00913       ACE_DEBUG((LM_NOTICE,
00914                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datawriterqos ")
00915                   ACE_TEXT("no [%s] sections.\n"),
00916                   DATAWRITERQOS_SECTION_NAME));
00917     }
00918     return 0;
00919   }
00920 
00921   // Ensure there are no key/values in the [datawriterqos] section.
00922   // Every key/value must be in a [datawriterqos/*] sub-section.
00923   ValueMap vm;
00924   if (pullValues(cf, section, vm) > 0) {
00925     ACE_ERROR_RETURN((LM_ERROR,
00926                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
00927                       ACE_TEXT("[datawriterqos] sections must have a subsection name\n")),
00928                       -1);
00929   }
00930   // Process the subsections of this section
00931   KeyList keys;
00932   if (processSections(cf, section, keys) != 0) {
00933     ACE_ERROR_RETURN((LM_ERROR,
00934                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
00935                       ACE_TEXT("too many nesting layers in the [datawriterqos] section.\n")),
00936                       -1);
00937   }
00938 
00939   // Loop through the [datawriterqos/*] sections
00940   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
00941     OPENDDS_STRING datawriterqos_name = it->first;
00942 
00943     if (DCPS_debug_level > 0) {
00944       ACE_DEBUG((LM_NOTICE,
00945                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datawriterqos ")
00946                   ACE_TEXT("processing [datawriterqos/%C] section.\n"),
00947                   datawriterqos_name.c_str()));
00948     }
00949 
00950     ValueMap values;
00951     pullValues(cf, it->second, values);
00952 
00953     DDS::DataWriterQos datawriterqos(TheServiceParticipant->initial_DataWriterQos());
00954 
00955     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
00956       OPENDDS_STRING name = it->first;
00957       OPENDDS_STRING value = it->second;
00958 
00959       if (name == "durability.kind") {
00960         if (value == "VOLATILE") {
00961           datawriterqos.durability.kind = DDS::VOLATILE_DURABILITY_QOS;
00962         } else if (value == "TRANSIENT_LOCAL") {
00963           datawriterqos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
00964 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
00965         } else if (value == "TRANSIENT") {
00966           datawriterqos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS;
00967         } else if (value == "PERSISTENT") {
00968           datawriterqos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS;
00969 #endif
00970         } else {
00971           ACE_ERROR_RETURN((LM_ERROR,
00972                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
00973                             ACE_TEXT("Illegal value for durability.kind (%C) in [datawriterqos/%C] section.\n"),
00974                             value.c_str(), datawriterqos_name.c_str()),
00975                             -1);
00976         }
00977       } else if (name == "deadline.period.sec") {
00978         parse_second(datawriterqos.deadline.period.sec, value);
00979       } else if (name == "deadline.period.nanosec") {
00980         parse_nanosecond(datawriterqos.deadline.period.nanosec, value);
00981       } else if (name == "latency_budget.duration.sec") {
00982         parse_second(datawriterqos.latency_budget.duration.sec, value);
00983       } else if (name == "latency_budget.duration.nanosec") {
00984         parse_nanosecond(datawriterqos.latency_budget.duration.nanosec, value);
00985       } else if (name == "liveliness.kind") {
00986         if (value == "AUTOMATIC") {
00987           datawriterqos.liveliness.kind = DDS::AUTOMATIC_LIVELINESS_QOS;
00988         } else if (value == "MANUAL_BY_TOPIC") {
00989           datawriterqos.liveliness.kind = DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
00990         } else if (value == "MANUAL_BY_PARTICIPANT") {
00991           datawriterqos.liveliness.kind = DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
00992         } else {
00993           ACE_ERROR_RETURN((LM_ERROR,
00994                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
00995                             ACE_TEXT("Illegal value for liveliness.kind (%C) in [datawriterqos/%C] section.\n"),
00996                             value.c_str(), datawriterqos_name.c_str()),
00997                             -1);
00998         }
00999       } else if (name == "liveliness.lease_duration.sec") {
01000         parse_second(datawriterqos.liveliness.lease_duration.sec, value);
01001       } else if (name == "liveliness.lease_duration.nanosec") {
01002         parse_nanosecond(datawriterqos.liveliness.lease_duration.nanosec, value);
01003       } else if (name == "reliability.kind") {
01004         if (value == "BEST_EFFORT") {
01005           datawriterqos.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
01006         } else if (value == "RELIABLE") {
01007           datawriterqos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
01008         } else {
01009           ACE_ERROR_RETURN((LM_ERROR,
01010                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
01011                             ACE_TEXT("Illegal value for reliability.kind (%C) in [datawriterqos/%C] section.\n"),
01012                             value.c_str(), datawriterqos_name.c_str()),
01013                             -1);
01014         }
01015       } else if (name == "reliability.max_blocking_time.sec") {
01016         parse_second(datawriterqos.reliability.max_blocking_time.sec, value);
01017       } else if (name == "reliability.max_blocking_time.nanosec") {
01018         parse_nanosecond(datawriterqos.reliability.max_blocking_time.nanosec, value);
01019       } else if (name == "destination_order.kind") {
01020         if (value == "BY_RECEPTION_TIMESTAMP") {
01021           datawriterqos.destination_order.kind = DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
01022         } else if (value == "BY_SOURCE_TIMESTAMP") {
01023           datawriterqos.destination_order.kind = DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
01024         } else {
01025           ACE_ERROR_RETURN((LM_ERROR,
01026                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
01027                             ACE_TEXT("Illegal value for destination_order.kind (%C) in [datawriterqos/%C] section.\n"),
01028                             value.c_str(), datawriterqos_name.c_str()),
01029                             -1);
01030         }
01031       } else if (name == "history.kind") {
01032         if (value == "KEEP_ALL") {
01033           datawriterqos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
01034         } else if (value == "KEEP_LAST") {
01035           datawriterqos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
01036         } else {
01037           ACE_ERROR_RETURN((LM_ERROR,
01038                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
01039                             ACE_TEXT("Illegal value for history.kind (%C) in [datawriterqos/%C] section.\n"),
01040                             value.c_str(), datawriterqos_name.c_str()),
01041                             -1);
01042         }
01043       } else if (name == "history.depth") {
01044         datawriterqos.history.depth = atoi(value.c_str());
01045       } else if (name == "resource_limits.max_samples") {
01046         datawriterqos.resource_limits.max_samples = atoi(value.c_str());
01047       } else if (name == "resource_limits.max_instances") {
01048         datawriterqos.resource_limits.max_instances = atoi(value.c_str());
01049       } else if (name == "resource_limits.max_samples_per_instance") {
01050         datawriterqos.resource_limits.max_samples_per_instance = atoi(value.c_str());
01051       } else if (name == "transport_priority.value") {
01052         datawriterqos.transport_priority.value = atoi(value.c_str());
01053       } else if (name == "lifespan.duration.sec") {
01054         parse_second(datawriterqos.lifespan.duration.sec, value);
01055       } else if (name == "lifespan.duration.nanosec") {
01056         parse_nanosecond(datawriterqos.lifespan.duration.nanosec, value);
01057       } else if (name == "ownership.kind") {
01058         if (value == "SHARED") {
01059           datawriterqos.ownership.kind = DDS::SHARED_OWNERSHIP_QOS;
01060         } else if (value == "EXCLUSIVE") {
01061           datawriterqos.ownership.kind = DDS::EXCLUSIVE_OWNERSHIP_QOS;
01062         } else {
01063           ACE_ERROR_RETURN((LM_ERROR,
01064                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
01065                             ACE_TEXT("Illegal value for ownership.kind (%C) in [datawriterqos/%C] section.\n"),
01066                             value.c_str(), datawriterqos_name.c_str()),
01067                             -1);
01068         }
01069       } else if (name == "ownership_strength.value") {
01070         datawriterqos.ownership_strength.value = atoi(value.c_str());
01071       } else {
01072         ACE_ERROR_RETURN((LM_ERROR,
01073                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_datawriterqos ")
01074                           ACE_TEXT("Unexpected entry (%C) in [datawriterqos/%C] section.\n"),
01075                           name.c_str(), datawriterqos_name.c_str()),
01076                           -1);
01077       }
01078     }
01079 
01080     registry.datawriterqos_map[datawriterqos_name] = datawriterqos;
01081   }
01082 
01083   return 0;
01084 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1493 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), OpenDDS::DCPS::EndpointRegistry::build_id(), ACE_String_Base< ACE_CHAR_T >::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, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::pullValues(), OpenDDS::DCPS::EndpointRegistry::reader_map, registry, ACE_Configuration::root_section(), OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, TheServiceParticipant, TheTransportRegistry, OpenDDS::DCPS::EndpointRegistry::topic_map, and OpenDDS::DCPS::EndpointRegistry::writer_map.

Referenced by load_configuration().

01494 {
01495   const ACE_Configuration_Section_Key& root = cf.root_section();
01496   ACE_Configuration_Section_Key section;
01497 
01498   if (cf.open_section(root, ENDPOINT_SECTION_NAME, 0, section) != 0) {
01499     if (DCPS_debug_level > 0) {
01500       // This is not an error if the configuration file does not have
01501       // any endpoint (sub)section.
01502       ACE_DEBUG((LM_NOTICE,
01503                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
01504                   ACE_TEXT("no [%s] sections.\n"),
01505                   ENDPOINT_SECTION_NAME));
01506     }
01507     return 0;
01508   }
01509 
01510   // Ensure there are no key/values in the [endpoint] section.
01511   // Every key/value must be in a [endpoint/*] sub-section.
01512   ValueMap vm;
01513   if (pullValues(cf, section, vm) > 0) {
01514     ACE_ERROR_RETURN((LM_ERROR,
01515                       ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01516                       ACE_TEXT("[endpoint] sections must have a subsection name\n")),
01517                       -1);
01518   }
01519   // Process the subsections of this section
01520   KeyList keys;
01521   if (processSections(cf, section, keys) != 0) {
01522     ACE_ERROR_RETURN((LM_ERROR,
01523                       ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01524                       ACE_TEXT("too many nesting layers in the [endpoint] section.\n")),
01525                       -1);
01526   }
01527 
01528   // Loop through the [endpoint/*] sections
01529   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01530     OPENDDS_STRING endpoint_name = it->first;
01531 
01532     if (DCPS_debug_level > 0) {
01533       ACE_DEBUG((LM_NOTICE,
01534                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
01535                   ACE_TEXT("processing [endpoint/%C] section.\n"),
01536                   endpoint_name.c_str()));
01537     }
01538 
01539     ValueMap values;
01540     pullValues(cf, it->second, values);
01541     int domain = 0;
01542     unsigned char participant[6];
01543     unsigned char entity[3];
01544     enum Type {
01545       Reader,
01546       Writer
01547     };
01548     Type type = Reader; // avoid warning
01549     OPENDDS_STRING topic_name;
01550     DDS::DataWriterQos datawriterqos(TheServiceParticipant->initial_DataWriterQos());
01551     DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
01552     DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
01553     DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
01554     TransportLocatorSeq trans_info;
01555     OPENDDS_STRING config_name;
01556 
01557     bool domain_specified = false,
01558       participant_specified = false,
01559       entity_specified = false,
01560       type_specified = false,
01561       topic_name_specified = false,
01562       config_name_specified = false;
01563 
01564     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01565       OPENDDS_STRING name = it->first;
01566       OPENDDS_STRING value = it->second;
01567 
01568       if (name == "domain") {
01569         if (convertToInteger(value, domain)) {
01570           domain_specified = true;
01571         } else {
01572           ACE_ERROR_RETURN((LM_ERROR,
01573                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01574                             ACE_TEXT("Illegal integer value for domain (%C) in [endpoint/%C] section.\n"),
01575                             value.c_str(), endpoint_name.c_str()),
01576                             -1);
01577         }
01578       } else if (name == "participant") {
01579 #ifdef __SUNPRO_CC
01580         int count = 0; std::count_if(value.begin(), value.end(), isxdigit, count);
01581 #else
01582         int count = std::count_if(value.begin(), value.end(), isxdigit);
01583 #endif
01584         if (value.size() != HEX_DIGITS_IN_PARTICIPANT || static_cast<size_t>(count) != HEX_DIGITS_IN_PARTICIPANT) {
01585           ACE_ERROR_RETURN((LM_ERROR,
01586                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01587                             ACE_TEXT("participant (%C) must be 12 hexadecimal digits in [endpoint/%C] section.\n"),
01588                             value.c_str(), endpoint_name.c_str()),
01589                             -1);
01590         }
01591 
01592         for (size_t idx = 0; idx != BYTES_IN_PARTICIPANT; ++idx) {
01593           participant[idx] = fromhex(value, idx);
01594         }
01595         participant_specified = true;
01596       } else if (name == "entity") {
01597 #ifdef __SUNPRO_CC
01598         int count = 0; std::count_if(value.begin(), value.end(), isxdigit, count);
01599 #else
01600         int count = std::count_if(value.begin(), value.end(), isxdigit);
01601 #endif
01602         if (value.size() != HEX_DIGITS_IN_ENTITY || static_cast<size_t>(count) != HEX_DIGITS_IN_ENTITY) {
01603           ACE_ERROR_RETURN((LM_ERROR,
01604                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01605                             ACE_TEXT("entity (%C) must be 6 hexadecimal digits in [endpoint/%C] section.\n"),
01606                             value.c_str(), endpoint_name.c_str()),
01607                             -1);
01608         }
01609 
01610         for (size_t idx = 0; idx != BYTES_IN_ENTITY; ++idx) {
01611           entity[idx] = fromhex(value, idx);
01612         }
01613         entity_specified = true;
01614       } else if (name == "type") {
01615         if (value == "reader") {
01616           type = Reader;
01617           type_specified = true;
01618         } else if (value == "writer") {
01619           type = Writer;
01620           type_specified = true;
01621         } else {
01622           ACE_ERROR_RETURN((LM_ERROR,
01623                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01624                             ACE_TEXT("Illegal string value for type (%C) in [endpoint/%C] section.\n"),
01625                             value.c_str(), endpoint_name.c_str()),
01626                             -1);
01627         }
01628       } else if (name == "topic") {
01629         EndpointRegistry::TopicMapType::const_iterator pos = this->registry.topic_map.find(value);
01630         if (pos != this->registry.topic_map.end()) {
01631           topic_name = pos->second.name;
01632           topic_name_specified = true;
01633         } else {
01634           ACE_ERROR_RETURN((LM_ERROR,
01635                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01636                             ACE_TEXT("Illegal topic reference (%C) in [endpoint/%C] section.\n"),
01637                             value.c_str(), endpoint_name.c_str()),
01638                             -1);
01639         }
01640       } else if (name == "datawriterqos") {
01641         EndpointRegistry::DataWriterQosMapType::const_iterator pos = this->registry.datawriterqos_map.find(value);
01642         if (pos != this->registry.datawriterqos_map.end()) {
01643           datawriterqos = pos->second;
01644         } else {
01645           ACE_ERROR_RETURN((LM_ERROR,
01646                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01647                             ACE_TEXT("Illegal datawriterqos reference (%C) in [endpoint/%C] section.\n"),
01648                             value.c_str(), endpoint_name.c_str()),
01649                             -1);
01650         }
01651       } else if (name == "publisherqos") {
01652         EndpointRegistry::PublisherQosMapType::const_iterator pos = this->registry.publisherqos_map.find(value);
01653         if (pos != this->registry.publisherqos_map.end()) {
01654           publisherqos = pos->second;
01655         } else {
01656           ACE_ERROR_RETURN((LM_ERROR,
01657                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01658                             ACE_TEXT("Illegal publisherqos reference (%C) in [endpoint/%C] section.\n"),
01659                             value.c_str(), endpoint_name.c_str()),
01660                             -1);
01661         }
01662       } else if (name == "datareaderqos") {
01663         EndpointRegistry::DataReaderQosMapType::const_iterator pos = this->registry.datareaderqos_map.find(value);
01664         if (pos != this->registry.datareaderqos_map.end()) {
01665           datareaderqos = pos->second;
01666         } else {
01667           ACE_ERROR_RETURN((LM_ERROR,
01668                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01669                             ACE_TEXT("Illegal datareaderqos reference (%C) in [endpoint/%C] section.\n"),
01670                             value.c_str(), endpoint_name.c_str()),
01671                             -1);
01672         }
01673       } else if (name == "subscriberqos") {
01674         EndpointRegistry::SubscriberQosMapType::const_iterator pos = this->registry.subscriberqos_map.find(value);
01675         if (pos != this->registry.subscriberqos_map.end()) {
01676           subscriberqos = pos->second;
01677         } else {
01678           ACE_ERROR_RETURN((LM_ERROR,
01679                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01680                             ACE_TEXT("Illegal subscriberqos reference (%C) in [endpoint/%C] section.\n"),
01681                             value.c_str(), endpoint_name.c_str()),
01682                             -1);
01683         }
01684       } else if (name == "config") {
01685         config_name = value;
01686         config_name_specified = true;
01687       } else {
01688         ACE_ERROR_RETURN((LM_ERROR,
01689                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01690                           ACE_TEXT("Unexpected entry (%C) in [endpoint/%C] section.\n"),
01691                           name.c_str(), endpoint_name.c_str()),
01692                           -1);
01693       }
01694     }
01695 
01696     if (!domain_specified) {
01697       ACE_ERROR_RETURN((LM_ERROR,
01698                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01699                         ACE_TEXT("No domain specified for [endpoint/%C] section.\n"),
01700                         endpoint_name.c_str()),
01701                         -1);
01702     }
01703 
01704     if (!participant_specified) {
01705       ACE_ERROR_RETURN((LM_ERROR,
01706                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01707                         ACE_TEXT("No participant specified for [endpoint/%C] section.\n"),
01708                         endpoint_name.c_str()),
01709                         -1);
01710     }
01711 
01712     if (!entity_specified) {
01713       ACE_ERROR_RETURN((LM_ERROR,
01714                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01715                         ACE_TEXT("No entity specified for [endpoint/%C] section.\n"),
01716                         endpoint_name.c_str()),
01717                         -1);
01718     }
01719 
01720     if (!type_specified) {
01721       ACE_ERROR_RETURN((LM_ERROR,
01722                         ACE_TEXT("(%P|%t) ERROR:StaticDiscovery::parse_endpoints ")
01723                         ACE_TEXT("No type specified for [endpoint/%C] section.\n"),
01724                         endpoint_name.c_str()),
01725                         -1);
01726     }
01727 
01728     if (!topic_name_specified) {
01729       ACE_ERROR_RETURN((LM_ERROR,
01730                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01731                         ACE_TEXT("No topic specified for [endpoint/%C] section.\n"),
01732                         endpoint_name.c_str()),
01733                         -1);
01734     }
01735 
01736     TransportConfig_rch config;
01737 
01738     if (config_name_specified) {
01739       config = TheTransportRegistry->get_config(config_name);
01740       if (config.is_nil()) {
01741         ACE_ERROR_RETURN((LM_ERROR,
01742                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01743                           ACE_TEXT("Illegal config reference (%C) in [endpoint/%C] section.\n"),
01744                           config_name.c_str(), endpoint_name.c_str()),
01745                           -1);
01746       }
01747     }
01748 
01749     if (config.is_nil() && domain_specified) {
01750       config = TheTransportRegistry->domain_default_config(domain);
01751     }
01752 
01753     if (config.is_nil()) {
01754       config = TheTransportRegistry->global_config();
01755     }
01756 
01757     try {
01758       config->populate_locators(trans_info);
01759     }
01760     catch (const CORBA::Exception& ex) {
01761       ACE_ERROR_RETURN((LM_ERROR,
01762                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01763                         ACE_TEXT("Exception caught while populating locators for [endpoint/%C] section. %C\n"),
01764                         endpoint_name.c_str(), ex._info().c_str()),
01765                         -1);
01766     }
01767     if (trans_info.length() == 0) {
01768         ACE_ERROR_RETURN((LM_ERROR,
01769                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01770                           ACE_TEXT("No locators for [endpoint/%C] section.\n"),
01771                           endpoint_name.c_str()),
01772                           -1);
01773     }
01774 
01775     EntityId_t entity_id = EndpointRegistry::build_id(entity,
01776       (type == Reader) ? ENTITYKIND_USER_READER_WITH_KEY : ENTITYKIND_USER_WRITER_WITH_KEY);
01777 
01778     RepoId id = EndpointRegistry::build_id(domain, participant, entity_id);
01779 
01780     if (DCPS_debug_level > 0) {
01781       ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) DEBUG: StaticDiscovery::parse_endpoints adding entity with id %C\n"), LogGuid(id).c_str()));
01782     }
01783 
01784     switch (type) {
01785     case Reader:
01786       // Populate the userdata.
01787       datareaderqos.user_data.value.length(3);
01788       datareaderqos.user_data.value[0] = entity_id.entityKey[0];
01789       datareaderqos.user_data.value[1] = entity_id.entityKey[1];
01790       datareaderqos.user_data.value[2] = entity_id.entityKey[2];
01791 
01792       if (!registry.reader_map.insert(std::make_pair(id,
01793             EndpointRegistry::Reader(topic_name, datareaderqos, subscriberqos, config_name, trans_info))).second) {
01794         ACE_ERROR_RETURN((LM_ERROR,
01795                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01796                           ACE_TEXT("Section [endpoint/%C] ignored - duplicate reader.\n"),
01797                           endpoint_name.c_str()),
01798                           -1);
01799       }
01800       break;
01801     case Writer:
01802       // Populate the userdata.
01803       datawriterqos.user_data.value.length(3);
01804       datawriterqos.user_data.value[0] = entity_id.entityKey[0];
01805       datawriterqos.user_data.value[1] = entity_id.entityKey[1];
01806       datawriterqos.user_data.value[2] = entity_id.entityKey[2];
01807 
01808       if (!registry.writer_map.insert(std::make_pair(id,
01809             EndpointRegistry::Writer(topic_name, datawriterqos, publisherqos, config_name, trans_info))).second) {
01810         ACE_ERROR_RETURN((LM_ERROR,
01811                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01812                           ACE_TEXT("Section [endpoint/%C] ignored - duplicate writer.\n"),
01813                           endpoint_name.c_str()),
01814                           -1);
01815       }
01816       break;
01817     }
01818   }
01819 
01820   return 0;
01821 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1262 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, LM_ERROR, LM_NOTICE, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::pullValues(), registry, ACE_Configuration::root_section(), TheServiceParticipant, and DDS::TOPIC_PRESENTATION_QOS.

Referenced by load_configuration().

01263 {
01264   const ACE_Configuration_Section_Key& root = cf.root_section();
01265   ACE_Configuration_Section_Key section;
01266 
01267   if (cf.open_section(root, PUBLISHERQOS_SECTION_NAME, 0, section) != 0) {
01268     if (DCPS_debug_level > 0) {
01269       // This is not an error if the configuration file does not have
01270       // any publisherqos (sub)section.
01271       ACE_DEBUG((LM_NOTICE,
01272                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
01273                   ACE_TEXT("no [%s] sections.\n"),
01274                   PUBLISHERQOS_SECTION_NAME));
01275     }
01276     return 0;
01277   }
01278 
01279   // Ensure there are no key/values in the [publisherqos] section.
01280   // Every key/value must be in a [publisherqos/*] sub-section.
01281   ValueMap vm;
01282   if (pullValues(cf, section, vm) > 0) {
01283     ACE_ERROR_RETURN((LM_ERROR,
01284                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01285                       ACE_TEXT("[publisherqos] sections must have a subsection name\n")),
01286                       -1);
01287   }
01288   // Process the subsections of this section
01289   KeyList keys;
01290   if (processSections(cf, section, keys) != 0) {
01291     ACE_ERROR_RETURN((LM_ERROR,
01292                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01293                       ACE_TEXT("too many nesting layers in the [publisherqos] section.\n")),
01294                       -1);
01295   }
01296 
01297   // Loop through the [publisherqos/*] sections
01298   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01299     OPENDDS_STRING publisherqos_name = it->first;
01300 
01301     if (DCPS_debug_level > 0) {
01302       ACE_DEBUG((LM_NOTICE,
01303                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
01304                   ACE_TEXT("processing [publisherqos/%C] section.\n"),
01305                   publisherqos_name.c_str()));
01306     }
01307 
01308     ValueMap values;
01309     pullValues(cf, it->second, values);
01310 
01311     DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
01312 
01313     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01314       OPENDDS_STRING name = it->first;
01315       OPENDDS_STRING value = it->second;
01316 
01317       if (name == "presentation.access_scope") {
01318         if (value == "INSTANCE") {
01319           publisherqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
01320         } else if (value == "TOPIC") {
01321           publisherqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
01322         } else if (value == "GROUP") {
01323           publisherqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
01324         } else {
01325           ACE_ERROR_RETURN((LM_ERROR,
01326                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01327                             ACE_TEXT("Illegal value for presentation.access_scope (%C) in [publisherqos/%C] section.\n"),
01328                             value.c_str(), publisherqos_name.c_str()),
01329                             -1);
01330         }
01331       } else if (name == "presentation.coherent_access") {
01332         if (parse_bool(publisherqos.presentation.coherent_access, value)) {
01333         } else {
01334           ACE_ERROR_RETURN((LM_ERROR,
01335                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01336                             ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [publisherqos/%C] section.\n"),
01337                             value.c_str(), publisherqos_name.c_str()),
01338                             -1);
01339         }
01340       } else if (name == "presentation.ordered_access") {
01341         if (parse_bool(publisherqos.presentation.ordered_access, value)) {
01342         } else {
01343           ACE_ERROR_RETURN((LM_ERROR,
01344                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01345                             ACE_TEXT("Illegal value for presentation.ordered_access (%C)")
01346                             ACE_TEXT("in [publisherqos/%C] section.\n"),
01347                             value.c_str(), publisherqos_name.c_str()),
01348                             -1);
01349         }
01350       } else if (name == "partition.name") {
01351         try {
01352           parse_list(publisherqos.partition, value);
01353         }
01354         catch (const CORBA::Exception& ex) {
01355           ACE_ERROR_RETURN((LM_ERROR,
01356             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01357             ACE_TEXT("Exception caught while parsing partition.name (%C) ")
01358             ACE_TEXT("in [publisherqos/%C] section: %C.\n"),
01359             value.c_str(), publisherqos_name.c_str(), ex._info().c_str()),
01360             -1);
01361         }
01362       } else {
01363         ACE_ERROR_RETURN((LM_ERROR,
01364                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01365                           ACE_TEXT("Unexpected entry (%C) in [publisherqos/%C] section.\n"),
01366                           name.c_str(), publisherqos_name.c_str()),
01367                           -1);
01368       }
01369     }
01370 
01371     registry.publisherqos_map[publisherqos_name] = publisherqos;
01372   }
01373 
01374   return 0;
01375 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1378 of file StaticDiscovery.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, LM_ERROR, LM_NOTICE, ACE_Configuration_Heap::open_section(), OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, ACE_Configuration::root_section(), OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, TheServiceParticipant, and DDS::TOPIC_PRESENTATION_QOS.

Referenced by load_configuration().

01379 {
01380   const ACE_Configuration_Section_Key& root = cf.root_section();
01381   ACE_Configuration_Section_Key section;
01382 
01383   if (cf.open_section(root, SUBSCRIBERQOS_SECTION_NAME, 0, section) != 0) {
01384     if (DCPS_debug_level > 0) {
01385       // This is not an error if the configuration file does not have
01386       // any subscriberqos (sub)section.
01387       ACE_DEBUG((LM_NOTICE,
01388                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
01389                   ACE_TEXT("no [%s] sections.\n"),
01390                   SUBSCRIBERQOS_SECTION_NAME));
01391     }
01392     return 0;
01393   }
01394 
01395   // Ensure there are no key/values in the [subscriberqos] section.
01396   // Every key/value must be in a [subscriberqos/*] sub-section.
01397   ValueMap vm;
01398   if (pullValues(cf, section, vm) > 0) {
01399     ACE_ERROR_RETURN((LM_ERROR,
01400                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01401                       ACE_TEXT("[subscriberqos] sections must have a subsection name\n")),
01402                       -1);
01403   }
01404   // Process the subsections of this section
01405   KeyList keys;
01406   if (processSections(cf, section, keys) != 0) {
01407     ACE_ERROR_RETURN((LM_ERROR,
01408                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01409                       ACE_TEXT("too many nesting layers in the [subscriberqos] section.\n")),
01410                       -1);
01411   }
01412 
01413   // Loop through the [subscriberqos/*] sections
01414   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01415     OPENDDS_STRING subscriberqos_name = it->first;
01416 
01417     if (DCPS_debug_level > 0) {
01418       ACE_DEBUG((LM_NOTICE,
01419                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
01420                   ACE_TEXT("processing [subscriberqos/%C] section.\n"),
01421                   subscriberqos_name.c_str()));
01422     }
01423 
01424     ValueMap values;
01425     pullValues(cf, it->second, values);
01426 
01427     DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
01428 
01429     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01430       OPENDDS_STRING name = it->first;
01431       OPENDDS_STRING value = it->second;
01432 
01433       if (name == "presentation.access_scope") {
01434         if (value == "INSTANCE") {
01435           subscriberqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
01436         } else if (value == "TOPIC") {
01437           subscriberqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
01438         } else if (value == "GROUP") {
01439           subscriberqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
01440         } else {
01441           ACE_ERROR_RETURN((LM_ERROR,
01442                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01443                             ACE_TEXT("Illegal value for presentation.access_scope (%C) in [subscriberqos/%C] section.\n"),
01444                             value.c_str(), subscriberqos_name.c_str()),
01445                             -1);
01446         }
01447       } else if (name == "presentation.coherent_access") {
01448         if (parse_bool(subscriberqos.presentation.coherent_access, value)) {
01449         } else {
01450           ACE_ERROR_RETURN((LM_ERROR,
01451                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01452                             ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [subscriberqos/%C] section.\n"),
01453                             value.c_str(), subscriberqos_name.c_str()),
01454                             -1);
01455         }
01456       } else if (name == "presentation.ordered_access") {
01457         if (parse_bool(subscriberqos.presentation.ordered_access, value)) {
01458         } else {
01459           ACE_ERROR_RETURN((LM_ERROR,
01460                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01461                             ACE_TEXT("Illegal value for presentation.ordered_access (%C) in [subscriberqos/%C] section.\n"),
01462                             value.c_str(), subscriberqos_name.c_str()),
01463                             -1);
01464         }
01465       } else if (name == "partition.name") {
01466         try {
01467           parse_list(subscriberqos.partition, value);
01468         }
01469         catch (const CORBA::Exception& ex) {
01470           ACE_ERROR_RETURN((LM_ERROR,
01471             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01472             ACE_TEXT("Exception caught while parsing partition.name (%C) ")
01473             ACE_TEXT("in [subscriberqos/%C] section: %C.\n"),
01474             value.c_str(), subscriberqos_name.c_str(), ex._info().c_str()),
01475             -1);
01476         }
01477       } else {
01478         ACE_ERROR_RETURN((LM_ERROR,
01479                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01480                           ACE_TEXT("Unexpected entry (%C) in [subscriberqos/%C] section.\n"),
01481                           name.c_str(), subscriberqos_name.c_str()),
01482                           -1);
01483       }
01484     }
01485 
01486    registry.subscriberqos_map[subscriberqos_name] = subscriberqos;
01487   }
01488 
01489   return 0;
01490 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 810 of file StaticDiscovery.cpp.

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

Referenced by load_configuration().

00811 {
00812   const ACE_Configuration_Section_Key& root = cf.root_section();
00813   ACE_Configuration_Section_Key section;
00814 
00815   if (cf.open_section(root, TOPIC_SECTION_NAME, 0, section) != 0) {
00816     if (DCPS_debug_level > 0) {
00817       // This is not an error if the configuration file does not have
00818       // any topic (sub)section.
00819       ACE_DEBUG((LM_NOTICE,
00820                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
00821                   ACE_TEXT("no [%s] sections.\n"),
00822                   TOPIC_SECTION_NAME));
00823     }
00824     return 0;
00825   }
00826 
00827   // Ensure there are no key/values in the [topic] section.
00828   // Every key/value must be in a [topic/*] sub-section.
00829   ValueMap vm;
00830   if (pullValues(cf, section, vm) > 0) {
00831     ACE_ERROR_RETURN((LM_ERROR,
00832                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00833                       ACE_TEXT("[topic] sections must have a subsection name\n")),
00834                       -1);
00835   }
00836   // Process the subsections of this section
00837   KeyList keys;
00838   if (processSections(cf, section, keys) != 0) {
00839     ACE_ERROR_RETURN((LM_ERROR,
00840                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00841                       ACE_TEXT("too many nesting layers in the [topic] section.\n")),
00842                       -1);
00843   }
00844 
00845   // Loop through the [topic/*] sections
00846   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
00847     OPENDDS_STRING topic_name = it->first;
00848 
00849     if (DCPS_debug_level > 0) {
00850       ACE_DEBUG((LM_NOTICE,
00851                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
00852                   ACE_TEXT("processing [topic/%C] section.\n"),
00853                   topic_name.c_str()));
00854     }
00855 
00856     ValueMap values;
00857     pullValues(cf, it->second, values);
00858 
00859     EndpointRegistry::Topic topic;
00860     bool name_specified = false,
00861       type_name_specified = false;
00862 
00863     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
00864       OPENDDS_STRING name = it->first;
00865       OPENDDS_STRING value = it->second;
00866 
00867       if (name == "name") {
00868         topic.name = value;
00869         name_specified = true;
00870       } else if (name == "type_name") {
00871         if (value.size() >= TYPE_NAME_MAX) {
00872           ACE_ERROR_RETURN((LM_ERROR,
00873                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00874                             ACE_TEXT("type_name (%C) must be less than 128 characters in [topic/%C] section.\n"),
00875                             value.c_str(), topic_name.c_str()),
00876                             -1);
00877         }
00878         topic.type_name = value;
00879         type_name_specified = true;
00880       } else {
00881         // Typos are ignored to avoid parsing FACE-specific keys.
00882       }
00883     }
00884 
00885     if (!name_specified) {
00886       topic.name = topic_name;
00887     }
00888 
00889     if (!type_name_specified) {
00890       ACE_ERROR_RETURN((LM_ERROR,
00891                         ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00892                         ACE_TEXT("No type_name specified for [topic/%C] section.\n"),
00893                         topic_name.c_str()),
00894                        -1);
00895     }
00896 
00897     registry.topic_map[topic_name] = topic;
00898   }
00899 
00900   return 0;
00901 }

Here is the call graph for this function:

Here is the caller graph for this function:

void OpenDDS::DCPS::StaticDiscovery::pre_reader ( DataReaderImpl reader  )  [private, virtual]

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 1853 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::EndpointRegistry::build_id(), OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::DataReaderImpl::get_qos(), OpenDDS::DCPS::DataReaderImpl::get_subscriber(), instance(), OpenDDS::DCPS::EndpointRegistry::reader_map, registry, DDS::DataReaderQos::user_data, and DDS::DomainParticipantQos::user_data.

01854 {
01855   const DDS::Subscriber_var sub = reader->get_subscriber();
01856   const DDS::DomainParticipant_var part = sub->get_participant();
01857   const DDS::DomainId_t dom = part->get_domain_id();
01858 
01859   DDS::DomainParticipantQos partQos;
01860   part->get_qos(partQos);
01861   if (partQos.user_data.value.length() < 6)
01862     return;
01863   const unsigned char* const partId = partQos.user_data.value.get_buffer();
01864 
01865   DDS::DataReaderQos qos;
01866   reader->get_qos(qos);
01867   if (qos.user_data.value.length() < 3)
01868     return;
01869   const unsigned char* const drId = qos.user_data.value.get_buffer();
01870 
01871   const EntityId_t entId =
01872     EndpointRegistry::build_id(drId, ENTITYKIND_USER_READER_WITH_KEY);
01873   const RepoId rid = EndpointRegistry::build_id(dom, partId, entId);
01874 
01875   const EndpointRegistry::ReaderMapType::const_iterator iter =
01876     registry.reader_map.find(rid);
01877 
01878   if (iter != registry.reader_map.end() && !iter->second.trans_cfg.empty()) {
01879     TransportRegistry::instance()->bind_config(iter->second.trans_cfg, reader);
01880   }
01881 }

Here is the call graph for this function:

void OpenDDS::DCPS::StaticDiscovery::pre_writer ( DataWriterImpl writer  )  [private, virtual]

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 1823 of file StaticDiscovery.cpp.

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

01824 {
01825   const DDS::Publisher_var pub = writer->get_publisher();
01826   const DDS::DomainParticipant_var part = pub->get_participant();
01827   const DDS::DomainId_t dom = part->get_domain_id();
01828 
01829   DDS::DomainParticipantQos partQos;
01830   part->get_qos(partQos);
01831   if (partQos.user_data.value.length() < 6)
01832     return;
01833   const unsigned char* const partId = partQos.user_data.value.get_buffer();
01834 
01835   DDS::DataWriterQos qos;
01836   writer->get_qos(qos);
01837   if (qos.user_data.value.length() < 3)
01838     return;
01839   const unsigned char* const dwId = qos.user_data.value.get_buffer();
01840 
01841   const EntityId_t entId =
01842     EndpointRegistry::build_id(dwId, ENTITYKIND_USER_WRITER_WITH_KEY);
01843   const RepoId rid = EndpointRegistry::build_id(dom, partId, entId);
01844 
01845   const EndpointRegistry::WriterMapType::const_iterator iter =
01846     registry.writer_map.find(rid);
01847 
01848   if (iter != registry.writer_map.end() && !iter->second.trans_cfg.empty()) {
01849     TransportRegistry::instance()->bind_config(iter->second.trans_cfg, writer);
01850   }
01851 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 276 of file StaticDiscovery.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1