A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-socket-state.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6#include "tcp-socket-state.h"
7
8namespace ns3
9{
10
11NS_OBJECT_ENSURE_REGISTERED(TcpSocketState);
12
13TypeId
15{
16 static TypeId tid =
17 TypeId("ns3::TcpSocketState")
19 .SetGroupName("Internet")
20 .AddConstructor<TcpSocketState>()
21 .AddAttribute("EnablePacing",
22 "Enable Pacing",
23 BooleanValue(false),
26 .AddAttribute("MaxPacingRate",
27 "Set Max Pacing Rate",
28 DataRateValue(DataRate("4Gb/s")),
31 .AddAttribute("PacingSsRatio",
32 "Percent pacing rate increase for slow start conditions",
33 UintegerValue(200),
36 .AddAttribute("PacingCaRatio",
37 "Percent pacing rate increase for congestion avoidance conditions",
38 UintegerValue(120),
41 .AddAttribute("PaceInitialWindow",
42 "Perform pacing for initial window of data",
43 BooleanValue(false),
46 .AddTraceSource("PacingRate",
47 "The current TCP pacing rate",
49 "ns3::TracedValueCallback::DataRate")
50 .AddTraceSource("CongestionWindow",
51 "The TCP connection's congestion window",
53 "ns3::TracedValueCallback::Uint32")
54 .AddTraceSource("CongestionWindowInflated",
55 "The TCP connection's inflated congestion window",
57 "ns3::TracedValueCallback::Uint32")
58 .AddTraceSource("SlowStartThreshold",
59 "TCP slow start threshold (bytes)",
61 "ns3::TracedValueCallback::Uint32")
62 .AddTraceSource("CongState",
63 "TCP Congestion machine state",
65 "ns3::TracedValueCallback::TcpCongState")
66 .AddTraceSource("EcnState",
67 "Trace ECN state change of socket",
69 "ns3::TracedValueCallback::EcnState")
70 .AddTraceSource("HighestSequence",
71 "Highest sequence number received from peer",
73 "ns3::TracedValueCallback::SequenceNumber32")
74 .AddTraceSource("NextTxSequence",
75 "Next sequence number to send (SND.NXT)",
77 "ns3::TracedValueCallback::SequenceNumber32")
78 .AddTraceSource("BytesInFlight",
79 "The TCP connection's congestion window",
81 "ns3::TracedValueCallback::Uint32")
82 .AddTraceSource("RTT",
83 "Smoothed RTT",
85 "ns3::TracedValueCallback::Time")
86 .AddTraceSource("LastRTT",
87 "RTT of the last (S)ACKed packet",
89 "ns3::TracedValueCallback::Time");
90 return tid;
91}
92
94 : Object(other),
95 m_cWnd(other.m_cWnd),
96 m_ssThresh(other.m_ssThresh),
97 m_initialCWnd(other.m_initialCWnd),
98 m_initialSsThresh(other.m_initialSsThresh),
99 m_segmentSize(other.m_segmentSize),
100 m_lastAckedSeq(other.m_lastAckedSeq),
101 m_congState(other.m_congState),
102 m_ecnState(other.m_ecnState),
103 m_highTxMark(other.m_highTxMark),
104 m_nextTxSequence(other.m_nextTxSequence),
105 m_rcvTimestampValue(other.m_rcvTimestampValue),
106 m_rcvTimestampEchoReply(other.m_rcvTimestampEchoReply),
107 m_pacing(other.m_pacing),
108 m_maxPacingRate(other.m_maxPacingRate),
109 m_pacingRate(other.m_pacingRate),
110 m_pacingSsRatio(other.m_pacingSsRatio),
111 m_pacingCaRatio(other.m_pacingCaRatio),
112 m_paceInitialWindow(other.m_paceInitialWindow),
113 m_minRtt(other.m_minRtt),
114 m_bytesInFlight(other.m_bytesInFlight),
115 m_isCwndLimited(other.m_isCwndLimited),
116 m_srtt(other.m_srtt),
117 m_lastRtt(other.m_lastRtt),
118 m_ecnMode(other.m_ecnMode),
119 m_useEcn(other.m_useEcn),
120 m_ectCodePoint(other.m_ectCodePoint),
121 m_lastAckedSackedBytes(other.m_lastAckedSackedBytes)
122
123{
124}
125
127 "CA_OPEN",
128 "CA_DISORDER",
129 "CA_CWR",
130 "CA_RECOVERY",
131 "CA_LOSS",
132};
133
135 "ECN_DISABLED",
136 "ECN_IDLE",
137 "ECN_CE_RCVD",
138 "ECN_SENDING_ECE",
139 "ECN_ECE_RCVD",
140 "ECN_CWR_SENT",
141};
142
143} // namespace ns3
Class for representing data rates.
Definition data-rate.h:78
A base class which provides memory management and object aggregation.
Definition object.h:78
Data structure that records the congestion state of a connection.
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
TracedValue< DataRate > m_pacingRate
Current Pacing rate.
TracedValue< TcpCongState_t > m_congState
State in the Congestion state machine.
bool m_paceInitialWindow
Enable/Disable pacing for the initial window.
DataRate m_maxPacingRate
Max Pacing rate.
TracedValue< Time > m_srtt
Smoothed RTT.
bool m_pacing
Pacing status.
static TypeId GetTypeId()
Get the type ID.
static const char *const TcpCongStateName[TcpSocketState::CA_LAST_STATE]
Literal names of TCP states for use in log messages.
@ CA_LAST_STATE
Used only in debug messages.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< Time > m_lastRtt
RTT of the last (S)ACKed packet.
@ ECN_CWR_SENT
Sender has reduced the congestion window, and sent a packet with CWR bit set in TCP header.
TcpSocketState()
TcpSocketState Constructor.
TracedValue< uint32_t > m_bytesInFlight
Bytes in flight.
TracedValue< uint32_t > m_cWndInfl
Inflated congestion window trace (used only for backward compatibility purpose)
uint16_t m_pacingCaRatio
CA pacing ratio.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
uint16_t m_pacingSsRatio
SS pacing ratio.
static const char *const EcnStateName[TcpSocketState::ECN_CWR_SENT+1]
Literal names of ECN states for use in log messages.
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Definition data-rate.h:285
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeChecker > MakeDataRateChecker()
Definition data-rate.cc:20
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70