-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFB-TCP.h
121 lines (96 loc) · 2.94 KB
/
FB-TCP.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Author: Reza Poorzare <[email protected]>
*
* Anna Calveras <[email protected]>, Supervisor
*/
#ifndef TCPfbtcp_H
#define TCPfbtcp_H
#include "ns3/tcp-congestion-ops.h"
#include "ns3/tcp-recovery-ops.h"
namespace ns3 {
/**
* \ingroup congestionOps
*
* \brief An implementation of TCP fbtcp
*/
class Tcpfbtcp : public TcpNewReno
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
/**
* Create an unbound tcp socket.
*/
Tcpfbtcp (void);
//The function for calculating the network's upperbound.
void setThreshold (double th);
/**
* \brief Copy constructor
* \param sock the object to copy
*/
Tcpfbtcp (const Tcpfbtcp& sock);
virtual ~Tcpfbtcp (void);
virtual std::string GetName () const;
/**
* \brief Compute RTTs needed to execute fbtcp algorithm
*
* \param segmentsAcked count of segments ACKed
* \param rtt last RTT
*
*/
virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
const Time& rtt);
/**
* \brief Enable/disable fbtcp algorithm depending on the congestion state
*
* We only start a fbtcp cycle when we are in normal congestion state (CA_OPEN state).
*
* \param tcb internal congestion state
* \param newState new congestion state to which the TCP is going to switch
*/
virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
const TcpSocketState::TcpCongState_t newState);
/**
* \param tcb internal congestion state
* \param segmentsAcked count of segments ACKed
*/
virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
/**
* \param tcb internal congestion state
* \param bytesInFlight bytes in flight
*
*/
virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
uint32_t bytesInFlight);
virtual Ptr<TcpCongestionOps> Fork ();
protected:
private:
/**
* \brief Enable fbtcp algorithm to start taking fbtcp samples
*
* fbtcp algorithm is enabled in the following situations:
* 1. at the establishment of a connection
* 2. after an RTO
* 3. after fast recovery
* 4. when an idle connection is restarted
*
* \param tcb internal congestion state
*/
void Enablefbtcp (Ptr<TcpSocketState> tcb);
/**
* \brief Stop taking fbtcp samples
*/
void Disablefbtcp ();
private:
Time m_baseRtt; //!< Minimum of all fbtcp RTT measurements seen during connection
Time m_minRtt; //!< Minimum of all RTT measurements within last RTT
uint32_t m_cntRtt; //!< Number of RTT measurements during last RTT
bool m_doingfbtcpNow; //!< If true, do fbtcp for this RTT
SequenceNumber32 m_begSndNxt; //!< Right edge during last RTT
};
} // namespace ns3
#endif // TCPfbtcp_H