CS144Lab/libsponge/tcp_connection.cc
2021-10-19 18:08:12 -07:00

50 lines
1.4 KiB
C++

#include "tcp_connection.hh"
#include <iostream>
// Dummy implementation of a TCP connection
// For Lab 4, please replace with a real implementation that passes the
// automated checks run by `make check`.
template <typename... Targs>
void DUMMY_CODE(Targs &&... /* unused */) {}
using namespace std;
size_t TCPConnection::remaining_outbound_capacity() const { return {}; }
size_t TCPConnection::bytes_in_flight() const { return {}; }
size_t TCPConnection::unassembled_bytes() const { return {}; }
size_t TCPConnection::time_since_last_segment_received() const { return {}; }
void TCPConnection::segment_received(const TCPSegment &seg) { DUMMY_CODE(seg); }
bool TCPConnection::active() const { return {}; }
size_t TCPConnection::write(const string &data) {
DUMMY_CODE(data);
return {};
}
//! \param[in] ms_since_last_tick number of milliseconds since the last call to this method
void TCPConnection::tick(const size_t ms_since_last_tick) { DUMMY_CODE(ms_since_last_tick); }
void TCPConnection::end_input_stream() {}
void TCPConnection::connect() {}
TCPConnection::~TCPConnection() {
try {
if (active()) {
cerr << "Warning: Unclean shutdown of TCPConnection\n";
// Your code here: need to send a RST segment to the peer
}
} catch (const exception &e) {
std::cerr << "Exception destructing TCP FSM: " << e.what() << std::endl;
}
}