Sponge
CS144's user-space TCP library
stream_reassembler.cc
Go to the documentation of this file.
1 #include "stream_reassembler.hh"
2 
3 // Dummy implementation of a stream reassembler.
4 
5 // For Lab 1, please replace with a real implementation that passes the
6 // automated checks run by `make check_lab1`.
7 
8 // You will need to add private members to the class declaration in `stream_reassembler.hh`
9 
10 template <typename... Targs>
11 void DUMMY_CODE(Targs &&... /* unused */) {}
12 
13 using namespace std;
14 
15 StreamReassembler::StreamReassembler(const size_t capacity) : _output(capacity), _capacity(capacity) {}
16 
20 void StreamReassembler::push_substring(const string &data, const size_t index, const bool eof) {
21  DUMMY_CODE(data, index, eof);
22 }
23 
24 size_t StreamReassembler::unassembled_bytes() const { return {}; }
25 
26 bool StreamReassembler::empty() const { return {}; }
StreamReassembler::StreamReassembler
StreamReassembler(const size_t capacity)
Construct a StreamReassembler that will store up to capacity bytes.
Definition: stream_reassembler.cc:15
StreamReassembler::unassembled_bytes
size_t unassembled_bytes() const
Definition: stream_reassembler.cc:24
stream_reassembler.hh
std
StreamReassembler::push_substring
void push_substring(const std::string &data, const uint64_t index, const bool eof)
Receive a substring and write any newly contiguous bytes into the stream.
Definition: stream_reassembler.cc:20
DUMMY_CODE
void DUMMY_CODE(Targs &&...)
Definition: stream_reassembler.cc:11
StreamReassembler::empty
bool empty() const
Is the internal state empty (other than the output stream)?
Definition: stream_reassembler.cc:26