00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef DCPS_UDPDATALINK_H 00009 #define DCPS_UDPDATALINK_H 00010 00011 #include "Udp_Export.h" 00012 00013 #include "UdpSendStrategy.h" 00014 #include "UdpSendStrategy_rch.h" 00015 #include "UdpReceiveStrategy.h" 00016 #include "UdpReceiveStrategy_rch.h" 00017 #include "UdpInst_rch.h" 00018 00019 #include "ace/Basic_Types.h" 00020 #include "ace/SOCK_Dgram.h" 00021 00022 #include "dds/DCPS/transport/framework/DataLink.h" 00023 #include "dds/DCPS/transport/framework/TransportReactorTask.h" 00024 00025 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 namespace OpenDDS { 00028 namespace DCPS { 00029 00030 class UdpTransport; 00031 class ReceivedDataSample; 00032 typedef RcHandle<UdpTransport> UdpTransport_rch; 00033 00034 class OpenDDS_Udp_Export UdpDataLink 00035 : public DataLink { 00036 public: 00037 UdpDataLink(UdpTransport& transport, 00038 Priority priority, 00039 TransportReactorTask* reactor_task, 00040 bool active); 00041 00042 bool active() const; 00043 00044 TransportReactorTask* reactor_task(); 00045 00046 ACE_Reactor* get_reactor(); 00047 00048 ACE_INET_Addr& remote_address(); 00049 00050 ACE_SOCK_Dgram& socket(); 00051 00052 bool open(const ACE_INET_Addr& remote_address); 00053 00054 void control_received(ReceivedDataSample& sample, 00055 const ACE_INET_Addr& remote_address); 00056 00057 protected: 00058 bool active_; 00059 00060 TransportReactorTask* reactor_task_; 00061 00062 UdpSendStrategy_rch send_strategy_; 00063 UdpReceiveStrategy_rch recv_strategy_; 00064 00065 virtual void stop_i(); 00066 00067 private: 00068 ACE_INET_Addr remote_address_; 00069 00070 ACE_SOCK_Dgram socket_; 00071 }; 00072 00073 } // namespace DCPS 00074 } // namespace OpenDDS 00075 00076 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00077 00078 #ifdef __ACE_INLINE__ 00079 # include "UdpDataLink.inl" 00080 #endif /* __ACE_INLINE__ */ 00081 00082 #endif /* DCPS_UDPDATALINK_H */