RtpsDiscovery.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_RTPS_RTPSDISCOVERY_H
00009 #define OPENDDS_RTPS_RTPSDISCOVERY_H
00010 
00011 
00012 #include "dds/DCPS/DiscoveryBase.h"
00013 #include "dds/DCPS/RTPS/GuidGenerator.h"
00014 #include "dds/DCPS/RTPS/Spdp.h"
00015 #include "rtps_export.h"
00016 
00017 #include "ace/Configuration.h"
00018 
00019 #include "dds/DCPS/PoolAllocator.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 #pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 class DDS_TEST;
00026 
00027 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 namespace OpenDDS {
00030 namespace RTPS {
00031 
00032 /**
00033  * @class RtpsDiscovery
00034  *
00035  * @brief Discovery Strategy class that implements RTPS discovery
00036  *
00037  * This class implements the Discovery interface for Rtps-based
00038  * discovery.
00039  *
00040  */
00041 class OpenDDS_Rtps_Export RtpsDiscovery : public OpenDDS::DCPS::PeerDiscovery<Spdp> {
00042 public:
00043   explicit RtpsDiscovery(const RepoKey& key);
00044   ~RtpsDiscovery();
00045 
00046   virtual OpenDDS::DCPS::RepoId generate_participant_guid();
00047 
00048   virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant(
00049     DDS::DomainId_t domain,
00050     const DDS::DomainParticipantQos& qos);
00051 
00052 #if defined(OPENDDS_SECURITY)
00053   virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant_secure(
00054     DDS::DomainId_t domain,
00055     const DDS::DomainParticipantQos& qos,
00056     const OpenDDS::DCPS::RepoId& guid,
00057     DDS::Security::IdentityHandle id,
00058     DDS::Security::PermissionsHandle perm,
00059     DDS::Security::ParticipantCryptoHandle part_crypto);
00060 #endif
00061 
00062   virtual bool supports_liveliness() const { return true; }
00063 
00064   virtual void signal_liveliness(const DDS::DomainId_t domain_id,
00065                                  const OpenDDS::DCPS::RepoId& part_id,
00066                                  DDS::LivelinessQosPolicyKind kind);
00067 
00068   // configuration parameters:
00069 
00070   ACE_Time_Value resend_period() const { return resend_period_; }
00071   void resend_period(const ACE_Time_Value& period) {
00072     resend_period_ = period;
00073   }
00074 
00075   u_short pb() const { return pb_; }
00076   void pb(u_short port_base) {
00077     pb_ = port_base;
00078   }
00079 
00080   u_short dg() const { return dg_; }
00081   void dg(u_short domain_gain) {
00082     dg_ = domain_gain;
00083   }
00084 
00085   u_short pg() const { return pg_; }
00086   void pg(u_short participant_gain) {
00087     pg_ = participant_gain;
00088   }
00089 
00090   u_short d0() const { return d0_; }
00091   void d0(u_short offset_zero) {
00092     d0_ = offset_zero;
00093   }
00094 
00095   u_short d1() const { return d1_; }
00096   void d1(u_short offset_one) {
00097     d1_ = offset_one;
00098   }
00099 
00100   u_short dx() const { return dx_; }
00101   void dx(u_short offset_two) {
00102     dx_ = offset_two;
00103   }
00104 
00105   unsigned char ttl() const { return ttl_; }
00106   void ttl(unsigned char time_to_live) {
00107     ttl_ = time_to_live;
00108   }
00109 
00110   OPENDDS_STRING sedp_local_address() const { return sedp_local_address_; }
00111   void sedp_local_address(const OPENDDS_STRING& mi) {
00112     sedp_local_address_ = mi;
00113   }
00114 
00115   OPENDDS_STRING spdp_local_address() const { return spdp_local_address_; }
00116   void spdp_local_address(const OPENDDS_STRING& mi) {
00117     spdp_local_address_ = mi;
00118   }
00119 
00120   bool sedp_multicast() const { return sedp_multicast_; }
00121   void sedp_multicast(bool sm) {
00122     sedp_multicast_ = sm;
00123   }
00124 
00125   OPENDDS_STRING multicast_interface() const { return multicast_interface_; }
00126   void multicast_interface(const OPENDDS_STRING& mi) {
00127     multicast_interface_ = mi;
00128   }
00129 
00130   OPENDDS_STRING default_multicast_group() const { return default_multicast_group_; }
00131   void default_multicast_group(const OPENDDS_STRING& group) {
00132     default_multicast_group_ = group;
00133   }
00134 
00135   typedef OPENDDS_VECTOR(OPENDDS_STRING) AddrVec;
00136   const AddrVec& spdp_send_addrs() const { return spdp_send_addrs_; }
00137   AddrVec& spdp_send_addrs() { return spdp_send_addrs_; }
00138 
00139   OPENDDS_STRING guid_interface() const { return guid_interface_; }
00140   void guid_interface(const OPENDDS_STRING& gi) {
00141     guid_interface_ = gi;
00142   }
00143 private:
00144   ACE_Time_Value resend_period_;
00145   u_short pb_, dg_, pg_, d0_, d1_, dx_;
00146   unsigned char ttl_;
00147   bool sedp_multicast_;
00148   OPENDDS_STRING multicast_interface_, sedp_local_address_, spdp_local_address_;
00149   OPENDDS_STRING default_multicast_group_;  /// FUTURE: handle > 1 group.
00150   OPENDDS_STRING guid_interface_;
00151   AddrVec spdp_send_addrs_;
00152 
00153   /// Guids will be unique within this RTPS configuration
00154   GuidGenerator guid_gen_;
00155 
00156 public:
00157   class Config : public Discovery::Config {
00158   public:
00159     int discovery_config(ACE_Configuration_Heap& cf);
00160   };
00161 
00162   class OpenDDS_Rtps_Export StaticInitializer {
00163   public:
00164     StaticInitializer();
00165   };
00166 
00167 private:
00168   friend class ::DDS_TEST;
00169 };
00170 
00171 static RtpsDiscovery::StaticInitializer initialize_rtps;
00172 
00173 typedef OpenDDS::DCPS::RcHandle<RtpsDiscovery> RtpsDiscovery_rch;
00174 
00175 } // namespace RTPS
00176 } // namespace OpenDDS
00177 
00178 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00179 
00180 #endif /* OPENDDS_RTPS_RTPSDISCOVERY_H  */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1