00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_TCPRECEIVESTRATEGY_H 00009 #define OPENDDS_TCPRECEIVESTRATEGY_H 00010 00011 #include "TcpConnection_rch.h" 00012 #include "TcpDataLink_rch.h" 00013 #include "dds/DCPS/transport/framework/TransportReceiveStrategy_T.h" 00014 #include "dds/DCPS/transport/framework/TransportReactorTask_rch.h" 00015 #include "dds/DCPS/RcEventHandler.h" 00016 00017 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00018 00019 namespace OpenDDS { 00020 namespace DCPS { 00021 00022 class TcpConnection; 00023 00024 class TcpReceiveStrategy 00025 : public TransportReceiveStrategy<>, 00026 public RcEventHandler 00027 { 00028 public: 00029 00030 TcpReceiveStrategy(TcpDataLink& link, 00031 const TransportReactorTask_rch& task); 00032 00033 virtual ~TcpReceiveStrategy(); 00034 00035 int reset(TcpConnection* old_connection, TcpConnection* new_connection); 00036 00037 ACE_Reactor* get_reactor(); 00038 00039 bool gracefully_disconnected(); 00040 00041 protected: 00042 00043 virtual ssize_t receive_bytes(iovec iov[], 00044 int n, 00045 ACE_INET_Addr& remote_address, 00046 ACE_HANDLE fd); 00047 00048 virtual void deliver_sample(ReceivedDataSample& sample, 00049 const ACE_INET_Addr& remote_address); 00050 00051 virtual int start_i(); 00052 virtual void stop_i(); 00053 00054 // Delegate to the connection object to re-establishment 00055 // the connection. 00056 virtual void relink(bool do_suspend = true); 00057 00058 private: 00059 00060 TcpDataLink& link_; 00061 TransportReactorTask_rch reactor_task_; 00062 }; 00063 00064 } // namespace DCPS 00065 } // namespace OpenDDS 00066 00067 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00068 00069 #if defined (__ACE_INLINE__) 00070 #include "TcpReceiveStrategy.inl" 00071 #endif /* __ACE_INLINE__ */ 00072 00073 #endif /* OPENDDS_TCPRECEIVESTRATEGY_H */