00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_TRANSPORTREASSEMBLY
00009 #define OPENDDS_DCPS_TRANSPORTREASSEMBLY
00010
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "dds/DCPS/Definitions.h"
00013 #include "ReceivedDataSample.h"
00014 #include "dds/DCPS/PoolAllocator.h"
00015
00016 namespace OpenDDS {
00017 namespace DCPS {
00018
00019 class OpenDDS_Dcps_Export TransportReassembly {
00020 public:
00021
00022
00023
00024
00025 bool reassemble(const SequenceNumber& transportSeq, bool firstFrag,
00026 ReceivedDataSample& data);
00027
00028 bool reassemble(const SequenceRange& seqRange, ReceivedDataSample& data);
00029
00030
00031
00032
00033 void data_unavailable(const SequenceRange& transportSeqDropped);
00034
00035 void data_unavailable(const SequenceNumber& dataSampleSeq,
00036 const RepoId& pub_id);
00037
00038
00039
00040 bool has_frags(const SequenceNumber& seq, const RepoId& pub_id) const;
00041
00042
00043
00044
00045 CORBA::ULong get_gaps(const SequenceNumber& msg_seq, const RepoId& pub_id,
00046 CORBA::Long bitmap[], CORBA::ULong length,
00047 CORBA::ULong& numBits) const;
00048
00049 private:
00050
00051 bool reassemble_i(const SequenceRange& seqRange, bool firstFrag,
00052 ReceivedDataSample& data);
00053
00054
00055
00056
00057
00058
00059 struct FragKey {
00060 FragKey(const PublicationId& pubId, const SequenceNumber& dataSampleSeq);
00061
00062 bool operator<(const FragKey& rhs) const
00063 {
00064 if (compare_(this->publication_, rhs.publication_)) return true;
00065 if (compare_(rhs.publication_, this->publication_)) return false;
00066 return this->data_sample_seq_ < rhs.data_sample_seq_;
00067 }
00068
00069 static GUID_tKeyLessThan compare_;
00070 PublicationId publication_;
00071 SequenceNumber data_sample_seq_;
00072 };
00073
00074
00075
00076
00077 struct FragRange {
00078 FragRange(const SequenceRange& seqRange,
00079 const ReceivedDataSample& data);
00080
00081 SequenceRange transport_seq_;
00082 ReceivedDataSample rec_ds_;
00083 };
00084
00085
00086
00087
00088
00089 typedef OPENDDS_MAP(FragKey, OPENDDS_LIST(FragRange) ) FragMap;
00090 FragMap fragments_;
00091
00092 OPENDDS_SET(FragKey) have_first_;
00093
00094 static bool insert(OPENDDS_LIST(FragRange)& flist,
00095 const SequenceRange& seqRange,
00096 ReceivedDataSample& data);
00097 };
00098
00099 }
00100 }
00101
00102 #endif