A Discrete-Event Network Simulator
API
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. 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  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 (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...
 
virtual TypeId GetInstanceTypeId () const
 Get the instance TypeId. 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 int GetPeerName (Address &address) const
 Get the peer address of a connected socket. 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 SetCongestionControlAlgorithm (Ptr< TcpCongestionOps > algo)
 Install a congestion control algorithm on this socket. 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)
 
void UpdateCongState (TcpSocketState::TcpCongState_t oldValue, TcpSocketState::TcpCongState_t newValue)
 Callback function to hook to TcpSocketState congestion state. More...
 
void UpdateCwnd (uint32_t oldValue, uint32_t newValue)
 Callback function to hook to TcpSocketState congestion window. More...
 
void UpdateHighTxMark (SequenceNumber32 oldValue, SequenceNumber32 newValue)
 Callback function to hook to TcpSocketState high tx mark. More...
 
void UpdateNextTxSequence (SequenceNumber32 oldValue, SequenceNumber32 newValue)
 Callback function to hook to TcpSocketState next tx sequence. More...
 
void UpdateSsThresh (uint32_t oldValue, uint32_t newValue)
 Callback function to hook to TcpSocketState slow start threshold. More...
 
- 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...
 
uint8_t GetPriority (void) const
 Query the priority value of this socket. More...
 
virtual void Ipv6JoinGroup (Ipv6Address address, Ipv6MulticastFilterMode filterMode, std::vector< Ipv6Address > sourceAddresses)
 Joins a IPv6 multicast group. More...
 
virtual void Ipv6JoinGroup (Ipv6Address address)
 Joins a IPv6 multicast group without filters. More...
 
virtual void Ipv6LeaveGroup (void)
 Leaves IPv6 multicast group this socket is joined to. 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 SetPriority (uint8_t priority)
 Manually set the socket priority. 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...
 
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...
 
bool IsInitialized (void) const
 Check if the object has been initialized. 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::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 uint8_t IpTos2Priority (uint8_t ipTos)
 Return the priority corresponding to a given TOS value. 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...
 

Public Attributes

TracedCallback< TcpSocketState::TcpCongState_t, TcpSocketState::TcpCongState_tm_congStateTrace
 Callback pointer for congestion state trace chaining. More...
 
TracedCallback< uint32_t, uint32_t > m_cWndTrace
 Callback pointer for cWnd trace chaining. More...
 
TracedCallback< SequenceNumber32, SequenceNumber32m_highTxMarkTrace
 Callback pointer for high tx mark chaining. More...
 
TracedCallback< SequenceNumber32, SequenceNumber32m_nextTxSequenceTrace
 Callback pointer for next tx sequence chaining. More...
 
TracedCallback< uint32_t, uint32_t > m_ssThTrace
 Callback pointer for ssTh trace chaining. More...
 

Protected Member Functions

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 (bool scale=true) const
 The amount of Rx window announced to the peer. More...
 
virtual uint32_t AvailableWindow (void) const
 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...
 
virtual 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 DupAck ()
 Dupack management. More...
 
virtual void EstimateRtt (const TcpHeader &tcpHeader)
 Take into account the packet for RTT estimation. More...
 
void FastRetransmit ()
 Enter the FastRetransmit, and retransmit the head. More...
 
virtual Ptr< TcpSocketBaseFork (void)
 Call CopyObject<> to clone me. 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 Time GetConnTimeout (void) const
 Get the connection timeout. More...
 
virtual uint32_t GetDataRetries (void) const
 Get the number of data transmission retries before giving up. 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 uint32_t GetSynRetries (void) const
 Get the number of connection retries before giving up. More...
 
virtual bool GetTcpNoDelay (void) const
 Check if Nagle's algorithm is enabled or not. More...
 
virtual void LastAckTimeout (void)
 Timeout at LAST_ACK, close the connection. More...
 
void LimitedTransmit ()
 Limited transmit algorithm. More...
 
virtual void NewAck (SequenceNumber32 const &seq, bool resetRTO)
 Update buffers w.r.t. 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, const SequenceNumber32 &seq)
 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 ReceivedAck (Ptr< Packet > packet, const TcpHeader &tcpHeader)
 Received an ACK packet. 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 Retransmit (void)
 Halving cwnd and call DoRetransmit() More...
 
virtual void ReTxTimeout (void)
 Call Retransmit() upon RTO event. 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...
 
virtual 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 SetConnTimeout (Time timeout)
 Set the connection timeout. More...
 
virtual void SetDataRetries (uint32_t retries)
 Set the number of data transmission retries before giving up. 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 SetSynRetries (uint32_t count)
 Set the number of connection retries before giving up. 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) const
 Return count of number of unacked bytes. More...
 
virtual void UpdateRttHistory (const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
 Update the RTT history, when we send TCP segments. 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) const
 Return the max possible number of unacked bytes. More...
 
- Protected Member Functions inherited from ns3::Socket
virtual void DoDispose (void)
 Destructor implementation. 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...
 

Static Protected Member Functions

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

Protected Attributes

uint32_t m_bytesAckedNotProcessed
 Bytes acked, but not processed. More...
 
TracedValue< uint32_t > m_bytesInFlight
 Bytes in flight. More...
 
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...
 
Time m_cnTimeout
 Timeout for connection retry. More...
 
Ptr< TcpCongestionOpsm_congestionControl
 Congestion control. More...
 
bool m_connected
 Connection established. More...
 
uint32_t m_dataRetrCount
 Count of remaining data retransmission attempts. More...
 
uint32_t m_dataRetries
 Number of data retransmission attempts. 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...
 
SequenceNumber32 m_highTxAck
 Highest ack sent. 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...
 
bool m_isFirstPartialAck
 First partial ACK during RECOVERY. More...
 
EventId m_lastAckEvent
 Last ACK timeout event. More...
 
TracedValue< Timem_lastRtt
 Last RTT sample collected. More...
 
bool m_limitedTx
 perform limited transmit 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...
 
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_rcvWindShift
 Window shift to apply to outgoing segments. More...
 
SequenceNumber32 m_recover
 Previous highest Tx seqnum for fast recovery. More...
 
uint32_t m_retransOut
 Number of retransmission in this window. More...
 
EventId m_retxEvent
 Retransmission event. More...
 
uint32_t m_retxThresh
 Fast Retransmit threshold. 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...
 
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_rxTrace
 Trace of received packets. 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_sndWindShift
 Window shift to apply to incoming segments. More...
 
TracedValue< TcpStates_tm_state
 TCP state. More...
 
uint32_t m_synCount
 Count of remaining connection retries. More...
 
uint32_t m_synRetries
 Number of connection attempts. More...
 
Ptr< TcpSocketStatem_tcb
 Congestion control informations. 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...
 
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_txTrace
 Trace of transmitted packets. More...
 
bool m_winScalingEnabled
 Window Scale option enabled (RFC 7323) More...
 
- Protected Attributes inherited from ns3::Socket
Ptr< NetDevicem_boundnetdevice
 the device this socket is bound to (might be null). More...
 
Ipv6Address m_ipv6MulticastGroupAddress
 IPv6 multicast group address. More...
 
bool m_recvPktInfo
 if the socket should add packet info tags to the packet forwarded to L4. More...
 

Friends

class TcpGeneralTest
 

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

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 serves as a base for other TCP functions where the sliding window mechanism is handled here. This class provides connection orientation and sliding window flow control. Part of this class 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

Another one (CA_CWR) is present but not used. For more information, see the TcpCongState_t documentation.

Congestion control interface

Congestion control, unlike older releases of ns-3, has been splitted 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 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 5681. It basically 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.

In ns-3, these algorithms are included in this class, and it is implemented inside the ReceivedAck method. The attribute which manages the number of dup ACKs necessary to start the fast retransmit algorithm is named "ReTxThreshold", and its default value is 3, while the Limited Transmit one can be enabled by setting the attribute "LimitedTransmit" to true.

Fast recovery

The fast recovery algorithm is introduced RFC 2001, and it basically avoids to reset cWnd to 1 segment after sensing a loss on the channel. Instead, the slow start threshold is halved, and the cWnd is set equal to such value, plus segments for the cWnd inflation.

The algorithm is implemented in the ReceivedAck method.

Config Paths

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

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

Attributes

  • 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
  • ReTxThreshold: Threshold for fast retransmit
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 3
    • Flags: construct write read
  • LimitedTransmit: Enable limited transmit
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read

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: 4294967295
    • 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
  • DataRetries: Number of data retransmission attempts
    • 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

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

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

Member Typedef Documentation

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]ipv4
[in]interface

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

Constructor & Destructor Documentation

ns3::TcpSocketBase::TcpSocketBase ( void  )

Create an unbound TCP socket.

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

References m_rxBuffer, m_tcb, m_txBuffer, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, UpdateCongState(), UpdateCwnd(), UpdateHighTxMark(), UpdateNextTxSequence(), and UpdateSsThresh().

+ Here is the call graph for this function:

ns3::TcpSocketBase::TcpSocketBase ( const TcpSocketBase sock)
ns3::TcpSocketBase::~TcpSocketBase ( void  )
virtual

Definition at line 445 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

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

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 3302 of file tcp-socket-base.cc.

References AddOptionTimestamp(), m_timestampEnabled, and NS_LOG_FUNCTION.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 3395 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:

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 3358 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:

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

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

References m_maxWinSize, m_rcvWindShift, m_rxBuffer, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and visualizer.higcontainer::w.

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

+ Here is the caller graph for this function:

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

Return unfilled portion of window.

Returns
unfilled portion of window

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, UnAckDataCount(), and Window().

Referenced by SendPendingData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::Bind ( void  )
virtual

Allocate a local IPv4 endpoint for this socket.

Returns
0 on success, -1 on failure.

Implements ns3::Socket.

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

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

Referenced by BindToNetDevice(), and Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::Bind6 ( void  )
virtual

Allocate a local IPv6 endpoint for this socket.

Returns
0 on success, -1 on failure.

Implements ns3::Socket.

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

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

Referenced by BindToNetDevice(), and Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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.

Warning
BindToNetDevice should be used after Bind. Otherwise it will perform a Bind itself.
Parameters
netdevicePointer to Netdevice of desired interface
Returns
nothing

Reimplemented from ns3::Socket.

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

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

+ Here is the call graph for this function:

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

Return total bytes in flight.

Returns
total bytes in flight

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

References m_bytesInFlight, m_dupAckCount, m_retransOut, m_tcb, m_txBuffer, and NS_LOG_FUNCTION.

Referenced by FastRetransmit(), ReceivedAck(), and Retransmit().

+ Here is the caller graph for this function:

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 3334 of file tcp-socket-base.cc.

References ns3::Node::GetId(), m_maxWinSize, m_node, m_rxBuffer, 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:

void ns3::TcpSocketBase::CancelAllTimers ( void  )
protected

Cancel all timer when endpoint is deleted.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::Close ( void  )
virtual

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 748 of file tcp-socket-base.cc.

References DoClose(), m_closeOnEmpty, 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:

void ns3::TcpSocketBase::CloseAndNotify ( void  )
protected

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

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 2408 of file tcp-socket-base.cc.

References ns3::TcpHeader::ACK, ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), ns3::TcpHeader::GetSequenceNumber(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), m_dataRetrCount, m_dataRetries, m_endPoint, m_endPoint6, m_rxBuffer, m_state, m_synCount, m_synRetries, m_tcp, NS_LOG_DEBUG, 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:

void ns3::TcpSocketBase::ConnectionSucceeded ( void  )
protected

Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()

Definition at line 2443 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:

void ns3::TcpSocketBase::DeallocateEndPoint ( void  )
protected

Deallocate m_endPoint and m_endPoint6.

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

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

Referenced by CloseAndNotify(), DoRetransmit(), and SendRST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::DelAckTimeout ( void  )
protectedvirtual

Action upon delay ACK timeout, i.e.

send an ACK

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

References ns3::TcpHeader::ACK, m_delAckCount, and SendEmptyPacket().

Referenced by ReceivedData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::Destroy ( void  )
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 2130 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:

void ns3::TcpSocketBase::Destroy6 ( void  )
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 2146 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:

int ns3::TcpSocketBase::DoClose ( void  )
protected

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

Returns
0 on success

Definition at line 1053 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:

int ns3::TcpSocketBase::DoConnect ( void  )
protected

Perform the real connection tasks: Send SYN if allowed, RST if invalid.

Returns
0 on success

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

References ns3::TcpSocket::CLOSE_WAIT, CloseAndNotify(), ns3::TcpSocket::CLOSED, ns3::TcpSocket::LAST_ACK, ns3::TcpSocket::LISTEN, m_state, NS_LOG_DEBUG, NS_LOG_FUNCTION, SendEmptyPacket(), SendRST(), ns3::TcpHeader::SYN, ns3::TcpSocket::SYN_SENT, ns3::TcpSocket::TcpStateName, and ns3::TcpSocket::TIME_WAIT.

Referenced by Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 1194 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::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::Packet::GetSize(), 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, m_highRxAckMark, m_persistEvent, m_persistTimeout, m_retxEvent, m_rWnd, m_rxBuffer, m_rxTrace, m_sendPendingDataEvent, m_state, m_tcb, m_tcp, m_timestampEnabled, m_txTrace, m_winScalingEnabled, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_ERROR, NS_LOG_LOGIC, OutOfRange(), PersistTimeout(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessListen(), ProcessOptionTimestamp(), ProcessOptionWScale(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ns3::TcpHeader::PSH, ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::TcpHeader::RST, ns3::Simulator::Schedule(), SendEmptyPacket(), 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::TimeStep(), 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:

void ns3::TcpSocketBase::DoPeerClose ( void  )
protected
void ns3::TcpSocketBase::DoRetransmit ( void  )
protectedvirtual
void ns3::TcpSocketBase::DupAck ( )
protected
void ns3::TcpSocketBase::EstimateRtt ( const TcpHeader tcpHeader)
protectedvirtual

Take into account the packet for RTT estimation.

Estimate the RTT.

Parameters
tcpHeaderthe packet's TCP header

Called by ForwardUp() to estimate RTT.

Parameters
tcpHeaderTCP header for the incoming packet

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

References ns3::RttHistory::count, ns3::TcpOptionTS::ElapsedTimeFromTsValue(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetOption(), ns3::TcpHeader::HasOption(), ns3::Time::IsZero(), m_clockGranularity, m_history, m_lastRtt, m_minRto, m_rto, m_rtt, m_timestampEnabled, ns3::Max(), ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::RttHistory::retx, ns3::RttHistory::seq, ns3::RttHistory::time, and ns3::TcpOption::TS.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::FastRetransmit ( )
protected

Enter the FastRetransmit, and retransmit the head.

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

References BytesInFlight(), ns3::TcpSocketState::CA_RECOVERY, DoRetransmit(), m_congestionControl, m_dupAckCount, m_recover, m_tcb, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by DupAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Call CopyObject<> to clone me.

Returns
a copy of the socket

Reimplemented in ns3::TcpSocketSmallAcks, ns3::TcpSocketMsgBase, and ns3::TcpSocketHalfAck.

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

Referenced by ProcessListen().

+ Here is the caller graph for this function:

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 1168 of file tcp-socket-base.cc.

References m_icmpCallback, and NS_LOG_FUNCTION.

Referenced by SetupCallback().

+ Here is the caller graph for this function:

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 1181 of file tcp-socket-base.cc.

References m_icmpCallback6, and NS_LOG_FUNCTION.

Referenced by SetupCallback().

+ Here is the caller graph for this function:

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

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

Parameters
packetthe incoming packet
headerthe packet's IPv4 header
portthe remote port
incomingInterfacethe incoming interface

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

References DoForwardUp(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv4Header::GetSource(), m_endPoint, NS_LOG_LOGIC, and port.

Referenced by SetupCallback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ForwardUp6 ( Ptr< Packet packet,
Ipv6Header  header,
uint16_t  port,
Ptr< Ipv6Interface incomingInterface 
)
protected

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

Parameters
packetthe incoming packet
headerthe packet's IPv6 header
portthe remote port
incomingInterfacethe incoming interface

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

References DoForwardUp(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerPort(), ns3::Ipv6Header::GetSourceAddress(), m_endPoint6, NS_LOG_LOGIC, and port.

Referenced by SetupCallback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::TcpSocketBase::GetAllowBroadcast ( void  ) const
protectedvirtual

Query whether broadcast datagram transmissions are allowed.

This method corresponds to using getsockopt() SO_BROADCAST of real network or BSD sockets.

Returns
true if broadcast is allowed, false otherwise

Implements ns3::Socket.

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

Time ns3::TcpSocketBase::GetClockGranularity ( void  ) const

Get the Clock Granularity (used in RTO calcs).

Returns
The Clock Granularity.

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

References m_clockGranularity.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Time ns3::TcpSocketBase::GetConnTimeout ( void  ) const
protectedvirtual

Get the connection timeout.

Returns
the connection timeout

Implements ns3::TcpSocket.

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

References m_cnTimeout.

uint32_t ns3::TcpSocketBase::GetDataRetries ( void  ) const
protectedvirtual

Get the number of data transmission retries before giving up.

Returns
the number of data transmission retries

Implements ns3::TcpSocket.

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

References m_dataRetries, and NS_LOG_FUNCTION.

uint32_t ns3::TcpSocketBase::GetDelAckMaxCount ( void  ) const
protectedvirtual

Get the number of packet to fire an ACK before delay timeout.

Returns
the number of packet to fire an ACK before delay timeout

Implements ns3::TcpSocket.

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

References m_delAckMaxCount.

Time ns3::TcpSocketBase::GetDelAckTimeout ( void  ) const
protectedvirtual

Get the time to delay an ACK.

Returns
the time to delay an ACK

Implements ns3::TcpSocket.

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

References m_delAckTimeout.

enum Socket::SocketErrno ns3::TcpSocketBase::GetErrno ( void  ) const
virtual

Get last error number.

Returns
the errno associated to the last call which failed in this socket. Each socket's errno is initialized to zero when the socket is created.

Implements ns3::Socket.

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

References m_errno.

uint32_t ns3::TcpSocketBase::GetInitialCwnd ( void  ) const
protectedvirtual

Get the initial Congestion Window.

Returns
the initial congestion window (in bytes)

Implements ns3::TcpSocket.

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

References m_tcb.

Referenced by DoForwardUp().

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::GetInitialSSThresh ( void  ) const
protectedvirtual

Get the initial Slow Start Threshold.

Returns
the Slow Start Threshold (in bytes)

Implements ns3::TcpSocket.

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

References m_tcb.

Referenced by DoForwardUp().

+ Here is the caller graph for this function:

TypeId ns3::TcpSocketBase::GetInstanceTypeId ( void  ) const
virtual

Get the instance TypeId.

Returns
the instance TypeId

Reimplemented from ns3::Object.

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

References GetTypeId().

+ Here is the call graph for this function:

Time ns3::TcpSocketBase::GetMinRto ( void  ) const

Get the Minimum RTO.

Returns
The minimum RTO.

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

References m_minRto.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Ptr< Node > ns3::TcpSocketBase::GetNode ( void  ) const
virtual

Return the node this socket is associated with.

Returns
the node

Implements ns3::Socket.

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

References m_node, and NS_LOG_FUNCTION_NOARGS.

int ns3::TcpSocketBase::GetPeerName ( Address address) const
virtual

Get the peer address of a connected socket.

Parameters
addressthe address this socket is connected to.
Returns
0 if success, -1 otherwise

Implements ns3::Socket.

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

References ns3::Socket::ERROR_NOTCONN, ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv6EndPoint::GetPeerPort(), m_endPoint, m_endPoint6, m_errno, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Time ns3::TcpSocketBase::GetPersistTimeout ( void  ) const
protectedvirtual

Get the timout for persistent connection.

When the timout expires, send 1-byte data to probe for the window size at the receiver when the local knowledge tells that the receiver has zero window size

Returns
the persistent timout

Implements ns3::TcpSocket.

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

References m_persistTimeout.

uint32_t ns3::TcpSocketBase::GetRcvBufSize ( void  ) const
protectedvirtual

Get the receive buffer size.

Returns
the buffer size (in bytes)

Implements ns3::TcpSocket.

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

References m_rxBuffer.

Referenced by SetRcvBufSize().

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::GetRxAvailable ( void  ) const
virtual

Return number of bytes which can be returned from one or multiple calls to Recv.

Must be possible to call this method from the Recv callback.

Returns
the number of bytes which can be returned from one or multiple Recv calls.

Implements ns3::Socket.

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

References m_rxBuffer, and NS_LOG_FUNCTION.

Ptr< TcpRxBuffer > ns3::TcpSocketBase::GetRxBuffer ( void  ) const

Get a pointer to the Rx buffer.

Returns
a pointer to the rx buffer

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

References m_rxBuffer.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::GetSegSize ( void  ) const
protectedvirtual

Get the segment size.

Returns
the segment size (in bytes)

Implements ns3::TcpSocket.

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

References m_tcb.

Referenced by DoForwardUp().

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::GetSndBufSize ( void  ) const
protectedvirtual

Get the send buffer size.

Returns
the buffer size (in bytes)

Implements ns3::TcpSocket.

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

References m_txBuffer.

enum Socket::SocketType ns3::TcpSocketBase::GetSocketType ( void  ) const
virtual
Returns
the socket type, analogous to getsockopt (SO_TYPE)

Implements ns3::Socket.

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

References ns3::Socket::NS3_SOCK_STREAM.

int ns3::TcpSocketBase::GetSockName ( Address address) const
virtual

Get socket address.

Parameters
addressthe address name this socket is associated with.
Returns
0 if success, -1 otherwise

Implements ns3::Socket.

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

References ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv4Address::GetZero(), m_endPoint, m_endPoint6, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

uint32_t ns3::TcpSocketBase::GetSynRetries ( void  ) const
protectedvirtual

Get the number of connection retries before giving up.

Returns
the number of connection retries

Implements ns3::TcpSocket.

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

References m_synRetries.

bool ns3::TcpSocketBase::GetTcpNoDelay ( void  ) const
protectedvirtual

Check if Nagle's algorithm is enabled or not.

Returns
true if Nagle's algorithm is DISABLED

Implements ns3::TcpSocket.

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

References m_noDelay.

uint32_t ns3::TcpSocketBase::GetTxAvailable ( void  ) const
virtual

Returns the number of bytes which can be sent in a single call to Send.

For datagram sockets, this returns the number of bytes that can be passed atomically through the underlying protocol.

For stream sockets, this returns the available space in bytes left in the transmit buffer.

Returns
The number of bytes which can be sent in a single Send call.

Implements ns3::Socket.

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

References m_txBuffer, and NS_LOG_FUNCTION.

Referenced by ConnectionSucceeded(), NewAck(), and ProcessSynRcvd().

+ Here is the caller graph for this function:

Ptr< TcpTxBuffer > ns3::TcpSocketBase::GetTxBuffer ( void  ) const

Get a pointer to the Tx buffer.

Returns
a pointer to the tx buffer

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

References m_txBuffer.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::LastAckTimeout ( void  )
protectedvirtual

Timeout at LAST_ACK, close the connection.

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

References ns3::EventId::Cancel(), CloseAndNotify(), ns3::TcpSocket::LAST_ACK, m_closeNotified, m_lastAckEvent, m_state, and NS_LOG_FUNCTION.

Referenced by DoPeerClose().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::LimitedTransmit ( )
protected

Limited transmit algorithm.

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

References m_limitedTx, m_tcb, m_txBuffer, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and SendDataPacket().

Referenced by DupAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::Listen ( void  )
virtual

Listen for incoming connections.

Returns
0 on success, -1 on error (in which case errno is set).

Implements ns3::Socket.

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

References ns3::TcpSocket::CLOSED, ns3::Socket::ERROR_INVAL, ns3::TcpSocket::LISTEN, m_errno, m_state, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::NewAck ( SequenceNumber32 const &  seq,
bool  resetRTO 
)
protectedvirtual

Update buffers w.r.t.

ACK

Parameters
seqthe sequence number
resetRTOindicates if RTO should be reset

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

References ns3::EventId::Cancel(), ns3::TcpSocket::CLOSING, ns3::TcpSocket::FIN_WAIT_1, ns3::TracedValue< T >::Get(), ns3::Simulator::GetDelayLeft(), GetTxAvailable(), m_clockGranularity, m_minRto, m_retxEvent, m_rto, m_rtt, m_state, m_tcb, m_txBuffer, ns3::Max(), ns3::Socket::NotifySend(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, ReTxTimeout(), ns3::Simulator::Schedule(), and ns3::TcpSocket::SYN_RCVD.

Referenced by ReceivedAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::TcpSocketBase::OutOfRange ( SequenceNumber32  head,
SequenceNumber32  tail 
) const
protected

Check if a sequence number range is within the rx window.

Parameters
headstart of the Sequence window
tailend of the Sequence window
Returns
true if it is in range

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

References ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::CLOSING, ns3::TcpSocket::LAST_ACK, ns3::TcpSocket::LISTEN, m_rxBuffer, m_state, ns3::TcpSocket::SYN_RCVD, and ns3::TcpSocket::SYN_SENT.

Referenced by DoForwardUp().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::PeerClose ( Ptr< Packet p,
const TcpHeader tcpHeader 
)
protected

Received a FIN from peer, notify rx buffer.

Parameters
pthe packet
tcpHeaderthe packet's TCP header

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

References ns3::TcpSocket::CLOSING, DoPeerClose(), ns3::TcpSocket::FIN_WAIT_1, ns3::TcpHeader::GetSequenceNumber(), ns3::Packet::GetSize(), m_rxBuffer, m_state, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ReceivedData().

Referenced by ProcessEstablished(), and ProcessSynRcvd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessClosing ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protected

Received a packet upon CLOSING.

Parameters
packetthe packet
tcpHeaderthe packet's TCP header

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

References ns3::TcpHeader::ACK, CloseAndNotify(), ns3::TcpHeader::FIN, ns3::TcpHeader::FlagsToString(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), m_rxBuffer, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::TcpHeader::PSH, ns3::TcpHeader::RST, SendEmptyPacket(), SendRST(), TimeWait(), and ns3::TcpHeader::URG.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessEstablished ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protected

Received a packet upon ESTABLISHED state.

This function is mimicking the role of tcp_rcv_established() in tcp_input.c in Linux kernel.

Parameters
packetthe packet
tcpHeaderthe packet's TCP header

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

References ns3::TcpHeader::ACK, CloseAndNotify(), ns3::TcpHeader::FIN, ns3::TcpHeader::FlagsToString(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), m_rxBuffer, m_tcb, m_txBuffer, NS_LOG_FUNCTION, NS_LOG_LOGIC, PeerClose(), ns3::TcpHeader::PSH, ReceivedAck(), ReceivedData(), ns3::TcpHeader::RST, SendEmptyPacket(), SendRST(), ns3::TcpHeader::SYN, and ns3::TcpHeader::URG.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessLastAck ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protected

Received a packet upon LAST_ACK.

Parameters
packetthe packet
tcpHeaderthe packet's TCP header

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

References ns3::TcpHeader::ACK, CloseAndNotify(), ns3::TcpHeader::FIN, ns3::TcpHeader::FlagsToString(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), m_rxBuffer, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::TcpHeader::PSH, ReceivedData(), ns3::TcpHeader::RST, SendEmptyPacket(), SendRST(), and ns3::TcpHeader::URG.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessListen ( Ptr< Packet packet,
const TcpHeader tcpHeader,
const Address fromAddress,
const Address toAddress 
)
protected

Received a packet upon LISTEN state.

Parameters
packetthe packet
tcpHeaderthe packet's TCP header
fromAddressthe source address
toAddressthe destination address

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

References CompleteFork(), Fork(), ns3::TcpHeader::GetFlags(), ns3::Socket::NotifyConnectionRequest(), NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::TcpHeader::PSH, ns3::Simulator::ScheduleNow(), ns3::TcpHeader::SYN, and ns3::TcpHeader::URG.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessOptionTimestamp ( const Ptr< const TcpOption option,
const SequenceNumber32 seq 
)
protected

Process the timestamp option from other side.

Get the timestamp and the echo, then save timestamp (which will be the echo value in our out-packets) and save the echoed timestamp, to utilize later to calculate RTT.

See also
EstimateRtt
Parameters
optionOption from the segment
seqSequence number of the segment

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

References ns3::Node::GetId(), m_highTxAck, m_node, m_rxBuffer, m_timestampToEcho, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessOptionWScale ( const Ptr< const TcpOption option)
protected

Read and parse the Window scale option.

Read the window scale option (encoded logarithmically) and save it. Per RFC 1323, the value can't exceed 14.

Parameters
optionWindow scale option read from the header

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

References ns3::Node::GetId(), m_node, m_sndWindShift, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ProcessWait ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protected
void ns3::TcpSocketBase::ReceivedData ( Ptr< Packet packet,
const TcpHeader tcpHeader 
)
protectedvirtual
Ptr< Packet > ns3::TcpSocketBase::Recv ( uint32_t  maxSize,
uint32_t  flags 
)
virtual

Read data from the socket.

This function matches closely in semantics to the recv() function call in the standard C library (libc): ssize_t recv (int s, void *buf, size_t len, int flags); except that the receive I/O is asynchronous. This is the primary Recv method at this low-level API and must be implemented by subclasses.

This method is normally used only on a connected socket. In a typical blocking sockets model, this call would block until at least one byte is returned or the connection closes. In ns-3 at this API, the call returns immediately in such a case and returns 0 if nothing is available to be read. However, an application can set a callback, ns3::SetRecvCallback, to be notified of data being available to be read (when it conceptually unblocks); this is an asynchronous I/O model for recv().

This variant of Recv() uses class ns3::Packet to encapsulate data, rather than providing a raw pointer and length field. This allows an ns-3 application to attach tags if desired (such as a flow ID) and may allow the simulator to avoid some data copies. Despite the appearance of receiving Packets on a stream socket, just think of it as a fancy byte buffer with streaming semantics.

The semantics depend on the type of socket. For a datagram socket, each Recv() returns the data from at most one Send(), and order is not necessarily preserved. For a stream socket, the bytes are delivered in order, and on-the-wire packet boundaries are not preserved.

The flags argument is formed by or'ing one or more of the values: MSG_OOB process out-of-band data MSG_PEEK peek at incoming message None of these flags are supported for now.

Some variants of Recv() are supported as additional API, including RecvFrom(), overloaded Recv() without arguments, and variants that use raw character buffers.

Parameters
maxSizereader will accept packet up to maxSize
flagsSocket control flags
Returns
Ptr<Packet> of the next in-sequence packet. Returns 0 if the socket cannot return a next in-sequence packet conforming to the maxSize and flags.
See also
SetRecvCallback

Implements ns3::Socket.

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

References ns3::TcpSocket::CLOSE_WAIT, m_rxBuffer, m_state, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.

Ptr< Packet > ns3::TcpSocketBase::RecvFrom ( uint32_t  maxSize,
uint32_t  flags,
Address fromAddress 
)
virtual

Read a single packet from the socket and retrieve the sender address.

Calls Recv(maxSize, flags) with maxSize implicitly set to maximum sized integer, and flags set to zero.

This method has similar semantics to Recv () but subclasses may want to provide checks on socket state, so the implementation is pushed to subclasses.

Parameters
maxSizereader will accept packet up to maxSize
flagsSocket control flags
fromAddressoutput parameter that will return the address of the sender of the received packet, if any. Remains untouched if no packet is received.
Returns
Ptr<Packet> of the next in-sequence packet. Returns 0 if the socket cannot return a next in-sequence packet.

Implements ns3::Socket.

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

References ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv6EndPoint::GetPeerPort(), ns3::Packet::GetSize(), ns3::Ipv4Address::GetZero(), m_endPoint, m_endPoint6, NS_LOG_FUNCTION, and ns3::Socket::Recv().

+ Here is the call graph for this function:

void ns3::TcpSocketBase::Retransmit ( void  )
protectedvirtual

Halving cwnd and call DoRetransmit()

Reimplemented in ns3::TcpSocketMsgBase.

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

References BytesInFlight(), ns3::TcpSocketState::CA_LOSS, ns3::TcpSocket::CLOSED, DoRetransmit(), m_congestionControl, m_dupAckCount, m_state, m_tcb, m_txBuffer, NS_LOG_DEBUG, and ns3::TcpSocket::TIME_WAIT.

Referenced by ns3::TcpSocketMsgBase::Retransmit(), and ReTxTimeout().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::ReTxTimeout ( void  )
protectedvirtual

Call Retransmit() upon RTO event.

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

References ns3::TcpSocket::CLOSED, m_recover, m_state, m_tcb, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, Retransmit(), and ns3::TcpSocket::TIME_WAIT.

Referenced by NewAck(), and SendDataPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::SafeSubtraction ( uint32_t  a,
uint32_t  b 
)
staticprotected

Performs a safe subtraction between a and b (a-b)

Safe is used to indicate that, if b>a, the results returned is 0.

Parameters
afirst number
bsecond number
Returns
0 if b>0, (a-b) otherwise

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

Referenced by ReceivedAck().

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::Send ( Ptr< Packet p,
uint32_t  flags 
)
virtual

Send data (or dummy data) to the remote host.

This function matches closely in semantics to the send() function call in the standard C library (libc): ssize_t send (int s, const void *msg, size_t len, int flags); except that the send I/O is asynchronous. This is the primary Send method at this low-level API and must be implemented by subclasses.

In a typical blocking sockets model, this call would block upon lack of space to hold the message to be sent. In ns-3 at this API, the call returns immediately in such a case, but the callback registered with SetSendCallback() is invoked when the socket has space (when it conceptually unblocks); this is an asynchronous I/O model for send().

This variant of Send() uses class ns3::Packet to encapsulate data, rather than providing a raw pointer and length field. This allows an ns-3 application to attach tags if desired (such as a flow ID) and may allow the simulator to avoid some data copies. Despite the appearance of sending Packets on a stream socket, just think of it as a fancy byte buffer with streaming semantics.

If either the message buffer within the Packet is too long to pass atomically through the underlying protocol (for datagram sockets), or the message buffer cannot entirely fit in the transmit buffer (for stream sockets), -1 is returned and SocketErrno is set to ERROR_MSGSIZE. If the packet does not fit, the caller can split the Packet (based on information obtained from GetTxAvailable) and reattempt to send the data.

The flags argument is formed by or'ing one or more of the values: MSG_OOB process out-of-band data MSG_DONTROUTE bypass routing, use direct interface These flags are unsupported as of ns-3.1.

Parameters
pns3::Packet to send
flagsSocket control flags
Returns
the number of bytes accepted for transmission if no error occurs, and -1 otherwise.
See also
SetSendCallback

Implements ns3::Socket.

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

References ns3::TcpSocket::CLOSE_WAIT, ns3::Socket::ERROR_MSGSIZE, ns3::Socket::ERROR_NOTCONN, ns3::Socket::ERROR_SHUTDOWN, ns3::TcpSocket::ESTABLISHED, ns3::Packet::GetSize(), ns3::EventId::IsRunning(), m_connected, m_errno, m_sendPendingDataEvent, m_shutdownSend, m_state, m_txBuffer, NS_ABORT_MSG_IF, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), SendPendingData(), ns3::TcpSocket::SYN_SENT, ns3::TcpSocket::TcpStateName, and ns3::TimeStep().

Referenced by SendTo().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::SendDataPacket ( SequenceNumber32  seq,
uint32_t  maxSize,
bool  withAck 
)
protected

Extract at most maxSize bytes from the TxBuffer at sequence seq, add the TCP header, and send to TcpL4Protocol.

Parameters
seqthe sequence number
maxSizethe maximum data block to be transmitted (in bytes)
withAckforces an ACK to be sent
Returns
the number of bytes sent

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

References ns3::TcpHeader::ACK, AddOptions(), ns3::Packet::AddPacketTag(), AdvertisedWindowSize(), ns3::EventId::Cancel(), ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::ESTABLISHED, ns3::TcpHeader::FIN, ns3::TcpSocket::FIN_WAIT_1, ns3::Time::FromDouble(), ns3::TracedValue< T >::Get(), ns3::Socket::GetIpTos(), ns3::Socket::GetIpTtl(), ns3::Socket::GetIpv6HopLimit(), ns3::Socket::GetIpv6Tclass(), ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv6EndPoint::GetPeerPort(), ns3::Socket::GetPriority(), ns3::Packet::GetSize(), ns3::EventId::IsExpired(), ns3::Socket::IsManualIpTtl(), ns3::Socket::IsManualIpv6HopLimit(), ns3::Socket::IsManualIpv6Tclass(), ns3::TcpSocket::LAST_ACK, ns3::Socket::m_boundnetdevice, m_closeOnEmpty, m_delAckCount, m_delAckEvent, m_endPoint, m_endPoint6, m_retxEvent, m_rto, m_rxBuffer, m_state, m_tcb, m_tcp, m_txBuffer, m_txTrace, max, ns3::Min(), ns3::Socket::NotifyDataSent(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Packet::ReplacePacketTag(), ReTxTimeout(), ns3::Time::S, ns3::Simulator::Schedule(), ns3::Simulator::ScheduleNow(), ns3::TcpHeader::SetAckNumber(), ns3::TcpHeader::SetDestinationPort(), ns3::TcpHeader::SetFlags(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::SocketPriorityTag::SetPriority(), ns3::TcpHeader::SetSequenceNumber(), ns3::TcpHeader::SetSourcePort(), ns3::SocketIpv6TclassTag::SetTclass(), ns3::SocketIpTosTag::SetTos(), ns3::SocketIpTtlTag::SetTtl(), ns3::TcpHeader::SetWindowSize(), and UpdateRttHistory().

Referenced by DoRetransmit(), LimitedTransmit(), and SendPendingData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::SendEmptyPacket ( uint8_t  flags)
protectedvirtual

Send a empty packet that carries a flag, e.g.

ACK

Parameters
flagsthe packet's flags

Reimplemented in ns3::TcpSocketSmallAcks.

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

References ns3::TcpHeader::ACK, AddOptions(), AddOptionWScale(), ns3::Packet::AddPacketTag(), AdvertisedWindowSize(), ns3::EventId::Cancel(), CloseAndNotify(), ns3::TcpSocket::CLOSING, ns3::TcpHeader::FIN, ns3::TcpSocket::FIN_WAIT_1, ns3::TracedValue< T >::Get(), ns3::Socket::GetIpTos(), ns3::Socket::GetIpTtl(), ns3::Socket::GetIpv6HopLimit(), ns3::Socket::GetIpv6Tclass(), ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv6EndPoint::GetPeerPort(), ns3::Socket::GetPriority(), ns3::EventId::IsExpired(), ns3::Socket::IsManualIpTtl(), ns3::Socket::IsManualIpv6HopLimit(), ns3::Socket::IsManualIpv6Tclass(), ns3::TcpSocket::LAST_ACK, ns3::Socket::m_boundnetdevice, m_clockGranularity, m_cnTimeout, m_delAckCount, m_delAckEvent, m_endPoint, m_endPoint6, m_highTxAck, m_minRto, m_retxEvent, m_rto, m_rtt, m_rxBuffer, m_state, m_synCount, m_synRetries, m_tcb, m_tcp, m_txTrace, m_winScalingEnabled, ns3::Max(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Packet::ReplacePacketTag(), ns3::Simulator::Schedule(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::SocketPriorityTag::SetPriority(), ns3::SocketIpv6TclassTag::SetTclass(), ns3::SocketIpTosTag::SetTos(), ns3::SocketIpTtlTag::SetTtl(), ns3::TcpHeader::SYN, and UpdateRttHistory().

Referenced by CompleteFork(), DelAckTimeout(), DoClose(), DoConnect(), DoForwardUp(), DoPeerClose(), DoRetransmit(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ReceivedData(), SendRST(), SetRcvBufSize(), and ShutdownSend().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::TcpSocketBase::SendPendingData ( bool  withAck = false)
protected

Send as much pending data as possible according to the Tx window.

Note that this function did not implement the PSH flag.

Parameters
withAckforces an ACK to be sent
Returns
true if some data have been sent

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

References AvailableWindow(), m_endPoint, m_endPoint6, m_noDelay, m_rWnd, m_shutdownSend, m_tcb, m_txBuffer, min, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, SendDataPacket(), UnAckDataCount(), and visualizer.higcontainer::w.

Referenced by DoForwardUp(), DupAck(), ProcessSynSent(), ReceivedAck(), and Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::SendRST ( void  )
protected

Send reset and tear down this socket.

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

References DeallocateEndPoint(), ns3::Socket::NotifyErrorClose(), NS_LOG_FUNCTION, ns3::TcpHeader::RST, and SendEmptyPacket().

Referenced by Close(), DoClose(), DoConnect(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), and ProcessWait().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::SendTo ( Ptr< Packet p,
uint32_t  flags,
const Address toAddress 
)
virtual

Send data to a specified peer.

This method has similar semantics to Send () but subclasses may want to provide checks on socket state, so the implementation is pushed to subclasses.

Parameters
ppacket to send
flagsSocket control flags
toAddressIP Address of remote host
Returns
-1 in case of error or the number of bytes copied in the internal buffer and accepted for transmission.

Implements ns3::Socket.

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

References Send().

+ Here is the call graph for this function:

bool ns3::TcpSocketBase::SetAllowBroadcast ( bool  allowBroadcast)
protectedvirtual

Configure whether broadcast datagram transmissions are allowed.

This method corresponds to using setsockopt() SO_BROADCAST of real network or BSD sockets. If set on a socket, this option will enable or disable packets to be transmitted to broadcast destination addresses.

Parameters
allowBroadcastWhether broadcast is allowed
Returns
true if operation succeeds

Implements ns3::Socket.

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

void ns3::TcpSocketBase::SetClockGranularity ( Time  clockGranularity)

Sets the Clock Granularity (used in RTO calcs).

Parameters
clockGranularityThe Clock Granularity

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

References m_clockGranularity, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::SetCongestionControlAlgorithm ( Ptr< TcpCongestionOps algo)

Install a congestion control algorithm on this socket.

Parameters
algoAlgorithm to be installed

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

References m_congestionControl, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetConnTimeout ( Time  timeout)
protectedvirtual

Set the connection timeout.

Parameters
timeoutthe connection timeout

Implements ns3::TcpSocket.

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

References m_cnTimeout, NS_LOG_FUNCTION, and timeout.

void ns3::TcpSocketBase::SetDataRetries ( uint32_t  retries)
protectedvirtual

Set the number of data transmission retries before giving up.

Parameters
retriesthe number of data transmission retries

Implements ns3::TcpSocket.

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

References m_dataRetries, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetDelAckMaxCount ( uint32_t  count)
protectedvirtual

Set the number of packet to fire an ACK before delay timeout.

Parameters
countthe umber of packet to fire an ACK before delay timeout

Implements ns3::TcpSocket.

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

References m_delAckMaxCount, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetDelAckTimeout ( Time  timeout)
protectedvirtual

Set the time to delay an ACK.

Parameters
timeoutthe time to delay an ACK

Implements ns3::TcpSocket.

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

References m_delAckTimeout, NS_LOG_FUNCTION, and timeout.

void ns3::TcpSocketBase::SetInitialCwnd ( uint32_t  cwnd)
protectedvirtual

Set the initial Congestion Window.

Parameters
cwndthe initial congestion window (in bytes)

Implements ns3::TcpSocket.

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

References ns3::TcpSocket::CLOSED, m_state, m_tcb, and NS_ABORT_MSG_UNLESS.

void ns3::TcpSocketBase::SetInitialSSThresh ( uint32_t  threshold)
protectedvirtual

Set the initial Slow Start Threshold.

Parameters
thresholdthe Slow Start Threshold (in bytes)

Implements ns3::TcpSocket.

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

References ns3::TcpSocket::CLOSED, m_state, m_tcb, and NS_ABORT_MSG_UNLESS.

void ns3::TcpSocketBase::SetMinRto ( Time  minRto)

Sets the Minimum RTO.

Parameters
minRtoThe minimum RTO.

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

References m_minRto, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::SetNode ( Ptr< Node node)
virtual

Set the associated node.

Parameters
nodethe node

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

References m_node.

void ns3::TcpSocketBase::SetPersistTimeout ( Time  timeout)
protectedvirtual

Set the timout for persistent connection.

When the timout expires, send 1-byte data to probe for the window size at the receiver when the local knowledge tells that the receiver has zero window size

Parameters
timeoutthe persistent timout

Implements ns3::TcpSocket.

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

References m_persistTimeout, NS_LOG_FUNCTION, and timeout.

void ns3::TcpSocketBase::SetRcvBufSize ( uint32_t  size)
protectedvirtual

Set the receive buffer size.

Parameters
sizethe buffer size (in bytes)

Implements ns3::TcpSocket.

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

References ns3::TcpHeader::ACK, GetRcvBufSize(), m_connected, m_rxBuffer, NS_LOG_FUNCTION, and SendEmptyPacket().

+ Here is the call graph for this function:

void ns3::TcpSocketBase::SetRtt ( Ptr< RttEstimator rtt)
virtual

Set the associated RTT estimator.

Parameters
rttthe RTT estimator

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

References m_rtt.

void ns3::TcpSocketBase::SetSegSize ( uint32_t  size)
protectedvirtual

Set the segment size.

Parameters
sizethe segment size (in bytes)

Implements ns3::TcpSocket.

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

References ns3::TcpSocket::CLOSED, m_state, m_tcb, NS_ABORT_MSG_UNLESS, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetSndBufSize ( uint32_t  size)
protectedvirtual

Set the send buffer size.

Parameters
sizethe buffer size (in bytes)

Implements ns3::TcpSocket.

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

References m_txBuffer, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetSynRetries ( uint32_t  count)
protectedvirtual

Set the number of connection retries before giving up.

Parameters
countthe number of connection retries

Implements ns3::TcpSocket.

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

References m_synRetries, and NS_LOG_FUNCTION.

void ns3::TcpSocketBase::SetTcp ( Ptr< TcpL4Protocol tcp)
virtual

Set the associated TCP L4 protocol.

Parameters
tcpthe TCP L4 protocol

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

References m_tcp.

void ns3::TcpSocketBase::SetTcpNoDelay ( bool  noDelay)
protectedvirtual

Enable/Disable Nagle's algorithm.

Parameters
noDelaytrue to DISABLE Nagle's algorithm

Implements ns3::TcpSocket.

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

References m_noDelay, and NS_LOG_FUNCTION.

int ns3::TcpSocketBase::SetupCallback ( void  )
protected

Common part of the two Bind(), i.e.

set callback and remembering local addr:port

Returns
0 on success, -1 on failure

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

References Destroy(), Destroy6(), ForwardIcmp(), ForwardIcmp6(), ForwardUp(), ForwardUp6(), m_endPoint, m_endPoint6, ns3::MakeCallback(), NS_LOG_FUNCTION, ns3::Ipv4EndPoint::SetDestroyCallback(), ns3::Ipv6EndPoint::SetDestroyCallback(), ns3::Ipv4EndPoint::SetIcmpCallback(), ns3::Ipv6EndPoint::SetIcmpCallback(), ns3::Ipv4EndPoint::SetRxCallback(), and ns3::Ipv6EndPoint::SetRxCallback().

Referenced by Bind(), Bind6(), and CompleteFork().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::SetupEndpoint ( void  )
protected

Configure the endpoint to a local address.

Called by Connect() if Bind() didn't specify one.

Returns
0 on success

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

References ns3::Object::GetObject(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv4Route::GetSource(), ns3::Socket::m_boundnetdevice, m_endPoint, m_errno, m_node, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv4Header::SetDestination(), and ns3::Ipv4EndPoint::SetLocalAddress().

Referenced by Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::SetupEndpoint6 ( void  )
protected

Configure the endpoint v6 to a local address.

Called by Connect() if Bind() didn't specify one.

Returns
0 on success

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

References ns3::Object::GetObject(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Socket::m_boundnetdevice, m_endPoint6, m_errno, m_node, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv6Header::SetDestinationAddress(), and ns3::Ipv6EndPoint::SetLocalAddress().

Referenced by Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::TcpSocketBase::ShutdownRecv ( void  )
virtual
Returns
zero on success, -1 on failure.

Do not allow any further Recv calls. This method is typically implemented for Tcp sockets by a half close.

Implements ns3::Socket.

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

References m_shutdownRecv, and NS_LOG_FUNCTION.

int ns3::TcpSocketBase::ShutdownSend ( void  )
virtual
Returns
zero on success, -1 on failure.

Do not allow any further Send calls. This method is typically implemented for Tcp sockets by a half close.

Implements ns3::Socket.

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

References ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::ESTABLISHED, ns3::TcpHeader::FIN, ns3::TcpSocket::FIN_WAIT_1, ns3::TcpSocket::LAST_ACK, m_closeOnEmpty, m_shutdownSend, m_state, m_txBuffer, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and SendEmptyPacket().

+ Here is the call graph for this function:

void ns3::TcpSocketBase::TimeWait ( void  )
protected

Move from CLOSING or FIN_WAIT_2 to TIME_WAIT state.

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

References CancelAllTimers(), CloseAndNotify(), m_msl, m_state, m_timewaitEvent, NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::TcpSocket::TcpStateName, and ns3::TcpSocket::TIME_WAIT.

Referenced by ProcessClosing(), and ProcessWait().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::UnAckDataCount ( void  ) const
protectedvirtual

Return count of number of unacked bytes.

Returns
count of number of unacked bytes

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

References m_tcb, m_txBuffer, and NS_LOG_FUNCTION.

Referenced by AvailableWindow(), and SendPendingData().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateCongState ( TcpSocketState::TcpCongState_t  oldValue,
TcpSocketState::TcpCongState_t  newValue 
)

Callback function to hook to TcpSocketState congestion state.

Parameters
oldValueold congestion state value
newValuenew congestion state value

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

References m_congStateTrace.

Referenced by TcpSocketBase().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateCwnd ( uint32_t  oldValue,
uint32_t  newValue 
)

Callback function to hook to TcpSocketState congestion window.

Parameters
oldValueold cWnd value
newValuenew cWnd value

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

References m_cWndTrace.

Referenced by TcpSocketBase().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateHighTxMark ( SequenceNumber32  oldValue,
SequenceNumber32  newValue 
)

Callback function to hook to TcpSocketState high tx mark.

Parameters
oldValueold high tx mark
newValuenew high tx mark

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

References m_highTxMarkTrace.

Referenced by TcpSocketBase().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateNextTxSequence ( SequenceNumber32  oldValue,
SequenceNumber32  newValue 
)

Callback function to hook to TcpSocketState next tx sequence.

Parameters
oldValueold nextTxSeq value
newValuenew nextTxSeq value

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

References m_nextTxSequenceTrace.

Referenced by TcpSocketBase().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateRttHistory ( const SequenceNumber32 seq,
uint32_t  sz,
bool  isRetransmission 
)
protectedvirtual

Update the RTT history, when we send TCP segments.

Parameters
seqThe sequence number of the TCP segment
szThe segment's size
isRetransmissionWhether or not the segment is a retransmission

Reimplemented in ns3::TcpSocketMsgBase.

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

References m_history, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by SendDataPacket(), SendEmptyPacket(), and ns3::TcpSocketMsgBase::UpdateRttHistory().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateSsThresh ( uint32_t  oldValue,
uint32_t  newValue 
)

Callback function to hook to TcpSocketState slow start threshold.

Parameters
oldValueold ssTh value
newValuenew ssTh value

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

References m_ssThTrace.

Referenced by TcpSocketBase().

+ Here is the caller graph for this function:

void ns3::TcpSocketBase::UpdateWindowSize ( const TcpHeader header)
protected

Update the receiver window (RWND) based on the value of the window field in the header.

This method suppresses updates unless one of the following three conditions holds: 1) segment contains new data (advancing the right edge of the receive buffer), 2) segment does not contain new data but the segment acks new data (highest sequence number acked advances), or 3) the advertised window is larger than the current send window

Parameters
headerTcpHeader from which to extract the new window value

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

References ns3::TcpSocket::ESTABLISHED, ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetSequenceNumber(), ns3::TcpHeader::GetWindowSize(), m_highRxAckMark, m_highRxMark, m_rWnd, m_sndWindShift, m_state, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.

Referenced by DoForwardUp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::TcpSocketBase::Window ( void  ) const
protectedvirtual

Return the max possible number of unacked bytes.

Returns
the max possible number of unacked bytes

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

References ns3::TracedValue< T >::Get(), m_rWnd, m_tcb, min, and NS_LOG_FUNCTION.

Referenced by AvailableWindow().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class TcpGeneralTest
friend

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

Member Data Documentation

uint32_t ns3::TcpSocketBase::m_bytesAckedNotProcessed
protected

Bytes acked, but not processed.

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

Referenced by ReceivedAck().

TracedValue<uint32_t> ns3::TcpSocketBase::m_bytesInFlight
protected

Bytes in flight.

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

Referenced by BytesInFlight(), and GetTypeId().

Time ns3::TcpSocketBase::m_clockGranularity
protected
bool ns3::TcpSocketBase::m_closeNotified
protected

Told app to close socket.

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

Referenced by CloseAndNotify(), DoPeerClose(), LastAckTimeout(), and ReceivedData().

bool ns3::TcpSocketBase::m_closeOnEmpty
protected

Close socket upon tx buffer emptied.

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

Referenced by Close(), SendDataPacket(), and ShutdownSend().

Time ns3::TcpSocketBase::m_cnTimeout
protected

Timeout for connection retry.

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

Referenced by GetConnTimeout(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), SendEmptyPacket(), and SetConnTimeout().

Ptr<TcpCongestionOps> ns3::TcpSocketBase::m_congestionControl
protected

Callback pointer for congestion state trace chaining.

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

Referenced by GetTypeId(), and UpdateCongState().

bool ns3::TcpSocketBase::m_connected
protected

Connection established.

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

Referenced by DoForwardUp(), DupAck(), ProcessSynRcvd(), ProcessSynSent(), ReceivedAck(), Send(), and SetRcvBufSize().

TracedCallback<uint32_t, uint32_t> ns3::TcpSocketBase::m_cWndTrace

Callback pointer for cWnd trace chaining.

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

Referenced by GetTypeId(), and UpdateCwnd().

uint32_t ns3::TcpSocketBase::m_dataRetrCount
protected

Count of remaining data retransmission attempts.

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

Referenced by CompleteFork(), Connect(), DoRetransmit(), and ReceivedAck().

uint32_t ns3::TcpSocketBase::m_dataRetries
protected

Number of data retransmission attempts.

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

Referenced by CompleteFork(), Connect(), GetDataRetries(), ReceivedAck(), and SetDataRetries().

uint32_t ns3::TcpSocketBase::m_delAckCount
protected
EventId ns3::TcpSocketBase::m_delAckEvent
protected

Delayed ACK timeout event.

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

Referenced by CancelAllTimers(), ReceivedData(), SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), and SendEmptyPacket().

uint32_t ns3::TcpSocketBase::m_delAckMaxCount
protected

Number of packet to fire an ACK before delay timeout.

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

Referenced by GetDelAckMaxCount(), ProcessSynRcvd(), ProcessSynSent(), ReceivedData(), and SetDelAckMaxCount().

Time ns3::TcpSocketBase::m_delAckTimeout
protected

Time to delay an ACK.

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

Referenced by GetDelAckTimeout(), ReceivedData(), and SetDelAckTimeout().

uint32_t ns3::TcpSocketBase::m_dupAckCount
protected

Dupack counter.

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

Referenced by BytesInFlight(), DupAck(), FastRetransmit(), ReceivedAck(), and Retransmit().

enum SocketErrno ns3::TcpSocketBase::m_errno
mutableprotected

Socket error code.

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

Referenced by Bind(), Bind6(), Connect(), GetErrno(), GetPeerName(), Listen(), Send(), SetupEndpoint(), and SetupEndpoint6().

TracedValue<SequenceNumber32> ns3::TcpSocketBase::m_highRxAckMark
protected

Highest ack received.

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

Referenced by DoForwardUp(), DupAck(), GetTypeId(), and UpdateWindowSize().

TracedValue<SequenceNumber32> ns3::TcpSocketBase::m_highRxMark
protected

Highest seqno received.

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

Referenced by GetTypeId(), and UpdateWindowSize().

SequenceNumber32 ns3::TcpSocketBase::m_highTxAck
protected

Highest ack sent.

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

Referenced by ProcessOptionTimestamp(), and SendEmptyPacket().

TracedCallback<SequenceNumber32, SequenceNumber32> ns3::TcpSocketBase::m_highTxMarkTrace

Callback pointer for high tx mark chaining.

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

Referenced by GetTypeId(), and UpdateHighTxMark().

RttHistory_t ns3::TcpSocketBase::m_history
protected

List of sent packet.

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

Referenced by EstimateRtt(), and UpdateRttHistory().

Callback<void, Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> ns3::TcpSocketBase::m_icmpCallback
protected

ICMP callback.

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

Referenced by ForwardIcmp(), and GetTypeId().

Callback<void, Ipv6Address,uint8_t,uint8_t,uint8_t,uint32_t> ns3::TcpSocketBase::m_icmpCallback6
protected

ICMPv6 callback.

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

Referenced by ForwardIcmp6(), and GetTypeId().

bool ns3::TcpSocketBase::m_isFirstPartialAck
protected

First partial ACK during RECOVERY.

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

Referenced by ReceivedAck().

EventId ns3::TcpSocketBase::m_lastAckEvent
protected

Last ACK timeout event.

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

Referenced by CancelAllTimers(), DoPeerClose(), and LastAckTimeout().

TracedValue<Time> ns3::TcpSocketBase::m_lastRtt
protected

Last RTT sample collected.

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

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

bool ns3::TcpSocketBase::m_limitedTx
protected

perform limited transmit

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

Referenced by DupAck(), GetTypeId(), and LimitedTransmit().

uint16_t ns3::TcpSocketBase::m_maxWinSize
protected

Maximum window size to advertise.

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

Referenced by AdvertisedWindowSize(), CalculateWScale(), and GetTypeId().

Time ns3::TcpSocketBase::m_minRto
protected

minimum value of the Retransmit timeout

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

Referenced by EstimateRtt(), GetMinRto(), NewAck(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), SendEmptyPacket(), and SetMinRto().

double ns3::TcpSocketBase::m_msl
protected

Max segment lifetime.

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

Referenced by GetTypeId(), and TimeWait().

TracedCallback<SequenceNumber32, SequenceNumber32> ns3::TcpSocketBase::m_nextTxSequenceTrace

Callback pointer for next tx sequence chaining.

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

Referenced by GetTypeId(), and UpdateNextTxSequence().

Ptr<Node> ns3::TcpSocketBase::m_node
protected
bool ns3::TcpSocketBase::m_noDelay
protected

Set to true to disable Nagle's algorithm.

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

Referenced by GetTcpNoDelay(), SendPendingData(), and SetTcpNoDelay().

EventId ns3::TcpSocketBase::m_persistEvent
protected

Persist event: Send 1 byte to probe for a non-zero Rx window.

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

Referenced by CancelAllTimers(), DoForwardUp(), and PersistTimeout().

Time ns3::TcpSocketBase::m_persistTimeout
protected

Time between sending 1-byte probes.

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

Referenced by DoForwardUp(), GetPersistTimeout(), PersistTimeout(), and SetPersistTimeout().

uint8_t ns3::TcpSocketBase::m_rcvWindShift
protected

Window shift to apply to outgoing segments.

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

Referenced by AddOptionWScale(), and AdvertisedWindowSize().

SequenceNumber32 ns3::TcpSocketBase::m_recover
protected

Previous highest Tx seqnum for fast recovery.

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

Referenced by DupAck(), FastRetransmit(), ReceivedAck(), and ReTxTimeout().

uint32_t ns3::TcpSocketBase::m_retransOut
protected

Number of retransmission in this window.

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

Referenced by BytesInFlight(), DoRetransmit(), and ReceivedAck().

EventId ns3::TcpSocketBase::m_retxEvent
protected
uint32_t ns3::TcpSocketBase::m_retxThresh
protected

Fast Retransmit threshold.

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

Referenced by DupAck(), and GetTypeId().

TracedValue<Time> ns3::TcpSocketBase::m_rto
protected
Ptr<RttEstimator> ns3::TcpSocketBase::m_rtt
protected
TracedValue<uint32_t> ns3::TcpSocketBase::m_rWnd
protected

Receiver window (RCV.WND in RFC793)

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

Referenced by DoForwardUp(), GetTypeId(), SendPendingData(), UpdateWindowSize(), and Window().

TracedCallback<Ptr<const Packet>, const TcpHeader&, Ptr<const TcpSocketBase> > ns3::TcpSocketBase::m_rxTrace
protected

Trace of received packets.

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

Referenced by DoForwardUp(), and GetTypeId().

EventId ns3::TcpSocketBase::m_sendPendingDataEvent
protected

micro-delay event to send pending data

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

Referenced by CancelAllTimers(), DoForwardUp(), ReceivedAck(), and Send().

bool ns3::TcpSocketBase::m_shutdownRecv
protected

Receive no longer allowed.

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

Referenced by ProcessWait(), ReceivedData(), and ShutdownRecv().

bool ns3::TcpSocketBase::m_shutdownSend
protected

Send no longer allowed.

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

Referenced by DoPeerClose(), Send(), SendPendingData(), and ShutdownSend().

uint8_t ns3::TcpSocketBase::m_sndWindShift
protected

Window shift to apply to incoming segments.

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

Referenced by ProcessOptionWScale(), and UpdateWindowSize().

TracedCallback<uint32_t, uint32_t> ns3::TcpSocketBase::m_ssThTrace

Callback pointer for ssTh trace chaining.

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

Referenced by GetTypeId(), and UpdateSsThresh().

uint32_t ns3::TcpSocketBase::m_synCount
protected

Count of remaining connection retries.

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

Referenced by CompleteFork(), Connect(), DoRetransmit(), ProcessSynSent(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), and SendEmptyPacket().

uint32_t ns3::TcpSocketBase::m_synRetries
protected
bool ns3::TcpSocketBase::m_timestampEnabled
protected

Timestamp option enabled.

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

Referenced by AddOptions(), DoForwardUp(), EstimateRtt(), and GetTypeId().

uint32_t ns3::TcpSocketBase::m_timestampToEcho
protected

Timestamp to echo.

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

Referenced by AddOptionTimestamp(), and ProcessOptionTimestamp().

EventId ns3::TcpSocketBase::m_timewaitEvent
protected

TIME_WAIT expiration event: Move this socket to CLOSED state.

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

Referenced by CancelAllTimers(), and TimeWait().

TracedCallback<Ptr<const Packet>, const TcpHeader&, Ptr<const TcpSocketBase> > ns3::TcpSocketBase::m_txTrace
protected

Trace of transmitted packets.

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

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

bool ns3::TcpSocketBase::m_winScalingEnabled
protected

Window Scale option enabled (RFC 7323)

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

Referenced by DoForwardUp(), GetTypeId(), and SendEmptyPacket().


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