00001
00002
00003
00004
00005
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 "dds/DCPS/Service_Participant.h"
00016 #include "rtps_export.h"
00017
00018 #include "ace/Configuration.h"
00019
00020 #include "dds/DCPS/PoolAllocator.h"
00021
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 #pragma once
00024 #endif
00025
00026 class DDS_TEST;
00027
00028 namespace OpenDDS {
00029 namespace RTPS {
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 class OpenDDS_Rtps_Export RtpsDiscovery : public OpenDDS::DCPS::PeerDiscovery<Spdp> {
00041 public:
00042 explicit RtpsDiscovery(const RepoKey& key);
00043 ~RtpsDiscovery();
00044
00045 virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant(
00046 DDS::DomainId_t domain,
00047 const DDS::DomainParticipantQos& qos);
00048
00049 virtual bool supports_liveliness() const { return true; }
00050
00051 virtual void signal_liveliness(const DDS::DomainId_t domain_id,
00052 const OpenDDS::DCPS::RepoId& part_id,
00053 DDS::LivelinessQosPolicyKind kind);
00054
00055
00056
00057 ACE_Time_Value resend_period() const { return resend_period_; }
00058 void resend_period(const ACE_Time_Value& period) {
00059 resend_period_ = period;
00060 }
00061
00062 u_short pb() const { return pb_; }
00063 void pb(u_short port_base) {
00064 pb_ = port_base;
00065 }
00066
00067 u_short dg() const { return dg_; }
00068 void dg(u_short domain_gain) {
00069 dg_ = domain_gain;
00070 }
00071
00072 u_short pg() const { return pg_; }
00073 void pg(u_short participant_gain) {
00074 pg_ = participant_gain;
00075 }
00076
00077 u_short d0() const { return d0_; }
00078 void d0(u_short offset_zero) {
00079 d0_ = offset_zero;
00080 }
00081
00082 u_short d1() const { return d1_; }
00083 void d1(u_short offset_one) {
00084 d1_ = offset_one;
00085 }
00086
00087 u_short dx() const { return dx_; }
00088 void dx(u_short offset_two) {
00089 dx_ = offset_two;
00090 }
00091
00092 unsigned char ttl() const { return ttl_; }
00093 void ttl(unsigned char time_to_live) {
00094 ttl_ = time_to_live;
00095 }
00096
00097 OPENDDS_STRING sedp_local_address() const { return sedp_local_address_; }
00098 void sedp_local_address(const OPENDDS_STRING& mi) {
00099 sedp_local_address_ = mi;
00100 }
00101
00102 bool sedp_multicast() const { return sedp_multicast_; }
00103 void sedp_multicast(bool sm) {
00104 sedp_multicast_ = sm;
00105 }
00106
00107 OPENDDS_STRING multicast_interface() const { return multicast_interface_; }
00108 void multicast_interface(const OPENDDS_STRING& mi) {
00109 multicast_interface_ = mi;
00110 }
00111
00112 OPENDDS_STRING default_multicast_group() const { return default_multicast_group_; }
00113 void default_multicast_group(const OPENDDS_STRING& group) {
00114 default_multicast_group_ = group;
00115 }
00116
00117 typedef OPENDDS_VECTOR(OPENDDS_STRING) AddrVec;
00118 const AddrVec& spdp_send_addrs() const { return spdp_send_addrs_; }
00119 AddrVec& spdp_send_addrs() { return spdp_send_addrs_; }
00120
00121 private:
00122 ACE_Time_Value resend_period_;
00123 u_short pb_, dg_, pg_, d0_, d1_, dx_;
00124 unsigned char ttl_;
00125 bool sedp_multicast_;
00126 OPENDDS_STRING multicast_interface_, sedp_local_address_;
00127 OPENDDS_STRING default_multicast_group_;
00128 AddrVec spdp_send_addrs_;
00129
00130
00131 GuidGenerator guid_gen_;
00132
00133 public:
00134 class Config : public Discovery::Config {
00135 public:
00136 int discovery_config(ACE_Configuration_Heap& cf);
00137 };
00138
00139 class OpenDDS_Rtps_Export StaticInitializer {
00140 public:
00141 StaticInitializer();
00142 };
00143
00144 private:
00145 friend class ::DDS_TEST;
00146 };
00147
00148 static RtpsDiscovery::StaticInitializer initialize_rtps;
00149
00150 typedef OpenDDS::DCPS::RcHandle<RtpsDiscovery> RtpsDiscovery_rch;
00151
00152 }
00153 }
00154
00155 #endif