A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::TcpSocketBase Class Reference

A base class for implementation of a stream socket using TCP. More...

#include "tcp-socket-base.h"

+ Inheritance diagram for ns3::TcpSocketBase:
+ Collaboration diagram for ns3::TcpSocketBase:

Public Types

typedef void(* TcpTxRxTracedCallback) (const Ptr< const Packet > packet, const TcpHeader &header, const Ptr< const TcpSocketBase > socket)
 TracedCallback signature for tcp packet transmission or reception events.
 
- 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  Ipv6MulticastFilterMode { INCLUDE = 1 , EXCLUDE }
 Enumeration of the possible filter of a socket. More...
 
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  SocketPriority {
  NS3_PRIO_BESTEFFORT = 0 , NS3_PRIO_FILLER = 1 , NS3_PRIO_BULK = 2 , NS3_PRIO_INTERACTIVE_BULK = 4 ,
  NS3_PRIO_INTERACTIVE = 6 , NS3_PRIO_CONTROL = 7
}
 Enumeration of the possible socket priorities. 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

 TcpSocketBase ()
 Create an unbound TCP socket.
 
 TcpSocketBase (const TcpSocketBase &sock)
 Clone a TCP socket, for use upon receiving a connection request in LISTEN state.
 
 ~TcpSocketBase () override
 
int Bind () override
 Allocate a local IPv4 endpoint for this socket.
 
int Bind (const Address &address) override
 Allocate a local endpoint for this socket.
 
int Bind6 () override
 Allocate a local IPv6 endpoint for this socket.
 
void BindToNetDevice (Ptr< NetDevice > netdevice) override
 Bind a socket to specific device.
 
bool CheckEcnCe (uint8_t tos) const
 Checks for CE codepoint.
 
bool CheckEcnEct0 (uint8_t tos) const
 Checks for ECT(0) codepoint.
 
bool CheckEcnEct1 (uint8_t tos) const
 Checks for ECT(1) codepoint.
 
bool CheckNoEcn (uint8_t tos) const
 Checks if TOS has no ECN codepoints.
 
uint8_t ClearEcnBits (uint8_t tos) const
 Clears ECN bits from TOS.
 
int Close () override
 Close a socket.
 
int Connect (const Address &address) override
 Initiate a connection to a remote host.
 
Time GetClockGranularity () const
 Get the Clock Granularity (used in RTO calcs).
 
SocketErrno GetErrno () const override
 Get last error number.
 
TypeId GetInstanceTypeId () const override
 Get the instance TypeId.
 
Time GetMinRto () const
 Get the Minimum RTO.
 
Ptr< NodeGetNode () const override
 Return the node this socket is associated with.
 
int GetPeerName (Address &address) const override
 Get the peer address of a connected socket.
 
uint32_t GetRetxThresh () const
 Get the retransmission threshold (dup ack threshold for a fast retransmit)
 
uint32_t GetRxAvailable () const override
 Return number of bytes which can be returned from one or multiple calls to Recv.
 
Ptr< TcpRxBufferGetRxBuffer () const
 Get a pointer to the Rx buffer.
 
SocketType GetSocketType () const override
 
int GetSockName (Address &address) const override
 Get socket address.
 
uint32_t GetTxAvailable () const override
 Returns the number of bytes which can be sent in a single call to Send.
 
Ptr< TcpTxBufferGetTxBuffer () const
 Get a pointer to the Tx buffer.
 
int Listen () override
 Listen for incoming connections.
 
uint8_t MarkEcnCe (uint8_t tos) const
 Mark CE codepoint.
 
uint8_t MarkEcnCodePoint (const uint8_t tos, const TcpSocketState::EcnCodePoint_t codePoint) const
 mark ECN code point
 
uint8_t MarkEcnEct0 (uint8_t tos) const
 Mark ECT(0) codepoint.
 
uint8_t MarkEcnEct1 (uint8_t tos) const
 Mark ECT(1) codepoint.
 
Ptr< PacketRecv (uint32_t maxSize, uint32_t flags) override
 Read data from the socket.
 
Ptr< PacketRecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) override
 Read a single packet from the socket and retrieve the sender address.
 
int Send (Ptr< Packet > p, uint32_t flags) override
 Send data (or dummy data) to the remote host.
 
int SendTo (Ptr< Packet > p, uint32_t flags, const Address &toAddress) override
 Send data to a specified peer.
 
void SetClockGranularity (Time clockGranularity)
 Sets the Clock Granularity (used in RTO calcs).
 
void SetCongestionControlAlgorithm (Ptr< TcpCongestionOps > algo)
 Install a congestion control algorithm on this socket.
 
void SetMinRto (Time minRto)
 Sets the Minimum RTO.
 
virtual void SetNode (Ptr< Node > node)
 Set the associated node.
 
void SetPaceInitialWindow (bool paceWindow)
 Enable or disable pacing of the initial window.
 
void SetPacingStatus (bool pacing)
 Enable or disable pacing.
 
void SetRecoveryAlgorithm (Ptr< TcpRecoveryOps > recovery)
 Install a recovery algorithm on this socket.
 
void SetRetxThresh (uint32_t retxThresh)
 Set the retransmission threshold (dup ack threshold for a fast retransmit)
 
virtual void SetRtt (Ptr< RttEstimator > rtt)
 Set the associated RTT estimator.
 
virtual void SetTcp (Ptr< TcpL4Protocol > tcp)
 Set the associated TCP L4 protocol.
 
void SetUseEcn (TcpSocketState::UseEcn_t useEcn)
 Set ECN mode of use on the socket.
 
int ShutdownRecv () override
 
int ShutdownSend () override
 
void UpdateBytesInFlight (uint32_t oldValue, uint32_t newValue) const
 Callback function to hook to TcpSocketState bytes inflight.
 
void UpdateCongState (TcpSocketState::TcpCongState_t oldValue, TcpSocketState::TcpCongState_t newValue) const
 Callback function to hook to TcpSocketState congestion state.
 
void UpdateCwnd (uint32_t oldValue, uint32_t newValue) const
 Callback function to hook to TcpSocketState congestion window.
 
void UpdateCwndInfl (uint32_t oldValue, uint32_t newValue) const
 Callback function to hook to TcpSocketState inflated congestion window.
 
void UpdateEcnState (TcpSocketState::EcnState_t oldValue, TcpSocketState::EcnState_t newValue) const
 Callback function to hook to EcnState state.
 
void UpdateHighTxMark (SequenceNumber32 oldValue, SequenceNumber32 newValue) const
 Callback function to hook to TcpSocketState high tx mark.
 
void UpdateNextTxSequence (SequenceNumber32 oldValue, SequenceNumber32 newValue) const
 Callback function to hook to TcpSocketState next tx sequence.
 
void UpdatePacingRateTrace (DataRate oldValue, DataRate newValue) const
 Callback function to hook to TcpSocketState pacing rate.
 
void UpdateRtt (Time oldValue, Time newValue) const
 Callback function to hook to TcpSocketState rtt.
 
void UpdateSsThresh (uint32_t oldValue, uint32_t newValue) const
 Callback function to hook to TcpSocketState slow start threshold.
 
- Public Member Functions inherited from ns3::TcpSocket
 TcpSocket ()
 
 ~TcpSocket () override
 
- Public Member Functions inherited from ns3::Socket
 Socket ()
 
 ~Socket () override
 
virtual int Bind ()=0
 Allocate a local IPv4 endpoint for this socket.
 
virtual int Bind (const Address &address)=0
 Allocate a local endpoint for this socket.
 
virtual int Bind6 ()=0
 Allocate a local IPv6 endpoint for this socket.
 
virtual void BindToNetDevice (Ptr< NetDevice > netdevice)
 Bind a socket to specific device.
 
virtual int Close ()=0
 Close a socket.
 
virtual int Connect (const Address &address)=0
 Initiate a connection to a remote host.
 
virtual bool GetAllowBroadcast () const =0
 Query whether broadcast datagram transmissions are allowed.
 
Ptr< NetDeviceGetBoundNetDevice ()
 Returns socket's bound NetDevice, if any.
 
virtual Socket::SocketErrno GetErrno () const =0
 Get last error number.
 
uint8_t GetIpTos () const
 Query the value of IP Type of Service of this socket.
 
virtual uint8_t GetIpTtl () const
 Query the value of IP Time to Live field of this socket.
 
virtual uint8_t GetIpv6HopLimit () const
 Query the value of IP Hop Limit field of this socket.
 
uint8_t GetIpv6Tclass () const
 Query the value of IPv6 Traffic Class field of this socket.
 
virtual Ptr< NodeGetNode () const =0
 Return the node this socket is associated with.
 
virtual int GetPeerName (Address &address) const =0
 Get the peer address of a connected socket.
 
uint8_t GetPriority () const
 Query the priority value of this socket.
 
virtual uint32_t GetRxAvailable () const =0
 Return number of bytes which can be returned from one or multiple calls to Recv.
 
virtual Socket::SocketType GetSocketType () const =0
 
virtual int GetSockName (Address &address) const =0
 Get socket address.
 
virtual uint32_t GetTxAvailable () const =0
 Returns the number of bytes which can be sent in a single call to Send.
 
virtual void Ipv6JoinGroup (Ipv6Address address)
 Joins a IPv6 multicast group without filters.
 
virtual void Ipv6JoinGroup (Ipv6Address address, Ipv6MulticastFilterMode filterMode, std::vector< Ipv6Address > sourceAddresses)
 Joins a IPv6 multicast group.
 
virtual void Ipv6LeaveGroup ()
 Leaves IPv6 multicast group this socket is joined to.
 
bool IsIpRecvTos () const
 Ask if the socket is currently passing information about IP Type of Service up the stack.
 
bool IsIpRecvTtl () const
 Ask if the socket is currently passing information about IP_TTL up the stack.
 
bool IsIpv6RecvHopLimit () const
 Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
 
bool IsIpv6RecvTclass () const
 Ask if the socket is currently passing information about IPv6 Traffic Class up the stack.
 
bool IsRecvPktInfo () const
 Get status indicating whether enable/disable packet information to socket.
 
virtual int Listen ()=0
 Listen for incoming connections.
 
Ptr< PacketRecv ()
 Read a single packet from the socket.
 
virtual Ptr< PacketRecv (uint32_t maxSize, uint32_t flags)=0
 Read data from the socket.
 
int Recv (uint8_t *buf, uint32_t size, uint32_t flags)
 Recv data (or dummy data) from the remote host.
 
Ptr< PacketRecvFrom (Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address.
 
virtual Ptr< PacketRecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
 Read a single packet from the socket and retrieve the sender address.
 
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.
 
int Send (const uint8_t *buf, uint32_t size, uint32_t flags)
 Send data (or dummy data) to the remote host.
 
int Send (Ptr< Packet > p)
 Send data (or dummy data) to the remote host.
 
virtual int Send (Ptr< Packet > p, uint32_t flags)=0
 Send data (or dummy data) to the remote host.
 
int SendTo (const uint8_t *buf, uint32_t size, uint32_t flags, const Address &address)
 Send data to a specified peer.
 
virtual int SendTo (Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
 Send data to a specified peer.
 
void SetAcceptCallback (Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
 Accept connection requests from remote hosts.
 
virtual bool SetAllowBroadcast (bool allowBroadcast)=0
 Configure whether broadcast datagram transmissions are allowed.
 
void SetCloseCallbacks (Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
 Detect socket recv() events such as graceful shutdown or error.
 
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.
 
void SetDataSentCallback (Callback< void, Ptr< Socket >, uint32_t > dataSent)
 Notify application when a packet has been sent from transport protocol (non-standard socket call)
 
void SetIpRecvTos (bool ipv4RecvTos)
 Tells a socket to pass information about IP Type of Service up the stack.
 
void SetIpRecvTtl (bool ipv4RecvTtl)
 Tells a socket to pass information about IP_TTL up the stack.
 
void SetIpTos (uint8_t ipTos)
 Manually set IP Type of Service field.
 
virtual void SetIpTtl (uint8_t ipTtl)
 Manually set IP Time to Live field.
 
virtual void SetIpv6HopLimit (uint8_t ipHopLimit)
 Manually set IPv6 Hop Limit.
 
void SetIpv6RecvHopLimit (bool ipv6RecvHopLimit)
 Tells a socket to pass information about IPv6 Hop Limit up the stack.
 
void SetIpv6RecvTclass (bool ipv6RecvTclass)
 Tells a socket to pass information about IPv6 Traffic Class up the stack.
 
void SetIpv6Tclass (int ipTclass)
 Manually set IPv6 Traffic Class field.
 
void SetPriority (uint8_t priority)
 Manually set the socket priority.
 
void SetRecvCallback (Callback< void, Ptr< Socket > > receivedData)
 Notify application when new data is available to be read.
 
void SetRecvPktInfo (bool flag)
 Enable/Disable receive packet information to socket.
 
void SetSendCallback (Callback< void, Ptr< Socket >, uint32_t > sendCb)
 Notify application when space in transmit buffer is added.
 
virtual int ShutdownRecv ()=0
 
virtual int ShutdownSend ()=0
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::TcpSocket
static TypeId GetTypeId ()
 Get the type ID.
 
- 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.
 
static TypeId GetTypeId ()
 Get the type ID.
 
static uint8_t IpTos2Priority (uint8_t ipTos)
 Return the priority corresponding to a given TOS value.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Public Attributes

TracedCallback< uint32_t, uint32_tm_bytesInFlightTrace
 Callback pointer for bytesInFlight trace chaining.
 
TracedCallback< TcpSocketState::TcpCongState_t, TcpSocketState::TcpCongState_tm_congStateTrace
 Callback pointer for congestion state trace chaining.
 
TracedCallback< uint32_t, uint32_tm_cWndInflTrace
 Callback pointer for cWndInfl trace chaining.
 
TracedCallback< uint32_t, uint32_tm_cWndTrace
 Callback pointer for cWnd trace chaining.
 
TracedCallback< TcpSocketState::EcnState_t, TcpSocketState::EcnState_tm_ecnStateTrace
 Callback pointer for ECN state trace chaining.
 
TracedCallback< SequenceNumber32, SequenceNumber32m_highTxMarkTrace
 Callback pointer for high tx mark chaining.
 
TracedCallback< Time, Timem_lastRttTrace
 Callback pointer for RTT trace chaining.
 
TracedCallback< SequenceNumber32, SequenceNumber32m_nextTxSequenceTrace
 Callback pointer for next tx sequence chaining.
 
TracedCallback< DataRate, DataRatem_pacingRateTrace
 Callback pointer for pacing rate trace chaining.
 
TracedCallback< uint32_t, uint32_tm_ssThTrace
 Callback pointer for ssTh trace chaining.
 

Protected Member Functions

void AddOptions (TcpHeader &tcpHeader)
 Add options to TcpHeader.
 
void AddOptionSack (TcpHeader &header)
 Add the SACK option to the header.
 
void AddOptionSackPermitted (TcpHeader &header)
 Add the SACK PERMITTED option to the header.
 
void AddOptionTimestamp (TcpHeader &header)
 Add the timestamp option to the header.
 
void AddOptionWScale (TcpHeader &header)
 Add the window scale option to the header.
 
void AddSocketTags (const Ptr< Packet > &p) const
 Add Tags for the Socket.
 
virtual uint16_t AdvertisedWindowSize (bool scale=true) const
 The amount of Rx window announced to the peer.
 
virtual uint32_t AvailableWindow () const
 Return unfilled portion of window.
 
virtual uint32_t BytesInFlight () const
 Return total bytes in flight.
 
uint8_t CalculateWScale () const
 Calculate window scale value based on receive buffer space.
 
void CancelAllTimers ()
 Cancel all timer when endpoint is deleted.
 
void CloseAndNotify ()
 Peacefully close the socket by notifying the upper layer and deallocate end point.
 
virtual void CompleteFork (Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Complete a connection by forking the socket.
 
void ConnectionSucceeded ()
 Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()
 
void DeallocateEndPoint ()
 Deallocate m_endPoint and m_endPoint6.
 
virtual void DelAckTimeout ()
 Action upon delay ACK timeout, i.e.
 
void Destroy ()
 Kill this socket by zeroing its attributes (IPv4)
 
void Destroy6 ()
 Kill this socket by zeroing its attributes (IPv6)
 
int DoClose ()
 Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state.
 
int DoConnect ()
 Perform the real connection tasks: Send SYN if allowed, RST if invalid.
 
virtual void DoForwardUp (Ptr< Packet > packet, const Address &fromAddress, const Address &toAddress)
 Called by TcpSocketBase::ForwardUp{,6}().
 
void DoPeerClose ()
 FIN is in sequence, notify app and respond with a FIN.
 
void DoRetransmit ()
 Retransmit the first segment marked as lost, without considering available window nor pacing.
 
void DupAck (uint32_t currentDelivered)
 Dupack management.
 
void EnterCwr (uint32_t currentDelivered)
 Enter CA_CWR state upon receipt of an ECN Echo.
 
void EnterRecovery (uint32_t currentDelivered)
 Enter the CA_RECOVERY, and retransmit the head.
 
virtual void EstimateRtt (const TcpHeader &tcpHeader)
 Take into account the packet for RTT estimation.
 
virtual Ptr< TcpSocketBaseFork ()
 Call CopyObject<> to clone me.
 
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.
 
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.
 
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.
 
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.
 
bool GetAllowBroadcast () const override
 Query whether broadcast datagram transmissions are allowed.
 
Time GetConnTimeout () const override
 Get the connection timeout.
 
uint32_t GetDataRetries () const override
 Get the number of data transmission retries before giving up.
 
uint32_t GetDelAckMaxCount () const override
 Get the number of packet to fire an ACK before delay timeout.
 
Time GetDelAckTimeout () const override
 Get the time to delay an ACK.
 
SequenceNumber32 GetHighRxAck () const
 Get the current value of the receiver's highest (in-sequence) sequence number acked.
 
uint32_t GetInitialCwnd () const override
 Get the initial Congestion Window.
 
uint32_t GetInitialSSThresh () const override
 Get the initial Slow Start Threshold.
 
Time GetPersistTimeout () const override
 Get the timeout for persistent connection.
 
uint32_t GetRcvBufSize () const override
 Get the receive buffer size.
 
uint32_t GetRWnd () const
 Get the current value of the receiver's offered window (RCV.WND)
 
uint32_t GetSegSize () const override
 Get the segment size.
 
uint32_t GetSndBufSize () const override
 Get the send buffer size.
 
uint32_t GetSynRetries () const override
 Get the number of connection retries before giving up.
 
bool GetTcpNoDelay () const override
 Check if Nagle's algorithm is enabled or not.
 
bool IsPacingEnabled () const
 Return true if packets in the current window should be paced.
 
bool IsTcpOptionEnabled (uint8_t kind) const
 Return true if the specified option is enabled.
 
bool IsValidTcpSegment (const SequenceNumber32 seq, const uint32_t tcpHeaderSize, const uint32_t tcpPayloadSize)
 Checks whether the given TCP segment is valid or not.
 
virtual void LastAckTimeout ()
 Timeout at LAST_ACK, close the connection.
 
virtual void NewAck (const SequenceNumber32 &seq, bool resetRTO)
 Update buffers w.r.t.
 
void NotifyPacingPerformed ()
 Notify Pacing.
 
bool OutOfRange (SequenceNumber32 head, SequenceNumber32 tail) const
 Check if a sequence number range is within the rx window.
 
void PeerClose (Ptr< Packet > p, const TcpHeader &tcpHeader)
 Received a FIN from peer, notify rx buffer.
 
virtual void PersistTimeout ()
 Send 1 byte probe to get an updated window size.
 
virtual void ProcessAck (const SequenceNumber32 &ackNumber, bool scoreboardUpdated, uint32_t currentDelivered, const SequenceNumber32 &oldHeadSequence)
 Process a received ack.
 
void ProcessClosing (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon CLOSING.
 
void ProcessEstablished (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon ESTABLISHED state.
 
void ProcessLastAck (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon LAST_ACK.
 
void ProcessListen (Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Received a packet upon LISTEN state.
 
uint32_t ProcessOptionSack (const Ptr< const TcpOption > option)
 Read the SACK option.
 
void ProcessOptionSackPermitted (const Ptr< const TcpOption > option)
 Read the SACK PERMITTED option.
 
void ProcessOptionTimestamp (const Ptr< const TcpOption > option, const SequenceNumber32 &seq)
 Process the timestamp option from other side.
 
void ProcessOptionWScale (const Ptr< const TcpOption > option)
 Read and parse the Window scale option.
 
void ProcessSynRcvd (Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
 Received a packet upon SYN_RCVD.
 
void ProcessSynSent (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon SYN_SENT.
 
void ProcessWait (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received a packet upon CLOSE_WAIT, FIN_WAIT_1, FIN_WAIT_2.
 
void ReadOptions (const TcpHeader &tcpHeader, uint32_t *bytesSacked)
 Read TCP options before Ack processing.
 
virtual void ReceivedAck (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received an ACK packet.
 
virtual void ReceivedData (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Recv of a data, put into buffer, call L7 to get it if necessary.
 
virtual void ReTxTimeout ()
 An RTO event happened.
 
virtual 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.
 
virtual void SendEmptyPacket (uint8_t flags)
 Send a empty packet that carries a flag, e.g., ACK.
 
uint32_t SendPendingData (bool withAck=false)
 Send as much pending data as possible according to the Tx window.
 
void SendRST ()
 Send reset and tear down this socket.
 
bool SetAllowBroadcast (bool allowBroadcast) override
 Configure whether broadcast datagram transmissions are allowed.
 
void SetConnTimeout (Time timeout) override
 Set the connection timeout.
 
void SetDataRetries (uint32_t retries) override
 Set the number of data transmission retries before giving up.
 
void SetDelAckMaxCount (uint32_t count) override
 Set the number of packet to fire an ACK before delay timeout.
 
void SetDelAckTimeout (Time timeout) override
 Set the time to delay an ACK.
 
void SetInitialCwnd (uint32_t cwnd) override
 Set the initial Congestion Window.
 
void SetInitialSSThresh (uint32_t threshold) override
 Set the initial Slow Start Threshold.
 
void SetPersistTimeout (Time timeout) override
 Set the timeout for persistent connection.
 
void SetRcvBufSize (uint32_t size) override
 Set the receive buffer size.
 
void SetSegSize (uint32_t size) override
 Set the segment size.
 
void SetSndBufSize (uint32_t size) override
 Set the send buffer size.
 
void SetSynRetries (uint32_t count) override
 Set the number of connection retries before giving up.
 
void SetTcpNoDelay (bool noDelay) override
 Enable/Disable Nagle's algorithm.
 
int SetupCallback ()
 Common part of the two Bind(), i.e.
 
int SetupEndpoint ()
 Configure the endpoint to a local address.
 
int SetupEndpoint6 ()
 Configure the endpoint v6 to a local address.
 
void TimeWait ()
 Move from CLOSING or FIN_WAIT_2 to TIME_WAIT state.
 
virtual uint32_t UnAckDataCount () const
 Return count of number of unacked bytes.
 
void UpdatePacingRate ()
 Dynamically update the pacing rate.
 
virtual void UpdateRttHistory (const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
 Update the RTT history, when we send TCP segments.
 
void UpdateWindowSize (const TcpHeader &header)
 Update the receiver window (RWND) based on the value of the window field in the header.
 
virtual uint32_t Window () const
 Return the max possible number of unacked bytes.
 
- Protected Member Functions inherited from ns3::Socket
void DoDispose () override
 Destructor implementation.
 
bool IsManualIpTtl () const
 Checks if the socket has a specific IPv4 TTL set.
 
bool IsManualIpv6HopLimit () const
 Checks if the socket has a specific IPv6 Hop Limit set.
 
bool IsManualIpv6Tclass () const
 Checks if the socket has a specific IPv6 Tclass set.
 
void NotifyConnectionFailed ()
 Notify through the callback (if set) that the connection has not been established due to an error.
 
bool NotifyConnectionRequest (const Address &from)
 Notify through the callback (if set) that an incoming connection is being requested by a remote host.
 
void NotifyConnectionSucceeded ()
 Notify through the callback (if set) that the connection has been established.
 
void NotifyDataRecv ()
 Notify through the callback (if set) that some data have been received.
 
void NotifyDataSent (uint32_t size)
 Notify through the callback (if set) that some data have been sent.
 
void NotifyErrorClose ()
 Notify through the callback (if set) that the connection has been closed due to an error.
 
void NotifyNewConnectionCreated (Ptr< Socket > socket, const Address &from)
 Notify through the callback (if set) that a new connection has been created.
 
void NotifyNormalClose ()
 Notify through the callback (if set) that the connection has been closed.
 
void NotifySend (uint32_t spaceAvailable)
 Notify through the callback (if set) that some data have been sent.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Static Protected Member Functions

static uint32_t SafeSubtraction (uint32_t a, uint32_t b)
 Performs a safe subtraction between a and b (a-b)
 

Protected Attributes

TracedValue< uint32_tm_advWnd {0}
 Advertised Window size.
 
uint32_t m_bytesAckedNotProcessed {0}
 Bytes acked, but not processed.
 
Time m_clockGranularity {Seconds(0.001)}
 Clock Granularity used in RTO calcs.
 
bool m_closeNotified {false}
 Told app to close socket.
 
bool m_closeOnEmpty {false}
 Close socket upon tx buffer emptied.
 
Time m_cnTimeout {Seconds(0.0)}
 Timeout for connection retry.
 
Ptr< TcpCongestionOpsm_congestionControl
 Congestion control.
 
bool m_connected {false}
 Connection established.
 
uint32_t m_dataRetrCount {0}
 Count of remaining data retransmission attempts.
 
uint32_t m_dataRetries {0}
 Number of data retransmission attempts.
 
uint32_t m_delAckCount {0}
 Delayed ACK counter.
 
EventId m_delAckEvent {}
 Delayed ACK timeout event.
 
uint32_t m_delAckMaxCount {0}
 Number of packet to fire an ACK before delay timeout.
 
Time m_delAckTimeout {Seconds(0.0)}
 Time to delay an ACK.
 
uint32_t m_dupAckCount {0}
 Dupack counter.
 
TracedValue< SequenceNumber32m_ecnCESeq
 Sequence number of the last received Congestion Experienced.
 
TracedValue< SequenceNumber32m_ecnCWRSeq {0}
 Sequence number of the last sent CWR.
 
TracedValue< SequenceNumber32m_ecnEchoSeq
 Sequence number of the last received ECN Echo.
 
Ipv4EndPointm_endPoint {nullptr}
 the IPv4 endpoint
 
Ipv6EndPointm_endPoint6 {nullptr}
 the IPv6 endpoint
 
SocketErrno m_errno {ERROR_NOTERROR}
 Socket error code.
 
TracedValue< SequenceNumber32m_highRxAckMark {0}
 Highest ack received.
 
TracedValue< SequenceNumber32m_highRxMark {0}
 Highest seqno received.
 
SequenceNumber32 m_highTxAck {0}
 Highest ack sent.
 
std::deque< RttHistorym_history
 List of sent packet.
 
Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_tm_icmpCallback
 ICMP callback.
 
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_tm_icmpCallback6
 ICMPv6 callback.
 
bool m_isFirstPartialAck {true}
 First partial ACK during RECOVERY.
 
EventId m_lastAckEvent {}
 Last ACK timeout event.
 
bool m_limitedTx {true}
 perform limited transmit
 
uint16_t m_maxWinSize {0}
 Maximum window size to advertise.
 
Time m_minRto {Time::Max()}
 minimum value of the Retransmit timeout
 
double m_msl {0.0}
 Max segment lifetime.
 
Ptr< Nodem_node
 the associated node
 
bool m_noDelay {false}
 Set to true to disable Nagle's algorithm.
 
Timer m_pacingTimer {Timer::CANCEL_ON_DESTROY}
 Pacing Event.
 
EventId m_persistEvent {}
 Persist event: Send 1 byte to probe for a non-zero Rx window.
 
Time m_persistTimeout {Seconds(0.0)}
 Time between sending 1-byte probes.
 
Ptr< TcpRateOpsm_rateOps
 Rate operations.
 
uint8_t m_rcvWindShift {0}
 Window shift to apply to outgoing segments.
 
SequenceNumber32 m_recover
 Previous highest Tx seqnum for fast recovery (set it to initial seq number)
 
bool m_recoverActive {false}
 Whether "m_recover" has been set/activated It is used to avoid comparing with the old m_recover value which was set for handling previous congestion event.
 
Ptr< TcpRecoveryOpsm_recoveryOps
 Recovery Algorithm.
 
EventId m_retxEvent {}
 Retransmission event.
 
uint32_t m_retxThresh {3}
 Fast Retransmit threshold.
 
TracedValue< Timem_rto {Seconds(0.0)}
 Retransmit timeout.
 
Ptr< RttEstimatorm_rtt
 Round trip time estimator.
 
TracedValue< uint32_tm_rWnd {0}
 Receiver window (RCV.WND in RFC793)
 
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_rxTrace
 Trace of received packets.
 
bool m_sackEnabled {true}
 RFC SACK option enabled.
 
EventId m_sendPendingDataEvent {}
 micro-delay event to send pending data
 
bool m_shutdownRecv {false}
 Receive no longer allowed.
 
bool m_shutdownSend {false}
 Send no longer allowed.
 
uint8_t m_sndWindShift {0}
 Window shift to apply to incoming segments.
 
TracedValue< TcpStates_tm_state {CLOSED}
 TCP state.
 
uint32_t m_synCount {0}
 Count of remaining connection retries.
 
uint32_t m_synRetries {0}
 Number of connection attempts.
 
Ptr< TcpSocketStatem_tcb
 Congestion control information.
 
Ptr< TcpL4Protocolm_tcp
 the associated TCP L4 protocol
 
bool m_timestampEnabled {true}
 Timestamp option enabled.
 
uint32_t m_timestampToEcho {0}
 Timestamp to echo.
 
EventId m_timewaitEvent {}
 TIME_WAIT expiration event: Move this socket to CLOSED state.
 
Ptr< TcpTxBufferm_txBuffer
 Tx buffer.
 
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_txTrace
 Trace of transmitted packets.
 
bool m_winScalingEnabled {true}
 Window Scale option enabled (RFC 7323)
 
- Protected Attributes inherited from ns3::Socket
Ptr< NetDevicem_boundnetdevice
 the device this socket is bound to (might be null).
 
Ipv6Address m_ipv6MulticastGroupAddress
 IPv6 multicast group address.
 
bool m_recvPktInfo
 if the socket should add packet info tags to the packet forwarded to L4.
 

Related Functions

(Note that these are not member functions.)

class TcpGeneralTest
 TcpGeneralTest friend class (for tests).
 

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.
 

Detailed Description

A base class for implementation of a stream socket using TCP.

This class contains the essential components of TCP, as well as a sockets interface for upper layers to call. This class provides connection orientation and sliding window flow control; congestion control is delegated to subclasses of TcpCongestionOps. Part of TcpSocketBase is modified from the original NS-3 TCP socket implementation (TcpSocketImpl) by Raj Bhattacharjea raj.b.nosp@m.@gat.nosp@m.ech.e.nosp@m.du of Georgia Tech.

For IPv4 packets, the TOS set for the socket is used. The Bind and Connect operations set the TOS for the socket to the value specified in the provided address. A SocketIpTos tag is only added to the packet if the resulting TOS is non-null. Each packet is assigned the priority set for the socket. Setting a TOS for a socket also sets a priority for the socket (according to the Socket::IpTos2Priority function). A SocketPriority tag is only added to the packet if the priority is non-null.

Congestion state machine

The socket maintains two state machines; the TCP one, and another called "Congestion state machine", which keeps track of the phase we are in. Currently, ns-3 manages the states:

  • CA_OPEN
  • CA_DISORDER
  • CA_RECOVERY
  • CA_LOSS
  • CA_CWR

For more information, see the TcpCongState_t documentation.

Congestion control interface

Congestion control, unlike older releases of ns-3, has been split from TcpSocketBase. In particular, each congestion control is now a subclass of the main TcpCongestionOps class. Switching between congestion algorithm is now a matter of setting a pointer into the TcpSocketBase class. The idea and the interfaces are inspired by the Linux operating system, and in particular from the structure tcp_congestion_ops. The reference paper is https://www.sciencedirect.com/science/article/abs/pii/S1569190X15300939.

Transmission Control Block (TCB)

The variables needed to congestion control classes to operate correctly have been moved inside the TcpSocketState class. It contains information on the congestion window, slow start threshold, segment size and the state of the Congestion state machine.

To track the trace inside the TcpSocketState class, a "forward" technique is used, which consists in chaining callbacks from TcpSocketState to TcpSocketBase (see for example cWnd trace source).

Fast retransmit

The fast retransmit enhancement is introduced in RFC 2581 and updated in RFC

  1. It reduces the time a sender waits before retransmitting a lost segment, through the assumption that if it receives a certain number of duplicate ACKs, a segment has been lost and it can be retransmitted. Usually, it is coupled with the Limited Transmit algorithm, defined in RFC 3042. These algorithms are included in this class, and they are implemented inside the ProcessAck method. With the SACK option enabled, the LimitedTransmit algorithm will be always on, as a consequence of how the information in the received SACK block is managed.

The attribute which manages the number of dup ACKs necessary to start the fast retransmit algorithm is named "ReTxThreshold", and by default is 3. The parameter is also used in TcpTxBuffer to determine if a packet is lost (please take a look at TcpTxBuffer documentation to see details) but, right now, it is assumed to be fixed. In future releases this parameter can be made dynamic, to reflect the reordering degree of the network. With SACK, the next sequence to transmit is given by the RFC 6675 algorithm. Without SACK option, the implementation adds "hints" to TcpTxBuffer to make sure it returns, as next transmittable sequence, the first lost (or presumed lost) segment.

Fast recovery

The fast recovery algorithm is introduced RFC 2001, and it avoids to reset cWnd to 1 segment after sensing a loss on the channel. Instead, a new slow start threshold value is asked to the congestion control (for instance, with NewReno the returned amount is half of the previous), and the cWnd is set equal to such value. Ns-3 does not implement any inflation/deflation to the congestion window since it uses an evolved method (borrowed from Linux operating system) to calculate the number of bytes in flight. The fundamental idea is to subtract from the total bytes in flight the lost/sacked amount (the segments that have left the network) and to add the retransmitted count. In this way, congestion window represents the exact number of bytes that should be in flight. The implementation then decides what to transmit, it there is space, between new or already transmitted data portion. If a value of the congestion window with inflation and deflation is needed, there is a traced source named "CongestionWindowInflated". However, the variable behind it is not used in the code, but maintained for backward compatibility.

RTO expiration

When the Retransmission Time Out expires, the TCP faces a significant performance drop. The expiration event is managed in the ReTxTimeout method, which set the cWnd to 1 segment and starts "from scratch" again. The list of sent packet is set as lost entirely, and the transmission is re-started from the SND.UNA sequence number.

Options management

SYN and SYN-ACK options, which are allowed only at the beginning of the connection, are managed in the DoForwardUp and SendEmptyPacket methods. To read all others, we have set up a cycle inside ReadOptions. For adding them, there is no a unique place, since the options (and the information available to build them) are scattered around the code. For instance, the SACK option is built in SendEmptyPacket only under certain conditions.

SACK

The SACK generation/management is delegated to the buffer classes, namely TcpTxBuffer and TcpRxBuffer. In TcpRxBuffer it is managed the creation of the SACK option from the receiver point of view. It must provide an accurate (and efficient) representation of the status of the receiver buffer. On the other side, inside TcpTxBuffer the received options (that contain the SACK block) are processed and a particular data structure, called Scoreboard, is filled. Please take a look at TcpTxBuffer and TcpRxBuffer documentation if you need more information. The reference paper is https://dl.acm.org/citation.cfm?id=3067666.

Config Paths

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

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

Attributes

  • ClockGranularity: Clock Granularity used in RTO calculations
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+06ns
    • Flags: constructwriteread
  • CongestionOps: Pointer to TcpCongestionOps object
  • IcmpCallback: Callback invoked whenever an icmp error is received on this socket.
  • IcmpCallback6: Callback invoked whenever an icmpv6 error is received on this socket.
  • LimitedTransmit: Enable limited transmit
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • 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: constructwriteread
  • MaxWindowSize: Max size of advertised window
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 65535
    • Flags: constructwriteread
  • MinRto: Minimum retransmit timeout value
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+09ns
    • Flags: constructwriteread
  • ReTxThreshold: Threshold for fast retransmit
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 3
    • Flags: constructwriteread
  • RxBuffer: TCP Rx buffer
  • Sack: Enable or disable Sack option
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • Timestamp: Enable or disable Timestamp option
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • TxBuffer: TCP Tx buffer
  • UseEcn: Parameter to set ECN functionality
    • Set with class: ns3::EnumValue
    • Underlying type: Off|On|AcceptOnly
    • Initial value: Off
    • Flags: constructwrite
  • WindowScaling: Enable or disable Window Scaling option
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread

Attributes defined in parent class ns3::TcpSocket

  • 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: constructwriteread
  • ConnTimeout: TCP retransmission timeout when opening connection (seconds)
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+09ns
    • Flags: constructwriteread
  • DataRetries: Number of data retransmission attempts
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 6
    • Flags: constructwriteread
  • 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: constructwriteread
  • DelAckTimeout: Timeout value for TCP delayed acks, in seconds
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +2e+08ns
    • Flags: constructwriteread
  • InitialCwnd: TCP initial congestion window size (segments)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: constructwriteread
  • InitialSlowStartThreshold: TCP initial slow start threshold (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 4294967295
    • Flags: constructwriteread
  • PersistTimeout: Persist timeout to probe for rx window
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +6e+09ns
    • Flags: constructwriteread
  • RcvBufSize: TcpSocket maximum receive buffer size (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 131072
    • Flags: constructwriteread
  • 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: constructwriteread
  • SndBufSize: TcpSocket maximum transmit buffer size (bytes)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 131072
    • Flags: constructwriteread
  • TcpNoDelay: Set to true to disable Nagle's algorithm
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread

TraceSources

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

Definition at line 218 of file tcp-socket-base.h.

Member Typedef Documentation

◆ TcpTxRxTracedCallback

typedef void(* ns3::TcpSocketBase::TcpTxRxTracedCallback) (const Ptr< const Packet > packet, const TcpHeader &header, const Ptr< const TcpSocketBase > socket)

TracedCallback signature for tcp packet transmission or reception events.

Parameters
[in]packetThe packet.
[in]headerThe TcpHeader
[in]socketThis socket

Definition at line 616 of file tcp-socket-base.h.

Constructor & Destructor Documentation

◆ TcpSocketBase() [1/2]

◆ TcpSocketBase() [2/2]

◆ ~TcpSocketBase()

ns3::TcpSocketBase::~TcpSocketBase ( )
override

Definition at line 463 of file tcp-socket-base.cc.

References CancelAllTimers(), m_endPoint, m_endPoint6, m_node, m_tcp, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddOptions()

void ns3::TcpSocketBase::AddOptions ( TcpHeader tcpHeader)
protected

Add options to TcpHeader.

Test each option, and if it is enabled on our side, add it to the header

Parameters
tcpHeaderTcpHeader to add options to

Definition at line 4195 of file tcp-socket-base.cc.

References AddOptionTimestamp(), m_timestampEnabled, and NS_LOG_FUNCTION.

Referenced by DoForwardUp(), PersistTimeout(), SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), ns3::TcpSocketCongestedRouter::SendDataPacket(), SendEmptyPacket(), and ns3::TcpSocketSmallAcks::SendEmptyPacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddOptionSack()

void ns3::TcpSocketBase::AddOptionSack ( TcpHeader header)
protected

Add the SACK option to the header.

Parameters
headerTcpHeader where the method should add the option

Definition at line 4303 of file tcp-socket-base.cc.

References ns3::TcpHeader::AppendOption(), ns3::Node::GetId(), ns3::TcpHeader::GetMaxOptionLength(), ns3::TcpHeader::GetOptionLength(), m_node, ns3::TcpSocketState::m_rxBuffer, m_tcb, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.

Referenced by SendEmptyPacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddOptionSackPermitted()

void ns3::TcpSocketBase::AddOptionSackPermitted ( TcpHeader header)
protected

Add the SACK PERMITTED option to the header.

Parameters
headerTcpHeader where the method should add the option

Definition at line 4292 of file tcp-socket-base.cc.

References ns3::TcpHeader::AppendOption(), ns3::TcpHeader::GetFlags(), ns3::Node::GetId(), m_node, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::TcpHeader::SYN.

Referenced by SendEmptyPacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddOptionTimestamp()

void ns3::TcpSocketBase::AddOptionTimestamp ( TcpHeader header)
protected

Add the timestamp option to the header.

Set the timestamp as the lower bits of the Simulator::Now time, and the echo value as the last seen timestamp from the other part.

Parameters
headerTcpHeader to which add the option to

Definition at line 4360 of file tcp-socket-base.cc.

References ns3::TcpHeader::AppendOption(), ns3::Node::GetId(), m_node, m_timestampToEcho, ns3::TcpOptionTS::NowToTsValue(), NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by AddOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddOptionWScale()

void ns3::TcpSocketBase::AddOptionWScale ( TcpHeader header)
protected

Add the window scale option to the header.

Calculate our factor from the rxBuffer max size, and add it to the header.

Parameters
headerTcpHeader where the method should add the window scale option

Definition at line 4252 of file tcp-socket-base.cc.

References ns3::TcpHeader::AppendOption(), CalculateWScale(), ns3::TcpHeader::GetFlags(), ns3::Node::GetId(), m_node, m_rcvWindShift, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::TcpHeader::SYN.

Referenced by SendEmptyPacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddSocketTags()

◆ AdvertisedWindowSize()

uint16_t ns3::TcpSocketBase::AdvertisedWindowSize ( bool  scale = true) const
protectedvirtual

The amount of Rx window announced to the peer.

Parameters
scaleindicate if the window should be scaled. True for almost all cases, except when we are sending a SYN
Returns
size of Rx window announced to the peer

Reimplemented in TcpSocketAdvertisedWindowProxy.

Definition at line 3482 of file tcp-socket-base.cc.

References m_advWnd, m_maxWinSize, m_rcvWindShift, ns3::TcpSocketState::m_rxBuffer, m_tcb, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.

Referenced by DoForwardUp(), PersistTimeout(), SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), ns3::TcpSocketCongestedRouter::SendDataPacket(), SendEmptyPacket(), and ns3::TcpSocketSmallAcks::SendEmptyPacket().

+ Here is the caller graph for this function:

◆ AvailableWindow()

uint32_t ns3::TcpSocketBase::AvailableWindow ( ) const
protectedvirtual

Return unfilled portion of window.

Returns
unfilled portion of window

Definition at line 3474 of file tcp-socket-base.cc.

References BytesInFlight(), and Window().

Referenced by Send(), and SendPendingData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Bind() [1/2]

int ns3::TcpSocketBase::Bind ( )
overridevirtual

Allocate a local IPv4 endpoint for this socket.

Returns
0 on success, -1 on failure.

Implements ns3::Socket.

Definition at line 536 of file tcp-socket-base.cc.

References ns3::Socket::ERROR_ADDRNOTAVAIL, m_endPoint, m_errno, m_tcp, NS_LOG_FUNCTION, and SetupCallback().

Referenced by Connect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Bind() [2/2]

◆ Bind6()

int ns3::TcpSocketBase::Bind6 ( )
overridevirtual

Allocate a local IPv6 endpoint for this socket.

Returns
0 on success, -1 on failure.

Implements ns3::Socket.

Definition at line 552 of file tcp-socket-base.cc.

References ns3::Socket::ERROR_ADDRNOTAVAIL, m_endPoint6, m_errno, m_tcp, NS_LOG_FUNCTION, and SetupCallback().

Referenced by Connect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BindToNetDevice()

void ns3::TcpSocketBase::BindToNetDevice ( Ptr< NetDevice netdevice)
overridevirtual

Bind a socket to specific device.

This method corresponds to using setsockopt() SO_BINDTODEVICE of real network or BSD sockets. If set on a socket, this option will force packets to leave the bound device regardless of the device that IP routing would naturally choose. In the receive direction, only packets received from the bound interface will be delivered.

This option has no particular relationship to binding sockets to an address via Socket::Bind (). It is possible to bind sockets to a specific IP address on the bound interface by calling both Socket::Bind (address) and Socket::BindToNetDevice (device), but it is also possible to bind to mismatching device and address, even if the socket can not receive any packets as a result.

Parameters
netdevicePointer to NetDevice of desired interface

Reimplemented from ns3::Socket.

Definition at line 1007 of file tcp-socket-base.cc.

References ns3::Ipv4EndPoint::BindToNetDevice(), ns3::Ipv6EndPoint::BindToNetDevice(), ns3::Socket::BindToNetDevice(), m_endPoint, m_endPoint6, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ BytesInFlight()

uint32_t ns3::TcpSocketBase::BytesInFlight ( ) const
protectedvirtual

Return total bytes in flight.

Does not count segments lost and SACKed (or dupACKed)

Returns
total bytes in flight

Definition at line 3456 of file tcp-socket-base.cc.

References ns3::TcpSocketState::m_bytesInFlight, m_tcb, m_txBuffer, and NS_LOG_DEBUG.

Referenced by AvailableWindow(), EnterCwr(), EnterRecovery(), ProcessAck(), ReceivedAck(), ReTxTimeout(), and SendDataPacket().

+ Here is the caller graph for this function:

◆ CalculateWScale()

uint8_t ns3::TcpSocketBase::CalculateWScale ( ) const
protected

Calculate window scale value based on receive buffer space.

Calculate our factor from the rxBuffer max size

Returns
the Window Scale factor

Definition at line 4227 of file tcp-socket-base.cc.

References ns3::Node::GetId(), m_maxWinSize, m_node, ns3::TcpSocketState::m_rxBuffer, m_tcb, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.

Referenced by AddOptionWScale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CancelAllTimers()

void ns3::TcpSocketBase::CancelAllTimers ( )
protected

Cancel all timer when endpoint is deleted.

Definition at line 3994 of file tcp-socket-base.cc.

References ns3::EventId::Cancel(), ns3::Timer::Cancel(), m_delAckEvent, m_lastAckEvent, m_pacingTimer, m_persistEvent, m_retxEvent, m_sendPendingDataEvent, and m_timewaitEvent.

Referenced by ~TcpSocketBase(), DeallocateEndPoint(), Destroy(), Destroy6(), and TimeWait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckEcnCe()

bool ns3::TcpSocketBase::CheckEcnCe ( uint8_t  tos) const
inline

Checks for CE codepoint.

Parameters
tosthe TOS byte to check
Returns
true if TOS has CE codepoint set; otherwise false

Definition at line 543 of file tcp-socket-base.h.

◆ CheckEcnEct0()

bool ns3::TcpSocketBase::CheckEcnEct0 ( uint8_t  tos) const
inline

Checks for ECT(0) codepoint.

Parameters
tosthe TOS byte to check
Returns
true if TOS has ECT(0) codepoint set; otherwise false

Definition at line 521 of file tcp-socket-base.h.

◆ CheckEcnEct1()

bool ns3::TcpSocketBase::CheckEcnEct1 ( uint8_t  tos) const
inline

Checks for ECT(1) codepoint.

Parameters
tosthe TOS byte to check
Returns
true if TOS has ECT(1) codepoint set; otherwise false

Definition at line 532 of file tcp-socket-base.h.

◆ CheckNoEcn()

bool ns3::TcpSocketBase::CheckNoEcn ( uint8_t  tos) const
inline

Checks if TOS has no ECN codepoints.

Parameters
tosthe TOS byte to check
Returns
true if TOS does not have any ECN codepoints set; otherwise false

Definition at line 510 of file tcp-socket-base.h.

Referenced by AddSocketTags().

+ Here is the caller graph for this function:

◆ ClearEcnBits()

uint8_t ns3::TcpSocketBase::ClearEcnBits ( uint8_t  tos) const
inline

Clears ECN bits from TOS.

Parameters
tosthe TOS byte to modify
Returns
TOS without ECN bits

Definition at line 499 of file tcp-socket-base.h.

◆ Close()

int ns3::TcpSocketBase::Close ( )
overridevirtual

Close a socket.

Returns
zero on success, -1 on failure.

After the Close call, the socket is no longer valid, and cannot safely be used for subsequent operations.

Internal:
First we check to see if there is any unread rx data. Bug 426 claims we should send reset in this case.

Implements ns3::Socket.

Definition at line 771 of file tcp-socket-base.cc.

References DoClose(), m_closeOnEmpty, ns3::TcpSocketState::m_nextTxSequence, ns3::TcpSocketState::m_rxBuffer, m_state, m_tcb, m_txBuffer, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_WARN, SendRST(), and ns3::TcpSocket::TcpStateName.

Referenced by DoPeerClose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CloseAndNotify()

void ns3::TcpSocketBase::CloseAndNotify ( )
protected

Peacefully close the socket by notifying the upper layer and deallocate end point.

Definition at line 1132 of file tcp-socket-base.cc.

References ns3::EventId::Cancel(), ns3::TcpSocket::CLOSED, DeallocateEndPoint(), ns3::EventId::IsRunning(), m_closeNotified, m_lastAckEvent, m_state, ns3::Socket::NotifyNormalClose(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::TcpSocket::TcpStateName.

Referenced by DoClose(), DoConnect(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), and TimeWait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompleteFork()

void ns3::TcpSocketBase::CompleteFork ( Ptr< Packet p,
const TcpHeader tcpHeader,
const Address fromAddress,
const Address toAddress 
)
protectedvirtual

Complete a connection by forking the socket.

This function is called only if a SYN received in LISTEN state. After TcpSocketBase cloned, allocate a new end point to handle the incoming connection and send a SYN+ACK to complete the handshake.

Parameters
pthe packet triggering the fork
tcpHeaderthe TCP header of the triggering packet
fromAddressthe address of the remote host
toAddressthe address the connection is directed to

Reimplemented in ns3::TcpSocketMsgBase.

Definition at line 2966 of file tcp-socket-base.cc.

References ns3::TcpHeader::ACK, ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), ns3::TcpHeader::CWR, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_DISABLED, ns3::TcpSocketState::ECN_IDLE, ns3::TcpSocketState::EcnStateName, ns3::Socket::GetBoundNetDevice(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), m_dataRetrCount, m_dataRetries, ns3::TcpSocketState::m_ecnState, m_endPoint, m_endPoint6, ns3::TcpSocketState::m_rxBuffer, m_state, m_synCount, m_synRetries, m_tcb, m_tcp, ns3::TcpSocketState::m_useEcn, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::TcpSocketState::Off, SendEmptyPacket(), SetupCallback(), ns3::TcpHeader::SYN, and ns3::TcpSocket::SYN_RCVD.

Referenced by ns3::TcpSocketMsgBase::CompleteFork(), and ProcessListen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Connect()

◆ ConnectionSucceeded()

void ns3::TcpSocketBase::ConnectionSucceeded ( )
protected

Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()

Definition at line 3020 of file tcp-socket-base.cc.

References GetTxAvailable(), ns3::Socket::NotifyConnectionSucceeded(), and ns3::Socket::NotifySend().

Referenced by ProcessSynSent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeallocateEndPoint()

void ns3::TcpSocketBase::DeallocateEndPoint ( )
protected

Deallocate m_endPoint and m_endPoint6.

Definition at line 2876 of file tcp-socket-base.cc.

References CancelAllTimers(), m_endPoint, m_endPoint6, m_tcp, ns3::Ipv4EndPoint::SetDestroyCallback(), and ns3::Ipv6EndPoint::SetDestroyCallback().

Referenced by CloseAndNotify(), LastAckTimeout(), ReTxTimeout(), SendEmptyPacket(), and SendRST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DelAckTimeout()

void ns3::TcpSocketBase::DelAckTimeout ( )
protectedvirtual

Action upon delay ACK timeout, i.e.

send an ACK

Definition at line 3857 of file tcp-socket-base.cc.

References ns3::TcpHeader::ACK, ns3::TcpSocketState::CA_EVENT_DELAYED_ACK, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_SENDING_ECE, m_congestionControl, m_delAckCount, ns3::TcpSocketState::m_ecnState, m_tcb, and SendEmptyPacket().

Referenced by ReceivedData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Destroy()

void ns3::TcpSocketBase::Destroy ( )
protected

Kill this socket by zeroing its attributes (IPv4)

This is a callback function configured to m_endpoint in SetupCallback(), invoked when the endpoint is destroyed.

Definition at line 2701 of file tcp-socket-base.cc.

References CancelAllTimers(), ns3::Simulator::GetDelayLeft(), m_endPoint, m_retxEvent, m_tcp, ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by SetupCallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Destroy6()

void ns3::TcpSocketBase::Destroy6 ( )
protected

Kill this socket by zeroing its attributes (IPv6)

This is a callback function configured to m_endpoint in SetupCallback(), invoked when the endpoint is destroyed.

Definition at line 2717 of file tcp-socket-base.cc.

References CancelAllTimers(), ns3::Simulator::GetDelayLeft(), m_endPoint6, m_retxEvent, m_tcp, ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by SetupCallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoClose()

int ns3::TcpSocketBase::DoClose ( )
protected

Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state.

Returns
0 on success

Definition at line 1090 of file tcp-socket-base.cc.

References ns3::TcpHeader::ACK, ns3::TcpSocket::CLOSE_WAIT, CloseAndNotify(), ns3::TcpSocket::CLOSED, ns3::TcpSocket::CLOSING, ns3::TcpSocket::ESTABLISHED, ns3::TcpHeader::FIN, ns3::TcpSocket::FIN_WAIT_1, ns3::TcpSocket::FIN_WAIT_2, ns3::TcpSocket::LAST_ACK, ns3::TcpSocket::LISTEN, m_state, NS_LOG_DEBUG, NS_LOG_FUNCTION, SendEmptyPacket(), SendRST(), ns3::TcpSocket::SYN_RCVD, ns3::TcpSocket::SYN_SENT, and ns3::TcpSocket::TIME_WAIT.

Referenced by Close().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoConnect()

int ns3::TcpSocketBase::DoConnect ( )
protected

◆ DoForwardUp()

void ns3::TcpSocketBase::DoForwardUp ( Ptr< Packet packet,
const Address fromAddress,
const Address toAddress 
)
protectedvirtual

Called by TcpSocketBase::ForwardUp{,6}().

Get a packet from L3. This is the real function to handle the incoming packet from lower layers. This is wrapped by ForwardUp() so that this function can be overloaded by daughter classes.

Parameters
packetthe incoming packet
fromAddressthe address of the sender of packet
toAddressthe address of the receiver of packet (hopefully, us)

Definition at line 1309 of file tcp-socket-base.cc.

References ns3::TcpHeader::ACK, AddOptions(), AdvertisedWindowSize(), ns3::EventId::Cancel(), ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::CLOSED, ns3::TcpSocket::CLOSING, ns3::TcpHeader::CWR, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_IDLE, ns3::TcpSocketState::EcnStateName, ns3::TcpSocket::ESTABLISHED, EstimateRtt(), ns3::TcpSocket::FIN_WAIT_1, ns3::TcpSocket::FIN_WAIT_2, ns3::TracedValue< T >::Get(), ns3::TcpHeader::GetAckNumber(), ns3::Simulator::GetDelayLeft(), ns3::TcpHeader::GetDestinationPort(), ns3::TcpHeader::GetFlags(), GetInitialCwnd(), GetInitialSSThresh(), ns3::TcpHeader::GetOption(), GetSegSize(), ns3::TcpHeader::GetSequenceNumber(), ns3::TcpHeader::GetSourcePort(), ns3::TcpHeader::GetWindowSize(), ns3::TcpHeader::HasOption(), ns3::EventId::IsExpired(), ns3::EventId::IsRunning(), ns3::TcpSocket::LAST_ACK, ns3::TcpSocket::LISTEN, ns3::Socket::m_boundnetdevice, m_connected, ns3::TcpSocketState::m_cWnd, ns3::TcpSocketState::m_cWndInfl, ns3::TcpSocketState::m_ecnState, m_highRxAckMark, ns3::TcpSocketState::m_nextTxSequence, m_persistEvent, m_persistTimeout, m_retxEvent, m_rWnd, ns3::TcpSocketState::m_rxBuffer, m_rxTrace, m_sackEnabled, ns3::TcpSocketState::m_ssThresh, m_state, m_tcb, m_tcp, m_timestampEnabled, m_txBuffer, m_txTrace, m_winScalingEnabled, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_LOGIC, PersistTimeout(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessListen(), ProcessOptionSackPermitted(), ProcessOptionTimestamp(), ProcessOptionWScale(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ns3::TcpHeader::PSH, ns3::TcpHeader::RST, ns3::TcpOption::SACKPERMITTED, ns3::Simulator::Schedule(), SendPendingData(), ns3::TcpHeader::SetAckNumber(), ns3::TcpHeader::SetDestinationPort(), ns3::TcpHeader::SetFlags(), ns3::TcpHeader::SetSequenceNumber(), ns3::TcpHeader::SetSourcePort(), ns3::TcpHeader::SetWindowSize(), ns3::TcpHeader::SYN, ns3::TcpSocket::SYN_RCVD, ns3::TcpSocket::SYN_SENT, ns3::TcpSocket::TcpStateName, ns3::TcpSocket::TIME_WAIT, ns3::TcpOption::TS, UpdateWindowSize(), ns3::TcpHeader::URG, and ns3::TcpOption::WINSCALE.

Referenced by ForwardUp(), and ForwardUp6().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoPeerClose()

◆ DoRetransmit()

void ns3::TcpSocketBase::DoRetransmit ( )
protected

Retransmit the first segment marked as lost, without considering available window nor pacing.

Definition at line 3959 of file tcp-socket-base.cc.

References ns3::TcpSocketState::m_nextTxSequence, m_sackEnabled, ns3::TcpSocketState::m_segmentSize, m_tcb, m_txBuffer, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and SendDataPacket().

Referenced by EnterRecovery(), and ProcessAck().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DupAck()

void ns3::TcpSocketBase::DupAck ( uint32_t  currentDelivered)
protected

◆ EnterCwr()

void ns3::TcpSocketBase::EnterCwr ( uint32_t  currentDelivered)
protected

Enter CA_CWR state upon receipt of an ECN Echo.

Parameters
currentDeliveredCurrently (S)ACKed bytes

Definition at line 1615 of file tcp-socket-base.cc.

References BytesInFlight(), ns3::TcpSocketState::CA_CWR, m_congestionControl, ns3::TcpSocketState::m_congState, ns3::TcpSocketState::m_cWnd, ns3::TcpSocketState::m_cWndInfl, m_dupAckCount, ns3::TcpSocketState::m_highTxMark, m_recover, m_recoveryOps, ns3::TcpSocketState::m_ssThresh, m_tcb, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::TcpSocketState::TcpCongStateName, and UnAckDataCount().

Referenced by ReceivedAck().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnterRecovery()

void ns3::TcpSocketBase::EnterRecovery ( uint32_t  currentDelivered)
protected

◆ EstimateRtt()

void ns3::TcpSocketBase::EstimateRtt ( const TcpHeader tcpHeader)
protectedvirtual

◆ Fork()

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

Call CopyObject<> to clone me.

Returns
a copy of the socket

Reimplemented in TcpSocketAdvertisedWindowProxy, TcpSocketHalfAck, TcpDctcpCongestedRouter, ns3::TcpSocketCongestedRouter, ns3::TcpSocketMsgBase, and ns3::TcpSocketSmallAcks.

Definition at line 4543 of file tcp-socket-base.cc.

Referenced by ProcessListen().

+ Here is the caller graph for this function:

◆ ForwardIcmp()

void ns3::TcpSocketBase::ForwardIcmp ( Ipv4Address  icmpSource,
uint8_t  icmpTtl,
uint8_t  icmpType,
uint8_t  icmpCode,
uint32_t  icmpInfo 
)
protected

Called by the L3 protocol when it received an ICMP packet to pass on to TCP.

Parameters
icmpSourcethe ICMP source address
icmpTtlthe ICMP Time to Live
icmpTypethe ICMP Type
icmpCodethe ICMP Code
icmpInfothe ICMP Info

Definition at line 1253 of file tcp-socket-base.cc.

References m_icmpCallback, and NS_LOG_FUNCTION.

Referenced by SetupCallback().

+ Here is the caller graph for this function:

◆ ForwardIcmp6()

void ns3::TcpSocketBase::ForwardIcmp6 ( Ipv6Address  icmpSource,
uint8_t  icmpTtl,
uint8_t  icmpType,
uint8_t  icmpCode,
uint32_t  icmpInfo 
)
protected

Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP.

Parameters
icmpSourcethe ICMP source address
icmpTtlthe ICMP Time to Live
icmpTypethe ICMP Type
icmpCodethe ICMP Code
icmpInfothe ICMP Info

Definition at line 1269 of file tcp-socket-base.cc.

References m_icmpCallback6, and NS_LOG_FUNCTION.

Referenced by SetupCallback().

+ Here is the caller graph for this function:

◆ ForwardUp()

void ns3::TcpSocketBase::ForwardUp ( Ptr< Packet packet,
Ipv4Header  header,
uint16_t  port,
Ptr< Ipv4Interface incomingInterface 
)
protected