A Discrete-Event Network Simulator
API
tcp-socket-state.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
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 #include "tcp-socket-state.h"
19 
20 namespace ns3 {
21 
22 NS_OBJECT_ENSURE_REGISTERED (TcpSocketState);
23 
24 TypeId
26 {
27  static TypeId tid = TypeId ("ns3::TcpSocketState")
28  .SetParent<Object> ()
29  .SetGroupName ("Internet")
30  .AddConstructor <TcpSocketState> ()
31  .AddAttribute ("EnablePacing", "Enable Pacing",
32  BooleanValue (false),
35  .AddAttribute ("MaxPacingRate", "Set Max Pacing Rate",
36  DataRateValue (DataRate ("4Gb/s")),
39  .AddTraceSource ("CongestionWindow",
40  "The TCP connection's congestion window",
42  "ns3::TracedValueCallback::Uint32")
43  .AddTraceSource ("CongestionWindowInflated",
44  "The TCP connection's inflated congestion window",
46  "ns3::TracedValueCallback::Uint32")
47  .AddTraceSource ("SlowStartThreshold",
48  "TCP slow start threshold (bytes)",
50  "ns3::TracedValueCallback::Uint32")
51  .AddTraceSource ("CongState",
52  "TCP Congestion machine state",
54  "ns3::TracedValueCallback::TcpCongState")
55  .AddTraceSource ("EcnState",
56  "Trace ECN state change of socket",
58  "ns3::TracedValueCallback::EcnState")
59  .AddTraceSource ("HighestSequence",
60  "Highest sequence number received from peer",
62  "ns3::TracedValueCallback::SequenceNumber32")
63  .AddTraceSource ("NextTxSequence",
64  "Next sequence number to send (SND.NXT)",
66  "ns3::TracedValueCallback::SequenceNumber32")
67  .AddTraceSource ("BytesInFlight",
68  "The TCP connection's congestion window",
70  "ns3::TracedValueCallback::Uint32")
71  .AddTraceSource ("RTT",
72  "Last RTT sample",
74  "ns3::TracedValueCallback::Time")
75  ;
76  return tid;
77 }
78 
80  : Object (other),
81  m_cWnd (other.m_cWnd),
82  m_ssThresh (other.m_ssThresh),
83  m_initialCWnd (other.m_initialCWnd),
84  m_initialSsThresh (other.m_initialSsThresh),
85  m_segmentSize (other.m_segmentSize),
86  m_lastAckedSeq (other.m_lastAckedSeq),
87  m_congState (other.m_congState),
88  m_ecnState (other.m_ecnState),
89  m_highTxMark (other.m_highTxMark),
90  m_nextTxSequence (other.m_nextTxSequence),
91  m_rcvTimestampValue (other.m_rcvTimestampValue),
92  m_rcvTimestampEchoReply (other.m_rcvTimestampEchoReply),
93  m_pacing (other.m_pacing),
94  m_maxPacingRate (other.m_maxPacingRate),
95  m_currentPacingRate (other.m_currentPacingRate),
96  m_minRtt (other.m_minRtt),
97  m_bytesInFlight (other.m_bytesInFlight),
98  m_lastRtt (other.m_lastRtt)
99 {
100 }
101 
102 const char* const
104 {
105  "CA_OPEN", "CA_DISORDER", "CA_CWR", "CA_RECOVERY", "CA_LOSS"
106 };
107 
108 const char* const
110 {
111  "ECN_DISABLED", "ECN_IDLE", "ECN_CE_RCVD", "ECN_SENDING_ECE", "ECN_ECE_RCVD", "ECN_CWR_SENT"
112 };
113 
114 } //namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:36
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
bool m_pacing
Pacing status.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:84
static const char *const EcnStateName[TcpSocketState::ECN_CWR_SENT+1]
Literal names of ECN states for use in log messages.
static const char *const TcpCongStateName[TcpSocketState::CA_LAST_STATE]
Literal names of TCP states for use in log messages.
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
TcpSocketState()
TcpSocketState Constructor.
Data structure that records the congestion state of a connection.
Ptr< const AttributeChecker > MakeDataRateChecker(void)
Definition: data-rate.cc:30
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Class for representing data rates.
Definition: data-rate.h:88
TracedValue< uint32_t > m_cWndInfl
Inflated congestion window trace (used only for backward compatibility purpose)
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: data-rate.h:242
TracedValue< uint32_t > m_bytesInFlight
Bytes in flight.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Used only in debug messages.
TracedValue< TcpCongState_t > m_congState
State in the Congestion state machine.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
static TypeId GetTypeId(void)
Get the type ID.
TracedValue< uint32_t > m_cWnd
Congestion window.
Sender has reduced the congestion window, and sent a packet with CWR bit set in TCP header...
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
TracedValue< Time > m_lastRtt
Last RTT sample collected.
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
A base class which provides memory management and object aggregation.
Definition: object.h:87
DataRate m_maxPacingRate
Max Pacing rate.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.