RtpsUdpTransport.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 DCPS_RTPSUDPTRANSPORT_H
00009 #define DCPS_RTPSUDPTRANSPORT_H
00010 
00011 #include "Rtps_Udp_Export.h"
00012 
00013 #include "RtpsUdpDataLink.h"
00014 #include "RtpsUdpDataLink_rch.h"
00015 
00016 #include "dds/DCPS/transport/framework/TransportImpl.h"
00017 #include "dds/DCPS/transport/framework/TransportClient.h"
00018 
00019 #include "dds/DCPS/PoolAllocator.h"
00020 
00021 #include "dds/DCPS/RTPS/RtpsCoreC.h"
00022 
00023 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00024 
00025 namespace OpenDDS {
00026 namespace DCPS {
00027 
00028 class RtpsUdpInst;
00029 
00030 class OpenDDS_Rtps_Udp_Export RtpsUdpTransport : public TransportImpl {
00031 public:
00032   RtpsUdpTransport(RtpsUdpInst& inst);
00033   RtpsUdpInst& config() const;
00034 private:
00035   virtual AcceptConnectResult connect_datalink(const RemoteTransport& remote,
00036                                                const ConnectionAttribs& attribs,
00037                                                const TransportClient_rch& client);
00038 
00039   virtual AcceptConnectResult accept_datalink(const RemoteTransport& remote,
00040                                               const ConnectionAttribs& attribs,
00041                                               const TransportClient_rch& client);
00042 
00043   virtual void stop_accepting_or_connecting(const TransportClient_wrch& client,
00044                                             const RepoId& remote_id);
00045 
00046   bool configure_i(RtpsUdpInst& config);
00047 
00048   virtual void shutdown_i();
00049 
00050   virtual void register_for_reader(const RepoId& participant,
00051                                    const RepoId& writerid,
00052                                    const RepoId& readerid,
00053                                    const TransportLocatorSeq& locators,
00054                                    OpenDDS::DCPS::DiscoveryListener* listener);
00055 
00056   virtual void unregister_for_reader(const RepoId& participant,
00057                                      const RepoId& writerid,
00058                                      const RepoId& readerid);
00059 
00060   virtual void register_for_writer(const RepoId& /*participant*/,
00061                                    const RepoId& /*readerid*/,
00062                                    const RepoId& /*writerid*/,
00063                                    const TransportLocatorSeq& /*locators*/,
00064                                    DiscoveryListener* /*listener*/);
00065 
00066   virtual void unregister_for_writer(const RepoId& /*participant*/,
00067                                      const RepoId& /*readerid*/,
00068                                      const RepoId& /*writerid*/);
00069 
00070   virtual bool connection_info_i(TransportLocator& info) const;
00071   ACE_INET_Addr get_connection_addr(const TransportBLOB& data,
00072                                     bool* requires_inline_qos = 0,
00073                                     unsigned int* blob_bytes_read = 0) const;
00074 
00075   virtual void release_datalink(DataLink* link);
00076 
00077   virtual OPENDDS_STRING transport_type() const { return "rtps_udp"; }
00078 
00079   RtpsUdpDataLink_rch make_datalink(const GuidPrefix_t& local_prefix);
00080 
00081   void use_datalink(const RepoId& local_id,
00082                     const RepoId& remote_id,
00083                     const TransportBLOB& remote_data,
00084                     bool local_reliable, bool remote_reliable,
00085                     bool local_durable, bool remote_durable);
00086 
00087 #if defined(OPENDDS_SECURITY)
00088   void local_crypto_handle(DDS::Security::ParticipantCryptoHandle pch)
00089   {
00090     local_crypto_handle_ = pch;
00091     if (link_) {
00092       link_->local_crypto_handle(pch);
00093     }
00094   }
00095 #endif
00096 
00097   //protects access to link_ for duration of make_datalink
00098   typedef ACE_Thread_Mutex         ThreadLockType;
00099   typedef ACE_Guard<ThreadLockType>     GuardThreadType;
00100   ThreadLockType links_lock_;
00101 
00102   /// This protects the connections_ and the pending_connections_
00103   /// data members.
00104   typedef ACE_SYNCH_MUTEX     LockType;
00105   typedef ACE_Guard<LockType> GuardType;
00106   LockType connections_lock_;
00107 
00108   /// RTPS uses only one link per transport.
00109   /// This link can be safely reused by any clients that belong to the same
00110   /// domain participant (same GUID prefix).  Use by a second participant
00111   /// is not possible because the network location returned by
00112   /// connection_info_i() can't be shared among participants.
00113   RtpsUdpDataLink_rch link_;
00114   bool map_ipv4_to_ipv6() const;
00115 
00116   ACE_SOCK_Dgram unicast_socket_;
00117 
00118   TransportClient_wrch default_listener_;
00119 
00120 #if defined(OPENDDS_SECURITY)
00121   DDS::Security::ParticipantCryptoHandle local_crypto_handle_;
00122 #endif
00123 
00124 };
00125 
00126 } // namespace DCPS
00127 } // namespace OpenDDS
00128 
00129 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00130 
00131 #endif  /* DCPS_RTPSUDPTRANSPORT_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1