A base class for implementation of a stream socket using TCP. More...
#include "tcp-socket-base.h"
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... | |
bool | CheckEcnCe (uint8_t tos) const |
Checks for CE bits. More... | |
bool | CheckEcnEct0 (uint8_t tos) const |
Checks for ECT(0) bits. More... | |
bool | CheckEcnEct1 (uint8_t tos) const |
Checks for ECT(1) bits. More... | |
bool | CheckNoEcn (uint8_t tos) const |
Checks if TOS has no ECN bits. More... | |
uint8_t | ClearEcnBits (uint8_t tos) const |
Clears ECN bits from TOS. 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< Node > | GetNode (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... | |
uint32_t | GetRetxThresh (void) const |
Get the retransmission threshold (dup ack threshold for a fast retransmit) More... | |
virtual uint32_t | GetRxAvailable (void) const |
Return number of bytes which can be returned from one or multiple calls to Recv. More... | |
Ptr< TcpRxBuffer > | GetRxBuffer (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< TcpTxBuffer > | GetTxBuffer (void) const |
Get a pointer to the Tx buffer. More... | |
virtual int | Listen (void) |
Listen for incoming connections. More... | |
uint8_t | MarkEcnCe (uint8_t tos) const |
Mark CE. More... | |
uint8_t | MarkEcnEct0 (uint8_t tos) const |
Mark ECT(0) More... | |
uint8_t | MarkEcnEct1 (uint8_t tos) const |
Mark ECT(1) More... | |
virtual Ptr< Packet > | Recv (uint32_t maxSize, uint32_t flags) |
Read data from the socket. More... | |
virtual Ptr< Packet > | RecvFrom (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 | SetEcn (EcnMode_t ecnMode) |
Set ECN mode to use on the socket. More... | |
void | SetMinRto (Time minRto) |
Sets the Minimum RTO. More... | |
virtual void | SetNode (Ptr< Node > node) |
Set the associated node. More... | |
void | SetRecoveryAlgorithm (Ptr< TcpRecoveryOps > recovery) |
Install a recovery algorithm on this socket. More... | |
void | SetRetxThresh (uint32_t retxThresh) |
Set the retransmission threshold (dup ack threshold for a fast retransmit) 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 | UpdateBytesInFlight (uint32_t oldValue, uint32_t newValue) |
Callback function to hook to TcpSocketState bytes inflight. More... | |
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 | UpdateCwndInfl (uint32_t oldValue, uint32_t newValue) |
Callback function to hook to TcpSocketState inflated congestion window. More... | |
void | UpdateEcnState (TcpSocketState::EcnState_t oldValue, TcpSocketState::EcnState_t newValue) |
Callback function to hook to EcnState state. 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 | UpdateRtt (Time oldValue, Time newValue) |
Callback function to hook to TcpSocketState rtt. More... | |
void | UpdateSsThresh (uint32_t oldValue, uint32_t newValue) |
Callback function to hook to TcpSocketState slow start threshold. More... | |
![]() | |
TcpSocket (void) | |
virtual | ~TcpSocket (void) |
![]() | |
Socket (void) | |
virtual | ~Socket (void) |
Ptr< NetDevice > | GetBoundNetDevice () |
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< Packet > | Recv (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< Packet > | RecvFrom (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... | |
![]() | |
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... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
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 TypeId | GetTypeId (void) |
Get the type ID. More... | |
![]() | |
static Ptr< Socket > | CreateSocket (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 TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
void | AddOptions (TcpHeader &tcpHeader) |
Add options to TcpHeader. More... | |
void | AddOptionSack (TcpHeader &header) |
Add the SACK option to the header. More... | |
void | AddOptionSackPermitted (TcpHeader &header) |
Add the SACK PERMITTED option to the header. 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... | |
void | AddSocketTags (const Ptr< Packet > &p) const |
Add Tags for the Socket. 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) const |
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... | |
void | DoRetransmit (void) |
Retransmit the first segment marked as lost, without considering available window nor pacing. More... | |
void | DupAck (uint32_t currentDelivered) |
Dupack management. More... | |
void | EnterRecovery (uint32_t currentDelivered) |
Enter the CA_RECOVERY, and retransmit the head. More... | |
virtual void | EstimateRtt (const TcpHeader &tcpHeader) |
Take into account the packet for RTT estimation. More... | |
virtual Ptr< TcpSocketBase > | Fork (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 timeout 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... | |
bool | IsTcpOptionEnabled (uint8_t kind) const |
Return true if the specified option is enabled. More... | |
bool | IsValidTcpSegment (const SequenceNumber32 seq, const uint32_t tcpHeaderSize, const uint32_t tcpPayloadSize) |
Checks whether the given TCP segment is valid or not. More... | |
virtual void | LastAckTimeout (void) |
Timeout at LAST_ACK, close the connection. More... | |
virtual void | NewAck (SequenceNumber32 const &seq, bool resetRTO) |
Update buffers w.r.t. More... | |
void | NotifyPacingPerformed (void) |
Notify Pacing. 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... | |
virtual void | ProcessAck (const SequenceNumber32 &ackNumber, bool scoreboardUpdated, uint32_t currentDelivered, const SequenceNumber32 &oldHeadSequence) |
Process a received ack. 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... | |
uint32_t | ProcessOptionSack (const Ptr< const TcpOption > option) |
Read the SACK option. More... | |
void | ProcessOptionSackPermitted (const Ptr< const TcpOption > option) |
Read the SACK PERMITTED option. 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... | |
void | ReadOptions (const TcpHeader &tcpHeader, uint32_t *bytesSacked) |
Read TCP options before Ack processing. 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 | ReTxTimeout (void) |
An RTO event happened. More... | |
virtual uint32_t | SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck) |
Extract at most maxSize bytes from the TxBuffer at sequence seq, add the TCP header, and send to TcpL4Protocol. More... | |
virtual void | SendEmptyPacket (uint8_t flags) |
Send a empty packet that carries a flag, e.g., ACK. More... | |
uint32_t | 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 timeout 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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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 | |
TracedValue< uint32_t > | m_advWnd {0} |
Advertised Window size. More... | |
uint32_t | m_bytesAckedNotProcessed {0} |
Bytes acked, but not processed. More... | |
Time | m_clockGranularity {Seconds (0.001)} |
Clock Granularity used in RTO calcs. More... | |
bool | m_closeNotified {false} |
Told app to close socket. More... | |
bool | m_closeOnEmpty {false} |
Close socket upon tx buffer emptied. More... | |
Time | m_cnTimeout {Seconds (0.0)} |
Timeout for connection retry. More... | |
Ptr< TcpCongestionOps > | m_congestionControl |
Congestion control. More... | |
bool | m_connected {false} |
Connection established. More... | |
uint32_t | m_dataRetrCount {0} |
Count of remaining data retransmission attempts. More... | |
uint32_t | m_dataRetries {0} |
Number of data retransmission attempts. More... | |
uint32_t | m_delAckCount {0} |
Delayed ACK counter. More... | |
EventId | m_delAckEvent {} |
Delayed ACK timeout event. More... | |
uint32_t | m_delAckMaxCount {0} |
Number of packet to fire an ACK before delay timeout. More... | |
Time | m_delAckTimeout {Seconds (0.0)} |
Time to delay an ACK. More... | |
uint32_t | m_dupAckCount {0} |
Dupack counter. More... | |
TracedValue< SequenceNumber32 > | m_ecnCESeq {0} |
Sequence number of the last received Congestion Experienced. More... | |
TracedValue< SequenceNumber32 > | m_ecnCWRSeq {0} |
Sequence number of the last sent CWR. More... | |
TracedValue< SequenceNumber32 > | m_ecnEchoSeq {0} |
Sequence number of the last received ECN Echo. More... | |
EcnMode_t | m_ecnMode {EcnMode_t::NoEcn} |
Socket ECN capability. More... | |
Ipv4EndPoint * | m_endPoint {nullptr} |
the IPv4 endpoint More... | |
Ipv6EndPoint * | m_endPoint6 {nullptr} |
the IPv6 endpoint More... | |
TracedValue< SequenceNumber32 > | m_highRxAckMark {0} |
Highest ack received. More... | |
TracedValue< SequenceNumber32 > | m_highRxMark {0} |
Highest seqno received. More... | |
SequenceNumber32 | m_highTxAck {0} |
Highest ack sent. More... | |
std::deque< RttHistory > | 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 {true} |
First partial ACK during RECOVERY. More... | |
EventId | m_lastAckEvent {} |
Last ACK timeout event. More... | |
bool | m_limitedTx {true} |
perform limited transmit More... | |
uint16_t | m_maxWinSize {0} |
Maximum window size to advertise. More... | |
Time | m_minRto {Time::Max ()} |
minimum value of the Retransmit timeout More... | |
double | m_msl {0.0} |
Max segment lifetime. More... | |
Ptr< Node > | m_node |
the associated node More... | |
bool | m_noDelay {false} |
Set to true to disable Nagle's algorithm. More... | |
Timer | m_pacingTimer {Timer::REMOVE_ON_DESTROY} |
Pacing Event. More... | |
EventId | m_persistEvent {} |
Persist event: Send 1 byte to probe for a non-zero Rx window. More... | |
Time | m_persistTimeout {Seconds (0.0)} |
Time between sending 1-byte probes. More... | |
Ptr< TcpRateOps > | m_rateOps |
Rate operations. More... | |
uint8_t | m_rcvWindShift {0} |
Window shift to apply to outgoing segments. More... | |
SequenceNumber32 | m_recover {0} |
Previous highest Tx seqnum for fast recovery (set it to initial seq number) More... | |
Ptr< TcpRecoveryOps > | m_recoveryOps |
Recovery Algorithm. More... | |
EventId | m_retxEvent {} |
Retransmission event. More... | |
uint32_t | m_retxThresh {3} |
Fast Retransmit threshold. More... | |
TracedValue< Time > | m_rto {Seconds (0.0)} |
Retransmit timeout. More... | |
Ptr< RttEstimator > | m_rtt |
Round trip time estimator. More... | |
TracedValue< uint32_t > | m_rWnd {0} |
Receiver window (RCV.WND in RFC793) More... | |
Ptr< TcpRxBuffer > | m_rxBuffer |
Rx buffer (reordering buffer) More... | |
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > | m_rxTrace |
Trace of received packets. More... | |
bool | m_sackEnabled {true} |
RFC SACK option enabled. More... | |
EventId | m_sendPendingDataEvent {} |
micro-delay event to send pending data More... | |
bool | m_shutdownRecv {false} |
Receive no longer allowed. More... | |
bool | m_shutdownSend {false} |
Send no longer allowed. More... | |
uint8_t | m_sndWindShift {0} |
Window shift to apply to incoming segments. More... | |
TracedValue< TcpStates_t > | m_state {CLOSED} |
TCP state. More... | |
uint32_t | m_synCount {0} |
Count of remaining connection retries. More... | |
uint32_t | m_synRetries {0} |
Number of connection attempts. More... | |
Ptr< TcpSocketState > | m_tcb |
Congestion control information. More... | |
Ptr< TcpL4Protocol > | m_tcp |
the associated TCP L4 protocol More... | |
bool | m_timestampEnabled {true} |
Timestamp option enabled. More... | |
uint32_t | m_timestampToEcho {0} |
Timestamp to echo. More... | |
EventId | m_timewaitEvent {} |
TIME_WAIT expiration event: Move this socket to CLOSED state. More... | |
Ptr< TcpTxBuffer > | m_txBuffer |
Tx buffer. More... | |
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > | m_txTrace |
Trace of transmitted packets. More... | |
bool | m_winScalingEnabled {true} |
Window Scale option enabled (RFC 7323) More... | |
![]() | |
Ptr< NetDevice > | m_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... | |
Related Functions | |
(Note that these are not member functions.) | |
class | TcpGeneralTest |
TcpGeneralTest friend class (for tests). More... | |
Additional Inherited Members | |
![]() | |
static const char *const | TcpStateName [TcpSocket::LAST_STATE] |
Literal names of TCP states for use in log messages. More... | |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
A base class for implementation of a stream socket using TCP.
This class contains the essential components of TCP, as well as a sockets interface for upper layers to call. This class provides connection orientation and sliding window flow control; congestion control is delegated to subclasses of TcpCongestionOps. Part of TcpSocketBase is modified from the original NS-3 TCP socket implementation (TcpSocketImpl) by Raj Bhattacharjea raj.b of Georgia Tech. @gat ech.e du
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.
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:
Another one (CA_CWR) is present but not used. For more information, see the TcpCongState_t documentation.
Congestion control, unlike older releases of ns-3, has been split from TcpSocketBase. In particular, each congestion control is now a subclass of the main TcpCongestionOps class. Switching between congestion algorithm is now a matter of setting a pointer into the TcpSocketBase class. The idea and the interfaces are inspired by the Linux operating system, and in particular from the structure tcp_congestion_ops. The reference paper is https://www.sciencedirect.com/science/article/pii/S1569190X15300939.
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).
The fast retransmit enhancement is introduced in RFC 2581 and updated in RFC
The attribute which manages the number of dup ACKs necessary to start the fast retransmit algorithm is named "ReTxThreshold", and by default is 3. The parameter is also used in TcpTxBuffer to determine if a packet is lost (please take a look at TcpTxBuffer documentation to see details) but, right now, it is assumed to be fixed. In future releases this parameter can be made dynamic, to reflect the reordering degree of the network. With SACK, the next sequence to transmit is given by the RFC 6675 algorithm. Without SACK option, the implementation adds "hints" to TcpTxBuffer to make sure it returns, as next transmittable sequence, the first lost (or presumed lost) segment.
The fast recovery algorithm is introduced RFC 2001, and it avoids to reset cWnd to 1 segment after sensing a loss on the channel. Instead, a new slow start threshold value is asked to the congestion control (for instance, with NewReno the returned amount is half of the previous), and the cWnd is set equal to such value. Ns-3 does not implement any inflation/deflation to the congestion window since it uses an evolved method (borrowed from Linux operating system) to calculate the number of bytes in flight. The fundamental idea is to subtract from the total bytes in flight the lost/sacked amount (the segments that have left the network) and to add the retransmitted count. In this way, congestion window represents the exact number of bytes that should be in flight. The implementation then decides what to transmit, it there is space, between new or already transmitted data portion. If a value of the congestion window with inflation and deflation is needed, there is a traced source named "CongestionWindowInflated". However, the variable behind it is not used in the code, but maintained for backward compatibility.
When the Retransmission Time Out expires, the TCP faces a significant performance drop. The expiration event is managed in the ReTxTimeout method, which set the cWnd to 1 segment and starts "from scratch" again. The list of sent packet is set as lost entirely, and the transmission is re-started from the SND.UNA sequence number.
SYN and SYN-ACK options, which are allowed only at the beginning of the connection, are managed in the DoForwardUp and SendEmptyPacket methods. To read all others, we have set up a cycle inside ReadOptions. For adding them, there is no a unique place, since the options (and the information available to build them) are scattered around the code. For instance, the SACK option is built in SendEmptyPacket only under certain conditions.
The SACK generation/management is delegated to the buffer classes, namely TcpTxBuffer and TcpRxBuffer. In TcpRxBuffer it is managed the creation of the SACK option from the receiver point of view. It must provide an accurate (and efficient) representation of the status of the receiver buffer. On the other side, inside TcpTxBuffer the received options (that contain the SACK block) are processed and a particular data structure, called Scoreboard, is filled. Please take a look at TcpTxBuffer and TcpRxBuffer documentation if you need more information. The reference paper is https://dl.acm.org/citation.cfm?id=3067666.
ns3::TcpSocketBase is accessible through the following paths with Config::Set and Config::Connect:
Size of this type is 1088 bytes (on a 64-bit architecture).
Definition at line 217 of file tcp-socket-base.h.
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.
[in] | packet | The packet. |
[in] | header | The TcpHeader |
[in] | socket | This socket |
Definition at line 569 of file tcp-socket-base.h.
ECN Modes.
Enumerator | |
---|---|
NoEcn | ECN is not enabled. |
ClassicEcn | ECN functionality as described in RFC 3168. |
Definition at line 487 of file tcp-socket-base.h.
ns3::TcpSocketBase::TcpSocketBase | ( | void | ) |
Create an unbound TCP socket.
Definition at line 240 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_currentPacingRate, ns3::TcpSocketState::m_maxPacingRate, m_pacingTimer, m_rateOps, m_rxBuffer, m_tcb, m_txBuffer, ns3::MakeCallback(), NotifyPacingPerformed(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Timer::SetFunction(), ns3::ObjectBase::TraceConnectWithoutContext(), UpdateBytesInFlight(), UpdateCongState(), UpdateCwnd(), UpdateCwndInfl(), UpdateEcnState(), UpdateHighTxMark(), UpdateNextTxSequence(), UpdateRtt(), and UpdateSsThresh().
ns3::TcpSocketBase::TcpSocketBase | ( | const TcpSocketBase & | sock | ) |
Clone a TCP socket, for use upon receiving a connection request in LISTEN state.
sock | the original Tcp Socket |
Definition at line 291 of file tcp-socket-base.cc.
References ns3::Object::CopyObject, m_congestionControl, ns3::TcpSocketState::m_currentPacingRate, ns3::TcpSocketState::m_maxPacingRate, m_pacingTimer, m_rateOps, m_recoveryOps, m_rtt, m_rxBuffer, m_tcb, m_txBuffer, ns3::MakeCallback(), NotifyPacingPerformed(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC(), ns3::Socket::SetConnectCallback(), ns3::Socket::SetDataSentCallback(), ns3::Timer::SetFunction(), ns3::Socket::SetRecvCallback(), ns3::Socket::SetSendCallback(), ns3::ObjectBase::TraceConnectWithoutContext(), UpdateBytesInFlight(), UpdateCongState(), UpdateCwnd(), UpdateCwndInfl(), UpdateEcnState(), UpdateHighTxMark(), UpdateNextTxSequence(), UpdateRtt(), and UpdateSsThresh().
|
virtual |
Definition at line 416 of file tcp-socket-base.cc.
References CancelAllTimers(), m_endPoint, m_endPoint6, m_node, m_tcp, NS_ASSERT, and NS_LOG_FUNCTION.
|
protected |
Add options to TcpHeader.
Test each option, and if it is enabled on our side, add it to the header
tcpHeader | TcpHeader to add options to |
Definition at line 3910 of file tcp-socket-base.cc.
References AddOptionTimestamp(), m_timestampEnabled, and NS_LOG_FUNCTION.
Referenced by DoForwardUp(), PersistTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), and SendEmptyPacket().
|
protected |
Add the SACK option to the header.
header | TcpHeader where the method should add the option |
Definition at line 4017 of file tcp-socket-base.cc.
References ns3::TcpHeader::AppendOption(), ns3::Node::GetId(), ns3::TcpHeader::GetMaxOptionLength(), ns3::TcpHeader::GetOptionLength(), m_node, m_rxBuffer, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC().
Referenced by SendEmptyPacket().
|
protected |
Add the SACK PERMITTED option to the header.
header | TcpHeader where the method should add the option |
Definition at line 4006 of file tcp-socket-base.cc.
References ns3::TcpHeader::AppendOption(), ns3::TcpHeader::GetFlags(), ns3::Node::GetId(), m_node, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::TcpHeader::SYN.
Referenced by SendEmptyPacket().
|
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.
header | TcpHeader to which add the option to |
Definition at line 4074 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().
|
protected |
Add the window scale option to the header.
Calculate our factor from the rxBuffer max size, and add it to the header.
header | TcpHeader where the method should add the window scale option |
Definition at line 3966 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().
Add Tags for the Socket.
p | Packet |
Definition at line 2791 of file tcp-socket-base.cc.
References ns3::Packet::AddPacketTag(), CheckEcnEct0(), ns3::TcpSocketState::ECN_DISABLED, ns3::Socket::GetIpTos(), ns3::Socket::GetIpTtl(), ns3::Socket::GetIpv6HopLimit(), ns3::Socket::GetIpv6Tclass(), ns3::Socket::GetPriority(), ns3::Packet::GetSize(), ns3::Socket::IsManualIpTtl(), ns3::Socket::IsManualIpv6HopLimit(), ns3::Socket::IsManualIpv6Tclass(), ns3::TcpSocketState::m_ecnState, m_tcb, MarkEcnEct0(), ns3::Packet::ReplacePacketTag(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::SocketPriorityTag::SetPriority(), ns3::SocketIpv6TclassTag::SetTclass(), ns3::SocketIpTosTag::SetTos(), and ns3::SocketIpTtlTag::SetTtl().
Referenced by SendDataPacket(), and SendEmptyPacket().
|
protectedvirtual |
The amount of Rx window announced to the peer.
scale | indicate if the window should be scaled. True for almost all cases, except when we are sending a SYN |
Reimplemented in TcpSocketAdvertisedWindowProxy.
Definition at line 3231 of file tcp-socket-base.cc.
References m_advWnd, m_maxWinSize, m_rcvWindShift, m_rxBuffer, NS_ASSERT_MSG(), NS_LOG_FUNCTION, NS_LOG_LOGIC(), and NS_LOG_WARN.
Referenced by TcpSocketAdvertisedWindowProxy::AdvertisedWindowSize(), DoForwardUp(), PersistTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), and SendEmptyPacket().
|
protectedvirtual |
Return unfilled portion of window.
Definition at line 3223 of file tcp-socket-base.cc.
References BytesInFlight(), and Window().
Referenced by Send(), and SendPendingData().
|
virtual |
Allocate a local IPv4 endpoint for this socket.
Implements ns3::Socket.
Definition at line 489 of file tcp-socket-base.cc.
References ns3::Socket::ERROR_ADDRNOTAVAIL, m_endPoint, m_tcp, NS_LOG_FUNCTION, and SetupCallback().
Referenced by Connect().
|
virtual |
Allocate a local endpoint for this socket.
address | the address to try to allocate |
Implements ns3::Socket.
Definition at line 522 of file tcp-socket-base.cc.
References first::address, ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), ns3::Socket::ERROR_ADDRINUSE, ns3::Socket::ERROR_ADDRNOTAVAIL, ns3::Socket::ERROR_INVAL, ns3::Ipv4Address::GetAny(), ns3::Ipv6Address::GetAny(), ns3::Socket::GetBoundNetDevice(), ns3::InetSocketAddress::GetIpv4(), ns3::Inet6SocketAddress::GetIpv6(), ns3::InetSocketAddress::GetPort(), ns3::Inet6SocketAddress::GetPort(), ns3::InetSocketAddress::GetTos(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), m_endPoint, m_endPoint6, m_tcp, NS_LOG_FUNCTION, NS_LOG_LOGIC(), port, ns3::Socket::SetIpTos(), and SetupCallback().
|
virtual |
Allocate a local IPv6 endpoint for this socket.
Implements ns3::Socket.
Definition at line 505 of file tcp-socket-base.cc.
References ns3::Socket::ERROR_ADDRNOTAVAIL, m_endPoint6, m_tcp, NS_LOG_FUNCTION, and SetupCallback().
Referenced by Connect().
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.
netdevice | Pointer to NetDevice of desired interface |
Reimplemented from ns3::Socket.
Definition at line 951 of file tcp-socket-base.cc.
References ns3::Ipv4EndPoint::BindToNetDevice(), ns3::Ipv6EndPoint::BindToNetDevice(), ns3::Socket::BindToNetDevice(), m_endPoint, m_endPoint6, and NS_LOG_FUNCTION.
|
protectedvirtual |
Return total bytes in flight.
Does not count segments lost and SACKed (or dupACKed)
Definition at line 3205 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_bytesInFlight, m_tcb, m_txBuffer, and NS_LOG_DEBUG.
Referenced by AvailableWindow(), EnterRecovery(), ProcessAck(), ReceivedAck(), ReTxTimeout(), and SendDataPacket().
|
protected |
Calculate window scale value based on receive buffer space.
Calculate our factor from the rxBuffer max size
Definition at line 3942 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().
|
protected |
Cancel all timer when endpoint is deleted.
Definition at line 3709 of file tcp-socket-base.cc.
References ns3::EventId::Cancel(), ns3::Timer::Cancel(), m_delAckEvent, m_lastAckEvent, m_pacingTimer, m_persistEvent, m_retxEvent, m_sendPendingDataEvent, and m_timewaitEvent.
Referenced by DeallocateEndPoint(), Destroy(), Destroy6(), TimeWait(), and ~TcpSocketBase().
|
inline |
Checks for CE bits.
Definition at line 528 of file tcp-socket-base.h.
|
inline |
Checks for ECT(0) bits.
Definition at line 508 of file tcp-socket-base.h.
Referenced by AddSocketTags().
|
inline |
Checks for ECT(1) bits.
Definition at line 518 of file tcp-socket-base.h.
|
inline |
Checks if TOS has no ECN bits.
Definition at line 498 of file tcp-socket-base.h.
|
inline |
Clears ECN bits from TOS.
Definition at line 479 of file tcp-socket-base.h.
|
virtual |
Close a socket.
After the Close call, the socket is no longer valid, and cannot safely be used for subsequent operations.
Implements ns3::Socket.
Definition at line 719 of file tcp-socket-base.cc.
References DoClose(), m_closeOnEmpty, ns3::TcpSocketState::m_nextTxSequence, 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().
|
protected |
Peacefully close the socket by notifying the upper layer and deallocate end point.
Definition at line 1070 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().
|
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.
p | the packet triggering the fork |
tcpHeader | the TCP header of the triggering packet |
fromAddress | the address of the remote host |
toAddress | the address the connection is directed to |
Reimplemented in ns3::TcpSocketMsgBase.
Definition at line 2725 of file tcp-socket-base.cc.
References ns3::TcpHeader::ACK, ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), ns3::TcpHeader::CWR, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_DISABLED, ns3::TcpSocketState::ECN_IDLE, ns3::TcpSocketState::EcnStateName, ns3::Socket::GetBoundNetDevice(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), m_dataRetrCount, m_dataRetries, m_ecnMode, ns3::TcpSocketState::m_ecnState, m_endPoint, m_endPoint6, m_rxBuffer, m_state, m_synCount, m_synRetries, m_tcb, m_tcp, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_UNUSED, SendEmptyPacket(), SetupCallback(), ns3::TcpHeader::SYN, and ns3::TcpSocket::SYN_RCVD.
Referenced by ns3::TcpSocketMsgBase::CompleteFork(), and ProcessListen().
|
virtual |
Initiate a connection to a remote host.
address | Address of remote. |
Implements ns3::Socket.
Definition at line 625 of file tcp-socket-base.cc.
References first::address, Bind(), Bind6(), ns3::Inet6SocketAddress::ConvertFrom(), ns3::InetSocketAddress::ConvertFrom(), DoConnect(), ns3::Socket::ERROR_INVAL, ns3::InetSocketAddress::GetIpv4(), ns3::Ipv6Address::GetIpv4MappedAddress(), ns3::Inet6SocketAddress::GetIpv6(), ns3::InetSocketAddress::GetPort(), ns3::Inet6SocketAddress::GetPort(), ns3::InetSocketAddress::GetTos(), ns3::Ipv6Address::IsIpv4MappedAddress(), ns3::Inet6SocketAddress::IsMatchingType(), ns3::InetSocketAddress::IsMatchingType(), m_dataRetrCount, m_dataRetries, m_endPoint, m_endPoint6, m_rtt, m_synCount, m_synRetries, NS_ASSERT, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::Socket::SetIpTos(), ns3::Ipv4EndPoint::SetPeer(), ns3::Ipv6EndPoint::SetPeer(), SetupEndpoint(), and SetupEndpoint6().
|
protected |
Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded()
Definition at line 2777 of file tcp-socket-base.cc.
References GetTxAvailable(), ns3::Socket::NotifyConnectionSucceeded(), and ns3::Socket::NotifySend().
Referenced by ProcessSynSent().
|
protected |
Deallocate m_endPoint and m_endPoint6.
Definition at line 2640 of file tcp-socket-base.cc.
References CancelAllTimers(), m_endPoint, m_endPoint6, m_tcp, ns3::Ipv4EndPoint::SetDestroyCallback(), and ns3::Ipv6EndPoint::SetDestroyCallback().
Referenced by CloseAndNotify(), ReTxTimeout(), and SendRST().
|
protectedvirtual |
Action upon delay ACK timeout, i.e.
send an ACK
Definition at line 3595 of file tcp-socket-base.cc.
References ns3::TcpHeader::ACK, ns3::TcpSocketState::CA_EVENT_DELAYED_ACK, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_SENDING_ECE, m_congestionControl, m_delAckCount, ns3::TcpSocketState::m_ecnState, m_tcb, and SendEmptyPacket().
Referenced by ReceivedData().
|
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 2473 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().
|
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 2489 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().
|
protected |
Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state.
Definition at line 1028 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().
|
protected |
Perform the real connection tasks: Send SYN if allowed, RST if invalid.
Definition at line 996 of file tcp-socket-base.cc.
References ns3::TcpSocket::CLOSE_WAIT, CloseAndNotify(), ns3::TcpSocket::CLOSED, ns3::TcpHeader::CWR, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_DISABLED, ns3::TcpSocket::LAST_ACK, ns3::TcpSocket::LISTEN, m_ecnMode, ns3::TcpSocketState::m_ecnState, m_state, m_tcb, 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().
|
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.
packet | the incoming packet |
fromAddress | the address of the sender of packet |
toAddress | the address of the receiver of packet (hopefully, us) |
Definition at line 1239 of file tcp-socket-base.cc.
References ns3::TcpHeader::ACK, AddOptions(), AdvertisedWindowSize(), ns3::EventId::Cancel(), ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::CLOSED, ns3::TcpSocket::CLOSING, ns3::TcpHeader::CWR, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_IDLE, ns3::TcpSocketState::EcnStateName, ns3::TcpSocket::ESTABLISHED, EstimateRtt(), ns3::TcpSocket::FIN_WAIT_1, ns3::TcpSocket::FIN_WAIT_2, ns3::TracedValue< T >::Get(), ns3::TcpHeader::GetAckNumber(), ns3::Simulator::GetDelayLeft(), ns3::TcpHeader::GetDestinationPort(), ns3::TcpHeader::GetFlags(), GetInitialCwnd(), GetInitialSSThresh(), ns3::TcpHeader::GetOption(), GetSegSize(), ns3::TcpHeader::GetSequenceNumber(), ns3::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, ns3::TcpSocketState::m_cWnd, ns3::TcpSocketState::m_cWndInfl, ns3::TcpSocketState::m_ecnState, m_highRxAckMark, ns3::TcpSocketState::m_nextTxSequence, m_persistEvent, m_persistTimeout, m_retxEvent, m_rWnd, m_rxBuffer, m_rxTrace, m_sackEnabled, ns3::TcpSocketState::m_ssThresh, m_state, m_tcb, m_tcp, m_timestampEnabled, m_txTrace, m_winScalingEnabled, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_LOGIC(), PersistTimeout(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessListen(), ProcessOptionSackPermitted(), ProcessOptionTimestamp(), ProcessOptionWScale(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ns3::TcpHeader::PSH, ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::TcpHeader::RST, ns3::TcpOption::SACKPERMITTED, ns3::Simulator::Schedule(), SendPendingData(), ns3::TcpHeader::SetAckNumber(), ns3::TcpHeader::SetDestinationPort(), ns3::TcpHeader::SetFlags(), ns3::TcpHeader::SetSequenceNumber(), ns3::TcpHeader::SetSourcePort(), ns3::TcpHeader::SetWindowSize(), ns3::TcpHeader::SYN, ns3::TcpSocket::SYN_RCVD, ns3::TcpSocket::SYN_SENT, ns3::TcpSocket::TcpStateName, ns3::TcpSocket::TIME_WAIT, ns3::TcpOption::TS, UpdateWindowSize(), ns3::TcpHeader::URG, and ns3::TcpOption::WINSCALE.
Referenced by ForwardUp(), and ForwardUp6().
|
protected |
FIN is in sequence, notify app and respond with a FIN.
Definition at line 2433 of file tcp-socket-base.cc.
References ns3::TcpHeader::ACK, Close(), ns3::TcpSocket::CLOSE_WAIT, ns3::TcpSocket::ESTABLISHED, ns3::TcpSocket::FIN_WAIT_1, ns3::TcpSocket::FIN_WAIT_2, ns3::TcpSocket::LAST_ACK, LastAckTimeout(), m_clockGranularity, m_closeNotified, m_lastAckEvent, m_rtt, m_shutdownSend, m_state, ns3::Max(), ns3::Socket::NotifyNormalClose(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_LOGIC(), ns3::Simulator::Schedule(), SendEmptyPacket(), ns3::TcpSocket::SYN_RCVD, and ns3::TcpSocket::TcpStateName.
Referenced by PeerClose(), and ReceivedData().
|
protected |
Retransmit the first segment marked as lost, without considering available window nor pacing.
Definition at line 3682 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_nextTxSequence, m_sackEnabled, ns3::TcpSocketState::m_segmentSize, m_tcb, m_txBuffer, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and SendDataPacket().
Referenced by EnterRecovery(), and ProcessAck().
|
protected |
Dupack management.
currentDelivered | Current (S)ACKed bytes |
Definition at line 1598 of file tcp-socket-base.cc.
References ns3::TcpSocketState::CA_DISORDER, ns3::TcpSocketState::CA_LOSS, ns3::TcpSocketState::CA_OPEN, ns3::TcpSocketState::CA_RECOVERY, EnterRecovery(), m_congestionControl, ns3::TcpSocketState::m_congState, ns3::TcpSocketState::m_cWnd, m_dupAckCount, m_highRxAckMark, m_limitedTx, m_recover, m_recoveryOps, m_retxThresh, m_sackEnabled, ns3::TcpSocketState::m_segmentSize, m_tcb, m_txBuffer, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by ProcessAck().
|
protected |
Enter the CA_RECOVERY, and retransmit the head.
currentDelivered | Currently (S)ACKed bytes |
Definition at line 1541 of file tcp-socket-base.cc.
References BytesInFlight(), ns3::TcpSocketState::CA_RECOVERY, DoRetransmit(), m_congestionControl, ns3::TcpSocketState::m_congState, ns3::TcpSocketState::m_cWnd, m_dupAckCount, ns3::TcpSocketState::m_highTxMark, m_recover, m_recoveryOps, m_sackEnabled, ns3::TcpSocketState::m_segmentSize, ns3::TcpSocketState::m_ssThresh, m_tcb, m_txBuffer, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::TcpSocketState::TcpCongStateName, and UnAckDataCount().
Referenced by DupAck().
|
protectedvirtual |
Take into account the packet for RTT estimation.
Estimate the RTT.
tcpHeader | the packet's TCP header |
Called by ForwardUp() to estimate RTT.
tcpHeader | TCP header for the incoming packet |
Definition at line 3364 of file tcp-socket-base.cc.
References ns3::RttHistory::count, ns3::TcpOptionTS::ElapsedTimeFromTsValue(), ns3::TracedValue< T >::Get(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetOption(), ns3::TcpHeader::HasOption(), ns3::Time::IsZero(), m_clockGranularity, m_history, ns3::TcpSocketState::m_lastRtt, m_minRto, ns3::TcpSocketState::m_minRtt, m_rto, m_rtt, m_tcb, m_timestampEnabled, ns3::Max(), min, ns3::Simulator::Now(), NS_LOG_INFO, ns3::RttHistory::retx, ns3::RttHistory::seq, ns3::RttHistory::time, and ns3::TcpOption::TS.
Referenced by DoForwardUp().
|
protectedvirtual |
Call CopyObject<> to clone me.
Reimplemented in ns3::TcpSocketSmallAcks, ns3::TcpSocketMsgBase, ns3::TcpSocketCongestedRouter, TcpSocketAdvertisedWindowProxy, and TcpSocketHalfAck.
Definition at line 4250 of file tcp-socket-base.cc.
Referenced by ProcessListen().
|
protected |
Called by the L3 protocol when it received an ICMP packet to pass on to TCP.
icmpSource | the ICMP source address |
icmpTtl | the ICMP Time to Live |
icmpType | the ICMP Type |
icmpCode | the ICMP Code |
icmpInfo | the ICMP Info |
Definition at line 1187 of file tcp-socket-base.cc.
References m_icmpCallback, and NS_LOG_FUNCTION.
Referenced by SetupCallback().
|
protected |
Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP.
icmpSource | the ICMP source address |
icmpTtl | the ICMP Time to Live |
icmpType | the ICMP Type |
icmpCode | the ICMP Code |
icmpInfo | the ICMP Info |
Definition at line 1201 of file tcp-socket-base.cc.
References m_icmpCallback6, and NS_LOG_FUNCTION.
Referenced by SetupCallback().
|
protected |
Called by the L3 protocol when it received a packet to pass on to TCP.
packet | the incoming packet |
header | the packet's IPv4 header |
port | the remote port |
incomingInterface | the incoming interface |
Definition at line 1109 of file tcp-socket-base.cc.
References ns3::TcpSocketState::CA_EVENT_ECN_IS_CE, ns3::TcpSocketState::CA_EVENT_ECN_NO_CE, DoForwardUp(), ns3::Ipv4Header::ECN_CE, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_DISABLED, ns3::Ipv4Header::ECN_NotECT, ns3::TcpSocketState::EcnStateName, ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetEcn(), ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), IsValidTcpSegment(), m_congestionControl, m_ecnCESeq, ns3::TcpSocketState::m_ecnState, m_endPoint, m_tcb, NS_LOG_DEBUG, NS_LOG_INFO, NS_LOG_LOGIC(), ns3::Packet::PeekHeader(), and port.
Referenced by SetupCallback().
|
protected |
Called by the L3 protocol when it received a packet to pass on to TCP.
packet | the incoming packet |
header | the packet's IPv6 header |
port | the remote port |
incomingInterface | the incoming interface |
Definition at line 1148 of file tcp-socket-base.cc.
References ns3::TcpSocketState::CA_EVENT_ECN_IS_CE, ns3::TcpSocketState::CA_EVENT_ECN_NO_CE, DoForwardUp(), ns3::Ipv6Header::ECN_CE, ns3::TcpSocketState::ECN_CE_RCVD, ns3::Ipv6Header::ECN_NotECT, ns3::TcpSocketState::EcnStateName, ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Header::GetEcn(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerPort(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSourceAddress(), IsValidTcpSegment(), m_congestionControl, m_ecnCESeq, ns3::TcpSocketState::m_ecnState, m_endPoint6, m_tcb, NS_LOG_DEBUG, NS_LOG_INFO, NS_LOG_LOGIC(), ns3::Packet::PeekHeader(), and port.
Referenced by SetupCallback().
|
protectedvirtual |
Query whether broadcast datagram transmissions are allowed.
This method corresponds to using getsockopt() SO_BROADCAST of real network or BSD sockets.
Implements ns3::Socket.
Definition at line 3904 of file tcp-socket-base.cc.
Time ns3::TcpSocketBase::GetClockGranularity | ( | void | ) | const |
Get the Clock Granularity (used in RTO calcs).
Definition at line 4153 of file tcp-socket-base.cc.
References m_clockGranularity.
Referenced by GetTypeId().
|
protectedvirtual |
Get the connection timeout.
Implements ns3::TcpSocket.
Definition at line 3812 of file tcp-socket-base.cc.
References m_cnTimeout.
|
protectedvirtual |
Get the number of data transmission retries before giving up.
Implements ns3::TcpSocket.
Definition at line 3838 of file tcp-socket-base.cc.
References m_dataRetries, and NS_LOG_FUNCTION.
|
protectedvirtual |
Get the number of packet to fire an ACK before delay timeout.
Implements ns3::TcpSocket.
Definition at line 3865 of file tcp-socket-base.cc.
References m_delAckMaxCount.
|
protectedvirtual |
Get the time to delay an ACK.
Implements ns3::TcpSocket.
Definition at line 3852 of file tcp-socket-base.cc.
References m_delAckTimeout.
|
virtual |
Get last error number.
Implements ns3::Socket.
Definition at line 468 of file tcp-socket-base.cc.
|
protectedvirtual |
Get the initial Congestion Window.
Implements ns3::TcpSocket.
Definition at line 618 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_initialCWnd, and m_tcb.
Referenced by DoForwardUp().
|
protectedvirtual |
Get the initial Slow Start Threshold.
Implements ns3::TcpSocket.
Definition at line 603 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_initialSsThresh, and m_tcb.
Referenced by DoForwardUp().
|
virtual |
Get the instance TypeId.
Reimplemented from ns3::Object.
Definition at line 235 of file tcp-socket-base.cc.
References GetTypeId().
Time ns3::TcpSocketBase::GetMinRto | ( | void | ) | const |
Get the Minimum RTO.
Definition at line 4140 of file tcp-socket-base.cc.
References m_minRto.
Referenced by GetTypeId().
Return the node this socket is associated with.
Implements ns3::Socket.
Definition at line 482 of file tcp-socket-base.cc.
References m_node.
Referenced by ns3::TcpGeneralTest::AfterRetransmitCb(), ns3::TcpGeneralTest::BeforeRetransmitCb(), ns3::TcpGeneralTest::ProcessedAckCb(), ns3::TcpGeneralTest::RcvAckCb(), ns3::TcpGeneralTest::RxPacketCb(), ns3::TcpGeneralTest::TxPacketCb(), and ns3::TcpGeneralTest::UpdateRttHistoryCb().
|
virtual |
Get the peer address of a connected socket.
address | the address this socket is connected to. |
Implements ns3::Socket.
Definition at line 921 of file tcp-socket-base.cc.
References first::address, ns3::Socket::ERROR_NOTCONN, ns3::Ipv4EndPoint::GetPeerAddress(), ns3::Ipv6EndPoint::GetPeerAddress(), ns3::Ipv4EndPoint::GetPeerPort(), ns3::Ipv6EndPoint::GetPeerPort(), m_endPoint, m_endPoint6, NS_ASSERT, and NS_LOG_FUNCTION.
|
protectedvirtual |
Get the timeout for persistent connection.
When the timeout 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
Implements ns3::TcpSocket.
Definition at line 3891 of file tcp-socket-base.cc.
References m_persistTimeout.
|
protectedvirtual |
Get the receive buffer size.
Implements ns3::TcpSocket.
Definition at line 3783 of file tcp-socket-base.cc.
References m_rxBuffer.
Referenced by SetRcvBufSize().
|
inline |
Get the retransmission threshold (dup ack threshold for a fast retransmit)
Definition at line 318 of file tcp-socket-base.h.
References m_retxThresh.
Referenced by GetTypeId().
|
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.
Implements ns3::Socket.
Definition at line 892 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.
Definition at line 4165 of file tcp-socket-base.cc.
References m_rxBuffer.
Referenced by GetTypeId().
|
protectedvirtual |
Get the segment size.
Implements ns3::TcpSocket.
Definition at line 3799 of file tcp-socket-base.cc.
References ns3::TcpSocketState::m_segmentSize, and m_tcb.
Referenced by DoForwardUp().
|
protectedvirtual |
Get the send buffer size.
Implements ns3::TcpSocket.
Definition at line 3751 of file tcp-socket-base.cc.
References m_txBuffer.
|
virtual |
Implements ns3::Socket.
Definition at line 475 of file tcp-socket-base.cc.
References ns3::Socket::NS3_SOCK_STREAM.
|
virtual |
Get socket address.
address | the address name this socket is associated with. |
Implements ns3::Socket.
Definition at line 900 of file tcp-socket-base.cc.
References first::address, ns3::Ipv4EndPoint::GetLocalAddress(), ns3::Ipv6EndPoint::GetLocalAddress(), ns3::Ipv4EndPoint::GetLocalPort(), ns3::Ipv6EndPoint::GetLocalPort(), ns3::Ipv4Address::GetZero(), m_endPoint, m_endPoint6, and NS_LOG_FUNCTION.
|
protectedvirtual |
Get the number of connection retries before giving up.
Implements ns3::TcpSocket.
Definition at line 3825 of file tcp-socket-base.cc.
References m_synRetries.
|
protectedvirtual |
Check if Nagle's algorithm is enabled or not.
Implements ns3::TcpSocket.
Definition at line 3878 of file tcp-socket-base.cc.
References m_noDelay.
|
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.
Implements ns3::Socket.
Definition at line 884 of file tcp-socket-base.cc.
References m_txBuffer, and NS_LOG_FUNCTION.
Referenced by ConnectionSucceeded(), NewAck(), ProcessSynRcvd(), and SendPendingData().
Ptr< TcpTxBuffer > ns3::TcpSocketBase::GetTxBuffer | ( | void | ) | const |
Get a pointer to the Tx buffer.
Definition at line 4159 of file tcp-socket-base.cc.
References m_txBuffer.
Referenced by GetTypeId().
|
static |
Get the type ID.
Get the type ID.
Definition at line 73 of file tcp-socket-base.cc.
References GetClockGranularity(), GetMinRto(), GetRetxThresh(), GetRxBuffer(), GetTxBuffer(), m_advWnd, m_bytesInFlightTrace, m_congStateTrace, m_cWndInflTrace, m_cWndTrace, m_ecnCESeq, m_ecnCWRSeq, m_ecnEchoSeq, m_ecnMode, m_ecnStateTrace, m_highRxAckMark, m_highRxMark, m_highTxMarkTrace, m_icmpCallback, m_icmpCallback6, m_lastRttTrace, m_limitedTx, m_maxWinSize, m_msl, m_nextTxSequenceTrace, m_rto, m_rWnd, m_rxTrace, m_sackEnabled, m_ssThTrace, m_state, m_timestampEnabled, m_txTrace, m_winScalingEnabled, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeCallbackAccessor(), ns3::MakeCallbackChecker(), ns3::MakeDoubleAccessor(), ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakePointerAccessor(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::MilliSeconds(), ns3::Seconds(), SetClockGranularity(), SetMinRto(), ns3::TypeId::SetParent(), and SetRetxThresh().
Referenced by GetInstanceTypeId().
|
protected |
Return true if the specified option is enabled.
kind | kind of TCP option |
Definition at line 1498 of file tcp-socket-base.cc.
References m_sackEnabled, m_timestampEnabled, m_winScalingEnabled, NS_LOG_FUNCTION, ns3::TcpOption::SACK, ns3::TcpOption::SACKPERMITTED, ns3::TcpOption::TS, and ns3::TcpOption::WINSCALE.
|
protected |
Checks whether the given TCP segment is valid or not.
seq | the sequence number of packet's TCP header |
tcpHeaderSize | the size of packet's TCP header |
tcpPayloadSize | the size of TCP payload |
Definition at line 1215 of file tcp-socket-base.cc.
References ns3::TcpHeader::ACK, m_rxBuffer, m_state, NS_LOG_ERROR, NS_LOG_WARN, OutOfRange(), SendEmptyPacket(), and ns3::TcpSocket::TcpStateName.
Referenced by ForwardUp(), and ForwardUp6().
|
protectedvirtual |
Timeout at LAST_ACK, close the connection.
Definition at line 3611 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().
|
virtual |
Listen for incoming connections.
Implements ns3::Socket.
Definition at line 701 of file tcp-socket-base.cc.
References ns3::TcpSocket::CLOSED, ns3::Socket::ERROR_INVAL, ns3::TcpSocket::LISTEN, m_state, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
inline |
Mark CE.