Reorganize reassembly data structures

Started by factoring some details into a new DataBlockList class to at
least make it more clear where modifications occur.  More abstractions
likely to happen later as I experiment with alternate data structures
aimed at improving worse-case scenarios.
This commit is contained in:
Jon Siwek 2019-09-05 19:17:41 -07:00
parent 395c685da1
commit b19c8fad7a
8 changed files with 343 additions and 285 deletions

View file

@ -44,13 +44,7 @@ public:
// How much data is pending delivery since it's not yet reassembled.
// Includes the data due to holes (so this value is a bit different
// from waiting_on_hole above; and is computed in a different fashion).
uint64_t NumUndeliveredBytes() const
{
if ( last_block )
return last_block->upper - last_reassem_seq;
else
return 0;
}
uint64_t NumUndeliveredBytes() const;
void SetContentsFile(BroFile* f);
BroFile* GetContentsFile() const { return record_contents_file; }
@ -93,10 +87,10 @@ private:
void Gap(uint64_t seq, uint64_t len);
void RecordToSeq(uint64_t start_seq, uint64_t stop_seq, BroFile* f);
void RecordBlock(DataBlock* b, BroFile* f);
void RecordBlock(const DataBlock* b, BroFile* f);
void RecordGap(uint64_t start_seq, uint64_t upper_seq, BroFile* f);
void BlockInserted(DataBlock* b) override;
void BlockInserted(const DataBlock* b) override;
void Overlap(const u_char* b1, const u_char* b2, uint64_t n) override;
TCP_Endpoint* endp;