blob: 4cac6f10dd8828fbc50925b1223cb04b1f3ef46b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_
#define QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_
#include "net/third_party/quiche/src/quic/core/quic_stream_sequencer_buffer.h"
namespace quic {
namespace test {
class QuicStreamSequencerBufferPeer {
public:
explicit QuicStreamSequencerBufferPeer(QuicStreamSequencerBuffer* buffer);
QuicStreamSequencerBufferPeer(const QuicStreamSequencerBufferPeer&) = delete;
QuicStreamSequencerBufferPeer& operator=(
const QuicStreamSequencerBufferPeer&) = delete;
// Read from this buffer_ into the given destination buffer_ up to the
// size of the destination. Returns the number of bytes read. Reading from
// an empty buffer_->returns 0.
size_t Read(char* dest_buffer, size_t size);
// If buffer is empty, the blocks_ array must be empty, which means all
// blocks are deallocated.
bool CheckEmptyInvariants();
bool IsBlockArrayEmpty();
bool CheckInitialState();
bool CheckBufferInvariants();
size_t GetInBlockOffset(QuicStreamOffset offset);
QuicStreamSequencerBuffer::BufferBlock* GetBlock(size_t index);
int IntervalSize();
size_t max_buffer_capacity();
size_t ReadableBytes();
void set_total_bytes_read(QuicStreamOffset total_bytes_read);
void AddBytesReceived(QuicStreamOffset offset, QuicByteCount length);
bool IsBufferAllocated();
size_t max_blocks_count();
size_t current_blocks_count();
const QuicIntervalSet<QuicStreamOffset>& bytes_received();
private:
QuicStreamSequencerBuffer* buffer_;
};
} // namespace test
} // namespace quic
#endif // QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_BUFFER_PEER_H_
|