00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_TCPSENDSTRATEGY_H 00009 #define OPENDDS_TCPSENDSTRATEGY_H 00010 00011 #include "TcpConnection_rch.h" 00012 #include "TcpDataLink_rch.h" 00013 #include "TcpInst_rch.h" 00014 #include "TcpConnection_rch.h" 00015 #include "dds/DCPS/transport/framework/TransportSendStrategy.h" 00016 #include "dds/DCPS/transport/framework/TransportReactorTask_rch.h" 00017 00018 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00019 00020 namespace OpenDDS { 00021 namespace DCPS { 00022 00023 class TcpSynchResource; 00024 00025 class TcpSendStrategy : public TransportSendStrategy { 00026 public: 00027 00028 TcpSendStrategy(std::size_t id, 00029 TcpDataLink& link, 00030 TcpSynchResource* synch_resource, 00031 const TransportReactorTask_rch& task, 00032 Priority priority); 00033 virtual ~TcpSendStrategy(); 00034 00035 /// This is called by the datalink object to associate with the "new" connection object. 00036 /// The "old" connection object is unregistered with the reactor and the "new" connection 00037 /// object is registered for sending. The implementation of this method is borrowed from 00038 /// the ReceiveStrategy. 00039 int reset(bool reset_mode = false); 00040 00041 /// Enable or disable output processing by the reactor according to mode. 00042 virtual void schedule_output(); 00043 00044 protected: 00045 00046 virtual ssize_t send_bytes(const iovec iov[], int n, int& bp); 00047 virtual ACE_HANDLE get_handle(); 00048 virtual ssize_t send_bytes_i(const iovec iov[], int n); 00049 00050 /// Delegate to the connection object to re-establish 00051 /// the connection. 00052 virtual void relink(bool do_suspend = true); 00053 00054 virtual void stop_i(); 00055 virtual void add_delayed_notification(TransportQueueElement* element); 00056 private: 00057 TcpDataLink& link_; 00058 TransportReactorTask_rch reactor_task_; 00059 }; 00060 00061 } // namespace DCPS 00062 } // namespace OpenDDS 00063 00064 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00065 00066 #endif /* OPENDDS_TCPSENDSTRATEGY_H */