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 00016 namespace OpenDDS { 00017 namespace DCPS { 00018 00019 class TcpConnection; 00020 00021 class TcpReceiveStrategy : public TransportReceiveStrategy<> { 00022 public: 00023 00024 TcpReceiveStrategy(const TcpDataLink_rch& link, 00025 const TcpConnection_rch& connection, 00026 const TransportReactorTask_rch& task); 00027 00028 virtual ~TcpReceiveStrategy(); 00029 00030 int reset(TcpConnection* connection); 00031 00032 ACE_Reactor* get_reactor(); 00033 00034 bool gracefully_disconnected(); 00035 00036 protected: 00037 00038 virtual ssize_t receive_bytes(iovec iov[], 00039 int n, 00040 ACE_INET_Addr& remote_address, 00041 ACE_HANDLE fd); 00042 00043 virtual void deliver_sample(ReceivedDataSample& sample, 00044 const ACE_INET_Addr& remote_address); 00045 00046 virtual int start_i(); 00047 virtual void stop_i(); 00048 00049 // Delegate to the connection object to re-establishment 00050 // the connection. 00051 virtual void relink(bool do_suspend = true); 00052 00053 private: 00054 00055 TcpDataLink_rch link_; 00056 TcpConnection_rch connection_; 00057 TransportReactorTask_rch reactor_task_; 00058 }; 00059 00060 } // namespace DCPS 00061 } // namespace OpenDDS 00062 00063 #if defined (__ACE_INLINE__) 00064 #include "TcpReceiveStrategy.inl" 00065 #endif /* __ACE_INLINE__ */ 00066 00067 #endif /* OPENDDS_TCPRECEIVESTRATEGY_H */