00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DCPS_MULTICASTTRANSPORT_H
00009 #define DCPS_MULTICASTTRANSPORT_H
00010
00011 #include "Multicast_Export.h"
00012
00013 #include "MulticastDataLink_rch.h"
00014 #include "MulticastTypes.h"
00015
00016 #include "dds/DCPS/transport/framework/TransportImpl.h"
00017 #include "dds/DCPS/PoolAllocator.h"
00018
00019 namespace OpenDDS {
00020 namespace DCPS {
00021
00022 class MulticastInst;
00023 class MulticastSession;
00024
00025 class OpenDDS_Multicast_Export MulticastTransport : public TransportImpl {
00026 public:
00027 explicit MulticastTransport(const TransportInst_rch& inst);
00028 ~MulticastTransport();
00029
00030 void passive_connection(MulticastPeer local_peer, MulticastPeer remote_peer);
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
00050 virtual void release_datalink(DataLink* link);
00051
00052 virtual std::string transport_type() const { return "multicast"; }
00053
00054 private:
00055
00056 typedef ACE_SYNCH_MUTEX LockType;
00057 typedef ACE_Guard<LockType> GuardType;
00058
00059 typedef ACE_Thread_Mutex ThreadLockType;
00060 typedef ACE_Guard<ThreadLockType> GuardThreadType;
00061
00062 MulticastDataLink* make_datalink(const RepoId& local_id,
00063 Priority priority,
00064 bool active);
00065
00066 MulticastSession* start_session(const MulticastDataLink_rch& link,
00067 MulticastPeer remote_peer, bool active);
00068
00069 RcHandle<MulticastInst> config_i_;
00070
00071 ThreadLockType links_lock_;
00072
00073 typedef OPENDDS_MAP(MulticastPeer, MulticastDataLink_rch) Links;
00074 Links client_links_;
00075
00076 Links server_links_;
00077
00078
00079
00080
00081
00082
00083
00084 ThreadLockType connections_lock_;
00085 typedef std::vector<DataLink::OnStartCallback> Callbacks;
00086 typedef std::pair<MulticastPeer, MulticastPeer> Peers;
00087 typedef OPENDDS_MAP(Peers, Callbacks) PendConnMap;
00088 PendConnMap pending_connections_;
00089
00090 OPENDDS_SET(Peers) connections_;
00091 };
00092
00093 }
00094 }
00095
00096 #endif