A Discrete-Event Network Simulator
API
tcp-socket-state.h
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 #pragma once
19 
20 #include "ns3/object.h"
21 #include "ns3/data-rate.h"
22 #include "ns3/traced-value.h"
23 #include "ns3/sequence-number.h"
24 
25 namespace ns3 {
26 
39 class TcpSocketState : public Object
40 {
41 public:
47  static TypeId GetTypeId (void);
48 
52  TcpSocketState () : Object () { }
53 
58  TcpSocketState (const TcpSocketState &other);
59 
74  typedef enum
75  {
87 
88  // Note: "not triggered" events are currently not triggered by the code.
89  typedef enum
90  {
99  } TcpCAEvent_t;
100 
105  typedef enum
106  {
114  } EcnState_t;
115 
123  typedef void (* TcpCongStatesTracedValueCallback)(const TcpCongState_t oldValue,
124  const TcpCongState_t newValue);
125 
133  typedef void (* EcnStatesTracedValueCallback)(const EcnState_t oldValue,
134  const EcnState_t newValue);
135 
140 
144  static const char* const EcnStateName[TcpSocketState::ECN_CWR_SENT + 1];
145 
146  // Congestion control
150  uint32_t m_initialCWnd {0};
151  uint32_t m_initialSsThresh {0};
152 
153  // Segment
154  uint32_t m_segmentSize {0};
156 
158 
160 
163 
164  uint32_t m_rcvTimestampValue {0};
165  uint32_t m_rcvTimestampEchoReply {0};
166 
167  // Pacing related variables
168  bool m_pacing {false};
171 
173 
176 
182  uint32_t GetCwndInSegments () const
183  {
184  return m_cWnd / m_segmentSize;
185  }
186 
192  uint32_t GetSsThreshInSegments () const
193  {
194  return m_ssThresh / m_segmentSize;
195  }
196 };
197 
198 } //namespace ns3
uint32_t m_rcvTimestampValue
Receiver Timestamp value.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void(* TcpCongStatesTracedValueCallback)(const TcpCongState_t oldValue, const TcpCongState_t newValue)
TracedValue Callback signature for TcpCongState_t.
DataRate m_currentPacingRate
Current Pacing rate.
Last ACK received had ECE bit set in TCP header.
Normal state, no dubious events.
CWND was reduced, we are fast-retransmitting.
In all the respects it is "Open", but requires a bit more attention.
bool m_pacing
Pacing status.
uint32_t m_initialSsThresh
Initial Slow Start Threshold value.
uint32_t m_rcvTimestampEchoReply
Sender Timestamp echoed by the receiver.
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.
uint32_t m_segmentSize
Segment size.
TcpSocketState()
TcpSocketState Constructor.
uint32_t m_initialCWnd
Initial cWnd value.
Data structure that records the congestion state of a connection.
Receiver sends an ACK with ECE bit set in TCP header.
Class for representing data rates.
Definition: data-rate.h:88
Last packet received had CE bit set in IP header.
static Time Max()
Maximum representable Time.
Definition: nstime.h:273
TracedValue< uint32_t > m_cWndInfl
Inflated congestion window trace (used only for backward compatibility purpose)
cWnd was reduced due to some Congestion Notification event.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
ECN is enabled but currently there is no action pertaining to ECE or CWR to be taken.
uint32_t GetCwndInSegments() const
Get cwnd in segments rather than bytes.
TracedValue< uint32_t > m_bytesInFlight
Bytes in flight.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
TcpCongState_t
Definition of the Congestion state machine.
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.
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...
uint32_t GetSsThreshInSegments() const
Get slow start thresh in segments rather than bytes.
TracedValue< Time > m_lastRtt
Last RTT sample collected.
CWND was reduced due to RTO timeout or SACK reneging.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1007
Time m_minRtt
Minimum RTT observed throughout the connection.
void(* EcnStatesTracedValueCallback)(const EcnState_t oldValue, const EcnState_t newValue)
TracedValue Callback signature for EcnState_t.
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
first transmit when no packets in flight
A base class which provides memory management and object aggregation.
Definition: object.h:87
DataRate m_maxPacingRate
Max Pacing rate.
received CE marked IP packet.
a unique identifier for an interface.
Definition: type-id.h:58
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
EcnState_t
Definition of the Ecn state machine.
ECT set, but not CE marked.