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 00018 #include "ace/Basic_Types.h" 00019 #include "ace/SOCK_Dgram.h" 00020 00021 #include "dds/DCPS/transport/framework/DataLink.h" 00022 #include "dds/DCPS/transport/framework/TransportReactorTask.h" 00023 00024 namespace OpenDDS { 00025 namespace DCPS { 00026 00027 class UdpInst; 00028 class UdpTransport; 00029 class ReceivedDataSample; 00030 00031 class OpenDDS_Udp_Export UdpDataLink 00032 : public DataLink { 00033 public: 00034 UdpDataLink(UdpTransport* transport, 00035 Priority priority, 00036 bool active); 00037 00038 void configure(UdpInst* config, 00039 TransportReactorTask* reactor_task); 00040 00041 void send_strategy(UdpSendStrategy* send_strategy); 00042 void receive_strategy(UdpReceiveStrategy* recv_strategy); 00043 00044 bool active() const; 00045 00046 UdpInst* config(); 00047 TransportReactorTask* reactor_task(); 00048 00049 ACE_Reactor* get_reactor(); 00050 00051 ACE_INET_Addr& remote_address(); 00052 00053 ACE_SOCK_Dgram& socket(); 00054 00055 bool open(const ACE_INET_Addr& remote_address); 00056 00057 void control_received(ReceivedDataSample& sample, 00058 const ACE_INET_Addr& remote_address); 00059 00060 protected: 00061 bool active_; 00062 00063 UdpInst* config_; 00064 TransportReactorTask* reactor_task_; 00065 00066 UdpSendStrategy_rch send_strategy_; 00067 UdpReceiveStrategy_rch recv_strategy_; 00068 00069 virtual void stop_i(); 00070 00071 private: 00072 ACE_INET_Addr remote_address_; 00073 00074 ACE_SOCK_Dgram socket_; 00075 }; 00076 00077 } // namespace DCPS 00078 } // namespace OpenDDS 00079 00080 #ifdef __ACE_INLINE__ 00081 # include "UdpDataLink.inl" 00082 #endif /* __ACE_INLINE__ */ 00083 00084 #endif /* DCPS_UDPDATALINK_H */