-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathtcp-rl.h
114 lines (88 loc) · 3.37 KB
/
tcp-rl.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
/*
* Copyright (c) 2018 Technische Universität Berlin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Piotr Gawlowicz <[email protected]>
* Modify: Pengyu Liu <[email protected]>
* Hao Yin <[email protected]>
* Muyuan Shen <[email protected]>
*/
#ifndef TCP_RL_H_MSG
#define TCP_RL_H_MSG
#include "tcp-rl-env.h"
#include "ns3/tcp-congestion-ops.h"
#include "ns3/tcp-socket-base.h"
namespace ns3
{
class TcpSocketBase;
class Time;
// used to get pointer to Congestion Algorithm
class TcpSocketDerived : public TcpSocketBase
{
public:
static TypeId GetTypeId();
TypeId GetInstanceTypeId() const override;
TcpSocketDerived();
~TcpSocketDerived() override;
Ptr<TcpCongestionOps> GetCongestionControlAlgorithm();
};
class TcpRlTimeBased : public TcpCongestionOps
{
public:
static TypeId GetTypeId();
TcpRlTimeBased();
TcpRlTimeBased(const TcpRlTimeBased& sock);
~TcpRlTimeBased() override;
std::string GetName() const override;
uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
void CongestionStateSet(Ptr<TcpSocketState> tcb,
const TcpSocketState::TcpCongState_t newState) override;
void CwndEvent(Ptr<TcpSocketState> tcb, const TcpSocketState::TcpCAEvent_t event) override;
Ptr<TcpCongestionOps> Fork() override;
protected:
static uint64_t GenerateUuid();
virtual void CreateEnv();
void ConnectSocketCallbacks();
bool m_cbConnect{false};
TcpSocketBase* m_tcpSocket{nullptr};
Ptr<TcpTimeStepEnv> env;
};
class TcpRlEventBased : public TcpCongestionOps
{
public:
static TypeId GetTypeId();
TcpRlEventBased();
TcpRlEventBased(const TcpRlEventBased& sock);
~TcpRlEventBased() override;
std::string GetName() const override;
uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
void CongestionStateSet(Ptr<TcpSocketState> tcb,
const TcpSocketState::TcpCongState_t newState) override;
void CwndEvent(Ptr<TcpSocketState> tcb, const TcpSocketState::TcpCAEvent_t event) override;
Ptr<TcpCongestionOps> Fork() override;
protected:
static uint64_t GenerateUuid();
virtual void CreateEnv();
void ConnectSocketCallbacks();
bool m_cbConnect{false};
TcpSocketBase* m_tcpSocket{nullptr};
Ptr<TcpEventBasedEnv> env;
};
} // namespace ns3
#endif /* TCP_RL_H_MSG */