21 #define NS_LOG_APPEND_CONTEXT \
22 if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
26 #include "ns3/trace-source-accessor.h"
27 #include "ns3/simulator.h"
28 #include "ns3/abort.h"
42 .AddConstructor<TcpNewReno> ()
43 .AddAttribute (
"ReTxThreshold",
"Threshold for fast retransmit",
46 MakeUintegerChecker<uint32_t> ())
47 .AddAttribute (
"LimitedTransmit",
"Enable limited transmit",
50 MakeBooleanChecker ())
51 .AddTraceSource (
"CongestionWindow",
52 "The TCP connection's congestion window",
54 .AddTraceSource (
"SlowStartThreshold",
55 "TCP slow start threshold (bytes)",
72 m_ssThresh (sock.m_ssThresh),
73 m_initialCWnd (sock.m_initialCWnd),
74 m_initialSsThresh (sock.m_initialSsThresh),
75 m_retxThresh (sock.m_retxThresh),
77 m_limitedTx (sock.m_limitedTx)
116 return CopyObject<TcpNewReno> (
this);
124 NS_LOG_LOGIC (
"TcpNewReno receieved ACK for seq " << seq <<
142 NS_LOG_INFO (
"Received full ACK. Leaving fast recovery with cwnd set to " <<
m_cWnd);
155 adder = std::max (1.0, adder);
156 m_cWnd +=
static_cast<uint32_t
> (adder);
175 NS_LOG_INFO (
"Triple dupack. Enter fast recovery mode. Reset cwnd to " <<
m_cWnd <<
214 m_rtt->IncreaseMultiplier ();
virtual int Listen(void)
Listen for incoming connections.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
bool m_limitedTx
perform limited transmit
uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck)
Extract at most maxSize bytes from the TxBuffer at sequence seq, add the TCP header, and send to TcpL4Protocol.
void DiscardUpTo(const SequenceNumber32 &seq)
Discard data up to but not including this sequence number.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const
Returns the number of bytes from the buffer in the range [seq, tailSequence)
SequenceNumber32 HeadSequence(void) const
Returns the first byte's sequence number.
uint32_t m_initialSsThresh
Initial Slow Start Threshold value.
virtual int Listen(void)
Listen for incoming connections.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual uint32_t GetInitialCwnd(void) const
Get the initial Congestion Window.
virtual uint32_t Window(void)
Return the max possible number of unacked bytes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
uint32_t m_segmentSize
Segment size.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
An implementation of a stream socket using TCP.
TracedValue< TcpStates_t > m_state
TCP state.
virtual void SetSegSize(uint32_t size)
Set the segment size.
a polymophic address class
TracedValue< uint32_t > m_ssThresh
Slow Start Threshold.
TcpTxBuffer m_txBuffer
Tx buffer.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DupAck(const TcpHeader &t, uint32_t count)
Received dupack (duplicate ACK)
Hold an unsigned integer type.
virtual void SetInitialCwnd(uint32_t cwnd)
Set the initial Congestion Window.
virtual uint32_t GetInitialSSThresh(void) const
Get the initial Slow Start Threshold.
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
TracedValue< uint32_t > m_cWnd
Congestion window.
A base class for implementation of a stream socket using TCP.
Ptr< RttEstimator > m_rtt
Round trip time estimator.
void InitializeCwnd(void)
Set the congestion window when connection starts.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
bool m_inFastRec
currently in fast recovery
uint32_t m_retxThresh
Fast Retransmit threshold.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
virtual uint32_t BytesInFlight(void)
Return total bytes in flight.
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit()
static Time Now(void)
Return the "current simulation time".
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
uint32_t m_initialCWnd
Initial cWnd value.
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
bool m_connected
Connection established.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if cond is false.
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
TcpNewReno(void)
Create an unbound tcp socket.
a unique identifier for an interface.
virtual void SetInitialSSThresh(uint32_t threshold)
Set the initial Slow Start Threshold.
TypeId SetParent(TypeId tid)
bool SendPendingData(bool withAck=false)
Send as much pending data as possible according to the Tx window.
TracedValue< uint32_t > m_rWnd
Flow control window at remote side.
virtual void DoRetransmit(void)
Retransmit the oldest packet.
SequenceNumber32 m_recover
Previous highest Tx seqnum for fast recovery.
virtual ~TcpNewReno(void)