A Discrete-Event Network Simulator
API
ns3::TcpWestwood Class Reference

An implementation of a stream socket using TCP. More...

#include "tcp-westwood.h"

+ Inheritance diagram for ns3::TcpWestwood:
+ Collaboration diagram for ns3::TcpWestwood:

Public Types

enum  FilterType { NONE, TUSTIN }
 Filter type (None or Tustin) More...
 
enum  ProtocolType { WESTWOOD, WESTWOODPLUS }
 Protocol variant (Westwood or Westwood+) More...
 
- Public Types inherited from ns3::TcpSocket
enum  TcpStates_t {
  CLOSED = 0, LISTEN, SYN_SENT, SYN_RCVD,
  ESTABLISHED, CLOSE_WAIT, LAST_ACK, FIN_WAIT_1,
  FIN_WAIT_2, CLOSING, TIME_WAIT, LAST_STATE
}
 Names of the 11 TCP states. More...
 
- Public Types inherited from ns3::Socket
enum  SocketErrno {
  ERROR_NOTERROR, ERROR_ISCONN, ERROR_NOTCONN, ERROR_MSGSIZE,
  ERROR_AGAIN, ERROR_SHUTDOWN, ERROR_OPNOTSUPP, ERROR_AFNOSUPPORT,
  ERROR_INVAL, ERROR_BADF, ERROR_NOROUTETOHOST, ERROR_NODEV,
  ERROR_ADDRNOTAVAIL, ERROR_ADDRINUSE, SOCKET_ERRNO_LAST
}
 Enumeration of the possible errors returned by a socket. More...
 
enum  SocketType { NS3_SOCK_STREAM, NS3_SOCK_SEQPACKET, NS3_SOCK_DGRAM, NS3_SOCK_RAW }
 Enumeration of the possible socket types. More...
 

Public Member Functions

 TcpWestwood (void)
 
 TcpWestwood (const TcpWestwood &sock)
 Copy constructor. More...
 
virtual ~TcpWestwood (void)
 
- Public Member Functions inherited from ns3::TcpSocketBase
 TcpSocketBase (void)
 Create an unbound TCP socket. More...
 
 TcpSocketBase (const TcpSocketBase &sock)
 Clone a TCP socket, for use upon receiving a connection request in LISTEN state. More...
 
virtual ~TcpSocketBase (void)
 
virtual int Bind (void)
 Allocate a local IPv4 endpoint for this socket. More...
 
virtual int Bind (const Address &address)
 Allocate a local endpoint for this socket. More...
 
virtual int Bind6 (void)
 Allocate a local IPv6 endpoint for this socket. More...
 
virtual void BindToNetDevice (Ptr< NetDevice > netdevice)
 Bind a socket to specific device. More...
 
virtual int Close (void)
 Close a socket. More...
 
virtual int Connect (const Address &address)
 Initiate a connection to a remote host. More...
 
Time GetClockGranularity (void) const
 Get the Clock Granularity (used in RTO calcs). More...
 
virtual enum SocketErrno GetErrno (void) const
 Get last error number. More...
 
Time GetMinRto (void) const
 Get the Minimum RTO. More...
 
virtual Ptr< NodeGetNode (void) const
 Return the node this socket is associated with. More...
 
virtual uint32_t GetRxAvailable (void) const
 Return number of bytes which can be returned from one or multiple calls to Recv. More...
 
Ptr< TcpRxBufferGetRxBuffer (void) const
 Get a pointer to the Rx buffer. More...
 
virtual enum SocketType GetSocketType (void) const
 
virtual int GetSockName (Address &address) const
 Get socket address. More...
 
virtual uint32_t GetTxAvailable (void) const
 Returns the number of bytes which can be sent in a single call to Send. More...
 
Ptr< TcpTxBufferGetTxBuffer (void) const
 Get a pointer to the Tx buffer. More...
 
virtual int Listen (void)
 Listen for incoming connections. More...
 
virtual Ptr< PacketRecv (uint32_t maxSize, uint32_t flags)
 Read data from the socket. More...
 
virtual Ptr< PacketRecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address. More...
 
virtual int Send (Ptr< Packet > p, uint32_t flags)
 Send data (or dummy data) to the remote host. More...
 
virtual int SendTo (Ptr< Packet > p, uint32_t flags, const Address &toAddress)
 Send data to a specified peer. More...
 
void SetClockGranularity (Time clockGranularity)
 Sets the Clock Granularity (used in RTO calcs). More...
 
void SetMinRto (Time minRto)
 Sets the Minimum RTO. More...
 
virtual void SetNode (Ptr< Node > node)
 Set the associated node. More...
 
virtual void SetRtt (Ptr< RttEstimator > rtt)
 Set the associated RTT estimator. More...
 
virtual void SetTcp (Ptr< TcpL4Protocol > tcp)
 Set the associated TCP L4 protocol. More...
 
virtual int ShutdownRecv (void)
 
virtual int ShutdownSend (void)
 
- Public Member Functions inherited from ns3::TcpSocket
 TcpSocket (void)
 
virtual ~TcpSocket (void)
 
- Public Member Functions inherited from ns3::Socket
 Socket (void)
 
virtual ~Socket (void)
 
Ptr< NetDeviceGetBoundNetDevice ()
 Returns socket's bound netdevice, if any. More...
 
uint8_t GetIpTos (void) const
 Query the value of IP Type of Service of this socket. More...
 
virtual uint8_t GetIpTtl (void) const
 Query the value of IP Time to Live field of this socket. More...
 
virtual uint8_t GetIpv6HopLimit (void) const
 Query the value of IP Hop Limit field of this socket. More...
 
uint8_t GetIpv6Tclass (void) const
 Query the value of IPv6 Traffic Class field of this socket. More...
 
bool IsIpRecvTos (void) const
 Ask if the socket is currently passing information about IP Type of Service up the stack. More...
 
bool IsIpRecvTtl (void) const
 Ask if the socket is currently passing information about IP_TTL up the stack. More...
 
bool IsIpv6RecvHopLimit (void) const
 Ask if the socket is currently passing information about IPv6 Hop Limit up the stack. More...
 
bool IsIpv6RecvTclass (void) const
 Ask if the socket is currently passing information about IPv6 Traffic Class up the stack. More...
 
bool IsRecvPktInfo () const
 Get status indicating whether enable/disable packet information to socket. More...
 
Ptr< PacketRecv (void)
 Read a single packet from the socket. More...
 
int Recv (uint8_t *buf, uint32_t size, uint32_t flags)
 Recv data (or dummy data) from the remote host. More...
 
Ptr< PacketRecvFrom (Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address. More...
 
int RecvFrom (uint8_t *buf, uint32_t size, uint32_t flags, Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address. More...
 
int Send (Ptr< Packet > p)
 Send data (or dummy data) to the remote host. More...
 
int Send (const uint8_t *buf, uint32_t size, uint32_t flags)
 Send data (or dummy data) to the remote host. More...
 
int SendTo (const uint8_t *buf, uint32_t size, uint32_t flags, const Address &address)
 Send data to a specified peer. More...
 
void SetAcceptCallback (Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
 Accept connection requests from remote hosts. More...
 
void SetCloseCallbacks (Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
 Detect socket recv() events such as graceful shutdown or error. More...
 
void SetConnectCallback (Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
 Specify callbacks to allow the caller to determine if the connection succeeds of fails. More...
 
void SetDataSentCallback (Callback< void, Ptr< Socket >, uint32_t > dataSent)
 Notify application when a packet has been sent from transport protocol (non-standard socket call) More...
 
void SetIpRecvTos (bool ipv4RecvTos)
 Tells a socket to pass information about IP Type of Service up the stack. More...
 
void SetIpRecvTtl (bool ipv4RecvTtl)
 Tells a socket to pass information about IP_TTL up the stack. More...
 
void SetIpTos (uint8_t ipTos)
 Manually set IP Type of Service field. More...
 
virtual void SetIpTtl (uint8_t ipTtl)
 Manually set IP Time to Live field. More...
 
virtual void SetIpv6HopLimit (uint8_t ipHopLimit)
 Manually set IPv6 Hop Limit. More...
 
void SetIpv6RecvHopLimit (bool ipv6RecvHopLimit)
 Tells a socket to pass information about IPv6 Hop Limit up the stack. More...
 
void SetIpv6RecvTclass (bool ipv6RecvTclass)
 Tells a socket to pass information about IPv6 Traffic Class up the stack. More...
 
void SetIpv6Tclass (int ipTclass)
 Manually set IPv6 Traffic Class field. More...
 
void SetRecvCallback (Callback< void, Ptr< Socket > >)
 Notify application when new data is available to be read. More...
 
void SetRecvPktInfo (bool flag)
 Enable/Disable receive packet information to socket. More...
 
void SetSendCallback (Callback< void, Ptr< Socket >, uint32_t > sendCb)
 Notify application when space in transmit buffer is added. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Implement the GetInstanceTypeId method defined in ObjectBase. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::TcpSocketBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::TcpSocket
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Socket
static Ptr< SocketCreateSocket (Ptr< Node > node, TypeId tid)
 This method wraps the creation of sockets that is performed on a given node by a SocketFactory specified by TypeId. More...
 
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

virtual void DupAck (const TcpHeader &t, uint32_t count)
 Received dupack (duplicate ACK) More...
 
virtual void EstimateRtt (const TcpHeader &header)
 Estimate the RTT, record the minimum value, and run a clock on the RTT to trigger Westwood+ bandwidth sampling. More...
 
virtual Ptr< TcpSocketBaseFork (void)
 Call CopyObject<> to clone me. More...
 
virtual void NewAck (SequenceNumber32 const &seq)
 Update buffers w.r.t. More...
 
virtual void ReceivedAck (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Process the newly received ACK. More...
 
virtual void Retransmit (void)
 Halving cwnd and call DoRetransmit() More...
 
- Protected Member Functions inherited from ns3::TcpSocketBase
virtual void AddOptions (TcpHeader &tcpHeader)
 Add options to TcpHeader. More...
 
void AddOptionTimestamp (TcpHeader &header)
 Add the timestamp option to the header. More...
 
void AddOptionWScale (TcpHeader &header)
 Add the window scale option to the header. More...
 
virtual uint16_t AdvertisedWindowSize (void)
 The amount of Rx window announced to the peer. More...
 
virtual uint32_t AvailableWindow (void)
 Return unfilled portion of window. More...
 
virtual uint32_t BytesInFlight (void)
 Return total bytes in flight. More...
 
uint8_t CalculateWScale () const
 Calculate window scale value based on receive buffer space. More...
 
void CancelAllTimers (void)
 Cancel all timer when endpoint is deleted. More...
 
void CloseAndNotify (void)
 Peacefully close the socket by notifying the upper layer and deallocate end point. More...
 
void CompleteFork (Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Complete a connection by forking the socket. More...
 
void ConnectionSucceeded (void)
 Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded() More...
 
void DeallocateEndPoint (void)
 Deallocate m_endPoint and m_endPoint6. More...
 
virtual void DelAckTimeout (void)
 Action upon delay ACK timeout, i.e. More...
 
void Destroy (void)
 Kill this socket by zeroing its attributes (IPv4) More...
 
void Destroy6 (void)
 Kill this socket by zeroing its attributes (IPv6) More...
 
int DoClose (void)
 Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state. More...
 
int DoConnect (void)
 Perform the real connection tasks: Send SYN if allowed, RST if invalid. More...
 
virtual void DoForwardUp (Ptr< Packet > packet, const Address &fromAddress, const Address &toAddress)
 Called by TcpSocketBase::ForwardUp{,6}(). More...
 
void DoPeerClose (void)
 FIN is in sequence, notify app and respond with a FIN. More...
 
virtual void DoRetransmit (void)
 Retransmit the oldest packet. More...
 
void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
 Called by the L3 protocol when it received an ICMP packet to pass on to TCP. More...
 
void ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
 Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP. More...
 
void ForwardUp (Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface)
 Called by the L3 protocol when it received a packet to pass on to TCP. More...
 
void ForwardUp6 (Ptr< Packet > packet, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
 Called by the L3 protocol when it received a packet to pass on to TCP. More...
 
virtual bool GetAllowBroadcast (void) const
 Query whether broadcast datagram transmissions are allowed. More...
 
virtual uint32_t GetConnCount (void) const
 Get the number of connection retries before giving up. More...
 
virtual Time GetConnTimeout (void) const
 Get the connection timeout. More...
 
virtual uint32_t GetDelAckMaxCount (void) const
 Get the number of packet to fire an ACK before delay timeout. More...
 
virtual Time GetDelAckTimeout (void) const
 Get the time to delay an ACK. More...
 
virtual uint32_t GetInitialCwnd (void) const
 Get the initial Congestion Window. More...
 
virtual uint32_t GetInitialSSThresh (void) const
 Get the initial Slow Start Threshold. More...
 
virtual Time GetPersistTimeout (void) const
 Get the timout for persistent connection. More...
 
virtual uint32_t GetRcvBufSize (void) const
 Get the receive buffer size. More...
 
virtual uint32_t GetSegSize (void) const
 Get the segment size. More...
 
virtual uint32_t GetSndBufSize (void) const
 Get the send buffer size. More...
 
virtual bool GetTcpNoDelay (void) const
 Check if Nagle's algorithm is enabled or not. More...
 
virtual void InitializeCwnd ()
 Initialize congestion window. More...
 
virtual void LastAckTimeout (void)
 Timeout at LAST_ACK, close the connection. More...
 
bool OutOfRange (SequenceNumber32 head, SequenceNumber32 tail) const
 Check if a sequence number range is within the rx window. More...
 
void PeerClose (Ptr< Packet > p, const TcpHeader &tcpHeader)
 Received a FIN from peer, notify rx buffer. More...
 
virtual void PersistTimeout (void)
 Send 1 byte probe to get an updated window size. More...
 
void ProcessClosing (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon CLOSING. More...
 
void ProcessEstablished (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon ESTABLISHED state. More...
 
void ProcessLastAck (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon LAST_ACK. More...
 
void ProcessListen (Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Received a packet upon LISTEN state. More...
 
void ProcessOptionTimestamp (const Ptr< const TcpOption > option)
 Process the timestamp option from other side. More...
 
void ProcessOptionWScale (const Ptr< const TcpOption > option)
 Read and parse the Window scale option. More...
 
void ProcessSynRcvd (Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Received a packet upon SYN_RCVD. More...
 
void ProcessSynSent (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon SYN_SENT. More...
 
void ProcessWait (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon CLOSE_WAIT, FIN_WAIT_1, FIN_WAIT_2. More...
 
virtual void ReadOptions (const TcpHeader &tcpHeader)
 Read TCP options from incoming packets. More...
 
virtual void ReceivedData (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Recv of a data, put into buffer, call L7 to get it if necessary. More...
 
virtual void ReTxTimeout (void)
 Call Retransmit() upon RTO event. More...
 
virtual void ScaleSsThresh (uint8_t scaleFactor)
 Scale the initial SsThresh value to the correct one. More...
 
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. More...
 
void SendEmptyPacket (uint8_t flags)
 Send a empty packet that carries a flag, e.g. More...
 
bool SendPendingData (bool withAck=false)
 Send as much pending data as possible according to the Tx window. More...
 
void SendRST (void)
 Send reset and tear down this socket. More...
 
virtual bool SetAllowBroadcast (bool allowBroadcast)
 Configure whether broadcast datagram transmissions are allowed. More...
 
virtual void SetConnCount (uint32_t count)
 Set the number of connection retries before giving up. More...
 
virtual void SetConnTimeout (Time timeout)
 Set the connection timeout. More...
 
virtual void SetDelAckMaxCount (uint32_t count)
 Set the number of packet to fire an ACK before delay timeout. More...
 
virtual void SetDelAckTimeout (Time timeout)
 Set the time to delay an ACK. More...
 
virtual void SetInitialCwnd (uint32_t cwnd)
 Set the initial Congestion Window. More...
 
virtual void SetInitialSSThresh (uint32_t threshold)
 Set the initial Slow Start Threshold. More...
 
virtual void SetPersistTimeout (Time timeout)
 Set the timout for persistent connection. More...
 
virtual void SetRcvBufSize (uint32_t size)
 Set the receive buffer size. More...
 
virtual void SetSegSize (uint32_t size)
 Set the segment size. More...
 
virtual void SetSndBufSize (uint32_t size)
 Set the send buffer size. More...
 
virtual void SetTcpNoDelay (bool noDelay)
 Enable/Disable Nagle's algorithm. More...
 
int SetupCallback (void)
 Common part of the two Bind(), i.e. More...
 
int SetupEndpoint (void)
 Configure the endpoint to a local address. More...
 
int SetupEndpoint6 (void)
 Configure the endpoint v6 to a local address. More...
 
void TimeWait (void)
 Move from CLOSING or FIN_WAIT_2 to TIME_WAIT state. More...
 
virtual uint32_t UnAckDataCount (void)
 Return count of number of unacked bytes. More...
 
void UpdateWindowSize (const TcpHeader &header)
 Update the receiver window (RWND) based on the value of the window field in the header. More...
 
virtual uint32_t Window (void)
 Return the max possible number of unacked bytes. More...
 
- Protected Member Functions inherited from ns3::Socket
virtual void DoDispose (void)
 Destructor implementation. More...
 
bool IsManualIpTos (void) const
 Checks if the socket has a specific IPv4 ToS set. More...
 
bool IsManualIpTtl (void) const
 Checks if the socket has a specific IPv4 TTL set. More...
 
bool IsManualIpv6HopLimit (void) const
 Checks if the socket has a specific IPv6 Hop Limit set. More...
 
bool IsManualIpv6Tclass (void) const
 Checks if the socket has a specific IPv6 Tclass set. More...
 
void NotifyConnectionFailed (void)
 Notify through the callback (if set) that the connection has not been established due to an error. More...
 
bool NotifyConnectionRequest (const Address &from)
 Notify through the callback (if set) that an incoming connection is being requested by a remote host. More...
 
void NotifyConnectionSucceeded (void)
 Notify through the callback (if set) that the connection has been established. More...
 
void NotifyDataRecv (void)
 Notify through the callback (if set) that some data have been received. More...
 
void NotifyDataSent (uint32_t size)
 Notify through the callback (if set) that some data have been sent. More...
 
void NotifyErrorClose (void)
 Notify through the callback (if set) that the connection has been closed due to an error. More...
 
void NotifyNewConnectionCreated (Ptr< Socket > socket, const Address &from)
 Notify through the callback (if set) that a new connection has been created. More...
 
void NotifyNormalClose (void)
 Notify through the callback (if set) that the connection has been closed. More...
 
void NotifySend (uint32_t spaceAvailable)
 Notify through the callback (if set) that some data have been sent. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Protected Attributes

int m_accountedFor
 The number of received DUPACKs. More...
 
int m_ackedSegments
 The number of segments ACKed between RTTs. More...
 
EventId m_bwEstimateEvent
 The BW estimation event for Westwood+. More...
 
TracedValue< double > m_currentBW
 Current value of the estimated BW. More...
 
enum FilterType m_fType
 0 for none, 1 for Tustin More...
 
bool m_inFastRec
 Currently in fast recovery if TRUE. More...
 
bool m_IsCount
 Start keeping track of m_ackedSegments for Westwood+ if TRUE. More...
 
double m_lastAck
 The time last ACK was received. More...
 
double m_lastBW
 Last bandwidth sample after being filtered. More...
 
double m_lastSampleBW
 Last bandwidth sample. More...
 
Time m_minRtt
 Minimum RTT. More...
 
SequenceNumber32 m_prevAckNo
 Previously received ACK number. More...
 
enum ProtocolType m_pType
 0 for Westwood, 1 for Westwood+ More...
 
- Protected Attributes inherited from ns3::TcpSocketBase
Time m_clockGranularity
 Clock Granularity used in RTO calcs. More...
 
bool m_closeNotified
 Told app to close socket. More...
 
bool m_closeOnEmpty
 Close socket upon tx buffer emptied. More...
 
uint32_t m_cnCount
 Count of remaining connection retries. More...
 
uint32_t m_cnRetries
 Number of connection retries before giving up. More...
 
Time m_cnTimeout
 Timeout for connection retry. More...
 
bool m_connected
 Connection established. More...
 
TracedValue< uint32_t > m_cWnd
 Congestion window. More...
 
uint32_t m_delAckCount
 Delayed ACK counter. More...
 
EventId m_delAckEvent
 Delayed ACK timeout event. More...
 
uint32_t m_delAckMaxCount
 Number of packet to fire an ACK before delay timeout. More...
 
Time m_delAckTimeout
 Time to delay an ACK. More...
 
uint32_t m_dupAckCount
 Dupack counter. More...
 
Ipv4EndPointm_endPoint
 the IPv4 endpoint More...
 
Ipv6EndPointm_endPoint6
 the IPv6 endpoint More...
 
enum SocketErrno m_errno
 Socket error code. More...
 
TracedValue< SequenceNumber32m_highRxAckMark
 Highest ack received. More...
 
TracedValue< SequenceNumber32m_highRxMark
 Highest seqno received. More...
 
TracedValue< SequenceNumber32m_highTxMark
 Highest seqno ever sent, regardless of ReTx. More...
 
RttHistory_t m_history
 List of sent packet. More...
 
Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
 ICMP callback. More...
 
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback6
 ICMPv6 callback. More...
 
uint32_t m_initialCWnd
 Initial cWnd value. More...
 
uint32_t m_initialSsThresh
 Initial Slow Start Threshold value. More...
 
EventId m_lastAckEvent
 Last ACK timeout event. More...
 
TracedValue< Timem_lastRtt
 Last RTT sample collected. More...
 
uint16_t m_maxWinSize
 Maximum window size to advertise. More...
 
Time m_minRto
 minimum value of the Retransmit timeout More...
 
double m_msl
 Max segment lifetime. More...
 
TracedValue< SequenceNumber32m_nextTxSequence
 Next seqnum to be sent (SND.NXT), ReTx pushes it back. More...
 
Ptr< Nodem_node
 the associated node More...
 
bool m_noDelay
 Set to true to disable Nagle's algorithm. More...
 
EventId m_persistEvent
 Persist event: Send 1 byte to probe for a non-zero Rx window. More...
 
Time m_persistTimeout
 Time between sending 1-byte probes. More...
 
uint8_t m_rcvScaleFactor
 Received Window Scale (i.e., the one of the peer) More...
 
EventId m_retxEvent
 Retransmission event. More...
 
TracedValue< Timem_rto
 Retransmit timeout. More...
 
Ptr< RttEstimatorm_rtt
 Round trip time estimator. More...
 
TracedValue< uint32_t > m_rWnd
 Receiver window (RCV.WND in RFC793) More...
 
Ptr< TcpRxBufferm_rxBuffer
 Rx buffer (reordering buffer) More...
 
uint32_t m_segmentSize
 Segment size. More...
 
EventId m_sendPendingDataEvent
 micro-delay event to send pending data More...
 
bool m_shutdownRecv
 Receive no longer allowed. More...
 
bool m_shutdownSend
 Send no longer allowed. More...
 
uint8_t m_sndScaleFactor
 Sent Window Scale (i.e., the one of the node) More...
 
TracedValue< uint32_t > m_ssThresh
 Slow start threshold. More...
 
TracedValue< TcpStates_tm_state
 TCP state. More...
 
Ptr< TcpL4Protocolm_tcp
 the associated TCP L4 protocol More...
 
bool m_timestampEnabled
 Timestamp option enabled. More...
 
uint32_t m_timestampToEcho
 Timestamp to echo. More...
 
EventId m_timewaitEvent
 TIME_WAIT expiration event: Move this socket to CLOSED state. More...
 
Ptr< TcpTxBufferm_txBuffer
 Tx buffer. More...
 
bool m_winScalingEnabled
 Window Scale option enabled. More...
 
- Protected Attributes inherited from ns3::Socket
Ptr< NetDevicem_boundnetdevice
 the device this socket is bound to (might be null). More...
 
bool m_recvPktInfo
 if the socket should add packet info tags to the packet forwarded to L4. More...
 

Private Member Functions

int CountAck (const TcpHeader &tcpHeader)
 Calculate the number of acknowledged packets upon the receipt of an ACK packet. More...
 
void EstimateBW (int acked, const TcpHeader &tcpHeader, Time rtt)
 Estimate the network's bandwidth. More...
 
void Filtering (void)
 Tustin filter. More...
 
void UpdateAckedSegments (int acked)
 Update the total number of acknowledged packets during the current RTT. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ns3::TcpSocket
static const char *const TcpStateName [TcpSocket::LAST_STATE]
 Literal names of TCP states for use in log messages. More...
 

Detailed Description

An implementation of a stream socket using TCP.

This class contains the implementation of TCP Westwood and Westwood+.

Westwood and Westwood+ employ the AIAD (Additive Increase/Adaptive Decrease) congestion control paradigm. When a congestion episode happens, instead of halving the cwnd, these protocols try to estimate the network's bandwidth and use the estimated value to adjust the cwnd. While Westwood performs the bandwidth sampling every ACK reception, Westwood+ samples the bandwidth every RTT.

The two main methods in the implementation are the CountAck (const TCPHeader&) and the EstimateBW (int, const, Time). The CountAck method calculates the number of acknowledged segments on the receipt of an ACK. The EstimateBW estimates the bandwidth based on the value returned by CountAck and the sampling interval (last ACK inter-arrival time for Westwood and last RTT for Westwood+).

Config Paths

ns3::TcpWestwood is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/$ns3::TcpL4Protocol/SocketList/[i]/$ns3::TcpWestwood"

Attributes

  • FilterType: Use this to choose no filter or Tustin's approximation filter
    • Set with class: ns3::EnumValue
    • Underlying type:
    • Initial value: Tustin
    • Flags: construct write read
  • ProtocolType: Use this to let the code run as Westwood or WestwoodPlus
    • Set with class: ns3::EnumValue
    • Underlying type:
    • Initial value: Westwood
    • Flags: construct write read

Attributes defined in parent class ns3::TcpSocketBase

  • MaxSegLifetime: Maximum segment lifetime in seconds, use for TIME_WAIT state transition to CLOSED state
    • Set with class: ns3::DoubleValue
    • Underlying type: double 0:1.79769e+308
    • Initial value: 120
    • Flags: construct write read
  • MaxWindowSize: Max size of advertised window
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 65535
    • Flags: construct write read
  • IcmpCallback: Callback invoked whenever an icmp error is received on this socket.
  • IcmpCallback6: Callback invoked whenever an icmpv6 error is received on this socket.
  • WindowScaling: Enable or disable Window Scaling option
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • Timestamp: Enable or disable Timestamp option
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • MinRto: Minimum retransmit timeout value
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +1000000000.0ns
    • Flags: construct write read
  • ClockGranularity: Clock Granularity used in RTO calculations
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +1000000.0ns
    • Flags: construct write read
  • TxBuffer: TCP Tx buffer
  • RxBuffer: TCP Rx buffer

Attributes defined in parent class ns3::TcpSocket

  • SndBufSize: TcpSocket maximum transmit buffer size (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 131072
    • Flags: construct write read
  • RcvBufSize: TcpSocket maximum receive buffer size (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 131072
    • Flags: construct write read
  • SegmentSize: TCP maximum segment size in bytes (may be adjusted based on MTU discovery)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 536
    • Flags: construct write read
  • InitialSlowStartThreshold: TCP initial slow start threshold (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 65535
    • Flags: construct write read
  • InitialCwnd: TCP initial congestion window size (segments)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 1
    • Flags: construct write read
  • ConnTimeout: TCP retransmission timeout when opening connection (seconds)
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +3000000000.0ns
    • Flags: construct write read
  • ConnCount: Number of connection attempts (SYN retransmissions) before returning failure
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 6
    • Flags: construct write read
  • DelAckTimeout: Timeout value for TCP delayed acks, in seconds
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +200000000.0ns
    • Flags: construct write read
  • DelAckCount: Number of packets to wait before sending a TCP ack
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 2
    • Flags: construct write read
  • TcpNoDelay: Set to true to disable Nagle's algorithm
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • PersistTimeout: Persist timeout to probe for rx window
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +6000000000.0ns
    • Flags: construct write read

TraceSources

TraceSources defined in parent class ns3::TcpSocketBase

  • RTO: Retransmission timeout
    Callback signature: ns3::Time::TracedValueCallback
  • RTT: Last RTT sample
    Callback signature: ns3::Time::TracedValueCallback
  • NextTxSequence: Next sequence number to send (SND.NXT)
    Callback signature: ns3::SequenceNumber32TracedValueCallback
  • HighestSequence: Highest sequence number ever sent in socket's life time
    Callback signature: ns3::SequenceNumber32TracedValueCallback
  • State: TCP state
    Callback signature: ns3::TcpStatesTracedValueCallback
  • RWND: Remote side's flow control window
    Callback signature: ns3::TracedValueCallback::Uint32
  • HighestRxSequence: Highest sequence number received from peer
    Callback signature: ns3::SequenceNumber32TracedValueCallback
  • HighestRxAck: Highest ack received from peer
    Callback signature: ns3::SequenceNumber32TracedValueCallback
  • CongestionWindow: The TCP connection's congestion window
    Callback signature: ns3::TracedValueCallback::Uint32
  • SlowStartThreshold: TCP slow start threshold (bytes)
    Callback signature: ns3::TracedValueCallback::Uint32

Size of this type is 896 bytes (on a 64-bit architecture).

Definition at line 62 of file tcp-westwood.h.

Constructor & Destructor Documentation

ns3::TcpWestwood::TcpWestwood ( void  )

Definition at line 71 of file tcp-westwood.cc.

References NS_LOG_FUNCTION.

ns3::TcpWestwood::TcpWestwood ( const TcpWestwood sock)

Copy constructor.

Parameters
sockthe object to copy

Definition at line 86 of file tcp-westwood.cc.

References m_minRtt, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.

ns3::TcpWestwood::~TcpWestwood ( void  )
virtual

Definition at line 105 of file tcp-westwood.cc.

Member Function Documentation

int ns3::TcpWestwood::CountAck ( const TcpHeader tcpHeader)
private

Calculate the number of acknowledged packets upon the receipt of an ACK packet.

Parameters
tcpHeaderthe header of the received ACK packet
Returns
the number of ACKed packets

Definition at line 202 of file tcp-westwood.cc.

References ns3::TcpHeader::GetAckNumber(), m_accountedFor, m_prevAckNo, ns3::TcpSocketBase::m_segmentSize, and NS_LOG_FUNCTION.

Referenced by ReceivedAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpWestwood::DupAck ( const TcpHeader tcpHeader,
uint32_t  count 
)
protectedvirtual
void ns3::TcpWestwood::EstimateBW ( int  acked,
const TcpHeader tcpHeader,
Time  rtt 
)
private

Estimate the network's bandwidth.

Parameters
ackedthe number of acknowledged packets returned by CountAck
tcpHeaderthe header of the packet
rttthe RTT estimation

Definition at line 176 of file tcp-westwood.cc.

References Filtering(), ns3::Time::GetSeconds(), m_ackedSegments, m_currentBW, m_IsCount, m_lastAck, m_pType, ns3::TcpSocketBase::m_segmentSize, ns3::Simulator::Now(), NS_LOG_FUNCTION, WESTWOOD, and WESTWOODPLUS.

Referenced by EstimateRtt(), and ReceivedAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpWestwood::EstimateRtt ( const TcpHeader header)
protectedvirtual

Estimate the RTT, record the minimum value, and run a clock on the RTT to trigger Westwood+ bandwidth sampling.

Parameters
headerthe packet header

Reimplemented from ns3::TcpSocketBase.

Definition at line 297 of file tcp-westwood.cc.

References ns3::EventId::Cancel(), ns3::TcpSocket::ESTABLISHED, EstimateBW(), ns3::TcpSocketBase::EstimateRtt(), m_ackedSegments, m_bwEstimateEvent, m_IsCount, ns3::TcpSocketBase::m_lastRtt, m_minRtt, m_pType, ns3::TcpSocketBase::m_state, NS_LOG_FUNCTION_NOARGS, ns3::Simulator::Schedule(), and WESTWOODPLUS.

+ Here is the call graph for this function:

void ns3::TcpWestwood::Filtering ( void  )
private

Tustin filter.

Definition at line 331 of file tcp-westwood.cc.

References m_currentBW, m_fType, m_lastBW, m_lastSampleBW, NONE, NS_LOG_FUNCTION, and TUSTIN.

Referenced by EstimateBW().

+ Here is the caller graph for this function:

Ptr< TcpSocketBase > ns3::TcpWestwood::Fork ( void  )
protectedvirtual

Call CopyObject<> to clone me.

Returns
a copy of the socket

Implements ns3::TcpSocketBase.

Definition at line 110 of file tcp-westwood.cc.

References NS_LOG_FUNCTION.

TypeId ns3::TcpWestwood::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 52 of file tcp-westwood.cc.

References m_currentBW, m_fType, m_pType, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTraceSourceAccessor(), NONE, ns3::TypeId::SetParent(), TUSTIN, WESTWOOD, and WESTWOODPLUS.

+ Here is the call graph for this function:

void ns3::TcpWestwood::NewAck ( SequenceNumber32 const &  seq)
protectedvirtual

Update buffers w.r.t.

ACK

Parameters
seqthe sequence number

Reimplemented from ns3::TcpSocketBase.

Definition at line 117 of file tcp-westwood.cc.

References ns3::TracedValue< T >::Get(), ns3::TcpSocketBase::m_cWnd, m_inFastRec, ns3::TcpSocketBase::m_segmentSize, ns3::TcpSocketBase::m_ssThresh, ns3::TcpSocketBase::NewAck(), NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

void ns3::TcpWestwood::ReceivedAck ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protectedvirtual

Process the newly received ACK.

Parameters
packetthe received ACK packet
tcpHeaderthe header attached to the ACK packet

Reimplemented from ns3::TcpSocketBase.

Definition at line 151 of file tcp-westwood.cc.

References ns3::TcpHeader::ACK, CountAck(), EstimateBW(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), m_IsCount, m_prevAckNo, m_pType, NS_LOG_FUNCTION, ns3::TcpSocketBase::ReceivedAck(), UpdateAckedSegments(), WESTWOOD, and WESTWOODPLUS.

+ Here is the call graph for this function:

void ns3::TcpWestwood::UpdateAckedSegments ( int  acked)
private

Update the total number of acknowledged packets during the current RTT.

Parameters
ackedthe number of packets the currently received ACK acknowledges

Definition at line 236 of file tcp-westwood.cc.

References m_ackedSegments.

Referenced by ReceivedAck().

+ Here is the caller graph for this function:

Member Data Documentation

int ns3::TcpWestwood::m_accountedFor
protected

The number of received DUPACKs.

Definition at line 157 of file tcp-westwood.h.

Referenced by CountAck().

int ns3::TcpWestwood::m_ackedSegments
protected

The number of segments ACKed between RTTs.

Definition at line 161 of file tcp-westwood.h.

Referenced by EstimateBW(), EstimateRtt(), and UpdateAckedSegments().

EventId ns3::TcpWestwood::m_bwEstimateEvent
protected

The BW estimation event for Westwood+.

Definition at line 163 of file tcp-westwood.h.

Referenced by EstimateRtt().

TracedValue<double> ns3::TcpWestwood::m_currentBW
protected

Current value of the estimated BW.

Definition at line 151 of file tcp-westwood.h.

Referenced by DupAck(), EstimateBW(), Filtering(), GetTypeId(), and Retransmit().

enum FilterType ns3::TcpWestwood::m_fType
protected

0 for none, 1 for Tustin

Definition at line 159 of file tcp-westwood.h.

Referenced by Filtering(), and GetTypeId().

bool ns3::TcpWestwood::m_inFastRec
protected

Currently in fast recovery if TRUE.

Definition at line 149 of file tcp-westwood.h.

Referenced by DupAck(), NewAck(), and Retransmit().

bool ns3::TcpWestwood::m_IsCount
protected

Start keeping track of m_ackedSegments for Westwood+ if TRUE.

Definition at line 162 of file tcp-westwood.h.

Referenced by EstimateBW(), EstimateRtt(), and ReceivedAck().

double ns3::TcpWestwood::m_lastAck
protected

The time last ACK was received.

Definition at line 155 of file tcp-westwood.h.

Referenced by EstimateBW().

double ns3::TcpWestwood::m_lastBW
protected

Last bandwidth sample after being filtered.

Definition at line 153 of file tcp-westwood.h.

Referenced by Filtering().

double ns3::TcpWestwood::m_lastSampleBW
protected

Last bandwidth sample.

Definition at line 152 of file tcp-westwood.h.

Referenced by Filtering().

Time ns3::TcpWestwood::m_minRtt
protected

Minimum RTT.

Definition at line 154 of file tcp-westwood.h.

Referenced by DupAck(), EstimateRtt(), Retransmit(), and TcpWestwood().

SequenceNumber32 ns3::TcpWestwood::m_prevAckNo
protected

Previously received ACK number.

Definition at line 156 of file tcp-westwood.h.

Referenced by CountAck(), and ReceivedAck().

enum ProtocolType ns3::TcpWestwood::m_pType
protected

0 for Westwood, 1 for Westwood+

Definition at line 158 of file tcp-westwood.h.

Referenced by EstimateBW(), EstimateRtt(), GetTypeId(), and ReceivedAck().


The documentation for this class was generated from the following files: