OpenDDS  Snapshot(2023/04/28-20:55)
MulticastSession.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TRANSPORT_MULTICAST_MULTICASTSESSION_H
9 #define OPENDDS_DCPS_TRANSPORT_MULTICAST_MULTICASTSESSION_H
10 
11 #include "Multicast_Export.h"
12 
13 #include "MulticastDataLink.h"
14 #include "MulticastTypes.h"
15 
16 #include "ace/Message_Block.h"
17 #include "ace/Synch_Traits.h"
18 
19 #include "dds/DCPS/RcObject.h"
23 #include "dds/DCPS/SporadicTask.h"
24 
26 class ACE_Reactor;
28 
30 
31 namespace OpenDDS {
32 namespace DCPS {
33 
35  : public virtual RcObject {
36 public:
37  virtual ~MulticastSession();
38 
39  MulticastDataLink* link();
40 
41  MulticastPeer remote_peer() const;
42 
43  bool acked();
44  void set_acked();
45  virtual bool is_reliable() { return false;}
46 
47  void syn_received(const Message_Block_Ptr& control);
48  void send_all_syn(const MonotonicTimePoint& now);
49  void send_syn(const GUID_t& local_writer,
50  const GUID_t& remote_reader);
51 
52  void synack_received(const Message_Block_Ptr& control);
53  void send_synack(const GUID_t& local_reader, const GUID_t& remote_writer);
54  virtual void send_naks() {}
55 
56  virtual bool check_header(const TransportHeader& header) = 0;
57  virtual void record_header_received(const TransportHeader& header) = 0;
58  virtual bool ready_to_deliver(const TransportHeader& header,
59  const ReceivedDataSample& data) = 0;
60  virtual void release_remote(const GUID_t& /*remote*/) {};
61 
62  virtual bool control_received(char submessage_id,
63  const Message_Block_Ptr& control);
64 
65  virtual bool start(bool active, bool acked) = 0;
66  virtual void stop();
67 
68  bool reassemble(ReceivedDataSample& data, const TransportHeader& header);
69 
70  void add_remote(const GUID_t& local);
71 
72  // Reliability.
73  void add_remote(const GUID_t& local,
74  const GUID_t& remote);
75 
76  void remove_remote(const GUID_t& local,
77  const GUID_t& remote);
78 
79 protected:
81 
83 
85  MulticastDataLink* link,
86  MulticastPeer remote_peer);
87 
88  void send_control(char submessage_id,
89  Message_Block_Ptr data);
90 
91  void start_syn();
92 
93  virtual void syn_hook(const SequenceNumber& /*seq*/) {}
94 
97  Reverse_Lock_t reverse_start_lock_;
98  bool started_;
99 
100  // A session must be for a publisher
101  // or subscriber. Implementation doesn't
102  // support being for both.
103  // As to control message,
104  // only subscribers receive syn, send synack, send naks, receive nakack,
105  // and publisher only send syn, receive synack, receive naks, send nakack.
106  bool active_;
107 
109 
110  bool acked_;
111  typedef OPENDDS_MAP_CMP(GUID_t, RepoIdSet, GUID_tKeyLessThan) PendingRemoteMap;
112  // For the active side, the pending_remote_map_ is used as a work queue.
113  // The active side will send SYNs to all of the readers until it gets a SYNACK.
114  // For the passive side, the pending_remote_map_ is used as a filter.
115  // The passive side only responds to SYNs that correspond to an association.
116  PendingRemoteMap pending_remote_map_;
117 
118 private:
119  void remove_remote_i(const GUID_t& local,
120  const GUID_t& remote);
121 
122 
124 
130 };
131 
132 } // namespace DCPS
133 } // namespace OpenDDS
134 
136 
137 #ifdef __ACE_INLINE__
138 # include "MulticastSession.inl"
139 #endif /* __ACE_INLINE__ */
140 
141 #endif /* DCPS_MULTICASTSESSION_H */
#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INT64 MulticastPeer
std::string String
GuidSet RepoIdSet
Definition: GuidUtils.h:113
#define OpenDDS_Multicast_Export
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
Definition: CHANGELOG.txt:8
Holds a data sample received by the transport.
typedef OPENDDS_MAP_CMP(GUID_t, WriterCoherentSample, GUID_tKeyLessThan) GroupCoherentSamples
#define ACE_END_VERSIONED_NAMESPACE_DECL
PmfSporadicTask< MulticastSession > Sporadic
Defines class that represents a transport packet header.
Sequence number abstraction. Only allows positive 64 bit values.
virtual void release_remote(const GUID_t &)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
ACE_Reverse_Lock< ACE_Thread_Mutex > Reverse_Lock_t
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
virtual void syn_hook(const SequenceNumber &)
RcHandle< Sporadic > syn_watchdog_
const TimeDuration initial_syn_delay_