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 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 236 of file StaticDiscovery.h.


Constructor & Destructor Documentation

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

Definition at line 595 of file StaticDiscovery.cpp.

00596   : PeerDiscovery<StaticParticipant>(key)
00597 {}


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 659 of file StaticDiscovery.cpp.

References OpenDDS::FaceTSS::config::build_id(), OpenDDS::DCPS::ENTITYID_PARTICIPANT, OpenDDS::DCPS::PeerDiscovery< Participant >::get_part(), OpenDDS::DCPS::AddDomainStatus::id, OpenDDS::DCPS::PeerDiscovery< Participant >::lock_, OpenDDS::DCPS::PeerDiscovery< Participant >::participants_, registry, and DDS::DomainParticipantQos::user_data.

00661 {
00662   AddDomainStatus ads = {RepoId(), false /*federated*/};
00663 
00664   if (qos.user_data.value.length() != 6) {
00665     ACE_DEBUG((LM_ERROR,
00666                 ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
00667                 ACE_TEXT("No userdata to identify participant\n")));
00668     return ads;
00669   }
00670 
00671   RepoId id = EndpointRegistry::build_id(domain,
00672                                          qos.user_data.value.get_buffer(),
00673                                          ENTITYID_PARTICIPANT);
00674   if (!get_part(domain, id).is_nil()) {
00675     ACE_DEBUG((LM_ERROR,
00676                 ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::add_domain_participant ")
00677                 ACE_TEXT("Duplicate participant\n")));
00678     return ads;
00679   }
00680 
00681   const RcHandle<StaticParticipant> participant = new StaticParticipant(id, qos, registry);
00682 
00683   {
00684     ACE_GUARD_RETURN(ACE_Thread_Mutex, g, lock_, ads);
00685     participants_[domain][id] = participant;
00686   }
00687 
00688   ads.id = id;
00689   return ads;
00690 }

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

Definition at line 248 of file StaticDiscovery.h.

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

00248 { return instance_; }

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

Definition at line 754 of file StaticDiscovery.cpp.

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

00755 {
00756   if (parse_topics(cf) ||
00757       parse_datawriterqos(cf) ||
00758       parse_datareaderqos(cf) ||
00759       parse_publisherqos(cf) ||
00760       parse_subscriberqos(cf) ||
00761       parse_endpoints(cf)) {
00762     return -1;
00763   }
00764 
00765   registry.match();
00766 
00767   return 0;
00768 }

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

Definition at line 1048 of file StaticDiscovery.cpp.

References 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::DATAREADERQOS_SECTION_NAME, OpenDDS::DCPS::DCPS_debug_level, DDS::KEEP_ALL_HISTORY_QOS, DDS::KEEP_LAST_HISTORY_QOS, DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS, OPENDDS_STRING, OpenDDS::DCPS::parse_nanosecond(), OpenDDS::DCPS::parse_second(), DDS::PERSISTENT_DURABILITY_QOS, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, DDS::RELIABLE_RELIABILITY_QOS, TheServiceParticipant, DDS::TRANSIENT_DURABILITY_QOS, DDS::TRANSIENT_LOCAL_DURABILITY_QOS, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

01049 {
01050   const ACE_Configuration_Section_Key& root = cf.root_section();
01051   ACE_Configuration_Section_Key section;
01052 
01053   if (cf.open_section(root, DATAREADERQOS_SECTION_NAME, 0, section) != 0) {
01054     if (DCPS_debug_level > 0) {
01055       // This is not an error if the configuration file does not have
01056       // any datareaderqos (sub)section.
01057       ACE_DEBUG((LM_NOTICE,
01058                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
01059                   ACE_TEXT("no [%s] sections.\n"),
01060                   DATAREADERQOS_SECTION_NAME));
01061     }
01062     return 0;
01063   }
01064 
01065   // Ensure there are no key/values in the [datareaderqos] section.
01066   // Every key/value must be in a [datareaderqos/*] sub-section.
01067   ValueMap vm;
01068   if (pullValues(cf, section, vm) > 0) {
01069     ACE_ERROR_RETURN((LM_ERROR,
01070                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01071                       ACE_TEXT("[datareaderqos] sections must have a subsection name\n")),
01072                       -1);
01073   }
01074   // Process the subsections of this section
01075   KeyList keys;
01076   if (processSections(cf, section, keys) != 0) {
01077     ACE_ERROR_RETURN((LM_ERROR,
01078                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01079                       ACE_TEXT("too many nesting layers in the [datareaderqos] section.\n")),
01080                       -1);
01081   }
01082 
01083   // Loop through the [datareaderqos/*] sections
01084   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01085     OPENDDS_STRING datareaderqos_name = it->first;
01086 
01087     if (DCPS_debug_level > 0) {
01088       ACE_DEBUG((LM_NOTICE,
01089                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_datareaderqos ")
01090                   ACE_TEXT("processing [datareaderqos/%C] section.\n"),
01091                   datareaderqos_name.c_str()));
01092     }
01093 
01094     ValueMap values;
01095     pullValues(cf, it->second, values);
01096 
01097     DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
01098 
01099     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01100       OPENDDS_STRING name = it->first;
01101       OPENDDS_STRING value = it->second;
01102 
01103       if (name == "durability.kind") {
01104         if (value == "VOLATILE") {
01105           datareaderqos.durability.kind = DDS::VOLATILE_DURABILITY_QOS;
01106         } else if (value == "TRANSIENT_LOCAL") {
01107           datareaderqos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
01108 #ifndef OPENDDS_NO_PERSISTENCE_PROFILE
01109         } else if (value == "TRANSIENT") {
01110           datareaderqos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS;
01111         } else if (value == "PERSISTENT") {
01112           datareaderqos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS;
01113 #endif
01114         } else {
01115           ACE_ERROR_RETURN((LM_ERROR,
01116                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01117                             ACE_TEXT("Illegal value for durability.kind (%C) in [datareaderqos/%C] section.\n"),
01118                             value.c_str(), datareaderqos_name.c_str()),
01119                             -1);
01120         }
01121       } else if (name == "deadline.period.sec") {
01122         parse_second(datareaderqos.deadline.period.sec, value);
01123       } else if (name == "deadline.period.nanosec") {
01124         parse_nanosecond(datareaderqos.deadline.period.nanosec, value);
01125       } else if (name == "latency_budget.duration.sec") {
01126         parse_second(datareaderqos.latency_budget.duration.sec, value);
01127       } else if (name == "latency_budget.duration.nanosec") {
01128         parse_nanosecond(datareaderqos.latency_budget.duration.nanosec, value);
01129       } else if (name == "liveliness.kind") {
01130         if (value == "AUTOMATIC") {
01131           datareaderqos.liveliness.kind = DDS::AUTOMATIC_LIVELINESS_QOS;
01132         } else if (value == "MANUAL_BY_TOPIC") {
01133           datareaderqos.liveliness.kind = DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS;
01134         } else if (value == "MANUAL_BY_PARTICIPANT") {
01135           datareaderqos.liveliness.kind = DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
01136         } else {
01137           ACE_ERROR_RETURN((LM_ERROR,
01138                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01139                             ACE_TEXT("Illegal value for liveliness.kind (%C) in [datareaderqos/%C] section.\n"),
01140                             value.c_str(), datareaderqos_name.c_str()),
01141                             -1);
01142         }
01143       } else if (name == "liveliness.lease_duration.sec") {
01144         parse_second(datareaderqos.liveliness.lease_duration.sec, value);
01145       } else if (name == "liveliness.lease_duration.nanosec") {
01146         parse_nanosecond(datareaderqos.liveliness.lease_duration.nanosec, value);
01147       } else if (name == "reliability.kind") {
01148         if (value == "BEST_EFFORT") {
01149           datareaderqos.reliability.kind = DDS::BEST_EFFORT_RELIABILITY_QOS;
01150         } else if (value == "RELIABLE") {
01151           datareaderqos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
01152         } else {
01153           ACE_ERROR_RETURN((LM_ERROR,
01154                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01155                             ACE_TEXT("Illegal value for reliability.kind (%C) in [datareaderqos/%C] section.\n"),
01156                             value.c_str(), datareaderqos_name.c_str()),
01157                             -1);
01158         }
01159       } else if (name == "reliability.max_blocking_time.sec") {
01160         parse_second(datareaderqos.reliability.max_blocking_time.sec, value);
01161       } else if (name == "reliability.max_blocking_time.nanosec") {
01162         parse_nanosecond(datareaderqos.reliability.max_blocking_time.nanosec, value);
01163       } else if (name == "destination_order.kind") {
01164         if (value == "BY_RECEPTION_TIMESTAMP") {
01165           datareaderqos.destination_order.kind = DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS;
01166         } else if (value == "BY_SOURCE_TIMESTAMP") {
01167           datareaderqos.destination_order.kind = DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS;
01168         } else {
01169           ACE_ERROR_RETURN((LM_ERROR,
01170                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01171                             ACE_TEXT("Illegal value for destination_order.kind (%C) in [datareaderqos/%C] section.\n"),
01172                             value.c_str(), datareaderqos_name.c_str()),
01173                             -1);
01174         }
01175       } else if (name == "history.kind") {
01176         if (value == "KEEP_ALL") {
01177           datareaderqos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
01178         } else if (value == "KEEP_LAST") {
01179           datareaderqos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
01180         } else {
01181           ACE_ERROR_RETURN((LM_ERROR,
01182                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01183                             ACE_TEXT("Illegal value for history.kind (%C) in [datareaderqos/%C] section.\n"),
01184                             value.c_str(), datareaderqos_name.c_str()),
01185                             -1);
01186         }
01187       } else if (name == "history.depth") {
01188         datareaderqos.history.depth = atoi(value.c_str());
01189       } else if (name == "resource_limits.max_samples") {
01190         datareaderqos.resource_limits.max_samples = atoi(value.c_str());
01191       } else if (name == "resource_limits.max_instances") {
01192         datareaderqos.resource_limits.max_instances = atoi(value.c_str());
01193       } else if (name == "resource_limits.max_samples_per_instance") {
01194         datareaderqos.resource_limits.max_samples_per_instance = atoi(value.c_str());
01195       } else if (name == "time_based_filter.minimum_separation.sec") {
01196         parse_second(datareaderqos.time_based_filter.minimum_separation.sec, value);
01197       } else if (name == "time_based_filter.minimum_separation.nanosec") {
01198         parse_nanosecond(datareaderqos.time_based_filter.minimum_separation.nanosec, value);
01199       } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.sec") {
01200         parse_second(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.sec, value);
01201       } else if (name == "reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec") {
01202         parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_nowriter_samples_delay.nanosec, value);
01203       } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.sec") {
01204         parse_second(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.sec, value);
01205       } else if (name == "reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec") {
01206         parse_nanosecond(datareaderqos.reader_data_lifecycle.autopurge_disposed_samples_delay.nanosec, value);
01207       } else {
01208         ACE_ERROR_RETURN((LM_ERROR,
01209                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_datareaderqos ")
01210                           ACE_TEXT("Unexpected entry (%C) in [datareaderqos/%C] section.\n"),
01211                           name.c_str(), datareaderqos_name.c_str()),
01212                           -1);
01213       }
01214     }
01215 
01216     registry.datareaderqos_map[datareaderqos_name] = datareaderqos;
01217   }
01218 
01219   return 0;
01220 }

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

Definition at line 865 of file StaticDiscovery.cpp.

References 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::DATAWRITERQOS_SECTION_NAME, OpenDDS::DCPS::DCPS_debug_level, DDS::EXCLUSIVE_OWNERSHIP_QOS, DDS::KEEP_ALL_HISTORY_QOS, DDS::KEEP_LAST_HISTORY_QOS, DDS::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, DDS::MANUAL_BY_TOPIC_LIVELINESS_QOS, OPENDDS_STRING, OpenDDS::DCPS::parse_nanosecond(), OpenDDS::DCPS::parse_second(), DDS::PERSISTENT_DURABILITY_QOS, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, DDS::RELIABLE_RELIABILITY_QOS, DDS::SHARED_OWNERSHIP_QOS, TheServiceParticipant, DDS::TRANSIENT_DURABILITY_QOS, DDS::TRANSIENT_LOCAL_DURABILITY_QOS, and DDS::VOLATILE_DURABILITY_QOS.

Referenced by load_configuration().

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

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

Definition at line 1433 of file StaticDiscovery.cpp.

References OpenDDS::FaceTSS::config::build_id(), OpenDDS::DCPS::convertToInteger(), OpenDDS::DCPS::EndpointRegistry::datareaderqos_map, OpenDDS::DCPS::EndpointRegistry::datawriterqos_map, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::ENDPOINT_SECTION_NAME, OpenDDS::DCPS::EntityId_t::entityKey, OpenDDS::DCPS::ENTITYKIND_USER_READER_WITH_KEY, OpenDDS::DCPS::ENTITYKIND_USER_WRITER_WITH_KEY, OpenDDS::DCPS::fromhex(), OpenDDS::DCPS::RcHandle< T >::is_nil(), OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::pullValues(), OpenDDS::DCPS::EndpointRegistry::reader_map, registry, OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, TheServiceParticipant, TheTransportRegistry, OpenDDS::DCPS::EndpointRegistry::topic_map, and OpenDDS::DCPS::EndpointRegistry::writer_map.

Referenced by load_configuration().

01434 {
01435   const ACE_Configuration_Section_Key& root = cf.root_section();
01436   ACE_Configuration_Section_Key section;
01437 
01438   if (cf.open_section(root, ENDPOINT_SECTION_NAME, 0, section) != 0) {
01439     if (DCPS_debug_level > 0) {
01440       // This is not an error if the configuration file does not have
01441       // any endpoint (sub)section.
01442       ACE_DEBUG((LM_NOTICE,
01443                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
01444                   ACE_TEXT("no [%s] sections.\n"),
01445                   ENDPOINT_SECTION_NAME));
01446     }
01447     return 0;
01448   }
01449 
01450   // Ensure there are no key/values in the [endpoint] section.
01451   // Every key/value must be in a [endpoint/*] sub-section.
01452   ValueMap vm;
01453   if (pullValues(cf, section, vm) > 0) {
01454     ACE_ERROR_RETURN((LM_ERROR,
01455                       ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01456                       ACE_TEXT("[endpoint] sections must have a subsection name\n")),
01457                       -1);
01458   }
01459   // Process the subsections of this section
01460   KeyList keys;
01461   if (processSections(cf, section, keys) != 0) {
01462     ACE_ERROR_RETURN((LM_ERROR,
01463                       ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01464                       ACE_TEXT("too many nesting layers in the [endpoint] section.\n")),
01465                       -1);
01466   }
01467 
01468   // Loop through the [endpoint/*] sections
01469   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01470     OPENDDS_STRING endpoint_name = it->first;
01471 
01472     if (DCPS_debug_level > 0) {
01473       ACE_DEBUG((LM_NOTICE,
01474                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_endpoints ")
01475                   ACE_TEXT("processing [endpoint/%C] section.\n"),
01476                   endpoint_name.c_str()));
01477     }
01478 
01479     ValueMap values;
01480     pullValues(cf, it->second, values);
01481     int domain = 0;
01482     unsigned char participant[6];
01483     unsigned char entity[3];
01484     enum Type {
01485       Reader,
01486       Writer
01487     };
01488     Type type = Reader; // avoid warning
01489     OPENDDS_STRING topic_name;
01490     DDS::DataWriterQos datawriterqos(TheServiceParticipant->initial_DataWriterQos());
01491     DDS::DataReaderQos datareaderqos(TheServiceParticipant->initial_DataReaderQos());
01492     DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
01493     DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
01494     TransportLocatorSeq trans_info;
01495     OPENDDS_STRING config_name;
01496 
01497     bool domainSpecified = false,
01498       participantSpecified = false,
01499       entitySpecified = false,
01500       typeSpecified = false,
01501       topic_name_Specified = false,
01502       config_name_Specified = false;
01503 
01504     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01505       OPENDDS_STRING name = it->first;
01506       OPENDDS_STRING value = it->second;
01507 
01508       if (name == "domain") {
01509         if (convertToInteger(value, domain)) {
01510           domainSpecified = true;
01511         } else {
01512           ACE_ERROR_RETURN((LM_ERROR,
01513                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01514                             ACE_TEXT("Illegal integer value for domain (%C) in [endpoint/%C] section.\n"),
01515                             value.c_str(), endpoint_name.c_str()),
01516                             -1);
01517         }
01518       } else if (name == "participant") {
01519 #ifdef __SUNPRO_CC
01520         int count = 0;
01521         std::count_if(value.begin(), value.end(), isxdigit, count);
01522         if (value.size() != 12 || count != 12) {
01523 #else
01524         if (value.size() != 12 ||
01525             std::count_if(value.begin(), value.end(), isxdigit) != 12) {
01526 #endif
01527           ACE_ERROR_RETURN((LM_ERROR,
01528                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01529                             ACE_TEXT("participant (%C) must be 12 hexadecimal digits in [endpoint/%C] section.\n"),
01530                             value.c_str(), endpoint_name.c_str()),
01531                             -1);
01532         }
01533 
01534         for (size_t idx = 0; idx != 6; ++idx) {
01535           participant[idx] = fromhex(value, idx);
01536         }
01537         participantSpecified = true;
01538       } else if (name == "entity") {
01539 #ifdef __SUNPRO_CC
01540         int count = 0;
01541         std::count_if(value.begin(), value.end(), isxdigit, count);
01542         if (value.size() != 6 || count != 6) {
01543 #else
01544         if (value.size() != 6 ||
01545             std::count_if(value.begin(), value.end(), isxdigit) != 6) {
01546 #endif
01547           ACE_ERROR_RETURN((LM_ERROR,
01548                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01549                             ACE_TEXT("entity (%C) must be 6 hexadecimal digits in [endpoint/%C] section.\n"),
01550                             value.c_str(), endpoint_name.c_str()),
01551                             -1);
01552         }
01553 
01554         for (size_t idx = 0; idx != 3; ++idx) {
01555           entity[idx] = fromhex(value, idx);
01556         }
01557         entitySpecified = true;
01558       } else if (name == "type") {
01559         if (value == "reader") {
01560           type = Reader;
01561           typeSpecified = true;
01562         } else if (value == "writer") {
01563           type = Writer;
01564           typeSpecified = true;
01565         } else {
01566           ACE_ERROR_RETURN((LM_ERROR,
01567                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01568                             ACE_TEXT("Illegal string value for type (%C) in [endpoint/%C] section.\n"),
01569                             value.c_str(), endpoint_name.c_str()),
01570                             -1);
01571         }
01572       } else if (name == "topic") {
01573         EndpointRegistry::TopicMapType::const_iterator pos = this->registry.topic_map.find(value);
01574         if (pos != this->registry.topic_map.end()) {
01575           topic_name = pos->second.name;
01576           topic_name_Specified = true;
01577         } else {
01578           ACE_ERROR_RETURN((LM_ERROR,
01579                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01580                             ACE_TEXT("Illegal topic reference (%C) in [endpoint/%C] section.\n"),
01581                             value.c_str(), endpoint_name.c_str()),
01582                             -1);
01583         }
01584       } else if (name == "datawriterqos") {
01585         EndpointRegistry::DataWriterQosMapType::const_iterator pos = this->registry.datawriterqos_map.find(value);
01586         if (pos != this->registry.datawriterqos_map.end()) {
01587           datawriterqos = pos->second;
01588         } else {
01589           ACE_ERROR_RETURN((LM_ERROR,
01590                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01591                             ACE_TEXT("Illegal datawriterqos reference (%C) in [endpoint/%C] section.\n"),
01592                             value.c_str(), endpoint_name.c_str()),
01593                             -1);
01594         }
01595       } else if (name == "publisherqos") {
01596         EndpointRegistry::PublisherQosMapType::const_iterator pos = this->registry.publisherqos_map.find(value);
01597         if (pos != this->registry.publisherqos_map.end()) {
01598           publisherqos = pos->second;
01599         } else {
01600           ACE_ERROR_RETURN((LM_ERROR,
01601                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01602                             ACE_TEXT("Illegal publisherqos reference (%C) in [endpoint/%C] section.\n"),
01603                             value.c_str(), endpoint_name.c_str()),
01604                             -1);
01605         }
01606       } else if (name == "datareaderqos") {
01607         EndpointRegistry::DataReaderQosMapType::const_iterator pos = this->registry.datareaderqos_map.find(value);
01608         if (pos != this->registry.datareaderqos_map.end()) {
01609           datareaderqos = pos->second;
01610         } else {
01611           ACE_ERROR_RETURN((LM_ERROR,
01612                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01613                             ACE_TEXT("Illegal datareaderqos reference (%C) in [endpoint/%C] section.\n"),
01614                             value.c_str(), endpoint_name.c_str()),
01615                             -1);
01616         }
01617       } else if (name == "subscriberqos") {
01618         EndpointRegistry::SubscriberQosMapType::const_iterator pos = this->registry.subscriberqos_map.find(value);
01619         if (pos != this->registry.subscriberqos_map.end()) {
01620           subscriberqos = pos->second;
01621         } else {
01622           ACE_ERROR_RETURN((LM_ERROR,
01623                             ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01624                             ACE_TEXT("Illegal subscriberqos reference (%C) in [endpoint/%C] section.\n"),
01625                             value.c_str(), endpoint_name.c_str()),
01626                             -1);
01627         }
01628       } else if (name == "config") {
01629         config_name = value;
01630         config_name_Specified = true;
01631       } else {
01632         ACE_ERROR_RETURN((LM_ERROR,
01633                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01634                           ACE_TEXT("Unexpected entry (%C) in [endpoint/%C] section.\n"),
01635                           name.c_str(), endpoint_name.c_str()),
01636                           -1);
01637       }
01638     }
01639 
01640     if (!domainSpecified) {
01641       ACE_ERROR_RETURN((LM_ERROR,
01642                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01643                         ACE_TEXT("No domain specified for [endpoint/%C] section.\n"),
01644                         endpoint_name.c_str()),
01645                         -1);
01646     }
01647 
01648     if (!participantSpecified) {
01649       ACE_ERROR_RETURN((LM_ERROR,
01650                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01651                         ACE_TEXT("No participant specified for [endpoint/%C] section.\n"),
01652                         endpoint_name.c_str()),
01653                         -1);
01654     }
01655 
01656     if (!entitySpecified) {
01657       ACE_ERROR_RETURN((LM_ERROR,
01658                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01659                         ACE_TEXT("No entity specified for [endpoint/%C] section.\n"),
01660                         endpoint_name.c_str()),
01661                         -1);
01662     }
01663 
01664     if (!typeSpecified) {
01665       ACE_ERROR_RETURN((LM_ERROR,
01666                         ACE_TEXT("(%P|%t) ERROR:StaticDiscovery::parse_endpoints ")
01667                         ACE_TEXT("No type specified for [endpoint/%C] section.\n"),
01668                         endpoint_name.c_str()),
01669                         -1);
01670     }
01671 
01672     if (!topic_name_Specified) {
01673       ACE_ERROR_RETURN((LM_ERROR,
01674                         ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01675                         ACE_TEXT("No topic specified for [endpoint/%C] section.\n"),
01676                         endpoint_name.c_str()),
01677                         -1);
01678     }
01679 
01680     TransportConfig_rch config;
01681 
01682     if (config_name_Specified) {
01683       config = TheTransportRegistry->get_config(config_name);
01684       if (config.is_nil()) {
01685         ACE_ERROR_RETURN((LM_ERROR,
01686                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01687                           ACE_TEXT("Illegal config reference (%C) in [endpoint/%C] section.\n"),
01688                           config_name.c_str(), endpoint_name.c_str()),
01689                           -1);
01690       }
01691     }
01692 
01693     if (config.is_nil() && domainSpecified) {
01694       config = TheTransportRegistry->domain_default_config(domain);
01695     }
01696 
01697     if (config.is_nil()) {
01698       config = TheTransportRegistry->global_config();
01699     }
01700 
01701     config->populate_locators(trans_info);
01702     if (trans_info.length() == 0) {
01703         ACE_ERROR_RETURN((LM_ERROR,
01704                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01705                           ACE_TEXT("No locators for [endpoint/%C] section.\n"),
01706                           endpoint_name.c_str()),
01707                           -1);
01708     }
01709 
01710     EntityId_t entity_id = EndpointRegistry::build_id(entity,
01711       (type == Reader) ? ENTITYKIND_USER_READER_WITH_KEY : ENTITYKIND_USER_WRITER_WITH_KEY);
01712 
01713     RepoId id = EndpointRegistry::build_id(domain, participant, entity_id);
01714 
01715     if (DCPS_debug_level > 0) {
01716       ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) DEBUG: StaticDiscovery::parse_endpoints adding entity with id %C\n"), LogGuid(id).c_str()));
01717     }
01718 
01719     switch (type) {
01720     case Reader:
01721       // Populate the userdata.
01722       datareaderqos.user_data.value.length(3);
01723       datareaderqos.user_data.value[0] = entity_id.entityKey[0];
01724       datareaderqos.user_data.value[1] = entity_id.entityKey[1];
01725       datareaderqos.user_data.value[2] = entity_id.entityKey[2];
01726 
01727       if (!registry.reader_map.insert(std::make_pair(id,
01728             EndpointRegistry::Reader(topic_name, datareaderqos, subscriberqos, config_name, trans_info))).second) {
01729         ACE_ERROR_RETURN((LM_ERROR,
01730                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01731                           ACE_TEXT("Section [endpoint/%C] ignored - duplicate reader.\n"),
01732                           endpoint_name.c_str()),
01733                           -1);
01734       }
01735       break;
01736     case Writer:
01737       // Populate the userdata.
01738       datawriterqos.user_data.value.length(3);
01739       datawriterqos.user_data.value[0] = entity_id.entityKey[0];
01740       datawriterqos.user_data.value[1] = entity_id.entityKey[1];
01741       datawriterqos.user_data.value[2] = entity_id.entityKey[2];
01742 
01743       if (!registry.writer_map.insert(std::make_pair(id,
01744             EndpointRegistry::Writer(topic_name, datawriterqos, publisherqos, config_name, trans_info))).second) {
01745         ACE_ERROR_RETURN((LM_ERROR,
01746                           ACE_TEXT("(%P|%t) ERROR: StaticDiscovery::parse_endpoints ")
01747                           ACE_TEXT("Section [endpoint/%C] ignored - duplicate writer.\n"),
01748                           endpoint_name.c_str()),
01749                           -1);
01750       }
01751       break;
01752     }
01753   }
01754 
01755   return 0;
01756 }

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

Definition at line 1223 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, OPENDDS_STRING, OpenDDS::DCPS::parse_bool(), OpenDDS::DCPS::parse_list(), OpenDDS::DCPS::processSections(), OpenDDS::DCPS::EndpointRegistry::publisherqos_map, OpenDDS::DCPS::PUBLISHERQOS_SECTION_NAME, OpenDDS::DCPS::pullValues(), registry, TheServiceParticipant, and DDS::TOPIC_PRESENTATION_QOS.

Referenced by load_configuration().

01224 {
01225   const ACE_Configuration_Section_Key& root = cf.root_section();
01226   ACE_Configuration_Section_Key section;
01227 
01228   if (cf.open_section(root, PUBLISHERQOS_SECTION_NAME, 0, section) != 0) {
01229     if (DCPS_debug_level > 0) {
01230       // This is not an error if the configuration file does not have
01231       // any publisherqos (sub)section.
01232       ACE_DEBUG((LM_NOTICE,
01233                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
01234                   ACE_TEXT("no [%s] sections.\n"),
01235                   PUBLISHERQOS_SECTION_NAME));
01236     }
01237     return 0;
01238   }
01239 
01240   // Ensure there are no key/values in the [publisherqos] section.
01241   // Every key/value must be in a [publisherqos/*] sub-section.
01242   ValueMap vm;
01243   if (pullValues(cf, section, vm) > 0) {
01244     ACE_ERROR_RETURN((LM_ERROR,
01245                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01246                       ACE_TEXT("[publisherqos] sections must have a subsection name\n")),
01247                       -1);
01248   }
01249   // Process the subsections of this section
01250   KeyList keys;
01251   if (processSections(cf, section, keys) != 0) {
01252     ACE_ERROR_RETURN((LM_ERROR,
01253                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01254                       ACE_TEXT("too many nesting layers in the [publisherqos] section.\n")),
01255                       -1);
01256   }
01257 
01258   // Loop through the [publisherqos/*] sections
01259   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01260     OPENDDS_STRING publisherqos_name = it->first;
01261 
01262     if (DCPS_debug_level > 0) {
01263       ACE_DEBUG((LM_NOTICE,
01264                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_publisherqos ")
01265                   ACE_TEXT("processing [publisherqos/%C] section.\n"),
01266                   publisherqos_name.c_str()));
01267     }
01268 
01269     ValueMap values;
01270     pullValues(cf, it->second, values);
01271 
01272     DDS::PublisherQos publisherqos(TheServiceParticipant->initial_PublisherQos());
01273 
01274     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01275       OPENDDS_STRING name = it->first;
01276       OPENDDS_STRING value = it->second;
01277 
01278       if (name == "presentation.access_scope") {
01279         if (value == "INSTANCE") {
01280           publisherqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
01281         } else if (value == "TOPIC") {
01282           publisherqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
01283         } else if (value == "GROUP") {
01284           publisherqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
01285         } else {
01286           ACE_ERROR_RETURN((LM_ERROR,
01287                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01288                             ACE_TEXT("Illegal value for presentation.access_scope (%C) in [publisherqos/%C] section.\n"),
01289                             value.c_str(), publisherqos_name.c_str()),
01290                             -1);
01291         }
01292       } else if (name == "presentation.coherent_access") {
01293         if (parse_bool(publisherqos.presentation.coherent_access, value)) {
01294         } else {
01295           ACE_ERROR_RETURN((LM_ERROR,
01296                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01297                             ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [publisherqos/%C] section.\n"),
01298                             value.c_str(), publisherqos_name.c_str()),
01299                             -1);
01300         }
01301       } else if (name == "presentation.ordered_access") {
01302         if (parse_bool(publisherqos.presentation.ordered_access, value)) {
01303         } else {
01304           ACE_ERROR_RETURN((LM_ERROR,
01305                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01306                             ACE_TEXT("Illegal value for presentation.ordered_access (%C) in [publisherqos/%C] section.\n"),
01307                             value.c_str(), publisherqos_name.c_str()),
01308                             -1);
01309         }
01310       } else if (name == "partition.name") {
01311         parse_list(publisherqos.partition, value);
01312       } else {
01313         ACE_ERROR_RETURN((LM_ERROR,
01314                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_publisherqos ")
01315                           ACE_TEXT("Unexpected entry (%C) in [publisherqos/%C] section.\n"),
01316                           name.c_str(), publisherqos_name.c_str()),
01317                           -1);
01318       }
01319     }
01320 
01321     registry.publisherqos_map[publisherqos_name] = publisherqos;
01322   }
01323 
01324   return 0;
01325 }

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

Definition at line 1328 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::DCPS_debug_level, DDS::GROUP_PRESENTATION_QOS, DDS::INSTANCE_PRESENTATION_QOS, OPENDDS_STRING, OpenDDS::DCPS::parse_bool(), OpenDDS::DCPS::parse_list(), OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, OpenDDS::DCPS::EndpointRegistry::subscriberqos_map, OpenDDS::DCPS::SUBSCRIBERQOS_SECTION_NAME, TheServiceParticipant, and DDS::TOPIC_PRESENTATION_QOS.

Referenced by load_configuration().

01329 {
01330   const ACE_Configuration_Section_Key& root = cf.root_section();
01331   ACE_Configuration_Section_Key section;
01332 
01333   if (cf.open_section(root, SUBSCRIBERQOS_SECTION_NAME, 0, section) != 0) {
01334     if (DCPS_debug_level > 0) {
01335       // This is not an error if the configuration file does not have
01336       // any subscriberqos (sub)section.
01337       ACE_DEBUG((LM_NOTICE,
01338                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
01339                   ACE_TEXT("no [%s] sections.\n"),
01340                   SUBSCRIBERQOS_SECTION_NAME));
01341     }
01342     return 0;
01343   }
01344 
01345   // Ensure there are no key/values in the [subscriberqos] section.
01346   // Every key/value must be in a [subscriberqos/*] sub-section.
01347   ValueMap vm;
01348   if (pullValues(cf, section, vm) > 0) {
01349     ACE_ERROR_RETURN((LM_ERROR,
01350                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01351                       ACE_TEXT("[subscriberqos] sections must have a subsection name\n")),
01352                       -1);
01353   }
01354   // Process the subsections of this section
01355   KeyList keys;
01356   if (processSections(cf, section, keys) != 0) {
01357     ACE_ERROR_RETURN((LM_ERROR,
01358                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01359                       ACE_TEXT("too many nesting layers in the [subscriberqos] section.\n")),
01360                       -1);
01361   }
01362 
01363   // Loop through the [subscriberqos/*] sections
01364   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
01365     OPENDDS_STRING subscriberqos_name = it->first;
01366 
01367     if (DCPS_debug_level > 0) {
01368       ACE_DEBUG((LM_NOTICE,
01369                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_subscriberqos ")
01370                   ACE_TEXT("processing [subscriberqos/%C] section.\n"),
01371                   subscriberqos_name.c_str()));
01372     }
01373 
01374     ValueMap values;
01375     pullValues(cf, it->second, values);
01376 
01377     DDS::SubscriberQos subscriberqos(TheServiceParticipant->initial_SubscriberQos());
01378 
01379     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
01380       OPENDDS_STRING name = it->first;
01381       OPENDDS_STRING value = it->second;
01382 
01383       if (name == "presentation.access_scope") {
01384         if (value == "INSTANCE") {
01385           subscriberqos.presentation.access_scope = DDS::INSTANCE_PRESENTATION_QOS;
01386         } else if (value == "TOPIC") {
01387           subscriberqos.presentation.access_scope = DDS::TOPIC_PRESENTATION_QOS;
01388         } else if (value == "GROUP") {
01389           subscriberqos.presentation.access_scope = DDS::GROUP_PRESENTATION_QOS;
01390         } else {
01391           ACE_ERROR_RETURN((LM_ERROR,
01392                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01393                             ACE_TEXT("Illegal value for presentation.access_scope (%C) in [subscriberqos/%C] section.\n"),
01394                             value.c_str(), subscriberqos_name.c_str()),
01395                             -1);
01396         }
01397       } else if (name == "presentation.coherent_access") {
01398         if (parse_bool(subscriberqos.presentation.coherent_access, value)) {
01399         } else {
01400           ACE_ERROR_RETURN((LM_ERROR,
01401                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01402                             ACE_TEXT("Illegal value for presentation.coherent_access (%C) in [subscriberqos/%C] section.\n"),
01403                             value.c_str(), subscriberqos_name.c_str()),
01404                             -1);
01405         }
01406       } else if (name == "presentation.ordered_access") {
01407         if (parse_bool(subscriberqos.presentation.ordered_access, value)) {
01408         } else {
01409           ACE_ERROR_RETURN((LM_ERROR,
01410                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01411                             ACE_TEXT("Illegal value for presentation.ordered_access (%C) in [subscriberqos/%C] section.\n"),
01412                             value.c_str(), subscriberqos_name.c_str()),
01413                             -1);
01414         }
01415       } else if (name == "partition.name") {
01416         parse_list(subscriberqos.partition, value);
01417       } else {
01418         ACE_ERROR_RETURN((LM_ERROR,
01419                           ACE_TEXT("(%P|%t) StaticDiscovery::parse_subscriberqos ")
01420                           ACE_TEXT("Unexpected entry (%C) in [subscriberqos/%C] section.\n"),
01421                           name.c_str(), subscriberqos_name.c_str()),
01422                           -1);
01423       }
01424     }
01425 
01426    registry.subscriberqos_map[subscriberqos_name] = subscriberqos;
01427   }
01428 
01429   return 0;
01430 }

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

Definition at line 771 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::EndpointRegistry::Topic::name, OPENDDS_STRING, OpenDDS::DCPS::processSections(), OpenDDS::DCPS::pullValues(), registry, OpenDDS::DCPS::EndpointRegistry::topic_map, OpenDDS::DCPS::TOPIC_SECTION_NAME, and OpenDDS::DCPS::EndpointRegistry::Topic::type_name.

Referenced by load_configuration().

00772 {
00773   const ACE_Configuration_Section_Key& root = cf.root_section();
00774   ACE_Configuration_Section_Key section;
00775 
00776   if (cf.open_section(root, TOPIC_SECTION_NAME, 0, section) != 0) {
00777     if (DCPS_debug_level > 0) {
00778       // This is not an error if the configuration file does not have
00779       // any topic (sub)section.
00780       ACE_DEBUG((LM_NOTICE,
00781                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
00782                   ACE_TEXT("no [%s] sections.\n"),
00783                   TOPIC_SECTION_NAME));
00784     }
00785     return 0;
00786   }
00787 
00788   // Ensure there are no key/values in the [topic] section.
00789   // Every key/value must be in a [topic/*] sub-section.
00790   ValueMap vm;
00791   if (pullValues(cf, section, vm) > 0) {
00792     ACE_ERROR_RETURN((LM_ERROR,
00793                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00794                       ACE_TEXT("[topic] sections must have a subsection name\n")),
00795                       -1);
00796   }
00797   // Process the subsections of this section
00798   KeyList keys;
00799   if (processSections(cf, section, keys) != 0) {
00800     ACE_ERROR_RETURN((LM_ERROR,
00801                       ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00802                       ACE_TEXT("too many nesting layers in the [topic] section.\n")),
00803                       -1);
00804   }
00805 
00806   // Loop through the [topic/*] sections
00807   for (KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
00808     OPENDDS_STRING topic_name = it->first;
00809 
00810     if (DCPS_debug_level > 0) {
00811       ACE_DEBUG((LM_NOTICE,
00812                   ACE_TEXT("(%P|%t) NOTICE: StaticDiscovery::parse_topics ")
00813                   ACE_TEXT("processing [topic/%C] section.\n"),
00814                   topic_name.c_str()));
00815     }
00816 
00817     ValueMap values;
00818     pullValues(cf, it->second, values);
00819 
00820     EndpointRegistry::Topic topic;
00821     bool name_Specified = false,
00822       type_name_Specified = false;
00823 
00824     for (ValueMap::const_iterator it = values.begin(); it != values.end(); ++it) {
00825       OPENDDS_STRING name = it->first;
00826       OPENDDS_STRING value = it->second;
00827 
00828       if (name == "name") {
00829         topic.name = value;
00830         name_Specified = true;
00831       } else if (name == "type_name") {
00832         if (value.size() >= 128) {
00833           ACE_ERROR_RETURN((LM_ERROR,
00834                             ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00835                             ACE_TEXT("type_name (%C) must be less than 128 characters in [topic/%C] section.\n"),
00836                             value.c_str(), topic_name.c_str()),
00837                             -1);
00838         }
00839         topic.type_name = value;
00840         type_name_Specified = true;
00841       } else {
00842         // Typos are ignored to avoid parsing FACE-specific keys.
00843       }
00844     }
00845 
00846     if (!name_Specified) {
00847       topic.name = topic_name;
00848     }
00849 
00850     if (!type_name_Specified) {
00851       ACE_ERROR_RETURN((LM_ERROR,
00852                         ACE_TEXT("(%P|%t) StaticDiscovery::parse_topics ")
00853                         ACE_TEXT("No type_name specified for [topic/%C] section.\n"),
00854                         topic_name.c_str()),
00855                        -1);
00856     }
00857 
00858     registry.topic_map[topic_name] = topic;
00859   }
00860 
00861   return 0;
00862 }

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

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 1788 of file StaticDiscovery.cpp.

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

01789 {
01790   const DDS::Subscriber_var sub = reader->get_subscriber();
01791   const DDS::DomainParticipant_var part = sub->get_participant();
01792   const DDS::DomainId_t dom = part->get_domain_id();
01793 
01794   DDS::DomainParticipantQos partQos;
01795   part->get_qos(partQos);
01796   if (partQos.user_data.value.length() < 6)
01797     return;
01798   const unsigned char* const partId = partQos.user_data.value.get_buffer();
01799 
01800   DDS::DataReaderQos qos;
01801   reader->get_qos(qos);
01802   if (qos.user_data.value.length() < 3)
01803     return;
01804   const unsigned char* const drId = qos.user_data.value.get_buffer();
01805 
01806   const EntityId_t entId =
01807     EndpointRegistry::build_id(drId, ENTITYKIND_USER_READER_WITH_KEY);
01808   const RepoId rid = EndpointRegistry::build_id(dom, partId, entId);
01809 
01810   const EndpointRegistry::ReaderMapType::const_iterator iter =
01811     registry.reader_map.find(rid);
01812 
01813   if (iter != registry.reader_map.end() && !iter->second.trans_cfg.empty()) {
01814     TransportRegistry::instance()->bind_config(iter->second.trans_cfg, reader);
01815   }
01816 }

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

Reimplemented from OpenDDS::DCPS::Discovery.

Definition at line 1758 of file StaticDiscovery.cpp.

References OpenDDS::DCPS::TransportRegistry::bind_config(), OpenDDS::FaceTSS::config::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, and OpenDDS::DCPS::EndpointRegistry::writer_map.

01759 {
01760   const DDS::Publisher_var pub = writer->get_publisher();
01761   const DDS::DomainParticipant_var part = pub->get_participant();
01762   const DDS::DomainId_t dom = part->get_domain_id();
01763 
01764   DDS::DomainParticipantQos partQos;
01765   part->get_qos(partQos);
01766   if (partQos.user_data.value.length() < 6)
01767     return;
01768   const unsigned char* const partId = partQos.user_data.value.get_buffer();
01769 
01770   DDS::DataWriterQos qos;
01771   writer->get_qos(qos);
01772   if (qos.user_data.value.length() < 3)
01773     return;
01774   const unsigned char* const dwId = qos.user_data.value.get_buffer();
01775 
01776   const EntityId_t entId =
01777     EndpointRegistry::build_id(dwId, ENTITYKIND_USER_WRITER_WITH_KEY);
01778   const RepoId rid = EndpointRegistry::build_id(dom, partId, entId);
01779 
01780   const EndpointRegistry::WriterMapType::const_iterator iter =
01781     registry.writer_map.find(rid);
01782 
01783   if (iter != registry.writer_map.end() && !iter->second.trans_cfg.empty()) {
01784     TransportRegistry::instance()->bind_config(iter->second.trans_cfg, writer);
01785   }
01786 }


Member Data Documentation

StaticDiscovery_rch OpenDDS::DCPS::StaticDiscovery::instance_ [static, private]

Definition at line 261 of file StaticDiscovery.h.

EndpointRegistry OpenDDS::DCPS::StaticDiscovery::registry

Definition at line 246 of file StaticDiscovery.h.

Referenced by add_domain_participant(), load_configuration(), parse_datareaderqos(), parse_datawriterqos(), parse_endpoints(), parse_publisherqos(), parse_subscriberqos(), parse_topics(), pre_reader(), and pre_writer().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:25 2016 for OpenDDS by  doxygen 1.4.7