00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DCPS_UDPTRANSPORT_H
00009 #define DCPS_UDPTRANSPORT_H
00010
00011 #include "Udp_Export.h"
00012
00013 #include "UdpDataLink.h"
00014 #include "UdpDataLink_rch.h"
00015
00016 #include "dds/DCPS/transport/framework/PriorityKey.h"
00017 #include "dds/DCPS/transport/framework/TransportImpl.h"
00018 #include "dds/DCPS/PoolAllocator.h"
00019
00020 namespace OpenDDS {
00021 namespace DCPS {
00022
00023 class UdpInst;
00024
00025 class OpenDDS_Udp_Export UdpTransport : public TransportImpl {
00026 public:
00027 explicit UdpTransport(const TransportInst_rch& inst);
00028
00029 void passive_connection(const ACE_INET_Addr& remote_address,
00030 ACE_Message_Block* data);
00031
00032 protected:
00033 virtual AcceptConnectResult connect_datalink(const RemoteTransport& remote,
00034 const ConnectionAttribs& attribs,
00035 TransportClient* client);
00036
00037 virtual AcceptConnectResult accept_datalink(const RemoteTransport& remote,
00038 const ConnectionAttribs& attribs,
00039 TransportClient* client);
00040
00041 virtual void stop_accepting_or_connecting(TransportClient* client,
00042 const RepoId& remote_id);
00043
00044 virtual bool configure_i(TransportInst* config);
00045
00046 virtual void shutdown_i();
00047
00048 virtual bool connection_info_i(TransportLocator& info) const;
00049 ACE_INET_Addr get_connection_addr(const TransportBLOB& data) const;
00050
00051 virtual void release_datalink(DataLink* link);
00052
00053 virtual std::string transport_type() const { return "udp"; }
00054
00055 private:
00056 UdpDataLink* make_datalink(const ACE_INET_Addr& remote_address,
00057 Priority priority, bool active);
00058
00059 PriorityKey blob_to_key(const TransportBLOB& remote,
00060 Priority priority, ACE_INET_Addr local_addr, bool active);
00061
00062 RcHandle<UdpInst> config_i_;
00063
00064 typedef ACE_SYNCH_MUTEX LockType;
00065 typedef ACE_Guard<LockType> GuardType;
00066 typedef ACE_Condition<LockType> ConditionType;
00067
00068
00069 LockType client_links_lock_;
00070
00071
00072
00073 typedef OPENDDS_MAP(PriorityKey, UdpDataLink_rch) UdpDataLinkMap;
00074 UdpDataLinkMap client_links_;
00075
00076
00077 UdpDataLink_rch server_link_;
00078
00079
00080
00081
00082 ACE_Recursive_Thread_Mutex connections_lock_;
00083
00084
00085
00086
00087
00088 std::set<PriorityKey> server_link_keys_;
00089
00090 typedef std::vector<DataLink::OnStartCallback> Callbacks;
00091 typedef OPENDDS_MAP(PriorityKey, Callbacks) PendConnMap;
00092
00093
00094
00095 PendConnMap pending_connections_;
00096
00097
00098
00099
00100 std::set<PriorityKey> pending_server_link_keys_;
00101 };
00102
00103 }
00104 }
00105
00106 #endif