A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-recovery-ops.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 NITK Surathkal
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Viyom Mittal <viyommittal@gmail.com>
7 * Vivek Jain <jain.vivek.anand@gmail.com>
8 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
9 *
10 */
11#include "tcp-recovery-ops.h"
12
13#include "tcp-socket-state.h"
14
15#include "ns3/log.h"
16
17namespace ns3
18{
19
20NS_LOG_COMPONENT_DEFINE("TcpRecoveryOps");
21
22NS_OBJECT_ENSURE_REGISTERED(TcpRecoveryOps);
23
24TypeId
26{
27 static TypeId tid = TypeId("ns3::TcpRecoveryOps").SetParent<Object>().SetGroupName("Internet");
28 return tid;
29}
30
36
38 : Object(other)
39{
40 NS_LOG_FUNCTION(this);
41}
42
47
48void
50{
51 NS_LOG_FUNCTION(this << bytesSent);
52}
53
54// Classic recovery
55
57
60{
61 static TypeId tid = TypeId("ns3::TcpClassicRecovery")
63 .SetGroupName("Internet")
64 .AddConstructor<TcpClassicRecovery>();
65 return tid;
66}
67
73
79
84
85void
87 uint32_t dupAckCount,
88 uint32_t unAckDataCount [[maybe_unused]],
89 uint32_t deliveredBytes [[maybe_unused]])
90{
91 NS_LOG_FUNCTION(this << tcb << dupAckCount << unAckDataCount);
92 tcb->m_cWnd = tcb->m_ssThresh;
93 tcb->m_cWndInfl = tcb->m_ssThresh + (dupAckCount * tcb->m_segmentSize);
94}
95
96void
98 uint32_t deliveredBytes [[maybe_unused]],
99 bool isDupAck)
100{
101 NS_LOG_FUNCTION(this << tcb << deliveredBytes << isDupAck);
102 tcb->m_cWndInfl += tcb->m_segmentSize;
103}
104
105void
107{
108 NS_LOG_FUNCTION(this << tcb);
109 // Follow NewReno procedures to exit FR if SACK is disabled
110 // (RFC2582 sec.3 bullet #5 paragraph 2, option 2)
111 // In this implementation, actual m_cWnd value is reset to ssThresh
112 // immediately before calling ExitRecovery(), so we just need to
113 // reset the inflated cWnd trace variable
114 tcb->m_cWndInfl = tcb->m_ssThresh.Get();
115}
116
117std::string
119{
120 return "TcpClassicRecovery";
121}
122
128
129} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
Definition object.h:581
Smart pointer class similar to boost::intrusive_ptr.
The Classic recovery implementation.
void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes, bool isDupAck) override
Performs recovery based on the recovery algorithm.
Ptr< TcpRecoveryOps > Fork() override
Copy the recovery algorithm across socket.
void EnterRecovery(Ptr< TcpSocketState > tcb, uint32_t dupAckCount, uint32_t unAckDataCount, uint32_t deliveredBytes) override
Performs variable initialization at the start of recovery.
void ExitRecovery(Ptr< TcpSocketState > tcb) override
Performs cwnd adjustments at the end of recovery.
std::string GetName() const override
Get the name of the recovery algorithm.
static TypeId GetTypeId()
Get the type ID.
~TcpClassicRecovery() override
Constructor.
recovery abstract class
static TypeId GetTypeId()
Get the type ID.
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
TcpRecoveryOps()
Constructor.
~TcpRecoveryOps() override
Deconstructor.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.