33 #define NS_LOG_APPEND_CONTEXT \
34 if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
38 #include "ns3/trace-source-accessor.h"
39 #include "ns3/simulator.h"
40 #include "ns3/abort.h"
42 #include "ns3/sequence-number.h"
56 .SetGroupName (
"Internet")
58 .AddAttribute(
"FilterType",
"Use this to choose no filter or Tustin's approximation filter",
61 .AddAttribute(
"ProtocolType",
"Use this to let the code run as Westwood or WestwoodPlus",
65 .AddTraceSource(
"EstimatedBW",
"The estimated bandwidth",
67 "ns3::TracedValueCallback::Double");
89 m_currentBW(sock.m_currentBW),
90 m_lastSampleBW(sock.m_lastSampleBW),
91 m_lastBW(sock.m_lastBW),
92 m_minRtt(sock.m_minRtt),
93 m_lastAck(sock.m_lastAck),
94 m_prevAckNo(sock.m_prevAckNo),
95 m_accountedFor(sock.m_accountedFor),
96 m_pType(sock.m_pType),
97 m_fType(sock.m_fType),
98 m_IsCount(sock.m_IsCount)
113 return CopyObject<TcpWestwood>(
this);
120 NS_LOG_LOGIC (
"TcpWestwood receieved ACK for seq " << seq <<
141 adder = std::max(1.0, adder);
142 m_cWnd +=
static_cast<uint32_t
>(adder);
EventId m_bwEstimateEvent
The BW estimation event for Westwood+.
int CountAck(const TcpHeader &tcpHeader)
Calculate the number of acknowledged packets upon the receipt of an ACK packet.
Simulation virtual time values and global simulation resolution.
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 "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
TracedValue< Time > m_lastRtt
Last RTT sample collected.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double m_lastBW
Last bandwidth sample after being filtered.
int m_accountedFor
The number of received DUPACKs.
TracedValue< uint32_t > m_cWnd
Congestion window.
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void DupAck(const TcpHeader &t, uint32_t count)
Received dupack (duplicate ACK)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
uint32_t m_segmentSize
Segment size.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received an ACK packet.
T Get(void) const
Get the underlying value.
TracedValue< TcpStates_t > m_state
TCP state.
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit()
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
enum FilterType m_fType
0 for none, 1 for Tustin
virtual void EstimateRtt(const TcpHeader &tcpHeader)
Take into account the packet for RTT estimation.
Hold variables of type enum.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Ptr< TcpTxBuffer > m_txBuffer
Tx buffer.
void Filtering(void)
Tustin filter.
A base class for implementation of a stream socket using TCP.
bool m_inFastRec
Currently in fast recovery if TRUE.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
void UpdateAckedSegments(int acked)
Update the total number of acknowledged packets during the current RTT.
double m_lastAck
The time last ACK was received.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
SequenceNumber32 m_prevAckNo
Previously received ACK number.
static TypeId GetTypeId(void)
Get the type ID.
static Time Now(void)
Return the current simulation virtual time.
virtual ~TcpWestwood(void)
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
int m_ackedSegments
The number of segments ACKed between RTTs.
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Process the newly received ACK.
bool m_connected
Connection established.
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
double m_lastSampleBW
Last bandwidth sample.
TracedValue< double > m_currentBW
Current value of the estimated BW.
Timeout to catch resent junk before entering closed, can only be entered from FIN_WAIT2 or CLOSING...
bool m_IsCount
Start keeping track of m_ackedSegments for Westwood+ if TRUE.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
void EstimateBW(int acked, const TcpHeader &tcpHeader, Time rtt)
Estimate the network's bandwidth.
Time m_minRtt
Minimum RTT.
EventId m_sendPendingDataEvent
micro-delay event to send pending data
a unique identifier for an interface.
virtual void EstimateRtt(const TcpHeader &header)
Estimate the RTT, record the minimum value, and run a clock on the RTT to trigger Westwood+ bandwidth...
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool SendPendingData(bool withAck=false)
Send as much pending data as possible according to the Tx window.
virtual void DoRetransmit(void)
Retransmit the oldest packet.
An implementation of a stream socket using TCP.
enum ProtocolType m_pType
0 for Westwood, 1 for Westwood+