A Discrete-Event Network Simulator
API
tcp-recovery-ops.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2018 NITK Surathkal
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Viyom Mittal <viyommittal@gmail.com>
19 * Vivek Jain <jain.vivek.anand@gmail.com>
20 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
21 *
22 */
23#include "tcp-recovery-ops.h"
24#include "tcp-socket-state.h"
25
26#include "ns3/log.h"
27
28namespace ns3 {
29
30NS_LOG_COMPONENT_DEFINE ("TcpRecoveryOps");
31
32NS_OBJECT_ENSURE_REGISTERED (TcpRecoveryOps);
33
34TypeId
36{
37 static TypeId tid = TypeId ("ns3::TcpRecoveryOps")
38 .SetParent<Object> ()
39 .SetGroupName ("Internet")
40 ;
41 return tid;
42}
43
45{
46 NS_LOG_FUNCTION (this);
47}
48
50{
51 NS_LOG_FUNCTION (this);
52}
53
55{
56 NS_LOG_FUNCTION (this);
57}
58
59void
61{
62 NS_LOG_FUNCTION (this << bytesSent);
63}
64
65// Classic recovery
66
68
71{
72 static TypeId tid = TypeId ("ns3::TcpClassicRecovery")
74 .SetGroupName ("Internet")
75 .AddConstructor<TcpClassicRecovery> ()
76 ;
77 return tid;
78}
79
81{
82 NS_LOG_FUNCTION (this);
83}
84
86 : TcpRecoveryOps (sock)
87{
88 NS_LOG_FUNCTION (this);
89}
90
92{
93 NS_LOG_FUNCTION (this);
94}
95
96void
98 [[maybe_unused]] uint32_t unAckDataCount,
99 [[maybe_unused]] uint32_t deliveredBytes)
100{
101 NS_LOG_FUNCTION (this << tcb << dupAckCount << unAckDataCount);
102 tcb->m_cWnd = tcb->m_ssThresh;
103 tcb->m_cWndInfl = tcb->m_ssThresh + (dupAckCount * tcb->m_segmentSize);
104}
105
106void
107TcpClassicRecovery::DoRecovery (Ptr<TcpSocketState> tcb, [[maybe_unused]] uint32_t deliveredBytes)
108{
109 NS_LOG_FUNCTION (this << tcb << deliveredBytes);
110 tcb->m_cWndInfl += tcb->m_segmentSize;
111}
112
113void
115{
116 NS_LOG_FUNCTION (this << tcb);
117 // Follow NewReno procedures to exit FR if SACK is disabled
118 // (RFC2582 sec.3 bullet #5 paragraph 2, option 2)
119 // In this implementation, actual m_cWnd value is reset to ssThresh
120 // immediately before calling ExitRecovery(), so we just need to
121 // reset the inflated cWnd trace variable
122 tcb->m_cWndInfl = tcb->m_ssThresh.Get ();
123}
124
125std::string
127{
128 return "TcpClassicRecovery";
129}
130
133{
134 return CopyObject<TcpClassicRecovery> (this);
135}
136
137} // namespace ns3
138
A base class which provides memory management and object aggregation.
Definition: object.h:88
The Classic recovery implementation.
virtual Ptr< TcpRecoveryOps > Fork() override
Copy the recovery algorithm across socket.
virtual void EnterRecovery(Ptr< TcpSocketState > tcb, uint32_t dupAckCount, uint32_t unAckDataCount, uint32_t deliveredBytes) override
Performs variable initialization at the start of recovery.
virtual void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes) override
Performs recovery based on the recovery algorithm.
static TypeId GetTypeId(void)
Get the type ID.
virtual void ExitRecovery(Ptr< TcpSocketState > tcb) override
Performs cwnd adjustments at the end of recovery.
virtual std::string GetName() const override
Get the name of the recovery algorithm.
TcpClassicRecovery()
Constructor.
virtual ~TcpClassicRecovery() override
Constructor.
recovery abstract class
virtual ~TcpRecoveryOps()
Deconstructor.
static TypeId GetTypeId(void)
Get the type ID.
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
TcpRecoveryOps()
Constructor.
uint32_t m_segmentSize
Segment size.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< uint32_t > m_cWndInfl
Inflated congestion window trace (used only for backward compatibility purpose)
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
T Get(void) const
Get the underlying value.
Definition: traced-value.h:232
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.