Sponge
CS144's user-space TCP library
tcp_state.hh
Go to the documentation of this file.
1 #ifndef SPONGE_LIBSPONGE_TCP_STATE
2 #define SPONGE_LIBSPONGE_TCP_STATE
3 
4 #include "tcp_receiver.hh"
5 #include "tcp_sender.hh"
6 
7 #include <string>
8 
23 class TCPState {
24  public:
26  static std::string state_summary(const TCPReceiver &receiver);
27 
29  static std::string state_summary(const TCPSender &receiver);
30 };
31 
33 const std::string ERROR = "error (connection was reset)";
34 const std::string LISTEN = "waiting for SYN: ackno is empty";
35 const std::string SYN_RECV = "SYN received (ackno exists), and input to stream hasn't ended";
36 const std::string FIN_RECV = "input to stream has ended";
37 } // namespace TCPReceiverStateSummary
38 
40 const std::string ERROR = "error (connection was reset)";
41 const std::string CLOSED = "waiting for stream to begin (no SYN sent)";
42 const std::string SYN_SENT = "stream started but nothing acknowledged";
43 const std::string SYN_ACKED = "stream ongoing";
44 const std::string FIN_SENT = "stream finished (FIN sent) but not fully acknowledged";
45 const std::string FIN_ACKED = "stream finished and fully acknowledged";
46 } // namespace TCPSenderStateSummary
47 
48 #endif // SPONGE_LIBSPONGE_TCP_STATE
TCPSenderStateSummary::SYN_SENT
const std::string SYN_SENT
Definition: tcp_state.hh:42
std::string
tcp_receiver.hh
TCPSenderStateSummary::FIN_SENT
const std::string FIN_SENT
Definition: tcp_state.hh:44
TCPSender
The "sender" part of a TCP implementation.
Definition: tcp_sender.hh:18
tcp_sender.hh
TCPReceiverStateSummary
Definition: tcp_state.hh:32
TCPReceiverStateSummary::FIN_RECV
const std::string FIN_RECV
Definition: tcp_state.hh:36
TCPReceiver
The "receiver" part of a TCP implementation.
Definition: tcp_receiver.hh:16
TCPReceiverStateSummary::LISTEN
const std::string LISTEN
Definition: tcp_state.hh:34
TCPSenderStateSummary
Definition: tcp_state.hh:39
TCPState
Summary of a TCPConnection's internal state.
Definition: tcp_state.hh:23
TCPSenderStateSummary::CLOSED
const std::string CLOSED
Definition: tcp_state.hh:41
TCPSenderStateSummary::ERROR
const std::string ERROR
Definition: tcp_state.hh:40
TCPReceiverStateSummary::SYN_RECV
const std::string SYN_RECV
Definition: tcp_state.hh:35
TCPSenderStateSummary::SYN_ACKED
const std::string SYN_ACKED
Definition: tcp_state.hh:43
TCPState::state_summary
static std::string state_summary(const TCPReceiver &receiver)
Summarize the state of a TCPReceiver in a string.
Definition: tcp_state.cc:5
TCPSenderStateSummary::FIN_ACKED
const std::string FIN_ACKED
Definition: tcp_state.hh:45
TCPReceiverStateSummary::ERROR
const std::string ERROR
Definition: tcp_state.hh:33