TcpDataLink.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_TCPDATALINK_H
00009 #define OPENDDS_TCPDATALINK_H
00010 
00011 #include "TcpConnection_rch.h"
00012 #include "TcpTransport_rch.h"
00013 #include "dds/DCPS/transport/framework/DataLink.h"
00014 #include "ace/INET_Addr.h"
00015 
00016 namespace OpenDDS {
00017 namespace DCPS {
00018 
00019 class TransportSendStrategy;
00020 class TransportStrategy;
00021 
00022 class TcpDataLink : public DataLink {
00023 public:
00024 
00025   TcpDataLink(const ACE_INET_Addr& remote_address,
00026                     TcpTransport*  transport_impl,
00027                     Priority          priority,
00028                     bool                 is_loopback,
00029                     bool                 is_active);
00030   virtual ~TcpDataLink();
00031 
00032   /// Accessor for the remote address.
00033   const ACE_INET_Addr& remote_address() const;
00034 
00035   /// Called when an established connection object is available
00036   /// for this TcpDataLink.  Called by the TcpTransport's
00037   /// connect_datalink() method.
00038   int connect(const TcpConnection_rch& connection,
00039               const TransportSendStrategy_rch& send_strategy,
00040               const TransportStrategy_rch& receive_strategy);
00041 
00042   int reuse_existing_connection(const TcpConnection_rch& connection);
00043   int reconnect(TcpConnection* connection);
00044 
00045   TcpConnection_rch get_connection();
00046   TcpTransport_rch get_transport_impl();
00047 
00048   virtual bool issues_on_deleted_callback() const;
00049 
00050   virtual void pre_stop_i();
00051 
00052   /// Set release pending flag.
00053   void set_release_pending(bool flag);
00054   /// Get release pending flag.
00055   bool is_release_pending() const;
00056 
00057 protected:
00058 
00059   /// Called when the DataLink is self-releasing because all of its
00060   /// reservations have been released, or when the TransportImpl is
00061   /// handling a shutdown() call.
00062   virtual void stop_i();
00063 
00064 private:
00065 
00066   void send_graceful_disconnect_message();
00067 
00068   ACE_INET_Addr           remote_address_;
00069   TcpConnection_rch connection_;
00070   TcpTransport_rch  transport_;
00071   bool graceful_disconnect_sent_;
00072   ACE_Atomic_Op<ACE_Thread_Mutex, bool> release_is_pending_;
00073 };
00074 
00075 } // namespace DCPS
00076 } // namespace OpenDDS
00077 
00078 #if defined (__ACE_INLINE__)
00079 #include "TcpDataLink.inl"
00080 #endif /* __ACE_INLINE__ */
00081 
00082 #endif  /* OPENDDS_TCPDATALINK_H */

Generated on Fri Feb 12 20:05:27 2016 for OpenDDS by  doxygen 1.4.7