00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_TCPINST_H
00009 #define OPENDDS_TCPINST_H
00010
00011 #include "Tcp_export.h"
00012 #include "TcpTransport.h"
00013
00014 #include "dds/DCPS/transport/framework/TransportInst.h"
00015 #include "dds/DCPS/SafetyProfileStreams.h"
00016 #include "ace/INET_Addr.h"
00017 #include "ace/SString.h"
00018
00019 #include <string>
00020
00021
00022 class DDS_TEST;
00023
00024 namespace OpenDDS {
00025 namespace DCPS {
00026
00027 class OpenDDS_Tcp_Export TcpInst
00028 : public TransportInst {
00029 public:
00030 virtual int load(ACE_Configuration_Heap& cf,
00031 ACE_Configuration_Section_Key& sect);
00032
00033
00034 virtual OPENDDS_STRING dump_to_str();
00035
00036
00037
00038
00039 std::string pub_address_str_;
00040
00041 bool enable_nagle_algorithm_;
00042
00043
00044
00045
00046
00047 int conn_retry_initial_delay_;
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 double conn_retry_backoff_multiplier_;
00058
00059
00060
00061
00062 int conn_retry_attempts_;
00063
00064
00065
00066
00067
00068
00069 int max_output_pause_period_;
00070
00071
00072
00073
00074
00075
00076
00077 int passive_reconnect_duration_;
00078
00079 bool is_reliable() const { return true; }
00080
00081
00082
00083
00084 const std::string& get_public_address() const {
00085 return (pub_address_str_ == "") ? local_address_str_ : pub_address_str_;
00086 }
00087
00088 virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator& trans_info) const;
00089
00090 OPENDDS_STRING local_address_string() const { return local_address_str_; }
00091 ACE_INET_Addr local_address() const { return local_address_; }
00092 void local_address(const char* str)
00093 {
00094 local_address_str_ = str;
00095 local_address_.set(str);
00096 }
00097 void local_address(u_short port_number, const char* host_name)
00098 {
00099 local_address_str_ = host_name;
00100 local_address_str_ += ":" + to_dds_string(port_number);
00101 local_address_.set(port_number, host_name);
00102 }
00103 void local_address_set_port(u_short port_number) {
00104 local_address_.set_port_number(port_number);
00105 size_t pos = local_address_str_.find_last_of(":");
00106 OPENDDS_STRING host_name = local_address_str_.substr(0, pos);
00107 local_address_str_ = host_name + ":" + to_dds_string(port_number);
00108 }
00109
00110 private:
00111 friend class TcpType;
00112 friend class TcpTransport;
00113 friend class ::DDS_TEST;
00114 explicit TcpInst(const OPENDDS_STRING& name);
00115 virtual ~TcpInst();
00116
00117 TcpTransport* new_impl(const TransportInst_rch& inst);
00118
00119
00120
00121 ACE_INET_Addr local_address_;
00122
00123
00124
00125
00126
00127 std::string local_address_str_;
00128 };
00129
00130 }
00131 }
00132
00133 #if defined (__ACE_INLINE__)
00134 #include "TcpInst.inl"
00135 #endif
00136
00137 #endif